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

[TECHNICAL] Detekt: static code analyzer #4487

Merged
merged 74 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
6ca22c0
feat: add detekt setup
jesmrec Oct 2, 2024
0bcf121
feat: add yml setup to execute in github actions
jesmrec Oct 4, 2024
419b8d4
feat: update detekt version to 1.23.3, adding new fields and removed …
jesmrec Nov 14, 2024
c81bbfc
feat: add dependency for detekt-rules-libraries and add available fie…
jesmrec Nov 20, 2024
8c49a60
feat: add dependency for detekt-formatting and add available fields t…
jesmrec Nov 20, 2024
272e6c7
feat: add new fields in 1.23.3 that were disabled: KDocReferencesNonP…
jesmrec Nov 20, 2024
d0033c6
fix: set the version line with correct format in toml file
jesmrec Dec 2, 2024
93e5997
feat: detekt.yml file with latest rules changes for the first iteration
jesmrec Dec 4, 2024
8a73d2d
fix: remove base line, and use correct version of action for gradle
jesmrec Dec 4, 2024
97012ea
style: make lines wrap automatically when they reach 150 characters i…
JuancaG05 Dec 4, 2024
9da3c12
style: wrap lines more than 150 characters in module `owncloudApp`
JuancaG05 Dec 4, 2024
a6ee78e
style: wrap lines more than 150 characters in module `owncloudComLibr…
JuancaG05 Dec 4, 2024
6ff4964
style: wrap lines more than 150 characters in module `owncloudData`
JuancaG05 Dec 10, 2024
9e99943
style: wrap lines more than 150 characters in module `owncloudDomain`
JuancaG05 Dec 10, 2024
3763025
style: wrap lines more than 150 characters in module `owncloudTestUtil`
JuancaG05 Dec 10, 2024
88ff2ac
refactor: refactor methods with more than 100 lines
JuancaG05 Dec 11, 2024
2de9701
refactor: fix for KtLint report
JuancaG05 Dec 11, 2024
dc888b8
refactor: remove unused private members
joragua Dec 11, 2024
8ee550b
refactor: remove unused private properties in module `owncloudApp`
joragua Dec 11, 2024
0f6755c
refactor: remove unused private properties in module `owncloudComLibr…
joragua Dec 11, 2024
1497781
refactor: replace when by if for binary conditions in module `ownclou…
joragua Dec 11, 2024
de8f584
refactor: replace when by if for binary conditions in module `ownclou…
joragua Dec 11, 2024
720a484
refactor: replace if/else condition with a null block by let in modul…
joragua Dec 11, 2024
01b9803
refactor: replace if/else condition with a null block by let in modul…
joragua Dec 11, 2024
0584ffa
refactor: fix for KtLint report
joragua Dec 11, 2024
e3a5f3f
refactor: remove unnecessary spaces between packages and imports
joragua Dec 12, 2024
58c0dc3
refactor: remove explicit `it` in lambda functions
joragua Dec 12, 2024
a2606fc
refactor: collapse if statements
joragua Dec 12, 2024
1025c3f
refactor: remove unused parameters
joragua Dec 12, 2024
4758647
refactor: rename invalid package declaration
joragua Dec 12, 2024
2f40c2d
feat: set up to run detekt over all the modules in parallel
jesmrec Dec 17, 2024
dba515b
refactor: remove unnecessary function and join two if conditions
joragua Jan 8, 2025
8ab3345
style: changed functions with just return to expression body in modul…
JuancaG05 Jan 9, 2025
855a40f
style: changed functions with just return to expression body in modul…
JuancaG05 Jan 9, 2025
277c163
style: changed functions with just return to expression body in modul…
JuancaG05 Jan 9, 2025
c0ce8a3
style: changed functions with just return to expression body in modul…
JuancaG05 Jan 10, 2025
dbe980c
style: added new line at the end of the file
JuancaG05 Jan 10, 2025
f29cd01
refactor: renamed member so that it doesn't have the name of its class
JuancaG05 Jan 10, 2025
66e5d8e
refactor: removed unused property
JuancaG05 Jan 10, 2025
34a2770
refactor: replaced forbidden comments by normal comments
joragua Jan 20, 2025
4f5e558
refactor: removed wildcard imports and added necessary ones
joragua Jan 20, 2025
7618d49
style: renamed some variables that were not following naming convention
joragua Jan 20, 2025
9ea9fe2
refactor: removed empty secondary constructors
joragua Jan 21, 2025
a73d06b
refactor: modified some methods with more than 2 `return`
joragua Jan 22, 2025
3c35a89
feat: disabled ReturnCount codesmell from detekt.yml
joragua Jan 22, 2025
24ef500
style: changed functions with just return to expression body
joragua Jan 23, 2025
472ac64
refactor: removed not implemented declarations (TODO functions)
joragua Jan 23, 2025
4e475fe
style: modified some comments and replaced `flow{}` by `flowOf()`
joragua Jan 23, 2025
95a4c95
style: added braces in multi-line loops
JuancaG05 Jan 24, 2025
7d1b1fb
style: ordered properly some classes (properties, constructors, metho…
JuancaG05 Jan 24, 2025
10d1ff7
refactor: renamed files so that they match the single top-level decla…
JuancaG05 Jan 27, 2025
fac94c6
refactor: added explicit Locale not to rely on default Locale, which …
JuancaG05 Jan 27, 2025
91288d1
refactor: avoid spread operators
JuancaG05 Jan 27, 2025
4a3d54f
refactor: transform utility classes to objects
JuancaG05 Jan 28, 2025
1862422
feat: disable CyclomaticComplexMethod rule from detekt.yml
JuancaG05 Jan 28, 2025
231a761
style: removed optional Unit return type
JuancaG05 Jan 28, 2025
025440b
style: consistent braces on `if` statements
JuancaG05 Jan 28, 2025
6b7df4e
style: consistent braces on `when` statements
JuancaG05 Jan 28, 2025
b058ab8
refactor: use `apply` instead of `also` when possible
JuancaG05 Jan 28, 2025
9184072
refactor: use more specific exception
JuancaG05 Jan 29, 2025
a9f6030
feat: disable TooGenericExceptionThrown rule from detekt.yml
JuancaG05 Jan 29, 2025
d357775
feat: disable some complexity rules from detekt.yml
JuancaG05 Jan 29, 2025
56fc727
refactor: avoid swallowed exceptions
JuancaG05 Jan 29, 2025
e6115ad
refactor: not printing stack trace for exceptions
JuancaG05 Jan 29, 2025
969cc00
refactor: fix for KtLint report
joragua Jan 29, 2025
0b7d1ba
refactor: added `catch` blocks for specific instances of exception
joragua Jan 29, 2025
5f323bf
style: renamed some constructor parameters that were not following na…
joragua Jan 30, 2025
93328a3
refactor: added missing messages in some exceptions
joragua Jan 30, 2025
4c4479b
feat: disabled CastToNullableType rule from detekt.yml
joragua Jan 30, 2025
68bd29b
refactor: reduced the number of conditions in some methods
joragua Jan 30, 2025
172c14c
refactor: renamed files so that they match the single-top declarations
joragua Jan 30, 2025
6f64545
chore: added calens file
JuancaG05 Jan 30, 2025
9a7fba2
docs: calens changelog updated
JuancaG05 Jan 30, 2025
e61ea92
fix: adapt and clean detekt.yml file to run in production
jesmrec Jan 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/detekt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Detekt

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:

pull_request:
branches:
- "*"
paths:
- ".github/workflows/detekt.yml"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Detekt:
# The type of runner that the job will run on
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: detekt execution
run: ./gradlew detekt; ./gradlew owncloudDomain:detekt; ./gradlew owncloudData:detekt; ./gradlew owncloudComLibrary:detekt; ./gradlew owncloudTestUtil:detekt
3 changes: 2 additions & 1 deletion .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ ownCloud admins and users.
* Enhancement - Added text labels for BottomNavigationView: [#4484](https://github.com/owncloud/android/issues/4484)
* Enhancement - OCIS Light Users: [#4490](https://github.com/owncloud/android/issues/4490)
* Enhancement - Enforce OIDC auth flow via branding: [#4500](https://github.com/owncloud/android/issues/4500)
* Enhancement - Detekt: static code analyzer: [#4506](https://github.com/owncloud/android/issues/4506)
* Enhancement - Multi-Personal (1st round): [#4514](https://github.com/owncloud/android/issues/4514)
* Enhancement - Technical improvements for user quota: [#4521](https://github.com/owncloud/android/issues/4521)

Expand Down Expand Up @@ -135,6 +136,14 @@ ownCloud admins and users.
https://github.com/owncloud/android/issues/4500
https://github.com/owncloud/android/pull/4516

* Enhancement - Detekt: static code analyzer: [#4506](https://github.com/owncloud/android/issues/4506)

The Kotlin static code analyzer Detekt has been introduced with the agreed
rules, and the left code smells have been fixed throughout the whole code.

https://github.com/owncloud/android/issues/4506
https://github.com/owncloud/android/pull/4487

* Enhancement - Multi-Personal (1st round): [#4514](https://github.com/owncloud/android/issues/4514)

Support for multi-personal accounts has been added. This first approach displays
Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ buildscript {
plugins {
alias libs.plugins.sonarqube
alias libs.plugins.ksp apply false
alias libs.plugins.detekt
}

allprojects {
Expand All @@ -37,6 +38,7 @@ subprojects {
apply plugin: "com.google.devtools.ksp"
apply plugin: "org.jlleitschuh.gradle.ktlint"
apply plugin: "org.sonarqube"
apply plugin: "io.gitlab.arturbosch.detekt"
}

sonarqube {
Expand Down
7 changes: 7 additions & 0 deletions changelog/unreleased/4487
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Detekt: static code analyzer

The Kotlin static code analyzer Detekt has been introduced with the agreed rules, and
the left code smells have been fixed throughout the whole code.

https://github.com/owncloud/android/issues/4506
https://github.com/owncloud/android/pull/4487
Loading
Loading