Compare commits

...

143 Commits

Author SHA1 Message Date
hashicorp-vault-sonar-prod[bot]
efc8e97d40
update coverage information (#4859)
Co-authored-by: SonarTech <sonartech@sonarsource.com>
2025-03-29 02:48:10 +00:00
Egon Okerman
ae0dfb3126
Update rule S7409: Clarify rule title and rule text (SONARKT-637) (#4826)
* Update rule title and text according to previous discussion

* Fix typo

* Add references to S6362 and S7409 in both rules' descriptions
2025-03-28 12:55:14 +00:00
github-actions[bot]
cc01781c31
Create rule S6096: add Kotlin (SONARSEC-6157) (#4846)
* Add kotlin to rule S6096

* Add Kotlin rule description, update Java SE name

* Apply suggestions from code review

Co-authored-by: Pierre-Loup <49131563+pierre-loup-tristant-sonarsource@users.noreply.github.com>

---------

Co-authored-by: christophe-zurn-sonarsource <christophe-zurn-sonarsource@users.noreply.github.com>
Co-authored-by: Christophe Zurn <christophe.zurn@sonarsource.com>
Co-authored-by: Christophe Zürn <36889251+christophe-zurn-sonarsource@users.noreply.github.com>
Co-authored-by: Pierre-Loup <49131563+pierre-loup-tristant-sonarsource@users.noreply.github.com>
2025-03-28 10:48:21 +00:00
hashicorp-vault-sonar-prod[bot]
5acd6984d0
update coverage information (#4856)
Co-authored-by: SonarTech <sonartech@sonarsource.com>
2025-03-28 02:49:31 +00:00
github-actions[bot]
4e3c0d465a
Create rule S2083: add Kotlin (SONARSEC-6155) (#4838)
* Add kotlin to rule S2083

* Add Kotlin rule description, update Java SE name, minor java fix

* Apply review comments

---------

Co-authored-by: christophe-zurn-sonarsource <christophe-zurn-sonarsource@users.noreply.github.com>
Co-authored-by: Christophe Zurn <christophe.zurn@sonarsource.com>
2025-03-27 10:23:23 +00:00
Rudy Regazzoni
266cde4510
SONARGO-118 Update S2068 exception category (#4823) 2025-03-27 09:26:11 +00:00
hashicorp-vault-sonar-prod[bot]
538d0b0b4f
update coverage information (#4849)
Co-authored-by: SonarTech <sonartech@sonarsource.com>
2025-03-27 02:49:10 +00:00
Egon Okerman
6b9c19eceb
Update rule S7201: Disable rule and move rule text to S6363 (SONARKT-636) (#4802)
* Close S7201

* Update S6363 with updated descriptions

* Update OWASP categories with S7201 info
2025-03-26 10:57:39 +00:00
github-actions[bot]
1490c6d3f0
Modify rule S3776: Add Rust (#4825)
* Add rust to rule S3776

* Update rule.adoc

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-26 09:36:59 +00:00
Arseniy Zaostrovnykh
110ce01fce
Modify rule S5443(cfamily): Fix src blocks highlighting (#4837) 2025-03-26 08:36:49 +00:00
Loïc Joly
d2964e7f0b
Revert "Fix frontend_tests job long running times (#4829)" (#4836)
This workaround should no longer be required, the initial bug in SCA analysis has been fixed.

This reverts commit 1012f37ffaf9774ad41f4826ea5854ae08893ec7.
2025-03-26 06:25:52 +00:00
hashicorp-vault-sonar-prod[bot]
ccef1ab5e6
update coverage information (#4835)
Co-authored-by: SonarTech <sonartech@sonarsource.com>
2025-03-26 02:48:47 +00:00
Peter Trifanov
d4177370f1
SONARIAC-1868 S6273 should support prefixes and not be in sonar-way (#4824) 2025-03-25 15:38:55 +00:00
github-actions[bot]
f15fa27234
SONARIAC-1869 Create rule S7452 AWS resource tags should have valid format (#4821)
* Create rule S7452

* SONARIAC-1869 Create rule S7452 AWS resource tags should have valid format

---------

Co-authored-by: petertrr <petertrr@users.noreply.github.com>
Co-authored-by: Peter Trifanov <peter.trifanov@sonarsource.com>
2025-03-25 15:32:07 +00:00
Pierre-Loup
84d701ffe5
Create rule S5344 for Kotlin (SONARKT-582) (#4803)
* Create rule S5344 for Kotlin

* Apply review suggestions
2025-03-25 15:04:15 +00:00
Arseniy Zaostrovnykh
1012f37ffa
Fix frontend_tests job long running times (#4829) 2025-03-25 13:57:34 +00:00
Arseniy Zaostrovnykh
f18135cc24
Adjust update_coverage GH Action to work with Merge Queue (#4806)
* Try merging with the queue

* Provide github token

* Fix syntax

* Get GITHUB_TOKEN from vault

* Add the PR label

* Wait for the new PR to merge

* Fix working dir

* Inline the script

* Checkout master

* Install python for slack notifications

* Fix logging

* install rspec-tools

* Log actual PR-merge status

* Final adjustments

* Set check interval to 20 seconds

* Test failure

* Fix pr close command

* Revert "Test failure"

This reverts commit c3c2b845feaa047a62ef19fb34c805bf3ef7a23f.

* Update .github/workflows/update_coverage.yml

---------

Co-authored-by: Fred Tingaud <95592999+frederic-tingaud-sonarsource@users.noreply.github.com>
2025-03-21 16:58:53 +00:00
Gyula Sallai
a8ad04a813
Modify rules S106,S126,S1612,S2148,S7411,S920 Remove from SonarWay (#4820) 2025-03-21 12:54:12 +00:00
hashicorp-vault-sonar-prod[bot]
c9b1950aa9
update coverage information (#4819)
Co-authored-by: SonarTech <sonartech@sonarsource.com>
2025-03-21 11:00:05 +00:00
Arseniy Zaostrovnykh
cff5da40b3
Add line to conflict with coverage update (#4816)
* Add line to conflict with coverage update

* Add another line to engender conflict
2025-03-21 10:18:21 +00:00
Arseniy Zaostrovnykh
1dca1a1b3f
Add line to conflict with coverage update (#4814) 2025-03-21 10:06:49 +00:00
hashicorp-vault-sonar-prod[bot]
3b7ef14b40
update coverage information (#4813)
Co-authored-by: SonarTech <sonartech@sonarsource.com>
2025-03-21 09:54:17 +00:00
Arseniy Zaostrovnykh
0a35748341
Revert "Update coverage information (#4808)" (#4811)
This reverts commit e240ba5d737b0b0a465ba23a6f99a2e0d41ba5bb.
2025-03-21 09:34:52 +00:00
hashicorp-vault-sonar-prod[bot]
e240ba5d73
Update coverage information (#4808)
* Try merging with the queue

* Provide github token

* Fix syntax

* Get GITHUB_TOKEN from vault

* Add the PR label

* update coverage information

---------

Co-authored-by: Arseniy Zaostrovnykh <necto.ne@gmail.com>
Co-authored-by: SonarTech <sonartech@sonarsource.com>
2025-03-21 08:16:22 +00:00
Pierre-Loup
dd52d59602
Modify rule S6249: update message (#935)
* S6249: Update issue message

* Add secondary location

* Update code example

Remove "mynoncompliant" from the resource names.
Add language specificators for code blocks

* Apply suggestions from code review

Co-authored-by: Loris S. <91723853+loris-s-sonarsource@users.noreply.github.com>

* Update secondary location issue message

---------

Co-authored-by: Loris S. <91723853+loris-s-sonarsource@users.noreply.github.com>
2025-03-20 14:11:28 +00:00
Pierre-Loup
84ac3f2f9f
Fix missing CWE link for S5542 (#4805) 2025-03-20 13:09:00 +00:00
Pavel Mikula
bfd616337b
Update Jira project keys for T-SQL, PL/SQL and VB6 (#4804) 2025-03-20 09:57:00 +00:00
GabinL21
cd6491db81
SONARTEXT-418 Create rules S7209 to S7402 (#4801)
* SONARTEXT-418 Create rules S7209 to S7402

* SONARTEXT-418 Create rules S7209 to S7402

* SONARTEXT-418 Add PKCE to OAuth2 secrets

* SONARTEXT-418 Fix validation
2025-03-19 20:11:43 +00:00
Antonio Aversa
1a1a60f52d
SONARKT-569 Modify rule S4830: add support for WebViews (#4673)
* SONARKT-569 Modify rule S4830: add support for WebViews

* Fix list of allowed frameworks

* Add Google Support link

* Have non-compliant and compliant code examples next to each other and in diff

* Update rules/S4830/kotlin/how-to-fix-it/android-webview.adoc

Co-authored-by: Egon Okerman <egon.okerman@sonarsource.com>

* Update rules/S4830/kotlin/how-to-fix-it/android-webview.adoc

Co-authored-by: Egon Okerman <egon.okerman@sonarsource.com>

---------

Co-authored-by: Egon Okerman <egon.okerman@sonarsource.com>
2025-03-19 15:31:02 +00:00
Antonio Aversa
d41b77b623
DART-213 Modify rules S1161, S7055: update descriptions and messages (#4799)
* DART-213 Modify rule S1161: update message details

* S7055: Update description

* Update rule.adoc
2025-03-19 15:28:12 +00:00
github-actions[bot]
74068df10a
Create rule S1862: Related "if/else if" statements should not have the same condition (#4687)
* Add rust to rule S1862

* Add rule description

* Fix errors

* Add link to Clippy lint

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 15:22:56 +00:00
github-actions[bot]
164b14aedc
Create rule S107: Functions should not have too many parameters (#4699)
* Add rust to rule S107

* Update RSPEC

* Remove tag

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
Co-authored-by: Yassin Kammoun <52890329+yassin-kammoun-sonarsource@users.noreply.github.com>
2025-03-19 14:54:18 +00:00
github-actions[bot]
2713aeaed6
Create rule S3498: Field init shorthand should be used (#4727)
* Add rust to rule S3498

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 14:46:55 +00:00
github-actions[bot]
ef35f53a80
Create rule S4325: Redundant casts should be avoided (#4729)
* Add rust to rule S4325

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 14:46:46 +00:00
Yassin Kammoun
c5bb992c80
Create rule S1858: "to_string()" should never be called on a String value (#4730)
* Add rust to rule S1858

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
2025-03-19 14:42:54 +00:00
github-actions[bot]
06ad3ace6f
Create rule S106: Standard outputs should not be used directly to log anything (#4735)
* Add rust to rule S106

* Update RSPEC

* Fix RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 14:40:00 +00:00
github-actions[bot]
bd332080f2
Create rule S7439 Comparisons with overlapping ranges that are always false should not be made (#4782)
* Create rule S7439

* Update rule.adoc

* Update metadata.json

* Update rule.adoc

* Update metadata.json

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-19 14:10:52 +00:00
github-actions[bot]
1de188a9e5
Create rule S7443 Calls to std::mem::transmute should not be evaluated eagerly (#4786)
* Create rule S7443

* Update metadata.json

* Update rule.adoc

* Update metadata.json

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-19 14:10:47 +00:00
github-actions[bot]
d4cbb1c40b
Create rule S7449 The #[inline] attribute should not be used on trait methods without implementation (#4793)
* Create rule S7449

* Update metadata.json

* Update rule.adoc

* Update rule.adoc

* Update rule.adoc

* Update metadata.json

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-19 14:10:41 +00:00
github-actions[bot]
70168e8e61
Create rule S7450 Synchronization locks should not be dropped immediately after acquisition (#4794)
* Create rule S7450

* Update metadata.json

* Update rule.adoc

* Update rule.adoc

* Update metadata.json

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-19 14:10:35 +00:00
github-actions[bot]
29af6f4517
Create rule S7438 Incompatible bit masks should not be used in comparisons (#4781)
* Create rule S7438

* Update rule.adoc

* Update metadata.json

* Update metadata.json

* Update metadata.json

* Update rule.adoc

* Update metadata.json

* Update rule.adoc

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-19 14:10:14 +00:00
github-actions[bot]
00d540f5ed
Create rule S7437 Variables should be swapped using std::mem::swap (#4780)
* Create rule S7437

* Update rule.adoc

* Update metadata.json

* Update metadata.json

* Update metadata.json

* Update metadata.json

* Update metadata.json

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-19 14:10:07 +00:00
github-actions[bot]
a02eec56d4
Create rule S7433 Raw pointers should not be casted to slices with differently sized elements (#4774)
* Create rule S7433

* Update metadata.json

* Update rule.adoc

* Update rule.adoc

* Update metadata.json

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-19 14:10:01 +00:00
github-actions[bot]
7b234485eb
Create rule S7428 Case mismatches in pattern arms of match expressions should be avoided (#4769)
* Create rule S7428

* Update rule.adoc

* Update metadata.json

* Update metadata.json

* Update metadata.json

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-19 14:09:52 +00:00
github-actions[bot]
8e35213fbb
Create rule S7426 C-like enums should not have unportable variants (#4767)
* Create rule S7426

* Update rule.adoc

* Update metadata.json

* Update metadata.json

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-19 14:09:47 +00:00
github-actions[bot]
c83072239e
Create rule S7424 Avoid manual PartialEq implementation with a derived Hash (#4765)
* Create rule S7424

* Update rule.adoc

* Update metadata.json

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-19 14:09:42 +00:00
github-actions[bot]
b16523921f
Create rule S7417 Manual PartialOrd implementation should be avoided when Ord is derived (#4757)
* Create rule S7417

* Update rule.adoc

* Update metadata.json

* Update metadata.json

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-19 14:09:19 +00:00
github-actions[bot]
cdb05a081b
Create rule S7413 Await should be used for awaitable returns in async blocks and functions (#4752)
* Create rule S7413

* Update rule.adoc

* Update metadata.json

* Update rule.adoc

* Update rule.adoc

* Update metadata.json

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-19 14:09:13 +00:00
github-actions[bot]
d17e141be3
Create rule S2198: Unnecessary mathematical comparisons should not be made (#4692)
* Add rust to rule S2198

* Add rule description

* Update rule.adoc

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-19 14:09:07 +00:00
github-actions[bot]
feaf726b3a
Create rule S6164: Mathematical constants should not be hardcoded (#4690)
* Add rust to rule S6164

* Add rule description

* Update rule.adoc

* Add link to Clippy lint

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 14:08:57 +00:00
github-actions[bot]
faeaec31d0
Modify rule S5856: Add language Rust (#4678)
* Add rust to rule S5856

* Add rule description

* Fix header

* Add Clippy tag and link to Clippy lint

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 14:08:10 +00:00
github-actions[bot]
f93da5854a
Create rule S1764: Identical expressions should not be used on both sides of a binary operator (#4681)
* Add rust to rule S1764

* Add rule description

* Whitespace

* Update metadata.json

* Fix JSON syntax

* Update rule.adoc

* Update rule.adoc

---------

Co-authored-by: sallaigy <sallaigy@users.noreply.github.com>
Co-authored-by: Gyula Sallai <gyula.sallai@sonarsource.com>
2025-03-19 14:07:55 +00:00
github-actions[bot]
aa593087ba
Create rule S6466: Accessing an array element should not trigger a panic (#4684)
* Add rust to rule S6466

* Update RSPEC

* Remove tag

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:38:59 +00:00
github-actions[bot]
5def9014ed
Create rule S6913: Clamping values with cmp::min and cmp::max should use correct ranges (#4689)
* Add rust to rule S6913

* Update RSPEC

* Remove tag

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:38:53 +00:00
github-actions[bot]
0b6c98a1f0
Create rule S4962: "std::ptr::null" should be used to denote the null pointer (#4697)
* Add rust to rule S4962

* Remove tag

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:38:48 +00:00
github-actions[bot]
e34bf94e7d
Create rule S905: Non-empty statements should change control flow or have at least one side-effect (#4698)
* Add rust to rule S905

* Update RSPEC

* Remove tag

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:38:43 +00:00
github-actions[bot]
8d3cf1eee3
Create rule S1612: Closures should be replaced with function pointers (#4700)
* Add rust to rule S1612

* Update RSPEC

* Remove tag

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:38:32 +00:00
github-actions[bot]
45cc311cd2
Create rule S2260: Rust source files should not have syntax errors (#4701)
* Add rust to rule S2260

* Update RSPEC

* Add to SonarWay

* Improve rule title

* Remove from Sonar way

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:38:25 +00:00
github-actions[bot]
99086a587d
Create rule S1116: Empty statements should be removed (#4728)
* Add rust to rule S1116

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:38:13 +00:00
github-actions[bot]
77af1ab66a
Create rule S1488: Local variables should not be declared and then immediately returned (#4732)
* Add rust to rule S1488

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:38:03 +00:00
github-actions[bot]
6cf7f45131
Create rule S920: Match expression conditions should not have boolean type (#4733)
* Add rust to rule S920

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:37:58 +00:00
github-actions[bot]
982f059788
Create rule S4275: Getters should access the expected fields (#4734)
* Add rust to rule S4275

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:37:54 +00:00
github-actions[bot]
dc98004888
Create rule S2193: "while" loop counters should not have floating type (#4736)
* Add rust to rule S2193

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:37:42 +00:00
github-actions[bot]
90a9b01d26
Create rule S7089: Inline vector literals should be preferred to chains of insertions (#4741)
* Add rust to rule S7089

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:37:38 +00:00
github-actions[bot]
ff68a34119
Create rule S2148: Underscores should be used to make large numbers readable (#4742)
* Add rust to rule S2148

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:37:35 +00:00
github-actions[bot]
6ca7dd2cc6
Create rule S2208: Wildcard imports should not be used (#4743)
* Add rust to rule S2208

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:37:31 +00:00
github-actions[bot]
06526591dd
Create rule S7411: Shared code in all branches should be extracted (#4744)
* Create rule S7411

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:37:27 +00:00
github-actions[bot]
91eadda5cf
Create rule S126: "if ... else if" constructs should end with "else" clauses (#4747)
* Add rust to rule S126

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:37:23 +00:00
github-actions[bot]
e94e4d8143
Create rule S7425: MaybeUninit::uninit().assume_init() should not be used (#4766)
* Create rule S7425

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:37:18 +00:00
github-actions[bot]
ea0dd90530
Create rule S7414: Avoid transmutes that can never be correct (#4753)
* Create rule S7414

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:07:55 +00:00
github-actions[bot]
87a178f05b
Create rule S7412: Pointer arithmetic should not be performed on zero-sized types (#4751)
* Create rule S7412

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:07:48 +00:00
github-actions[bot]
ec02230f32
Create rule S7415: Immutable variables should not be used in while loop conditions (#4754)
* Create rule S7415

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:07:33 +00:00
github-actions[bot]
ca818ac21b
Create rule S7418: Lint attributes should not be used on crate imports (#4759)
* Create rule S7418

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:07:29 +00:00
github-actions[bot]
7cf7c53935
Create rule S7419: I/O buffers should be processed entirely (#4760)
* Create rule S7419

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:07:26 +00:00
github-actions[bot]
96bd90a6a9
Create rule S7420: Collections should not be transmuted to different types (#4761)
* Create rule S7420

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:07:22 +00:00
github-actions[bot]
85d974977b
Create rule S7421: Closures of type Fn(...) -> Ord should not return the unit type (#4762)
* Create rule S7421

* Update RSPEC

* Change severity to Critical

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:07:18 +00:00
github-actions[bot]
1379adbc47
Create rule S7422: Unit values should not be hashed (#4763)
* Create rule S7422

* Update RSPEC

* Update snippets

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:07:14 +00:00
github-actions[bot]
66bae183f4
Create rule S7423: Unit values should not be compared (#4764)
* Create rule S7423

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:07:11 +00:00
github-actions[bot]
e1ee16f500
Create rule S7427: Null pointers should not be transmuted (#4768)
* Create rule S7427

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:07:03 +00:00
github-actions[bot]
31e8111116
Create rule S7429: Null function pointers should not be created through transmute (#4770)
* Create rule S7429

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:06:59 +00:00
github-actions[bot]
ef9ace8117
Create rule S7430: splitn should not be used with a limit of 0 or 1 (#4771)
* Create rule S7430

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:06:55 +00:00
github-actions[bot]
fd50acb2e3
Create rule S7431: size_of::<T> should not be used to count elements of type T (#4772)
* Create rule S7431

* Update RSPEC

* Update snippets

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:06:51 +00:00
github-actions[bot]
6edd31ee99
Create rule S7432: Reversed ranges and slices should not be empty (#4773)
* Create rule S7432

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:06:47 +00:00
github-actions[bot]
26f042cc83
Create rule S7436: Redundant comparisons should be removed (#4779)
* Create rule S7436

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:06:43 +00:00
github-actions[bot]
6919fdfd79
Create rule S7440: Formatting trait implementations should not be recursive (#4783)
* Create rule S7440

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:06:39 +00:00
github-actions[bot]
314d4b0ed2
Create rule S7441: Lines read from the standard input should be trimmed (#4784)
* Create rule S7441

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:06:36 +00:00
github-actions[bot]
32d452498a
Create rule S7442: unwrap() should only be used when there is a value to unwrap (#4785)
* Create rule S7442

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:06:31 +00:00
github-actions[bot]
0360734651
Create rule S7444: checked_add and overflowing_add should be used to prevent overflows (#4788)
* Create rule S7444

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:06:24 +00:00
github-actions[bot]
cb4497e15d
Create rule S7445: env! should be preferred over option_env! (#4789)
* Create rule S7445

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:06:20 +00:00
github-actions[bot]
c008bdb1a8
Create rule S7446: Functions expecting raw pointer arguments should be marked as unsafe (#4790)
* Create rule S7446

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:06:16 +00:00
github-actions[bot]
0b46bc20f9
Create rule S7447: File open options should be consistent (#4791)
* Create rule S7447

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:06:12 +00:00
github-actions[bot]
b294a06b26
Create rule S7448: Unix file permissions should be set with octal values (#4792)
* Create rule S7448

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:06:06 +00:00
github-actions[bot]
28e7cab961
Create rule S7451: Remainder operations with 1 or -1 should be avoided (#4797)
* Create rule S7451

* Update RSPEC

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 13:05:34 +00:00
github-actions[bot]
40b6cf5d12
Create rule S3723: Array elements should be separated by commas (#4688)
* Add rust to rule S3723

* Update RSPEC

* Remove tag

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 11:21:29 +00:00
github-actions[bot]
8ae7a510c0
Create rule S2589: Boolean expressions should not be gratuitous (#4683)
* Add rust to rule S2589

* Update RSPEC

* Remove tag

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 11:21:00 +00:00
github-actions[bot]
3c466262f6
Create rule S1656: Variables should not be self-assigned (#4679)
* Add rust to rule S1656

* Update RSPEC

* Remove tag

---------

Co-authored-by: yassin-kammoun-sonarsource <yassin-kammoun-sonarsource@users.noreply.github.com>
Co-authored-by: yassin-kammoun-sonarsource <yassin.kammoun@sonarsource.com>
2025-03-19 11:12:17 +00:00
guillem-bartrina-sonarsource
a9fc281e99
CPP-6230 Modify rule S1172: Mention new exceptional options introduced in C23 (#4750) 2025-03-19 08:23:22 +00:00
SonarTech
a4428806a8 update coverage information 2025-03-19 02:45:22 +00:00
Antonio Aversa
152a2d8c47
DART-124 Modify rules S3512, S7066, S7107, S7109: Update message (#4798) 2025-03-18 16:53:08 +00:00
Jonas Wielage
aa7f7e600d
Modify rule S4423 for Go: Add examples for HTTP servers (#4800)
* Revert "SONARGO-393 Modify rule S4423 for Go: remove examples for HTTP server…"

This reverts commit e7c5865c645d1d0268b89a1c9e6ec005c056545e.

* Adjusted text about go version
2025-03-18 15:34:53 +01:00
Egon Okerman
a025ef5394
Modify rule S7207: Add additional documentation (#4749)
* Add an extra reference

* Fix error due to reference placement
2025-03-18 14:37:50 +01:00
github-actions[bot]
3891361829
Create rule S7435: Processing persistent unique identifiers is security-sensitive (#4776) 2025-03-18 14:37:33 +01:00
Egon Okerman
c485ec3dc3
Modify rule S3330: Add FastAPI (APPSEC-1260) (#3414)
* Fix Flask docs

* Add FastAPI example
2025-03-18 14:37:05 +01:00
github-actions[bot]
f7e3f45cf3
Create rule S7200: Avoid resizing a vector to zero using vec.resize(0, value) (#4677) 2025-03-18 13:40:42 +01:00
Egon Okerman
734c90357c
Modify rule S2092: Add FastAPI (APPSEC-1260) (#3413)
* Fix Flask docs

* Add FastAPI example
2025-03-18 09:59:43 +00:00
Pierre-Loup
1dc3769b22
Modify rule S3649: Add databases support (APPSEC-1251) (#3381) 2025-03-18 09:31:43 +00:00
SonarTech
c02b8cfead update coverage information 2025-03-18 02:45:20 +00:00
github-actions[bot]
7be11bd842
Modify S3649: add Kotlin (SONARSEC-6147) (#4796) 2025-03-17 14:50:30 +00:00
Antonio Aversa
3d015e3518
Update rule S6474: Update message and highlighting (SONARKT-600) (#4723) 2025-03-17 13:59:11 +00:00
github-actions[bot]
697e49fc2c
Create rule S7410: Keyboard cache should be disabled for password inputs (SONARKT-583) (#4724) 2025-03-17 13:51:06 +00:00
Pierre-Loup
0884cdba3c Apply review suggestion 2025-03-17 14:32:34 +01:00
pierre-loup-tristant-sonarsource
99d5ce6339 Create rule S7416 2025-03-17 14:32:34 +01:00
Pierre-Loup
429661e018
Update issue messages for S6474 (#4758) 2025-03-17 12:43:15 +00:00
Pierre-Loup
d608b6dedb
Revert "Update S4507: Add kotlin code examples (SONARKT-580) (#4708)" (#4755)
This reverts commit d63f01a9b137c9a010f1f81a29cf800fba5cf438.
2025-03-17 12:36:22 +00:00
Eric Morand
7c9aad50bf
RULEAPI-836 - Add compatibleLanguages to javascript rule manifests (#4731) 2025-03-17 09:58:46 +00:00
lpilastri
693507a8ed
Modify rule S7190: improve code examples (#4795) 2025-03-17 10:53:53 +01:00
Ilia Kebets
c7f2158161
JS-641 Modify S3516 description: improve example (#4778) 2025-03-17 07:10:53 +01:00
SonarTech
f284ff36ad update coverage information 2025-03-15 02:43:13 +00:00
lpilastri
6507098d55
Modify rule S7180: improve description (#4777) 2025-03-14 16:50:45 +01:00
erwan-serandour
5b2ef9ae42
Modify rule S7186: update description to focus more explicitly on the Data Repository (#4787) 2025-03-14 16:30:40 +01:00
Massimo Paladin
85743bd38f GH actions: use ubuntu-latest instead of ubuntu-20.04 2025-03-14 16:19:47 +01:00
Egon Okerman
0c99d2979a
Change metadata (#4748) 2025-03-14 08:15:43 +00:00
SonarTech
13017974d0 update coverage information 2025-03-14 02:43:53 +00:00
SonarTech
69a0045069 update coverage information 2025-03-13 02:45:03 +00:00
github-actions[bot]
c6cbb0a4bd
Create rule S7134 (#4740)
Co-authored-by: Marco Kaufmann <marco.kaufmann@sonarsource.com>
2025-03-12 17:55:17 +01:00
github-actions[bot]
51dd4ca773
Create rule S7197 (#4739) 2025-03-12 17:44:22 +01:00
github-actions[bot]
b6559d9c46
Create rule S7409: Exposing Java interfaces in WebViews is security-sensitive (SONARKT-571) (#4721)
* Create rule S7409

* Initial commit

* Use double code tags everywhere

* Rephrase the Ask Yourself Whether section

---------

Co-authored-by: egon-okerman-sonarsource <egon-okerman-sonarsource@users.noreply.github.com>
Co-authored-by: Egon Okerman <egon.okerman@sonarsource.com>
2025-03-12 10:05:03 +01:00
SonarTech
29c60e929f update coverage information 2025-03-12 02:44:08 +00:00
Peter Trifanov
db6114afab
SONARGO-126 S1764 Improve RSPEC to cover a check for NaN (#4738) 2025-03-11 13:04:12 +00:00
tomasz-tylenda-sonarsource
d204203515
SONARJAVA-5401 S6809 Fix incomplete code in an example (#4737) 2025-03-11 11:55:00 +01:00
SonarTech
dd3bb762aa update coverage information 2025-03-11 02:44:35 +00:00
Solal Pirelli
5b31409df5
COBOL S1289 (COBOL.UnusedDataItem): Ignore EXTERNAL data items (#3985) 2025-03-10 09:00:37 +00:00
SonarTech
3c16fb5a55 update coverage information 2025-03-10 02:31:28 +00:00
SonarTech
71238b6d5c update coverage information 2025-03-08 02:29:56 +00:00
Quentin Jaquier
e7c5865c64
SONARGO-393 Modify rule S4423 for Go: remove examples for HTTP servers (#4726) 2025-03-07 14:04:22 +01:00
Pavel Mikula
c9e1585367
Autoclose issues created by Jira integration (#4722)
This will enable the automation to close issues that it created, to keep things more cleaned up.

Manually created issues will not be affected.
2025-03-07 08:30:57 +00:00
SonarTech
805318ee1b update coverage information 2025-03-07 02:44:23 +00:00
github-actions[bot]
e9f98eab67
Create rule S7204: Obfuscation should be enabled for release builds (SONARKT-579) (#4691)
* Create rule S7204

* Add initial rule text

* Take out empty lines from example

* Implement suggested review changes

---------

Co-authored-by: egon-okerman-sonarsource <egon-okerman-sonarsource@users.noreply.github.com>
Co-authored-by: Egon Okerman <egon.okerman@sonarsource.com>
2025-03-06 18:07:07 +01:00
github-actions[bot]
b34a35ee48
Create rule S7206: Implicit PendingIntents should be immutable (SONARKT-581) (#4710)
* Create rule S7206

* Initial commit

* Fix code tags

* Fix typo

---------

Co-authored-by: egon-okerman-sonarsource <egon-okerman-sonarsource@users.noreply.github.com>
Co-authored-by: Egon Okerman <egon.okerman@sonarsource.com>
2025-03-06 15:03:31 +00:00
github-actions[bot]
1f6f5da0e3
Create rule S7207: Components should be explicitly exported (#4713) 2025-03-06 15:48:28 +01:00
github-actions[bot]
8dc1c62edd
Create rule S6474: Using remote artifacts without authenticity and integrity checks is security-sensitive (SONARKT-574) (#4720) 2025-03-06 11:18:16 +01:00
SonarTech
1ae4d71783 update coverage information 2025-03-06 02:44:11 +00:00
SonarTech
e032cf53ea update coverage information 2025-03-05 02:44:02 +00:00
1156 changed files with 26717 additions and 3070 deletions

View File

@ -14,7 +14,6 @@ jobs:
# For external PR, ticket should be moved manually
if: |
github.event.pull_request.head.repo.full_name == github.repository
&& github.event.pull_request.merged
steps:
- id: secrets
uses: SonarSource/vault-action-wrapper@v3

View File

@ -7,7 +7,7 @@ on:
jobs:
build-and-deploy:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
permissions:
pull-requests: read # Get the list and metadata of open new-rule PRs
contents: write # Get the contents of open new-rule PRs, the 'master'; write to 'gh-pages' branch

View File

@ -10,7 +10,6 @@ jobs:
permissions:
id-token: write # required by SonarSource/vault-action-wrapper
contents: write
checks: read # required by fountainhead/action-wait-for-check
actions: write # required by andymckay/cancel-action
env:
TMP_BRANCH: temporary/coverage_update
@ -30,6 +29,7 @@ jobs:
fetch-depth: 0
path: 'rspec'
token: ${{ fromJSON(steps.secrets.outputs.vault).coverage_github_token }}
ref: 'master'
- uses: actions/setup-python@v4
with:
@ -73,40 +73,62 @@ jobs:
git commit -m "update coverage information"
git push --force-with-lease origin $TMP_BRANCH
- name: 'Wait for CI to succeed'
if: steps.gen-coverage.outputs.new_coverage == 'true'
uses: fountainhead/action-wait-for-check@v1.0.0
id: wait-for-build
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: all_required_checks
ref: ${{ env.TMP_BRANCH }}
timeoutSeconds: 2400
intervalSeconds: 30
- name: 'Create a PR'
id: create-github-pr
working-directory: 'rspec'
env:
GH_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).coverage_github_token }}
run: |
PR_URL=$(gh pr create --head ${{ env.TMP_BRANCH }} --title "Update coverage information" --body "" --label "rspec system")
gh pr merge $PR_URL
- name: 'Push the updated coverage to master'
if: |
steps.gen-coverage.outputs.new_coverage == 'true' &&
steps.wait-for-build.outputs.conclusion == 'success' &&
(github.event_name != 'workflow_dispatch' || github.ref == format('refs/heads/{0}', github.event.repository.default_branch))
- name: 'Wait until the PR is merged'
id: wait-for-pr-to-merge
env:
GH_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).coverage_github_token }}
working-directory: 'rspec'
run: |
git checkout master
git merge $TMP_BRANCH
git push origin master
set -ueo pipefail
- name: 'Delete the temporary branch'
if: always() && steps.create-temp-branch.conclusion == 'success'
uses: dawidd6/action-delete-branch@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: ${{ env.TMP_BRANCH}}
# Implicitly referring to the PR corresponding to current branch
- name: 'Fail if the change breaks CI'
if: |
steps.gen-coverage.outputs.new_coverage == 'true' &&
steps.wait-for-build.outputs.conclusion != 'success'
run: exit 1
# Set timeout (20 minutes in seconds)
TIMEOUT=1200 # seconds
START_TIME=$(date +%s)
INTERVAL=20 # seconds
while true; do
# Check if the PR is merged
PR_STATE=$(gh pr view --json state,mergedAt -q '.state')
MERGED_AT=$(gh pr view --json state,mergedAt -q '.mergedAt')
if [[ "${PR_STATE}" == "MERGED" ]]; then
echo "PR merged at: $MERGED_AT"
exit 0
fi
echo "PR state is ${PR_STATE}"
# Check for timeout
CURRENT_TIME=$(date +%s)
ELAPSED_TIME=$((CURRENT_TIME - START_TIME))
if [[ "${ELAPSED_TIME}" -gt "${TIMEOUT}" ]]; then
echo "Timeout waiting for PR to merge."
exit 1
fi
# Wait for $INTERVAL seconds before checking again
sleep "$INTERVAL"
done
- name: 'Close PR and delete branch upon failure to merge'
if: ${{ failure() }}
env:
GH_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).coverage_github_token }}
working-directory: 'rspec'
run: |
PR_URL=$(gh pr view --json url --jq '.url')
gh pr close "$PR_URL" --delete-branch
- name: 'Notify on slack about the failure'
if: ${{ failure() }}

View File

@ -25,7 +25,7 @@ on:
jobs:
update_quickfix_status:
name: Update quick fix status
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

View File

@ -27,6 +27,7 @@
* libxml2
// Java
* Android
* Android WebView
* Apache Commons
* Apache Commons
* Apache Commons Email
@ -42,12 +43,13 @@
* Java EE
* Java JWT
* Java SE
* Java JDBC API
* Java I/O API
* Jdom2
* JSP
* Legacy Mongo Java API
* OkHttp
* Realm
* Java Cryptography Extension
* Apache HttpClient
* Couchbase
* SAX
@ -96,6 +98,7 @@
* Argon2-cffi
* Bcrypt
* Cryptodome
* databases
* Django
* Django Templates
* FastAPI
@ -158,3 +161,5 @@
* Go Standard Library
// Kubernetes
* Helm
// Kotlin
Jetpack Compose

View File

@ -45,6 +45,7 @@ When web pages have massively long names like "Java™ Platform, Standard Editio
* AWS blog - https://aws.amazon.com/blogs
* Azure Documentation - https://learn.microsoft.com/en-us/azure/?product=popular
* CERT - https://wiki.sei.cmu.edu/confluence/display/seccode
* Clippy Lints - https://rust-lang.github.io/rust-clippy/master/index.html
* {cpp} reference - https://en.cppreference.com/w/
* {cpp} Core Guidelines - https://github.com/isocpp/CppCoreGuidelines/blob/e49158a/CppCoreGuidelines.md
* CVE - https://cve.mitre.org

File diff suppressed because it is too large Load Diff

View File

@ -158,7 +158,7 @@ const languageToJiraProject = new Map(Object.entries({
'HTML': 'SONARHTML',
'PHP': 'SONARPHP',
'PLI': 'SONARPLI',
'PLSQL': 'SONARPLSQL',
'PLSQL': 'PLSQL',
'RPG': 'SONARRPG',
'APEX': 'SONARAPEX',
'RUBY': 'SONARRUBY',
@ -168,8 +168,8 @@ const languageToJiraProject = new Map(Object.entries({
'GO': 'SONARGO',
'SECRETS': 'SONARTEXT',
'SWIFT': 'SONARSWIFT',
'TSQL': 'SONARTSQL',
'VB6': 'SONARVBSIX',
'TSQL': 'TSQL',
'VB6': 'VB6',
'XML': 'SONARXML',
'CLOUDFORMATION': 'SONARIAC',
'TERRAFORM': 'SONARIAC',
@ -320,7 +320,7 @@ function usePageMetadata(ruleid: string, language: string, classes: UsedStyles):
if (coverage !== 'Not Covered') {
prUrl = undefined;
branch = 'master';
branch = 'master';
}
return {

View File

@ -1,5 +1,9 @@
{
"title": "Function and method names should comply with a naming convention",
"defaultQualityProfiles": [],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"scope": "Main",
"defaultQualityProfiles": [],
"status": "deprecated",
"tags": []
}
"tags": [],
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,3 +1,7 @@
{
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"scope": "Main",
"defaultQualityProfiles": [],
"status": "deprecated",
"tags": []
}
"tags": [],
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -3,7 +3,9 @@
"bad-practice",
"user-experience"
],
"defaultQualityProfiles": [
"defaultQualityProfiles": [],
"compatibleLanguages": [
"js",
"ts"
]
}
}

View File

@ -0,0 +1,7 @@
{
"defaultQualityProfiles": [],
"tags": [
"bad-practice",
"clippy"
]
}

39
rules/S106/rust/rule.adoc Normal file
View File

@ -0,0 +1,39 @@
:language_std_outputs: print!, println!
== Why is this an issue?
include::../description.adoc[]
=== Code examples
==== Noncompliant code example
[source,rust,diff-id=1,diff-type=noncompliant]
----
fn do_something() {
println!("my message"); // Noncompliant, output directly to stdout without a logger
}
----
==== Compliant solution
[source,rust,diff-id=1,diff-type=compliant]
----
use log::{info, LevelFilter};
use simple_logger::SimpleLogger;
fn do_something() {
SimpleLogger::new().with_level(LevelFilter::Info).init().unwrap();
// ...
info!("my message"); // Compliant, output via logger
// ...
}
----
== Resources
=== Documentation
* Clippy Lints - https://rust-lang.github.io/rust-clippy/master/index.html#print_stdout
* OWASP - https://owasp.org/Top10/A09_2021-Security_Logging_and_Monitoring_Failures/[Top 10 2021 Category A9 - Security Logging and Monitoring Failures]
* OWASP - https://owasp.org/www-project-top-ten/2017/A3_2017-Sensitive_Data_Exposure[Top 10 2017 Category A3 - Sensitive Data Exposure]

View File

@ -1,4 +1,8 @@
{
"defaultQualityProfiles": [],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,3 +1,7 @@
{
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,4 +1,8 @@
{
"title": "Unused private class members should be removed",
"quickfix": "covered"
"title": "Unused private class members should be removed",
"quickfix": "covered",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -0,0 +1,6 @@
{
"tags": [
"brain-overload",
"clippy"
]
}

View File

@ -0,0 +1,6 @@
[source,rust]
----
fn set_coordinates(x1: i32, y1: i32, z1: i32, x2: i32, y2: i32, z2: i32) { // Noncompliant
// ...
}
----

27
rules/S107/rust/rule.adoc Normal file
View File

@ -0,0 +1,27 @@
:language: rust
include::../rule.adoc[]
== Resources
=== Documentation
* Clippy Lints - https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../parameters.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]

View File

@ -0,0 +1,11 @@
[source,rust]
----
// Each function does a part of what the original setCoordinates function was doing, so confusion risks are lower
fn set_origin(x: i32, y: i32, z: i32) {
// ...
}
fn set_size(width: i32, height: i32, depth: i32) {
// ...
}
----

View File

@ -0,0 +1,17 @@
[source,rust]
----
struct Point {
x: i32,
y: i32,
}
impl Point {
fn new(x: i32, y: i32) -> Point {
Point { x, y }
}
}
fn set_coordinates(p1: &mut Point, p2: &Point) {
// ...
}
----

View File

@ -3,5 +3,9 @@
"accessibility",
"wcag2-a",
"react"
],
"compatibleLanguages": [
"js",
"ts"
]
}
}

View File

@ -1,4 +1,8 @@
{
"scope": "Main",
"quickfix": "covered"
}
"quickfix": "covered",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,25 +1,31 @@
{
"title": "Mouse events should have corresponding keyboard events",
"type": "BUG",
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"constantCost": "5min"
"title": "Mouse events should have corresponding keyboard events",
"type": "BUG",
"status": "ready",
"remediation": {
"func": "Constant/Issue",
"constantCost": "5min"
},
"tags": [
"accessibility",
"react"
],
"defaultSeverity": "Minor",
"ruleSpecification": "RSPEC-1082",
"sqKey": "S1082",
"scope": "Main",
"defaultQualityProfiles": [
"Sonar way"
],
"quickfix": "unknown",
"code": {
"impacts": {
"RELIABILITY": "LOW"
},
"tags": [
"accessibility",
"react"
],
"defaultSeverity": "Minor",
"ruleSpecification": "RSPEC-1082",
"sqKey": "S1082",
"scope": "Main",
"defaultQualityProfiles": ["Sonar way"],
"quickfix": "unknown",
"code": {
"impacts": {
"RELIABILITY": "LOW"
},
"attribute": "COMPLETE"
}
}
"attribute": "COMPLETE"
},
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,3 +1,6 @@
{
}
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -3,7 +3,7 @@
"type": "CODE_SMELL",
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"func": "Constant/Issue",
"constantCost": "5min"
},
"tags": [
@ -14,12 +14,18 @@
"ruleSpecification": "RSPEC-1090",
"sqKey": "S1090",
"scope": "All",
"defaultQualityProfiles": ["Sonar way"],
"defaultQualityProfiles": [
"Sonar way"
],
"quickfix": "infeasible",
"code": {
"impacts": {
"RELIABILITY": "LOW"
},
"attribute": "CONVENTIONAL"
}
}
},
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"scope": "Main",
"defaultQualityProfiles": [],
"status": "deprecated",
"tags": []
}
"tags": [],
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -3,5 +3,9 @@
"quickfix": "covered",
"defaultQualityProfiles": [],
"status": "deprecated",
"tags": []
}
"tags": [],
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -4,5 +4,9 @@
"quickfix": "covered",
"defaultQualityProfiles": [],
"status": "deprecated",
"tags": []
}
"tags": [],
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -0,0 +1,6 @@
{
"tags": [
"unused",
"clippy"
]
}

View File

@ -0,0 +1,49 @@
== Why is this an issue?
include::../description.adoc[]
=== Code examples
==== Noncompliant code example
[source,rust,diff-id=1,diff-type=noncompliant]
----
fn main() {
let x = 5;
if x > 0 {
println!("x is positive");
}; // Noncompliant
match x {
1 => println!("x is one"),
2 => println!("x is two"),
_ => println!("x is something else"),
}; // Noncompliant
}
----
==== Compliant solution
[source,rust,diff-id=1,diff-type=compliant]
----
fn main() {
let x = 5;
if x > 0 {
println!("x is positive");
}
match x {
1 => println!("x is one"),
2 => println!("x is two"),
_ => println!("x is something else"),
}
}
----
== Resources
=== Documentation
* Clippy Lints - https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_semicolon

View File

@ -1,6 +1,9 @@
{
"title": "Variables should not be shadowed",
"defaultQualityProfiles": [
],
"scope": "Main"
}
"defaultQualityProfiles": [],
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -3,5 +3,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -3,5 +3,8 @@
"Sonar way"
],
"scope": "Main",
"quickfix": "covered"
}
"quickfix": "covered",
"compatibleLanguages": [
"js"
]
}

View File

@ -8,5 +8,9 @@
"Sonar way"
],
"scope": "Main",
"quickfix": "covered"
}
"quickfix": "covered",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -3,5 +3,9 @@
"quickfix": "covered",
"defaultQualityProfiles": [],
"status": "deprecated",
"tags": []
}
"tags": [],
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,6 +1,10 @@
{
"quickfix": "covered",
"defaultQualityProfiles": [],
"status": "deprecated",
"tags": []
}
"quickfix": "covered",
"defaultQualityProfiles": [],
"status": "deprecated",
"tags": [],
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -3,7 +3,7 @@
"type": "BUG",
"status": "deprecated",
"remediation": {
"func": "Constant\/Issue",
"func": "Constant/Issue",
"constantCost": "20min"
},
"tags": [
@ -14,9 +14,7 @@
"replacementRules": [
"RSPEC-2201"
],
"legacyKeys": [
]
"legacyKeys": []
},
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-1154",
@ -27,8 +25,10 @@
"EXP00-J."
]
},
"defaultQualityProfiles": [
],
"quickfix": "unknown"
}
"defaultQualityProfiles": [],
"quickfix": "unknown",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -47,8 +47,6 @@ ifdef::env-github,rspecator-view[]
The member '<method name>' overrides an inherited member but isn't annotated with '@override'.
If the member is a setter, the method name will end with a `=` sign, to distinguish it from the corresponding getter.
=== Highlighting
The identifier of the method, property or operator.

View File

@ -1,5 +1,9 @@
{
"title": "Variable, property and parameter names should comply with a naming convention",
"defaultQualityProfiles": [],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -6,6 +6,8 @@ include::../description.adoc[]
There are some cases when you want to have an unused parameter (usually because the function has to conform to a fixed prototype, or because it is virtual, or it will be called from a template). In this case, and if the parameter is never used, an accepted practice is to leave it unnamed. If it is only sometimes used (for instance, depending on conditional compilation), you may, since {cpp}17, use the ``\[[maybe_unused]]`` attribute to be explicit about it.
In case of C, since C23 you can also leave the parameter unnamed if it is never used, or use the `\[[maybe_unused]]` attribute if it is only used sometimes.
[source,cpp]
----
void f([[maybe_unused]] int i) {

View File

@ -1,6 +1,9 @@
{
"defaultQualityProfiles": [
],
"defaultQualityProfiles": [],
"scope": "Main",
"quickfix": "covered"
}
"quickfix": "covered",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -4,5 +4,9 @@
"Sonar way"
],
"scope": "Main",
"quickfix": "covered"
}
"quickfix": "covered",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,5 +1,7 @@
{
"defaultQualityProfiles": [
"defaultQualityProfiles": [],
"compatibleLanguages": [
"js",
"ts"
]
}
}

View File

@ -1,2 +1,6 @@
{
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,3 +1,7 @@
{
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"scope": "Main",
"defaultQualityProfiles": [],
"status": "deprecated",
"tags": []
}
"tags": [],
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,4 +1,8 @@
{
"title": "Initial values of parameters, caught exceptions, and loop variables should not be ignored",
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,3 +1,6 @@
{
}
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -3,5 +3,9 @@
"Sonar way"
],
"scope": "Main",
"quickfix": "covered"
}
"quickfix": "covered",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,3 +1,7 @@
{
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -0,0 +1,7 @@
{
"tags": [
"clippy"
],
"defaultQualityProfiles": [
]
}

33
rules/S126/rust/rule.adoc Normal file
View File

@ -0,0 +1,33 @@
== Why is this an issue?
include::../description.adoc[]
=== Noncompliant code example
[source,rust,diff-id=1,diff-type=noncompliant]
----
if x == 0 {
do_something();
} else if x == 1 {
do_something_else();
}
----
=== Compliant solution
[source,rust,diff-id=1,diff-type=compliant]
----
if x == 0 {
do_something();
} else if x == 1 {
do_something_else();
} else {
panic!("Unexpected value for x");
}
----
== Resources
=== Documentation
* Clippy Lints - https://rust-lang.github.io/rust-clippy/master/index.html#else_if_without_else

View File

@ -3,5 +3,9 @@
"Sonar way"
],
"scope": "Main",
"quickfix": "covered"
}
"quickfix": "covered",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -30,6 +30,8 @@ MOVE "John" TO FIRST_NAME.
``++FILLER++`` top level data items and top level data items which have sub data items with a ``++VALUE++`` clause are not checked by this rule.
``++EXTERNAL++`` data items are not checked by this rule.
ifdef::env-github,rspecator-view[]
'''

View File

@ -1,2 +1,6 @@
{
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -3,5 +3,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -5,5 +5,9 @@
"tags": [
"cwe",
"type-dependent"
],
"compatibleLanguages": [
"js",
"ts"
]
}
}

View File

@ -1,5 +1,9 @@
{
"defaultQualityProfiles": [
"Sonar way"
],
"compatibleLanguages": [
"js",
"ts"
]
}
}

View File

@ -2,5 +2,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,3 +1,5 @@
{
}
"compatibleLanguages": [
"js"
]
}

View File

@ -1,3 +1,7 @@
{
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,4 +1,8 @@
{
"defaultQualityProfiles": [],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,5 +1,7 @@
{
"defaultQualityProfiles": [
"defaultQualityProfiles": [],
"compatibleLanguages": [
"js",
"ts"
]
}
}

View File

@ -2,5 +2,9 @@
"scope": "Main",
"defaultQualityProfiles": [],
"status": "deprecated",
"tags": []
}
"tags": [],
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,6 +1,10 @@
{
"quickfix": "covered",
"defaultQualityProfiles": [],
"status": "deprecated",
"tags": []
}
"quickfix": "covered",
"defaultQualityProfiles": [],
"status": "deprecated",
"tags": [],
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"title": "Only \"while\", \"do\", \"for\" and \"switch\" statements should be labelled",
"defaultQualityProfiles": [
"Sonar way"
],
"compatibleLanguages": [
"js",
"ts"
]
}
}

View File

@ -1,5 +1,7 @@
{
"defaultQualityProfiles": [
"defaultQualityProfiles": [],
"compatibleLanguages": [
"js",
"ts"
]
}
}

View File

@ -2,13 +2,11 @@
"title": "Quotes for string literals should be used consistently",
"type": "CODE_SMELL",
"remediation": {
"func": "Constant\/Issue",
"func": "Constant/Issue",
"constantCost": "1min"
},
"extra": {
"replacementRules": [
],
"replacementRules": [],
"legacyKeys": [
"SingleQuote"
]
@ -26,5 +24,9 @@
"MAINTAINABILITY": "MEDIUM"
},
"attribute": "FORMATTED"
}
}
},
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,3 +1,5 @@
{
}
"compatibleLanguages": [
"js"
]
}

View File

@ -1,4 +1,7 @@
{
"title": "Public \"static\" fields should be read-only",
"quickfix": "covered"
}
"title": "Public \"static\" fields should be read-only",
"quickfix": "covered",
"compatibleLanguages": [
"ts"
]
}

View File

@ -1,3 +1,7 @@
{
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,3 +1,6 @@
{
}
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -2,5 +2,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -3,5 +3,8 @@
"defaultQualityProfiles": [
"Sonar way"
],
"scope": "Main"
}
"scope": "Main",
"compatibleLanguages": [
"js"
]
}

View File

@ -1,6 +1,9 @@
{
"defaultQualityProfiles": [
],
"defaultQualityProfiles": [],
"scope": "Main",
"quickfix": "covered"
}
"quickfix": "covered",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -0,0 +1,7 @@
{
"title": "Local variables should not be declared and then immediately returned",
"tags": [
"clumsy",
"clippy"
]
}

View File

@ -0,0 +1,34 @@
== Why is this an issue?
Declaring a variable only to immediately return it is considered a bad practice because it adds unnecessary complexity to the code. This practice can make the code harder to read and understand, as it introduces an extra step that doesn't add any value. Instead of declaring a variable and then immediately returning, it is generally better to return or throw the value directly. This makes the code cleaner, simpler, and easier to understand.
== How to fix it
Declaring a variable only to immediately return it is considered a bad practice because it adds unnecessary complexity to the code. To fix the issue, return the value directly.
=== Code examples
==== Noncompliant code example
[source,rust,diff-id=1,diff-type=noncompliant]
----
fn compute_duration_in_milliseconds(hours: u32, minutes: u32, seconds: u32) -> u32 {
let duration = (((hours * 60) + minutes) * 60 + seconds) * 1000;
duration
}
----
==== Compliant solution
[source,rust,diff-id=1,diff-type=compliant]
----
fn compute_duration_in_milliseconds(hours: u32, minutes: u32, seconds: u32) -> u32 {
(((hours * 60) + minutes) * 60 + seconds) * 1000
}
----
== Resources
=== Documentation
* Clippy Lints - https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return

View File

@ -1,3 +1,6 @@
{
}
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,3 +1,6 @@
{
}
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,5 +1,9 @@
{
"defaultQualityProfiles": [
"Sonar way"
],
"compatibleLanguages": [
"js",
"ts"
]
}
}

View File

@ -3,12 +3,10 @@
"type": "VULNERABILITY",
"status": "deprecated",
"remediation": {
"func": "Constant\/Issue",
"func": "Constant/Issue",
"constantCost": "5min"
},
"tags": [
],
"tags": [],
"extra": {
"replacementRules": [
"RSPEC-4507"
@ -21,8 +19,10 @@
"ruleSpecification": "RSPEC-1525",
"sqKey": "S1525",
"scope": "Main",
"defaultQualityProfiles": [
],
"quickfix": "unknown"
}
"defaultQualityProfiles": [],
"quickfix": "unknown",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -9,7 +9,7 @@
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"func": "Constant/Issue",
"constantCost": "10min"
},
"tags": [
@ -26,5 +26,9 @@
"sqKey": "S1526",
"scope": "Main",
"defaultQualityProfiles": [],
"quickfix": "unknown"
}
"quickfix": "unknown",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -1,3 +1,5 @@
{
}
"compatibleLanguages": [
"js"
]
}

View File

@ -9,16 +9,14 @@
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"func": "Constant/Issue",
"constantCost": "5min"
},
"tags": [
"suspicious"
],
"extra": {
"replacementRules": [
],
"replacementRules": [],
"legacyKeys": [
"ArrayAndObjectConstructors"
]
@ -27,8 +25,10 @@
"ruleSpecification": "RSPEC-1528",
"sqKey": "S1528",
"scope": "Main",
"defaultQualityProfiles": [
],
"quickfix": "covered"
}
"defaultQualityProfiles": [],
"quickfix": "covered",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -9,16 +9,12 @@
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"func": "Constant/Issue",
"constantCost": "5min"
},
"tags": [
],
"tags": [],
"extra": {
"replacementRules": [
],
"replacementRules": [],
"legacyKeys": [
"BitwiseOperators"
]
@ -30,5 +26,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"quickfix": "unknown"
}
"quickfix": "unknown",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -9,7 +9,7 @@
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"func": "Constant/Issue",
"constantCost": "5min"
},
"tags": [
@ -17,9 +17,7 @@
"user-experience"
],
"extra": {
"replacementRules": [
],
"replacementRules": [],
"legacyKeys": [
"FunctionDeclarationsWithinBlocks"
]
@ -28,8 +26,10 @@
"ruleSpecification": "RSPEC-1530",
"sqKey": "S1530",
"scope": "Main",
"defaultQualityProfiles": [
],
"quickfix": "unknown"
}
"defaultQualityProfiles": [],
"quickfix": "unknown",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -9,16 +9,14 @@
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"func": "Constant/Issue",
"constantCost": "1min"
},
"tags": [
"pitfall"
],
"extra": {
"replacementRules": [
],
"replacementRules": [],
"legacyKeys": [
"PrimitiveWrappers"
]
@ -30,5 +28,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"quickfix": "covered"
}
"quickfix": "covered",
"compatibleLanguages": [
"js",
"ts"
]
}

View File

@ -9,16 +9,14 @@
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"func": "Constant/Issue",
"constantCost": "5min"
},
"tags": [
"pitfall"
],
"extra": {
"replacementRules": [
],
"replacementRules": [],
"legacyKeys": [
"DuplicatePropertyName"
]
@ -30,5 +28,9 @@
"defaultQualityProfiles": [
"Sonar way"
],
"quickfix": "covered"
}
"quickfix": "covered",
"compatibleLanguages": [
"js",
"ts"
]
}

Some files were not shown because too many files have changed in this diff Show More