Skip to content

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

Merged
merged 4 commits into from
Oct 13, 2017

Conversation

filipesperandio
Copy link
Contributor

@filipesperandio filipesperandio commented Oct 13, 2017

Needed to override a few classes to be able to accomplish this, not sure the tradeoff is worth it. WDTY?

Fix #20

Dockerfile Outdated
CMD /usr/src/app/build/codeclimate-sonar /code /config.json

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"]

@@ -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());

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?

@@ -31,6 +34,13 @@ public String getTestsPatterns() {
return joinPatterns(config.testsPatterns);
}

public Path getWorkdir() {
if (config.workDir == null) {
return Paths.get("/tmp/sonarlint");

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?

Copy link
Contributor Author

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.

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().

Copy link
Contributor Author

@filipesperandio filipesperandio Oct 13, 2017

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

Copy link

@dblandin dblandin Oct 13, 2017

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense!!! 👍

@filipesperandio
Copy link
Contributor Author

@dblandin done!

Copy link

@dblandin dblandin left a comment

Choose a reason for hiding this comment

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

nice 👍

@filipesperandio filipesperandio merged commit ec60240 into channel/beta Oct 13, 2017
@filipesperandio filipesperandio deleted the fe/ditch-cp branch October 13, 2017 19:39
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.

2 participants