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 #4506

Open
10 of 52 tasks
jesmrec opened this issue Oct 30, 2024 · 2 comments · May be fixed by #4487
Open
10 of 52 tasks

[TECHNICAL] Detekt: static code analyzer #4506

jesmrec opened this issue Oct 30, 2024 · 2 comments · May be fixed by #4487

Comments

@jesmrec
Copy link
Collaborator

jesmrec commented Oct 30, 2024

Adding a new static code analyzer for Kotlin: https://detekt.dev/

TASKS

  • Research (if needed)
  • Create branch feature/detekt
  • Initial set up of the tool
  • First try to integrate in CI (github actions)
  • Launch the analyzer to get an initial set of existing code smells
  • Analyze the code smells and decide what to do with them
  • Check if more rules should be added or removed from the set of existing rules
  • Fix all code smells:
    • MaxLineLength: max 150 characters per line
    • LongMethod: refactor all methods with more than 100 lines
    • SwallowedException
    • UnusedPrivateMember
    • NestedBlockDepth -> refactor with more than 5
    • ReturnCount -> max 2
    • ComplexCondition
    • ForbiddenComment
    • EmptyFunctionBlock -> fix for no overriden methods
    • VariableNaming
    • ImplicitDefaultLocale
    • NewLineAtEndOfFile
    • UtilityClassWithPublicConstructor
    • EmptySecondaryConstructor
    • TooGenericExceptionThrown
    • PrintStackTrace
    • MemberNameEqualsClassName
    • FunctionOnlyReturningConstant
    • MandatoryBracesLoops
    • WildCardImport
    • LoopWithTooManyJumpStatements
    • InstanceOfCheckForException
    • NotImplementedDeclaration
    • ObjectExtendsThrowable
    • ThrowingExceptionsWithoutMessageOrCause
    • InvalidPackageDeclaration
    • MatchingDeclarationName
    • CognitiveComplexMethod
    • SpreadOperator (in migrations, add ALLMIGRATIONS to array directly)
    • CastNullableToNonNullableType
    • CollapsibleIfStatements
    • ExplicitItLambdaParameter (data module)
    • ExpressionBodySyntax
    • SpacingBetweenPackageAndImports
    • UnusedParameter
    • UnusedPrivateProperty
    • UseIfInsteadOfWhen
    • UseLet
    • UtilityClassWithPublicConstructor
  • Final CI setup (correct branching and setup ready to go)
  • No code smells -> green CI
  • Add Calens file
  • Code review and apply changes requested
  • Merge branch feature/detekt into master
@jesmrec jesmrec linked a pull request Oct 30, 2024 that will close this issue
2 tasks
@jesmrec jesmrec linked a pull request Oct 30, 2024 that will close this issue
2 tasks
@jesmrec
Copy link
Collaborator Author

jesmrec commented Oct 30, 2024

Some dependency on #4478.

Gradle version to push on, will determine the basic detekt version to use

@jesmrec jesmrec changed the title Detekt: static code analyzer [TECHINICAL] Detekt: static code analyzer Oct 30, 2024
@joragua joragua changed the title [TECHINICAL] Detekt: static code analyzer [TECHNICAL] Detekt: static code analyzer Oct 30, 2024
@jesmrec
Copy link
Collaborator Author

jesmrec commented Dec 4, 2024

Some rules did not return code smells, but they were candidates. They might deserve a look:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants