docs/guides/lint_rules/index.md
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.
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 .
marimo's lint rules are organized into three main categories based on their severity:
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 | ❌ |
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 | ⚠️ |
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. | 🛠️ |
marimo check --fixmarimo check --fix --unsafe-fixes (may change code behavior)Most lint rules are enabled by default. You can configure the linter behavior through marimo's configuration system.
marimo check