-
Notifications
You must be signed in to change notification settings - Fork 6
Override workdir to avoid having to copy files into a RW directory #32
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
Conversation
Dockerfile
Outdated
CMD /usr/src/app/build/codeclimate-sonar /code /config.json |
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.
Not sure what's more reliable but I think we more often use the array syntax for CMD
:
CMD ["/usr/src/app/build/codeclimate-sonar", "/code", "/config.json"]
src/main/java/cc/App.java
Outdated
@@ -30,7 +30,7 @@ public static void execute(System2 system) { | |||
InputFileFinder fileFinder = new Finder(config.getIncludePaths(), config.getTestsPatterns(), charset); | |||
ReportFactory reportFactory = new cc.report.ReportFactory(charset); | |||
ConfigurationReader reader = new ConfigurationReader(); | |||
SonarLintFactory sonarLintFactory = new SonarLintFactory(reader); | |||
org.sonarlint.cli.analysis.SonarLintFactory sonarLintFactory = new SonarLintFactory(reader, config.getWorkdir()); |
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.
Should this be SonarLintFactory
if we're already importing cc.analysis.SonarLintFactory
?
src/main/java/cc/Config.java
Outdated
@@ -31,6 +34,13 @@ public String getTestsPatterns() { | |||
return joinPatterns(config.testsPatterns); | |||
} | |||
|
|||
public Path getWorkdir() { | |||
if (config.workDir == null) { | |||
return Paths.get("/tmp/sonarlint"); |
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.
Is this where the source code is analyzed? Maybe we should call this /tmp/workspace
?
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 creates temporary files, like data it uses to create the issues. The original directory is <current_dir>/.sonarlint
, reason I kept sonarlint
, but /tmp/workspace
works for me too.
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.
Ahhh, I see. In that case /tmp/sonarlint
makes perfect since, but I might suggest changing the method from getWorkDir()
to getSonarlintDir()
.
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.
I named it workDir
because it is what it is called internally
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.
Internal to sonarlint that makes sense, but within the context of an engine, I think workDir
can be easily confused with the engine's working directory / workspace where we analyze the source code.
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.
Makes sense!!! 👍
@dblandin done! |
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.
nice 👍
Needed to override a few classes to be able to accomplish this, not sure the tradeoff is worth it. WDTY?
Fix #20