Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PoC migration to Kotlin Analysis API #479

Draft
wants to merge 117 commits into
base: godin/kotlin-analysis-api
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
38c1024
SONARKT-399 Fix shadowJar configuration
Godin Oct 9, 2024
d4fbea8
Remove obsolete code
Godin Oct 11, 2024
1dfc63a
SONARKT-398 Upgrade Kotlin compiler to 2.0.21
Godin Oct 14, 2024
6cf2db2
Get rid of `@OptIn(IDEAPluginsCompatibilityAPI::class)`
Godin Oct 22, 2024
c60ff8f
Generate aggregate coverage report and import it into Sonar
Godin Oct 23, 2024
a5daf15
Enable checksum verification of dependencies
Godin Oct 24, 2024
b66d10a
BUILD-6709 Change CODEOWNERS
Godin Oct 24, 2024
5770f81
SONARKT-363 Fix ClassCastException in RedundantMethodsInDataClassesCheck
Godin Oct 24, 2024
3efe09b
SONARKT-388 Fix IllegalArgumentException in CollectionShouldBeImmutab…
Godin Oct 25, 2024
2fbac1b
Aggregate coverage report should include `sonar-kotlin-test-api`
Godin Oct 30, 2024
6eda088
Package name should match containing directory
Godin Oct 30, 2024
7e34041
SONARKT-394 Upgrade analyzer-commons to 2.12.0
Godin Oct 24, 2024
81873d4
SONARKT-394 Add STIG metadata
Godin Oct 24, 2024
ec54954
Upgrade SonarSource/cirrus-modules to v3
Godin Oct 31, 2024
9cab62c
SONARKT-365 Reduce logging level to info for not supported highlighti…
leveretka Nov 5, 2024
55ae5aa
WIP migrated regex rules to Analysis API + checked 2.0
leveretka Nov 8, 2024
3f31a47
Migrated CipherBlockChainingCheck
leveretka Nov 11, 2024
12a51ff
Migrated CipherModeOperationCheck
leveretka Nov 11, 2024
c90d8c0
Migrated ClearTextProtocolCheck
leveretka Nov 11, 2024
5c88851
Migrated UnpredictableHashSaltCheck
leveretka Nov 11, 2024
3c31cae
Updated reasons of postponing
leveretka Nov 11, 2024
7833c4c
SONARKT-357 Enable "NOSONAR" in SonarLint
leveretka Nov 12, 2024
b0567b7
Migrate DataHashingCheck
leveretka Nov 12, 2024
b23293b
Migrate EncryptionAlgorithmCheck
leveretka Nov 12, 2024
f1a2494
Migrate PreparedStatementAndResultSetCheck
leveretka Nov 12, 2024
812f9aa
Migrate RobustCryptographicKeysCheck
leveretka Nov 12, 2024
4acbe23
Migrate ReceivingIntentsCheck
leveretka Nov 12, 2024
b66adab
Migrate WebViewsFileAccessCheck
leveretka Nov 12, 2024
6081317
Migrate WebViewJavaScriptSupportCheck
leveretka Nov 12, 2024
a440388
Migrate DebugFeatureEnabledCheck
leveretka Nov 12, 2024
335e0a1
Migrate ScheduledThreadPoolExecutorZeroCheck
leveretka Nov 12, 2024
c5f7f93
Migrate CollectionSizeAndArrayLengthCheck
leveretka Nov 12, 2024
8622649
Migrate EmptyLineRegexCheck
leveretka Nov 12, 2024
48cbe3a
Migrate StrongCipherAlgorithmCheck
leveretka Nov 12, 2024
15386eb
Migrate InjectableDispatchersCheck
leveretka Nov 12, 2024
4155423
Migrate UnpredictableSecureRandomSaltCheck
leveretka Nov 12, 2024
6e18d9d
Remove usages of predict* functions depending on the BindingContext
leveretka Nov 12, 2024
237efbd
Migrate MobileDatabaseEncryptionKeysCheck
leveretka Nov 12, 2024
723875d
Update remaining usages of "predict"
leveretka Nov 12, 2024
68dfe12
Migrate AndroidBroadcastingCheck
leveretka Nov 12, 2024
70e030d
cleanup
leveretka Nov 12, 2024
c8b1da7
SONARKT-387 Remove "CatchAll" from Detekt external issue import
leveretka Oct 28, 2024
96f726a
SONARKT-387 Remove "CatchAll" from AndroidLint external issue import
leveretka Oct 28, 2024
5bc98a2
SONARKT-387 Remove "CatchAll" external rule logic
leveretka Oct 28, 2024
ec68c6b
SONARKT-404 Fix IllegalArgumentException in UnusedDeferredResultCheck
Godin Nov 12, 2024
404b585
Replace remaining usages of matches(., bc) with matches(.)
leveretka Nov 13, 2024
b2debc0
Migrate VerifiedServerHostnamesCheck
leveretka Nov 13, 2024
a974fd9
Migrate ReplaceGuavaWithKotlinCheck
leveretka Nov 13, 2024
60dbd37
Migrate SingletonPatternCheck
leveretka Nov 13, 2024
0a2f556
Fix typo
Godin Nov 13, 2024
94961cd
Migrate CoroutinesTimeoutApiUnusedCheck
leveretka Nov 13, 2024
d31cbfb
SONARKT-242 Remove useless code
Godin Nov 13, 2024
11202df
Migrate ExternalAndroidStorageAccessCheck
leveretka Nov 13, 2024
059c1a2
Migrate VoidShouldBeUnitCheck
leveretka Nov 13, 2024
a9025aa
Migrate ArrayHashCodeAndToStringCheck
leveretka Nov 13, 2024
a8e406d
Migrate CollectionInappropriateCallsCheck
leveretka Nov 13, 2024
4a41000
Remove commented-out obsolete code
Godin Nov 13, 2024
98d2888
Migrate UselessNullCheckCheck
leveretka Nov 13, 2024
6c52e13
Migrate ServerCertificateCheck
leveretka Nov 13, 2024
edf4cb4
`:sonar-kotlin-api:test` should depend on `:kotlin-checks-test-sources`
Godin Nov 13, 2024
4b22576
SONARKT-364 Filter non-JAR files from classpath to avoid warning
leveretka Nov 13, 2024
7979720
Migrate AuthorisingNonAuthenticatedUsersCheck
leveretka Nov 14, 2024
8df047f
Migrate EqualsArgumentTypeCheck
leveretka Nov 14, 2024
be060a2
Migrate MapValuesShouldBeAccessedSafelyCheck
leveretka Nov 14, 2024
cf5fc57
Migrate InterfaceCouldBeFunctionalCheck
leveretka Nov 14, 2024
53d42eb
Update K1only reason
leveretka Nov 14, 2024
96908cd
Migrate DeprecatedCodeCheck
leveretka Nov 14, 2024
565782c
Migrate CoroutineScopeFunSuspendingCheck
leveretka Nov 14, 2024
46bfbaa
Migrate SamConversionCheck
leveretka Nov 14, 2024
708e065
Migrate UnencryptedDatabaseOnMobileCheck
leveretka Nov 14, 2024
9ef9bf3
Migrate SimplifySizeExpressionCheck
leveretka Nov 14, 2024
dbb99c0
Migrate DuplicateBranchCheck
leveretka Nov 15, 2024
08ad12e
Migrate WeakSSLContextCheck
leveretka Nov 15, 2024
e825051
Migrate VarShouldBeValCheck
leveretka Nov 15, 2024
1e1a1a6
Migrate PropertyGetterAndSetterUsageCheck
leveretka Nov 15, 2024
819ccc9
Migrate DelegationPatternCheck
leveretka Nov 18, 2024
cebf86f
Fix IllegalStateException: Unexpected constant value in CollectionSho…
leveretka Nov 19, 2024
33bcb16
SONARKT-412 Upgrade analyzer-commons to 2.16.0
Godin Nov 20, 2024
2dece8b
Fix SamConversionCheck when FunctionN* type is inferred
leveretka Nov 20, 2024
4502a1c
Fix FP in UselessNullCheckCheck when type is not resolved correctly
leveretka Nov 20, 2024
de3dbb4
Fix ruling tests
leveretka Nov 20, 2024
254ce15
Fix S6524 to comply with its description
leveretka Nov 22, 2024
9d503ff
rewrite CollectionShouldBeImmutableCheck
leveretka Nov 24, 2024
120d264
rewrite MainSafeCoroutinesCheck
leveretka Nov 24, 2024
a46d0eb
rewrite StructuredConcurrencyPrinciplesCheck
leveretka Nov 24, 2024
53e0a36
SONARKT-403 Execute TopDownAnalyzerFacadeForJVM even if classpath is …
Godin Nov 25, 2024
19d9776
SONARKT-414 Change license to SONAR Source-Available License v1.0 (SS…
andrei-epure-sonarsource Nov 25, 2024
b71974a
Fix ruling tests
leveretka Nov 24, 2024
aa6621d
Rewrite UnnecessaryImportsCheck
leveretka Nov 25, 2024
d51f069
SONARKT-415 Improve S6524 to comply with its description
leveretka Nov 25, 2024
7b703c1
SONARKT-413 Update rules metadata
Godin Nov 25, 2024
fd8ef19
To avoid OOMKiller increase amount of memory available for `ws_scan_t…
Godin Nov 25, 2024
925f269
Prepare for the next development iteration
Godin Nov 26, 2024
7c9193c
Fix formatting of license header
Godin Nov 26, 2024
005cd82
Add KotlinLanguageVersionTest
Godin Nov 26, 2024
8f4117e
(WIP) fix for Windows
Godin Nov 27, 2024
a50ad53
Merge branch 'master'
Godin Nov 27, 2024
17a052e
(WIP) verification-metadata.xml
Godin Nov 27, 2024
8c454d0
`:sonar-kotlin-checks:test` should depend on `:kotlin-checks-test-sou…
Godin Nov 27, 2024
265f61b
(WIP) fix license headers
Godin Nov 27, 2024
6c4600d
(WIP) fix wrong merge conflict resolution
Godin Nov 27, 2024
9b106bb
SONARKT-414 Fix license name in MANIFEST.MF
Godin Nov 27, 2024
2d4603e
Fix memory leaks in tests
Godin Nov 28, 2024
7d1370b
(WIP) cleanup dependencies
Godin Nov 28, 2024
ab6dadb
Merge branch 'master'
Godin Nov 28, 2024
436b28f
Fix findReceiverScopeFunctionLiteral to only resolve scope functions …
leveretka Nov 28, 2024
f44acf4
SONARKT-400 Integrate kotlin-analysis-api
Godin Nov 29, 2024
6e903b3
Fix findReceiverScopeFunctionLiteral to only resolve scope functions …
leveretka Nov 29, 2024
d41920b
Merge branch 'master'
Godin Nov 29, 2024
ee4ac6f
(WIP) replace `analyze` by `withKaSession`
Godin Nov 29, 2024
643b3f7
Remove duplicate test
Godin Nov 29, 2024
75018a6
SONARKT-400 Migrate UnusedDeferredResultCheck to kotlin-analysis-api
Godin Nov 29, 2024
7fef2f5
SONARKT-400 Migrate PropertyGetterAndSetterUsageCheck to kotlin-analy…
leveretka Nov 29, 2024
cd13463
SONARKT-400 Migrate DeprecatedCodeCheck to kotlin-analysis-api
leveretka Nov 29, 2024
48d52ad
SONARKT-400 Migrate VarShouldBeValCheck to kotlin-analysis-api
leveretka Nov 15, 2024
ce78158
SONARKT-400 Migrate CoroutineScopeFunSuspendingCheck to kotlin-analys…
leveretka Nov 30, 2024
ac81f7d
Merge branch 'master'
Godin Dec 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .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, aws=dict(zone=2))
return load_features(ctx)
3 changes: 1 addition & 2 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
platform: windows
region: eu-central-1
type: c5.4xlarge # 3.6 GHz (3.9GHz single core) Intel Xeon Scalable Processor, 16 vCPU, 32 GiB Memory
subnet_id: ${CIRRUS_AWS_SUBNET}
preemptible: false
use_ssd: true

