Skip to content

Allow configuration overrides #26

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 11 commits into from
Oct 13, 2017
Merged

Conversation

filipesperandio
Copy link
Contributor

@filipesperandio filipesperandio commented Oct 10, 2017

  • tests_patterns
  • charset

@filipesperandio filipesperandio changed the title Enforce config.json Use tests patterns supported by sonar to differentiate analysis Oct 12, 2017
@filipesperandio filipesperandio changed the title Use tests patterns supported by sonar to differentiate analysis Allow configuration overrides Oct 12, 2017
@codeclimate-hermes codeclimate-hermes requested review from toddmazierski and removed request for codeclimate-hermes October 12, 2017 17:00
Copy link

@toddmazierski toddmazierski left a comment

Choose a reason for hiding this comment

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

Looks good, @filipesperandio! Added a few comments.

@@ -48,7 +48,7 @@ public void limit_path_included_within_analysis() throws Exception {

@Test
public void include_all_files_by_default() throws Exception {
App.execute(new String[]{}, system);
App.execute(system);

Choose a reason for hiding this comment

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

Are there any test cases for when an exception is caught/logged in App.execute()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding that.

@Test
public void fetch_tests_patterns() throws Exception {
Config config = Config.gson().fromJson("{\"config\":{\"tests_patterns\":[\"src/test/**\",\"src/test2/**\"]}}", Config.class);
assertThat(config.getTestsPatterns()).isEqualTo("{src/test/**,src/test2/**}");

Choose a reason for hiding this comment

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

Should we also add a test case for when tests_patterns is null (or missing) in the configuration file?

@@ -30,6 +29,7 @@ public JsonReport(String baseDir) {
this.gson = new GsonFactory().create();
}


Choose a reason for hiding this comment

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

(extra line)

public class ReportFactory extends org.sonarlint.cli.report.ReportFactory {
public ReportFactory(Charset charset) {
super(charset);
}

Choose a reason for hiding this comment

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

Think there's any worth adding tests for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am actually fine with the SanityCheckTest testing this from an integration perspective.
Having the test in a higher level allows me to easy refactor and move stuff around without needing to update the tests as often.

}
@Override
public int run() {
return super.run();

Choose a reason for hiding this comment

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

Is it necessary to override this function if we're just delegating to the parent anyways?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needed to change the accessor to be public so we don't have to keep adding classes to that org.sornarlint.cli package :(

@filipesperandio
Copy link
Contributor Author

@toddmazierski Adjustments made!

Copy link

@toddmazierski toddmazierski left a comment

Choose a reason for hiding this comment

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

🚢

@filipesperandio filipesperandio merged commit 5e0c369 into channel/beta Oct 13, 2017
@filipesperandio filipesperandio deleted the fe/enfore-config-json branch October 13, 2017 17:09
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