-
-
Notifications
You must be signed in to change notification settings - Fork 791
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
Gradle plugin: Set default path for "config" parameter #1801
Conversation
detekt-cli/src/main/kotlin/io/gitlab/arturbosch/detekt/cli/runners/ConfigExporter.kt
Show resolved
Hide resolved
That's interesting, since you didn't touch the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, this PR looks fine. Let's wait for Artur's opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I like the "only look at root/config/detekt" approach without trying to figure out sub projects config.
InputArgument(source) | ||
) | ||
|
||
DetektInvoker.create(project).invokeCli(arguments.toList(), detektClasspath, name) | ||
if (config.first().exists()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can first()
here crash when project.files(...)
is empty or null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very literally yes, it would fail when project files is empty. But that won't happen as the value is set a couple lines earlier and doesn't rely on external input.
That said I'll make a new ConfigArgument
that accepts a single file instead of a collection to clean it up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was a bit awkward to deal with a new ConfigArgument
variant, so thought it's clearer to add error handling in the task itself.
To be clear this should never happen.
* Generate default config at user-specified path * Set a default path for detekt's config file * Write default config file to default config path * Update config to use new config layout convention * Update baseline file location * Catch possible error if `config` collection is not expected size
* Generate default config at user-specified path * Set a default path for detekt's config file * Write default config file to default config path * Update config to use new config layout convention * Update baseline file location * Catch possible error if `config` collection is not expected size
This PR:
rootDir/config/detekt/detekt.yml
by default (to match conventions in other Gradle plugins)Closes #1262