feat: Add basic badge rules
This adds some basic rules for badge usage, similar to what was added for GlBanner
.
When run against gitlab-org/gitlab@73269ed6, the WARNING
rules correctly find no instances:
$ semgrep --severity WARNING --config rules/components/badge ~/dev/gdk-ee/gitlab/{ee/,}app
Scanning 7346 files with 2 <multilang> rules.
[...snip...]
Ran 2 rules on 7346 files: 0 findings.
If Semgrep missed a finding, please send us feedback to let us know!
$ semgrep shouldafound --help
But the INFO ones find 271 correct usages:
$ semgrep --severity INFO --config rules/components/badge ~/dev/gdk-ee/gitlab/{ee/,}app
[...snip...]
/home/markrian/dev/gdk-ee/gitlab/ee/app/views/users/available_group_templates.html.haml
rules.components.badge.okay-badge-helper-haml
Correct usage of gl_badge_tag helper.
19┆ = gl_badge_tag projects.count, nil, { class: 'gl-font-weight-bold' }
Some files were skipped or only partially analyzed.
Scan was limited to files tracked by git.
Scan skipped: 2 files larger than 1.0 MB
For a full list of skipped files, run semgrep with the --verbose flag.
Ran 2 rules on 7350 files: 271 findings.
Edited by Mark Florian