-
Notifications
You must be signed in to change notification settings - Fork 120
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 shellcheck support #190
Conversation
src/test/java/pl/touk/sputnik/processor/shellcheck/ShellcheckResultParserTest.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #190 +/- ##
============================================
+ Coverage 72.38% 75.03% +2.65%
- Complexity 608 659 +51
============================================
Files 146 154 +8
Lines 1988 2079 +91
Branches 131 134 +3
============================================
+ Hits 1439 1560 +121
+ Misses 489 456 -33
- Partials 60 63 +3
Continue to review full report at Codecov.
|
Hej @dswiecki do you want to continue work on this PR? |
@SpOOnman I've updated PR |
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.
Thank you for your support!
I think there is a problem with shellcheck as it is a shell script. It is hard to run tests with it because we need an environment that has it installed. Please correct me if I'm wrong as I don't know this tool.
} | ||
|
||
String runOnFile(String filePath) { | ||
log.info("Review on file: " + filePath); |
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.
Please use {}
for string interpolation here
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.
Done
return Collections.emptyList(); | ||
} | ||
try { | ||
List<Violation> violations = new ArrayList<>(); |
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.
Would it be more readable with Java Stream API?
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.
Yes, done
} | ||
|
||
@Test | ||
public void shouldReturnNoViolationsWhenThereIsNoFileToReview() { |
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.
Why there is no Assumption here?
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.
In that case, the file to review does not exist thus the processor is not invoked
|
||
@Test | ||
public void shouldReturnOneViolationsForFile() { | ||
Assumptions.assumeTrue(isShellcheckInstalled()); |
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.
This test will pass only if shellcheck is intalled, right?
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.
yes, otherwise it is ignored
private boolean isShellcheckInstalled() { | ||
try { | ||
String result = new ExternalProcess().executeCommand("shellcheck"); | ||
return "".equals(result); |
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.
return StringUtils.isBlank(result)
maybe?
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.
done
|
||
String runOnFile(String filePath) { | ||
log.info("Review on file: " + filePath); | ||
return new ExternalProcess().executeCommand(buildParams(filePath)); |
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.
What if shellcheck is not installed?
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.
Then ExternalPorcess throws ExternalProcessException which is not handled specially like in the case of other ProcessorRunningExternalProcess processors
@SpOOnman on travis-ci there's shellcheck script installed by default |
Thank you! |
@dswiecki - how do you now run sputnik with a shellcheck-enabled system? I've tried setting |
* Add basic shellcheck support * Add shellcheck exclude rules * Update junit annotations * Shellcheck review
This PR adds https://github.com/koalaman/shellcheck integration