Skip to content

Commit

Permalink
Merge branch 'master' into rule/S2253-add-cfamily
Browse files Browse the repository at this point in the history
  • Loading branch information
loic-joly-sonarsource authored Dec 2, 2024
2 parents 53846e9 + b2b1cb9 commit 8da79ba
Show file tree
Hide file tree
Showing 288 changed files with 3,617 additions and 1,720 deletions.
2 changes: 1 addition & 1 deletion .cirrus.star
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("github.com/SonarSource/cirrus-modules@v2", "load_features")
load("github.com/SonarSource/cirrus-modules@v3", "load_features")

def main(ctx):
return load_features(ctx)
349 changes: 184 additions & 165 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This repository contains the specification of every static-analysis rule availab

It also contains rules which have been dropped and rules which will one day be implemented.

The content of this repository is covered by the link:LICENSE[SONAR Source-Available License v1.0].

== Rules directory structure

* https://github.com/SonarSource/rspec/tree/master/rules[rules] directory: contains every specified rule.
Expand Down
1,555 changes: 708 additions & 847 deletions frontend/public/covered_rules.json

Large diffs are not rendered by default.

21 changes: 10 additions & 11 deletions rspec-tools/rspec_tools/checklinks.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import os,io
import re
import requests
import datetime
import json
import pathlib
import random
import datetime
import socket

import requests
from bs4 import BeautifulSoup
from socket import timeout
import pathlib

TOLERABLE_LINK_DOWNTIME = datetime.timedelta(days=7)
LINK_PROBES_HISTORY_FILE = './link_probes.history'
Expand Down Expand Up @@ -73,7 +72,7 @@ def live_url(url: str, timeout=5):
req = requests.Request('GET', url, headers = {'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="90"',
'sec-ch-ua-mobile': '?0',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 GLS/100.10.9939.100',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'Sec-Fetch-Site':'none',
'Sec-Fetch-Mode':'navigate',
Expand Down Expand Up @@ -102,13 +101,13 @@ def live_url(url: str, timeout=5):
print(f"ERROR: Too many redirects: {rr}")
return False
except requests.Timeout as t:
print(f"ERROR: timeout ", t)
print(f"ERROR: Request timeout {t}")
return False
except timeout as t:
print(f"ERROR: timeout ", t)
except socket.timeout as t:
print(f"ERROR: Socket timeout {t}")
return False
except Exception as e:
print(f"ERROR: ", e)
print(f"ERROR: {e}")
return False

def findurl_in_html(filename,urls):
Expand Down
2 changes: 1 addition & 1 deletion rspec-tools/rspec_tools/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'sonar-css',
'sonar-dart',
'sonar-dataflow-bug-detection',
'sonar-dotnet',
'sonar-dotnet-enterprise',
'sonar-flex',
'sonar-go',
'sonar-html',
Expand Down
5 changes: 1 addition & 4 deletions rules/S100/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}
}
6 changes: 2 additions & 4 deletions rules/S1005/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S101/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S103/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S1066/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S1068/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S107/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S108/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S1116/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
7 changes: 2 additions & 5 deletions rules/S1117/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"title": "Local variables should not shadow class fields",
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}
"title": "Local variables should not shadow class fields"
}
6 changes: 2 additions & 4 deletions rules/S1125/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S1135/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S1142/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
7 changes: 2 additions & 5 deletions rules/S1144/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"title": "Unused \"private\" functions should be removed",
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}
"title": "Unused \"private\" functions should be removed"
}
5 changes: 1 addition & 4 deletions rules/S1145/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}
}
6 changes: 2 additions & 4 deletions rules/S115/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
17 changes: 17 additions & 0 deletions rules/S115/java/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ public enum MyEnum {
}
----

=== Exceptions

The rule applies to fields of primitive types (for example, ``float``), boxed primitives (``Float``), and Strings.
We do not apply it to other types, which can be mutated, or have methods with side effects.

[source,java]
----
public static final Logger log = getLogger(MyClass.class);
public static final List<Integer> myList = new ArrayList<>();
// call with side-effects
log.info("message")
// mutating an object
myList.add(28);
----

== Resources

=== External coding guidelines
Expand Down
6 changes: 2 additions & 4 deletions rules/S1151/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S116/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S117/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
7 changes: 2 additions & 5 deletions rules/S1170/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"title": "Public constants and fields initialized at declaration should be \"const static\" rather than merely \"const\"",
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}
"title": "Public constants and fields initialized at declaration should be \"const static\" rather than merely \"const\""
}
6 changes: 2 additions & 4 deletions rules/S1172/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
7 changes: 2 additions & 5 deletions rules/S1176/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"title": "Public classes, methods, properties and metadata should be documented with ASDoc",
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}
"title": "Public classes, methods, properties and metadata should be documented with ASDoc"
}
6 changes: 2 additions & 4 deletions rules/S1185/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S1186/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S120/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S122/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
5 changes: 1 addition & 4 deletions rules/S1224/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": [],
"quickfix": "unknown"

}
6 changes: 2 additions & 4 deletions rules/S124/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S125/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S127/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
6 changes: 2 additions & 4 deletions rules/S128/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": []
}

}
9 changes: 1 addition & 8 deletions rules/S129/flex/metadata.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
{
"tags": [],
"status": "deprecated",
"defaultQualityProfiles": [],
"quickfix": "unknown",
"remediation": {
"func": "Constant\/Issue",
"constantCost": "10min"
}

}
2 changes: 2 additions & 0 deletions rules/S1291/javascript/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
Loading

0 comments on commit 8da79ba

Please sign in to comment.