fix(lint): respect lint-config.yaml in mxcli lint CLI and options in Starlark rules#700
Conversation
AI Code ReviewWhat Looks GoodThe PR effectively addresses the three main issues described:
The implementation follows established patterns:
Test additions are thorough:
Starlark integration is clean:
RecommendationApprove - The PR is scoped to a single concern (fixing lint config handling), implements the solution correctly with appropriate tests, and maintains consistency with existing code patterns. No MDL syntax changes are involved, so full-stack consistency requirements don't apply. All checklist items are satisfied for this type of change. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
…Starlark rules The `mxcli lint` CLI command was ignoring the lint-config.yaml file entirely — config loading only existed in the executor (REPL/MDL script) path, not the CLI subcommand. Additionally, rule `options` from the YAML were never passed to rules even when loaded. Fixes: - Wire FindConfigFile/LoadConfig/ApplyConfig into cmd/mxcli/cmd_lint.go so excludeModules, rule enabled flags, severity overrides, and options are all respected when running `mxcli lint` - Add Configurable interface (linter.go): rules implementing Configure(options) receive their options map before Check is called - Fix ModuleRoles() and RoleMappings() iterators in context.go to apply IsExcluded() so Starlark rules using module_roles()/role_mappings() respect the excludeModules list - Add get_option(key, default) builtin to Starlark rules so .star files can read per-rule options from lint-config.yaml at check time - Implement Configurable on DomainModelSizeRule with max_entities option - Add config_test.go covering LoadConfig YAML parsing, ApplyConfig, and FindConfigFile; extend linter_test.go and domain_size_test.go for new paths Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R1yYeYn9rosf8UdAimdatt
1dd7ba3 to
506fb1c
Compare
AI Code ReviewCritical Issues
Moderate Issues
Minor Issues
What Looks Good
RecommendationApprove - The PR thoroughly addresses the reported issues with minimal, focused changes that follow project patterns and include appropriate test coverage. All applicable checklist items are satisfied. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
|
A genuine bug-fix PR (not just a new builtin), and I verified it end-to-end. Fixes three real bugs:
Plus a Verified:
Notes (one recurring, rest minor):
Recommendation: approve — the fix is correct, well-tested, and I confirmed the end-to-end behavior including the no-config regression risk. The docs addition is the one thing genuinely worth doing before/with merge; the rest are minor. |
Summary
mxcli lintCLI command was silently ignoringlint-config.yaml—FindConfigFile/LoadConfig/ApplyConfigwere only wired into the executor (REPL/MDL script) path, not the CLI subcommandoptionsfrom YAML were stored inRuleConfigbut never delivered to rules (no mechanism existed to pass them)ModuleRoles()andRoleMappings()iterators inLintContextdid not applyIsExcluded(), so Starlark rules usingmodule_roles()reported violations from excluded modulesChanges
cmd/mxcli/cmd_lint.goFindConfigFile→LoadConfig→ApplyConfigafter Starlark rules are loaded;excludeModulesfrom config merges with--excludeflag;--rulesallowlist still wins lastmdl/linter/linter.goConfigurableinterface;RuncallsConfigure(options)on any rule implementing it beforeCheckmdl/linter/context.goIsExcluded()inModuleRoles()andRoleMappings()iteratorsmdl/linter/starlark.goStarlarkRuleimplementsConfigurable(stores options map)get_option(key, default=None)builtin so.starrules can read per-rule options fromlint-config.yamlat check timemdl/linter/rules/domain_size.goDomainModelSizeRuleimplementsConfigurablewithmax_entitiesoptionTests
mdl/linter/config_test.go:LoadConfigYAML parsing (excludeModules,enabled,severity,options),ApplyConfig,FindConfigFilelinter_test.go:Configurableinterface called beforeCheck, not called when options emptydomain_size_test.go:Configurewith int/float64/unknown key, raises threshold end-to-endTest plan
go test ./mdl/linter/...passes (56 tests)mxcli lint -p app.mprwithlint-config.yamlin project root respectsexcludeModules, disabled rules, severity overridesget_option("key", default)reads value fromoptions:block in YAML--excludeflag still works independently when no config file presentYaml example
🤖 Generated with Claude Code
https://claude.ai/code/session_01R1yYeYn9rosf8UdAimdatt