[Feature Request] File based regex rules
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
Research direction
Start at the code-analyzer CLI entry point that loads code-analyzer.yml and trace how regex custom_rules are parsed. Review how an external YAML rule file could be referenced and shared, then verify that existing inline rules continue to work alongside file-based rules in a representative CLI run.
Written by the indexing model from the issue text.
Description
Product Area
The "code-analyzer" CLI
Your Need or Problem
Allow for regex rules to be placed into their own files and referenced from code-analyzer.yml so that they can be more easily shared between projects instead of merging them into existing files.
Your Desired Solution
Lets say we had the rule:
name: Salesforce Code Analyzer Configuration
version: 1.0.0
rulesets: []
engines:
regex:
custom_rules:
ProhibitSuppressWarnings:
regex: /@SuppressWarnings\([^)]*\)|\/\/\s*NOPMD/gi
file_extensions: ['.apex', '.cls', '.trigger']
description:
'Prohibits the use of @SuppressWarnings annotations and
NOPMD comments in Apex code. Suppressions hide code quality
issues; prefer fixing the underlying problems or improving
rules instead.'
violation_message:
'Suppression of warnings is not allowed. Fix the underlying
issue or improve the rule instead of suppressing violations.'
severity: 'High'
tags: ['CodeStyle', 'Recommended']
I would like to take the details of that rule and put them in a different .yaml file, then refer to that .yaml file from code-analyzer.yml
Alternatives Considered
Keep adding rules to code-analyzer.yml like today, using a pre-processor/script ahead of every run, etc
Additional Context (Screenshots, Files, etc)
No response
Workaround
No response
Urgency
Low
- Dominant language
- TypeScript
- Stars
- 240
- Forks
- 52
- Avg merge
- 9h 48m
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from forcedotcom/code-analyzer
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
forcedotcom/code-analyzer#2094 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
forcedotcom/code-analyzer#2093 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
forcedotcom/code-analyzer#2091 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
forcedotcom/code-analyzer#2090 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
forcedotcom/code-analyzer#2099 ·
All issues in forcedotcom/code-analyzer
Similar issues
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Mend: dependency security vulnerability untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 70/100