Expand Down Expand Up @@ -135,7 +134,7 @@
<<: *CLEANUP_GRADLE_CACHE_SCRIPT

ws_scan_task:
<<: *LINUX_3_5_CPU_7G
<<: *LINUX_6_CPU_12G_JAVA_17
<<: *SETUP_GRADLE_CACHE
depends_on:
- build
Expand Down Expand Up @@ -222,7 +221,7 @@
path: "*.hprof"
<<: *CLEANUP_GRADLE_CACHE_SCRIPT

promote_task:

Check warning on line 224 in .cirrus.yml

View check run for this annotation

Cirrus CI / Build Parsing Results

.cirrus.yml#L224

task "promote" depends on task "ws_scan", but their only_if conditions are different
depends_on:
- build
- build_test_analyze
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.github/CODEOWNERS @SonarSource/analysis-jvm-squad
.github/CODEOWNERS @SonarSource/analysis-mobile-squad
2 changes: 1 addition & 1 deletion .github/workflows/dogfood.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ jobs:
env:
SLACK_BOT_TOKEN: ${{ fromJSON(steps.secrets.outputs.vault).SLACK_BOT_TOKEN }}
with:
channel-id: squad-jvm-notifs
channel-id: squad-mobile
slack-message: "Dogfood build for `${{ steps.dogfood.outputs.sha1 }}`: *failed*, see the logs at https://github.com/SonarSource/sonar-kotlin/actions/workflows/dogfood.yml"
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ jobs:
with:
publishToBinaries: true
mavenCentralSync: true
slackChannel: squad-jvm-notifs
slackChannel: squad-mobile
2 changes: 1 addition & 1 deletion .github/workflows/slack_notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
id-token: write # to authenticate via OIDC
uses: SonarSource/gh-action_build-notify/.github/workflows/main.yaml@v1
with:
slackChannel: squad-jvm-notifs
slackChannel: squad-mobile
349 changes: 184 additions & 165 deletions LICENSE

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions LICENSE_HEADER
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
* modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the Sonar Source-Available License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* You should have received a copy of the Sonar Source-Available License
* along with this program; if not, see https://sonarsource.com/license/ssal/
*/
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,13 @@ See [this README in the utils](utils-kotlin/README.md).

