New rule: If expressions should not be too complex
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by reading the existing RoutineNestingDepth and TooManyNestedRoutines rules to understand how similar complexity checks are defined. Decide which measure or combination best identifies overly complex if expressions, then define the rule's scope and acceptance criteria so it is generally useful and distinguishable from existing rules.
Written by the indexing model from the issue text.
Description
Prerequisites
- This rule has not already been suggested.
- This should be a new rule, not an improvement to an existing rule.
- This rule would be generally useful, not specific to my code or setup.
Suggested rule title
If expressions should not be too complex
Rule description
Similar to the existing RoutineNestingDepth and TooManyNestedRoutines rules, this rule would catch if expressions that are unclear due to their size. This could be measured in a few ways, e.g.:
- Sum length of the guard, then, or else expressions
- Number of lines the entire expression covers
- Number of nested
ifexpressions - Whether anonymous methods are present
- etc.
Rationale
Keeping ternary use limited makes code more readable and less prone to errors.
- Dominant language
- Java
- Stars
- 160
- Forks
- 36
- Avg merge
- 22d 7h
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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 integrated-application-development/sonar-delphi
-
bug triage
Difficulty 3/5 1-2 days Newbie friendliness 66/100
integrated-application-development/sonar-delphi#473 · 1 comment ·
-
VariableInitialization false positive for custom managed record with Initialize operatorPossibly taken @Bazooper-blip claimed this 33 days ago. Openenhancement rule
Difficulty 3/5 1-2 days Newbie friendliness 65/100
integrated-application-development/sonar-delphi#468 · 1 comment ·
-
engine enhancement
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
feature rule
Difficulty 5/5 Over a week Newbie friendliness 35/100
integrated-application-development/sonar-delphi#423 · 1 comment ·
-
Support long directive names in the `{$IFOPT}` directivePossibly taken @Bazooper-blip claimed this 33 days ago. Openengine enhancement
integrated-application-development/sonar-delphi#412 · 1 comment · 1 reaction ·
All issues in integrated-application-development/sonar-delphi
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
geonetwork/core-geonetwork#9592 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/rocketmq-dashboard#7361 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
higress-group/himarket#358 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day