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

Add --version to cli #2383

Merged
merged 1 commit into from
Mar 3, 2020
Merged

Add --version to cli #2383

merged 1 commit into from
Mar 3, 2020

Conversation

BraisGabin
Copy link
Member

Closes #2382

This PR adds the --version flag. It prints the version of the running detekt cli.

I have a problem testing this. And It's that whichVersion() retutns null in test mode. Any idea?

@schalkms
Copy link
Member

schalkms commented Mar 2, 2020

You were just a few seconds faster than me in regards to the PR for this topic. 😉
I guess it is because of the manifest file that couldn't be loaded.

@arturbosch
Copy link
Member

I think it is because of these lines:
https://github.com/arturbosch/detekt/blob/25a8555c03e680096dcf390f23b4a51eea78aaee/detekt-cli/build.gradle.kts#L18-L23
The manifest file is only available inside the jar.
Will it help if you hardcode a manifest file inside the test/resources?

@arturbosch arturbosch added this to the 1.7.0 milestone Mar 2, 2020
@BraisGabin
Copy link
Member Author

Yes! adding a manifest in the test resources did the trick.

I edited the code too. I we can't know the version of detekt we should fail the task. We don't want to exit with a success because that can mess up the scripts of the users.

I can't test the failure case but it should never happen.

@codecov-io
Copy link

codecov-io commented Mar 2, 2020

Codecov Report

Merging #2383 into master will increase coverage by 0.08%.
The diff coverage is 71.42%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2383      +/-   ##
============================================
+ Coverage     82.73%   82.81%   +0.08%     
- Complexity     2135     2141       +6     
============================================
  Files           352      353       +1     
  Lines          6080     6087       +7     
  Branches       1109     1111       +2     
============================================
+ Hits           5030     5041      +11     
+ Misses          480      476       -4     
  Partials        570      570
Impacted Files Coverage Δ Complexity Δ
...ain/kotlin/io/gitlab/arturbosch/detekt/cli/Main.kt 38.46% <100%> (+2.46%) 7 <0> (+1) ⬆️
.../kotlin/io/gitlab/arturbosch/detekt/cli/CliArgs.kt 100% <100%> (ø) 7 <0> (ø) ⬇️
...ab/arturbosch/detekt/cli/runners/VersionPrinter.kt 60% <60%> (ø) 2 <2> (?)
...lin/io/gitlab/arturbosch/detekt/core/DebugUtils.kt 58.33% <0%> (ø) 0% <0%> (ø) ⬇️
.../arturbosch/detekt/cli/runners/SingleRuleRunner.kt 97.22% <0%> (+8.33%) 8% <0%> (+2%) ⬆️
...ab/arturbosch/detekt/cli/runners/ConfigExporter.kt 80% <0%> (+60%) 2% <0%> (+1%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32fe921...d580155. Read the comment docs.

@arturbosch arturbosch merged commit e896b00 into detekt:master Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add --version CLI option
4 participants