Skip to content

Conversation

@faogustavo
Copy link
Collaborator

  • The initial idea of this PR was basically to start using the existing detekt rules to ensure we add public documentation. They are:
    • OutdatedDocumentation
    • UndocumentedPublicClass
    • UndocumentedPublicFunction
    • UndocumentedPublicProperty
  • What I was trying to do is to enable a "warning level" report, and reuse that information to comment in the PR in case any of the "issues" are related to the modified code
  • But, when one of these conditions matches, the version 1.x from detekt considers it a failure and crashes the run. Some features, like setting the minimum version to "break", are only added in the 2.x version of detekt, making it impossible to implement the feature without the version bump
  • After fighting detekt for a while, I was able to migrate it to the new version, ensure all tests from our detekt-plugin work, etc
  • However, 2.x is still in alpha and has some bugs:

Note

TL;DR; The work is like 60~65% done. We need to revisit the documentation for v2 and update our config file to ensure we have everything under control. After wrapping up the detekt, we will need to get the report and combine with the changes in the PR to identify which entries the PR could resolve.

Comment on lines +18 to +19
KtPsiFactory(root.project)
.createPhysicalFile(fileName = root.name, text = root.modifiedText ?: root.text)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to remove this copy after the autocorrect is done running?

Finding(
Entity.from(declaredFunction),
"Function ${declaredFunction.name} is missing property $prop.",
suppressReasons = listOfNotNull("Auto correct".takeIf { autoCorrect }),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: create a const val with the "Auto correct" string


private val functionsToCheck: List<String> by config(defaultValue = listOf("equals", "hashCode", "toString"))

@Configuration("only check classes annotated with these annotations")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's up with this @Configuration annotation?

- The initial idea of this PR was basically to start using the existing
detekt rules to ensure we add public documentation. They are:
  - OutdatedDocumentation
  - UndocumentedPublicClass
  - UndocumentedPublicFunction
  - UndocumentedPublicProperty
- But, when one of these conditions matches, the version 1.x from
detekt considers it a failure and crashes the run
- In this initial moment, my goal was to enable as "warning" level
and reuse that information to log in the PR in case it's related to any
touched code
- However, some features like setting the minimum version to "break" is
only added in the 2.x version of detekt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants