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 support for multiple input directories #203

Merged
merged 2 commits into from
Oct 2, 2023

Conversation

gwhogg
Copy link
Contributor

@gwhogg gwhogg commented Oct 1, 2023

The detekt CLI docs indicate that multiple input directories can be supplied to it, using the -i/--input switch, provided they're delimited by commas. I've recently written a git hook which I'd like to use in conjunction with the detekt maven plugin so that only modified files are scanned by detekt. This will dramatically decrease the time it takes for pre-commit checks to happen, as the code base I'm working with is particularly large and scanning all files is a lengthy operation.

The changes here enable multiple directories to be provided. Each in turn is verified before being passed through to detekt. If any directories can't be resolved, the process is aborted and the offending paths are logged to standard out.

@codecov-commenter
Copy link

codecov-commenter commented Oct 2, 2023

Codecov Report

Merging #203 (48eadce) into main (c10753a) will increase coverage by 0.46%.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@             Coverage Diff              @@
##               main     #203      +/-   ##
============================================
+ Coverage     73.93%   74.40%   +0.46%     
- Complexity       37       38       +1     
============================================
  Files             9        9              
  Lines           165      168       +3     
  Branches         39       40       +1     
============================================
+ Hits            122      125       +3     
  Misses           17       17              
  Partials         26       26              
Files Coverage Δ
src/main/java/com/github/ozsie/CheckMojo.kt 94.44% <100.00%> (+1.11%) ⬆️

Copy link
Owner

@Ozsie Ozsie left a comment

Choose a reason for hiding this comment

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

Code looks good, though ValidFile2.kt needs to be added to baseline.xml since there are two issues in it that we want to ignore.

/home/runner/work/detekt-maven-plugin/detekt-maven-plugin/src/test/resources/code-samples/valid2/ValidFile2.kt:1:1: Package name should match the pattern: [a-z]+(\.[a-z][A-Za-z0-9]*)* [PackageNaming]
/home/runner/work/detekt-maven-plugin/detekt-maven-plugin/src/test/resources/code-samples/valid2/ValidFile2.kt:1:1: The package declaration does not match the actual file location. [InvalidPackageDeclaration]

@gwhogg gwhogg force-pushed the support-multiple-input-directories branch from 88cf38d to 48eadce Compare October 2, 2023 08:48
@gwhogg
Copy link
Contributor Author

gwhogg commented Oct 2, 2023

Code looks good, though ValidFile2.kt needs to be added to baseline.xml since there are two issues in it that we want to ignore.

/home/runner/work/detekt-maven-plugin/detekt-maven-plugin/src/test/resources/code-samples/valid2/ValidFile2.kt:1:1: Package name should match the pattern: [a-z]+(\.[a-z][A-Za-z0-9]*)* [PackageNaming]
/home/runner/work/detekt-maven-plugin/detekt-maven-plugin/src/test/resources/code-samples/valid2/ValidFile2.kt:1:1: The package declaration does not match the actual file location. [InvalidPackageDeclaration]

Thank you. I'd forgotten about the baseline, have pushed the fix in 48eadce.

@gwhogg gwhogg requested a review from Ozsie October 2, 2023 08:52
@gwhogg
Copy link
Contributor Author

gwhogg commented Oct 2, 2023

@Ozsie thanks for the review. Are you happy to merge this in please, as I don't have write access.

@Ozsie Ozsie merged commit 471623d into Ozsie:main Oct 2, 2023
14 checks passed
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.

None yet

3 participants