If you want a graphical output of ASTs, see [this README in the utils](utils-kotlin/README.md) for more info on how to convert an AST into a
DOT format.

# License

Copyright 2018-2024 SonarSource.

SonarQube analyzers released after November 29, 2024, including patch fixes for prior versions,
are published under the [Sonar Source-Available License Version 1 (SSALv1)](LICENSE.txt).

See individual files for details that specify the license applicable to each file.
Files subject to the SSALv1 will be noted in their headers.
16 changes: 14 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ subprojects {
}
licenses {
license {
name.set("GNU LPGL 3")
url.set("http://www.gnu.org/licenses/lgpl.txt")
name.set("SSALv1")
url.set("https://sonarsource.com/license/ssal/")
distribution.set("repo")
}
}
Expand Down Expand Up @@ -237,6 +237,18 @@ sonarqube {
}
}

subprojects {
sonarqube.properties {
property(
"sonar.coverage.jacoco.xmlReportPaths",
listOf(
"build/reports/jacoco/test/jacocoTestReport.xml",
"${project.rootDir}/sonar-kotlin-plugin/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml"
).joinToString(",")
)
}
}

artifactory {
clientConfig.info.buildName = "sonar-kotlin"
clientConfig.info.buildNumber = System.getenv("BUILD_NUMBER")
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group=org.sonarsource.kotlin
version=2.21-SNAPSHOT
version=2.21.1-SNAPSHOT
description=Code Analyzer for Kotlin
projectTitle=Kotlin
kotlinVersion=2.0.20
kotlinVersion=2.0.21
org.gradle.jvmargs=-Xmx4096M
Loading