Skip to content

Lint Rules

marimo includes a linter that helps you write better notebooks. The linter checks for various issues that could prevent your notebook from running correctly or cause confusion.

Usage

Run the linter using the CLI:

# Check all notebooks in current directory
marimo check .

# Check specific files
marimo check notebook1.py notebook2.py

# Auto-fix fixable issues
marimo check --fix .

Rule Categories

marimo's lint rules are organized into categories based on their severity:

🚨 Breaking Rules

These errors prevent notebook execution.

Code Name Description Fixable
MB001 unparsable-cells Cell contains unparsable code ❌
MB002 multiple-definitions Multiple cells define the same variable ❌
MB003 cycle-dependencies Cells have circular dependencies ❌
MB004 setup-cell-dependencies Setup cell cannot have dependencies ❌
MB005 invalid-syntax Cell contains code that throws a SyntaxError on compilation ❌

⚠️ Runtime Rules

These issues may cause runtime problems.

Code Name Description Fixable
MR001 self-import Importing a module with the same name as the file ❌
MR002 branch-expression Branch statements with output expressions that won't be displayed ❌
MR003 reusable-definition-order Reusable definitions depending on later reusable definitions ⚠️
MR004 private-import-alias Import aliased to a private (underscore-prefixed) name ❌

✨ Formatting Rules

These are style and formatting issues.

Code Name Description Fixable
MF001 general-formatting General formatting issues with the notebook format. 🛠️
MF002 parse-stdout Parse captured stdout during notebook loading ❌
MF003 parse-stderr Parse captured stderr during notebook loading ❌
MF004 empty-cells Empty cells that can be safely removed. ⚠️
MF005 sql-parse-error SQL parsing errors during dependency analysis ❌
MF006 misc-log-capture Miscellaneous log messages during processing ❌
MF007 markdown-indentation Markdown cells in mo.md() should be properly indented. 🛠️

🌐 WASM Rules

These issues affect WASM/Pyodide compatibility (off by default).

Code Name Description Fixable
MW001 incompatible-import Importing a module unavailable in WASM/Pyodide ❌
MW002 unsafe-system-call System call that fails in WASM/Pyodide ❌
MW003 incompatible-package Package with native extensions not available in Pyodide ❌

Legend

  • 🛠️ = Automatically fixable with marimo check --fix
  • ⚠️ = Fixable with marimo check --fix --unsafe-fixes (may change code behavior)
  • ❌ = Not automatically fixable

Configuration

Most lint rules are enabled by default. You can configure the linter behavior through marimo's configuration system.