Repository navigation
feat(lint): configurable QUAL004 entry-point and CUSTOM002 prefixes (mendixlabs/mxcli#1509) - #1531
Merged
Merged
Conversation
…ig.yaml (mendixlabs#1509) QUAL004 (orphaned elements) hard-coded its entry-point prefixes and CUSTOM002 (microflow prefix convention) its valid prefixes, and `mxcli init` rewrites the shipped rule files, so a project with its own naming convention could not keep an edit: the reporting project got 84 QUAL004 and 121 CUSTOM002 findings for TEST_/GET_/PRS_ microflows. Both rules now read an option - rules.QUAL004.options.entry_point_prefixes and rules.CUSTOM002.options.valid_prefixes - as a YAML list or comma-separated text. A configured list replaces the built-in one; unset, the built-in list applies as before. Underneath, goValueToStarlark converted scalars only, so any YAML list or map under a rule's options reached the rule as None, indistinguishable from "unset". Lists and string-keyed maps now convert recursively. A new get_list_option(key, default) builtin reads a list of strings in either spelling. An option value a rule cannot use is recorded and reported after the run as a warning naming rules.<ID>.options.<key> (RuleFailure, so it stays out of the score) while the rule runs on its default. QUAL004 still counts only callers in the model; a microflow called only from tests/*.test.mdl is reported, and its prefix belongs in the option (maintainer decision). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W3x8Fyvir8kLyPgJs1BDmF
Resolve the CHANGELOG conflict with #1532 (CONV020) by keeping both "Added" entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W3x8Fyvir8kLyPgJs1BDmF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements mendixlabs#1509 (#1391), approved by the maintainer. Rule options in
lint-config.yamlfall back to today's lists. Calls fromtests/*.test.mdlare not counted, by decision.The problem
QUAL004 (
orphaned_elements.star) and CUSTOM002 (example_microflow.star) hard-code their prefix lists.mxcli initrewrites the embedded.starfiles every time, so a project could not change them. AndgoValueToStarlarkhandled only scalars, so a YAML list under a rule's options reached the rule asNonewithout any warning.Change
mdl/linter/starlark.go)goValueToStarlarknow converts lists and string-keyed maps recursively, and returns an error for types it can't represent.get_optionrecords a warning and returns the default when a value can't be converted.get_list_option(key, default)reads a list of strings from a YAML list or from comma-separated text.entry_point_prefixes: 42) warns, namingrules.<ID>.options.<key>, and the rule runs on its default.entry_point_prefixes, and CUSTOM002 readsvalid_prefixes.docs-site/src/tools/starlark-rules.md, option warnings inmxcli-lint.md, the write-lint-rules skill, an example in the lint configinitseeds, and a CHANGELOG "Added" entry.Tests
starlark_options_test.go:LoadConfig);starlark_prefix_options_test.go: QUAL004 and CUSTOM002 with an unset control, a list, a string, a malformed value, and the message naming the configured prefixes..starfiles restored from main, all option cases fail.TEST_andGET_microflows, the configuration takes effect, and a value of42warns.make build,make testandmake lintpass.For review
RuleFailure, so it appears under "Rules That Could Not Run" although the rule ran on its default.Generated by Claude Code