Add 6 new Flow Scanner rules (lexical): HardcodedUrl, GetRecordAllFields, ProcessBuilder, InactiveFlow, InvalidApiVersion, MissingTriggerOrder#481
Conversation
Adds six lexical Flow rules inspired by the community lightning-flow-scanner rule set, filling gaps in the current 15-rule catalog: - HardcodedUrl (Moderate, BestPractices) - hardcoded http(s) URLs - GetRecordAllFields (Low, Performance) - Get Records storing all fields - ProcessBuilder (Moderate, BestPractices) - retired Process Builder / Workflow - InactiveFlow (Low, BestPractices) - non-Active flow status - InvalidApiVersion (Low, BestPractices) - missing/outdated apiVersion (< 50) - MissingTriggerOrder (Low, BestPractices) - record-triggered flow w/o triggerOrder Each rule is a Python Query class in optional_query.py, registered in its QUERIES map, mirrored in the TypeScript catalog (hardcoded-catalog.ts) and messages.ts, and reflected in the all-rules goldfile. Adds a contains-new-rule-violations test workspace plus a jest block asserting each rule flags its fixture, and updates the end-to-end rule count (15 -> 21) and per-rule violation counts. Bumps the engine to 0.39.0-SNAPSHOT. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Git2Gus App is installed but the |
aruntyagiTutu
left a comment
There was a problem hiding this comment.
Great addition of 6 new Flow Scanner rules to close gaps with the community scanner. The implementation is clean, consistent, and well-tested.
Key observations:
- ✅ Consistency: All 6 rules follow the existing
LexicalQuerypattern with properquery_id,get_query_description(),when_to_run(), andexecute()methods. - ✅ Testing: Each rule has a dedicated fixture in
contains-new-rule-violationsworkspace, plusit.each()blocks asserting each rule flags exactly its fixture.InactiveFlowhas a negative test (all-active workspace → no violations). - ✅ TypeScript/Python sync: Rules added to both
QUERIESmap (Python) andRuleNameenum +RULE_DESCRIPTIONS(TypeScript), with message catalog entries. - ✅ Goldfile updated:
all_rules.goldfile.jsonnow includes all 6 rules (15→21 total). - ✅ Version bump: Engine bumped to
0.39.0-SNAPSHOT. - ✅ Minimal scope: No unrelated changes, clear commit.
- ✅ Helper function:
flow_level_result()is a nice abstraction for rules that report flow-level issues (status, API version) rather than element-level issues.
Minor notes:
MIN_API_VERSION = 50.0is reasonable but not configurable. If the team later wants to bump this, it's a one-line change.url_patternregex is simple (https?://[^\s"'<>]+). May have edge cases (e.g., URLs in CDATA), but good enough for the common case.
Overall: excellent work, ready to merge.
🔴 CRITICAL: O(n) Performance Issue in HardcodedUrl RuleFile: IssueThe for hardcoded_url in hardcoded_urls:
if hardcoded_url['url'] not in excluded_urls: # O(n) lookup!
normalized_violations.append(...)Impact
RecommendationConvert excluded_url_set = set(excluded_urls)
for hardcoded_url in hardcoded_urls:
if hardcoded_url['url'] not in excluded_url_set: # O(1) lookup
normalized_violations.append(...)Expected improvement: 100-1000x faster for large exclusion lists ###📊 Review Summary Total findings: 3
Generated by |
What
Adds six new Flow Scanner rules, all six are lexical (single-flow) queries:
HardcodedUrlhttp(s)://URLs in string valuesGetRecordAllFieldsstoreOutputAutomatically=true, noqueriedFields)ProcessBuilderprocessTypeWorkflow/InvocableProcess)InactiveFlowstatusis notActiveInvalidApiVersionapiVersionor below the supported minimum (50.0)MissingTriggerOrdertriggerOrderHow
Queryclasses inFlowScanner/queries/optional_query.py, registered in that module'sQUERIESmap (auto-resolved byquery_manager).src/hardcoded-catalog.ts(RuleNameenum +RULE_DESCRIPTIONS) andsrc/messages.ts.all_rules.goldfile.json(now 21 rules).0.39.0-SNAPSHOT.Testing
contains-new-rule-violationstest workspace with a fixture per rule, plus a jest block asserting each rule flags exactly its fixture with no false positives, and thatInactiveFlowstays silent on an all-active workspace.GetRecordAllFields: 3,InactiveFlow: 4to the per-rule counts).tscbuild, andeslintall pass.🤖 Generated with Claude Code