Skip to content

feat: lint configuration#8560

Merged
dmadisetti merged 13 commits intomainfrom
dm/lint-config
Mar 26, 2026
Merged

feat: lint configuration#8560
dmadisetti merged 13 commits intomainfrom
dm/lint-config

Conversation

@dmadisetti
Copy link
Copy Markdown
Collaborator

📝 Summary

Closes #8341

Adds configuration entry points changes for lint rule selection. Example:

[tool.marimo.lint]
ignore = ["MF004"]

@dmadisetti dmadisetti added enhancement New feature or request api-change labels Mar 3, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Mar 25, 2026 9:24pm

Request Review

@dmadisetti dmadisetti changed the title Dm/lint config feat: lint configuration Mar 3, 2026
@dmadisetti dmadisetti marked this pull request as ready for review March 25, 2026 18:03
Copilot AI review requested due to automatic review settings March 25, 2026 18:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds configurable lint rule selection to marimo check via config ([tool.marimo.lint]) and CLI overrides, including support for per-file PEP 723 script metadata.

Changes:

  • Introduces LintConfig (select/ignore) and a rule resolution mechanism (resolve_rules) to filter enabled lint rules.
  • Threads lint_config through RuleEngine/Linter, adds CLI flags --select/--ignore, and supports PEP 723 file-level lint config merging.
  • Adds unit/integration tests and a PEP 723 fixture file demonstrating [tool.marimo.lint].

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
marimo/_config/config.py Adds LintConfig and exposes it under MarimoConfig/PartialMarimoConfig.
marimo/_lint/rule_selector.py New rule selection implementation (select/ignore, prefix matching, sorted output).
marimo/_lint/rule_engine.py Accepts lint_config in create_default() and filters rules accordingly.
marimo/_lint/linter.py Wires lint_config into linting pipeline; adds per-file PEP 723 config support.
marimo/_lint/__init__.py Adds resolve_lint_config() helper and passes lint config into run_check().
marimo/_cli/cli.py Adds marimo check --select/--ignore options and passes resolved lint config into lint runner.
marimo/_ai/_tools/tools/lint.py Notes TODO for applying session lint config in AI tool path.
tests/_lint/utils.py Extends lint test helper to accept lint_config.
tests/_lint/test_rule_selector.py Adds unit tests for rule selection behavior.
tests/_lint/test_lint_config_integration.py Adds integration tests for config propagation + PEP 723 config reading.
tests/_lint/test_files/empty_cell_with_lint_config.py Adds a PEP 723 metadata fixture demonstrating lint ignore configuration.

Comment on lines +130 to +135
from marimo._config.manager import ScriptConfigManager

try:
file_config = ScriptConfigManager(file_path).get_config(
hide_secrets=False
)
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_rule_engine_for_file() re-reads the file from disk via ScriptConfigManager even though the notebook contents were already read earlier in get_notebook_status(). For large repos this adds avoidable I/O per file. Consider parsing the PEP 723 block from load_result.contents (or passing the already-read text into ScriptConfigManager / a helper) so each file is only read once.

Copilot uses AI. Check for mistakes.
- Fix mypy [assignment] error in _lint/__init__.py (wrong ignore code)
- Regenerate packages/openapi/api.yaml and src/api.ts
@github-actions github-actions bot added the bash-focus Area to focus on during release bug bash label Mar 25, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Bundle Report

Changes will increase total bundle size by 52 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
marimo-esm 25.59MB 52 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: marimo-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/add-*.js 52 bytes 55.39kB 0.09%

@dmadisetti dmadisetti requested a review from mscolnick March 26, 2026 17:54
@dmadisetti dmadisetti requested a review from manzt March 26, 2026 17:54
Copy link
Copy Markdown
Contributor

@mscolnick mscolnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work! I think (if not already done) it would be good to relax the empty cell rule to allow for comments. That was the main reason some people wanted configuration in the first place

@dmadisetti
Copy link
Copy Markdown
Collaborator Author

Thanks! Will followup

@dmadisetti dmadisetti merged commit a1633ca into main Mar 26, 2026
41 of 54 checks passed
@dmadisetti dmadisetti deleted the dm/lint-config branch March 26, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-change bash-focus Area to focus on during release bug bash enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Marimo Lint Configuration

3 participants