Naming convention for scan rule constants in library packages
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Read the suggested convention options in the issue and check Ballerina's annotation rules for whether a constant mapping can be accessed in an annotation. Compare the namespace, completion, documentation, and import tradeoffs for each option; the issue is done when a convention is agreed on for rule constants across library packages.
Written by the indexing model from the issue text.
Description
Current Limitation
-
A
@scan:Suppressannotation names rules by ID, such asballerina:2orballerina/http:1, which does not say what is suppressed. -
ballerina/scanis adding a constant for each core rule, named after the finding it suppresses, so the annotation reads as what is suppressed and why:@scan:Suppress {rules: [scan:UNUSED_FUNCTION_PARAMETER], reason: "Required by the listener interface"} -
Packages that provide scan rules through an analyzer, such as the standard libraries, should provide constants for their rules too. Unlike
ballerina/scan, whose API is only about scanning, a library's rule constants share its namespace with the rest of its API. Without a convention:- a rule constant can clash with, or be mistaken for, an existing API constant of the library;
- completion and the API docs mix rule constants with the API;
- each library names them differently.
-
A plain prefix such as
SCAN_solves those, but breaks the finding-based reading:http:SCAN_UNSECURED_RESOURCEreads as "scan unsecured resource" rather than "suppress the unsecured resource finding".
Suggested Improvement
Agree on a convention for rule constants in library packages, so that they read as the finding, stay apart from the library's API, and look the same in every library. Options to discuss (rule names are illustrative):
- No prefix, named after the finding:
http:UNSECURED_RESOURCE. Reads best; relies on the name not clashing with the API and on the docs marking it as a rule. - A suffix:
http:UNSECURED_RESOURCE_RULE. - A constant mapping of rules:
http:SCAN_RULES.UNSECURED_RESOURCE. Groups the rules under one name; needs checking that member access on a constant mapping is accepted in the annotation. - A separate module of the library, such as
ballerina/http.rules: keeps the rules out of the main API, but needs an extra import in every file that suppresses a rule.
Version
0.13.0-SNAPSHOT
- Dominant language
- Java
- Stars
- 15
- Forks
- 12
- Avg merge
- 12h 17m
- Merged PRs (30d)
- 13
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No 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 ballerina-platform/static-code-analysis-tool
-
Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ballerina-platform/static-code-analysis-tool#140 ·
Maintainers usually reply within 1 day
-
Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ballerina-platform/static-code-analysis-tool#139 ·
Maintainers usually reply within 1 day
-
Scan with the dependency versions locked in Dependencies.tomlPossibly taken @TharmiganK claimed this 1 day ago. OpenType/Improvement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
ballerina-platform/static-code-analysis-tool#141 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
Type/Improvement
Difficulty 3/5 1-2 days Newbie friendliness 62/100
ballerina-platform/static-code-analysis-tool#138 ·
Maintainers usually reply within 1 day
-
Type/Improvement
Difficulty 3/5 1-2 days Newbie friendliness 63/100
ballerina-platform/static-code-analysis-tool#137 ·
Maintainers usually reply within 1 day
All issues in ballerina-platform/static-code-analysis-tool
Similar issues
-
[BUG] micronaut-serde-oracle-jdbc-json brings a second OJDBC driver onto the runtime classpathPossibly taken @ZARAYACH claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
micronaut-projects/micronaut-serialization#1494 · 4 comments ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 2 days
-
code-health feature/sync OS/Android QA/Test-Plan-Specified QA/Yes
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
brave/brave-browser#60327 ·
Maintainers usually reply within 1 day
-
Type: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
it-at-m/raumreservierung#383 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
aws/context-ontology-accelerator#325 ·
Maintainers usually reply within 1 day