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

support 6.7 LTS #840

Merged
merged 7 commits into from
Nov 29, 2017
Merged

support 6.7 LTS #840

merged 7 commits into from
Nov 29, 2017

Conversation

vilchik-elena
Copy link
Contributor

Fixes #837, fixes #839

@ghost ghost assigned vilchik-elena Nov 24, 2017
@ghost ghost added the in progress label Nov 24, 2017
@vilchik-elena vilchik-elena changed the title bump sonar-plugin-api to 6.7 support 6.7 LTS Nov 24, 2017
Collection<File> files = StreamSupport.stream(inputFiles.spliterator(), false)
.map(CompatibleInputFile::file)
.map(InputFile::file)

Choose a reason for hiding this comment

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

MINOR Remove this use of "file"; it is deprecated. rule

} catch (IOException e) {
throw Throwables.propagate(e);
}
}

private static Settings settings() {
Settings settings = new MapSettings();
private static Configuration config() {
Copy link
Contributor

Choose a reason for hiding this comment

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

@vilchik-elena just a question: this kind of change is not related to dropping old versions support, it's about preparing for future removals of currently deprecated code, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@inverno mostly yes (while note, that MapSettings changed its package)

.defaultValue(LCOV_REPORT_PATHS_DEFAULT_VALUE)
.name("LCOV Files")
.description("Paths (absolute or relative) to the files with LCOV data.")
.onQualifiers(Qualifiers.MODULE, Qualifiers.PROJECT)
Copy link
Contributor

Choose a reason for hiding this comment

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

@vilchik-elena add multivalues

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

.subCategory(TEST_AND_COVERAGE)
.category(JAVASCRIPT_CATEGORY)
.build(),

PropertyDefinition.builder(FILE_SUFFIXES_KEY)
.defaultValue(FILE_SUFFIXES_DEFVALUE)
.name("File Suffixes")
.description("Comma-separated list of suffixes for files to analyze.")
Copy link
Contributor

Choose a reason for hiding this comment

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

@vilchik-elena maybe drop Comma-separated here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@@ -177,13 +162,13 @@ private void analyse(SensorContext sensorContext, CompatibleInputFile inputFile,
scanFile(sensorContext, inputFile, executor, visitors, scriptTree);
} catch (RecognitionException e) {
checkInterrupted(e);
LOG.error("Unable to parse file: " + inputFile.absolutePath());
LOG.error("Unable to parse file: " + inputFile.toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

@vilchik-elena I would use inputFile.uri(). It might be more stable than toString and it is absolute, as before, unlike the current implementation of DefaultInputFile.toString() which is using the project-relative path. Unless the goal was to use the project-relative path, in which case we should use InputFile.getProjectRelativePath().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

LOG.error(e.getMessage());
processRecognitionException(e, sensorContext, inputFile);
} catch (Exception e) {
checkInterrupted(e);
processException(e, sensorContext, inputFile);
LOG.error("Unable to analyse file: " + inputFile.absolutePath(), e);
LOG.error("Unable to analyse file: " + inputFile.toString(), e);
Copy link
Contributor

Choose a reason for hiding this comment

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

@vilchik-elena same as above

boolean isMinified = new MinificationAssessor().isMinified(file);
if (isMinified) {
LOG.debug("File [" + file.absolutePath() + "] looks like a minified file and will not be analyzed");
LOG.debug("File [" + file.toString() + "] looks like a minified file and will not be analyzed");
Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -35,17 +35,10 @@
/**
* @return the current file
*/
JavaScriptFile getJavaScriptFile();
InputFile getJavaScriptFile();
Copy link
Contributor

Choose a reason for hiding this comment

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

@vilchik-elena JavaScriptFile -> InputFile ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

createSensor().analyseFiles(context, ImmutableList.of((TreeVisitor) check), ImmutableList.of(file), executor, progressReport);
assertThat(context.allAnalysisErrors()).hasSize(1);

assertThat(logTester.logs()).contains("Unable to analyse file: " + file.absolutePath());
assertThat(logTester.logs()).contains("Unable to analyse file: " + file.toString());
Copy link
Contributor

Choose a reason for hiding this comment

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

@vilchik-elena if you follow my suggestion on file.uri() you'll have to update here as well


@Override
public String relativePath() {
return inputFile.relativePath();

Choose a reason for hiding this comment

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

MINOR Remove this use of "relativePath"; it is deprecated. rule

@SonarTech
Copy link

SonarQube analysis reported 7 issues

  • MINOR 6 minor
  • INFO 1 info

Watch the comments in this conversation to review them.

4 extra issues

Note: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:

  1. MINOR MetricsVisitor.java#L128: Remove this use of "COMPLEXITY_IN_CLASSES"; it is deprecated. rule
  2. MINOR MetricsVisitor.java#L129: Remove this use of "COMPLEXITY_IN_FUNCTIONS"; it is deprecated. rule
  3. MINOR MetricsVisitor.java#L138: Remove this use of "FUNCTION_COMPLEXITY_DISTRIBUTION"; it is deprecated. rule
  4. MINOR MetricsVisitor.java#L146: Remove this use of "FILE_COMPLEXITY_DISTRIBUTION"; it is deprecated. rule

/**
* @deprecated since 4.0, use {@link JavaScriptFile#fileName()} or {@link JavaScriptFile#uri()}
*/
@Deprecated
String relativePath();

Choose a reason for hiding this comment

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

INFO Do not forget to remove this deprecated code someday. rule

@@ -68,7 +68,7 @@ private void checkPlainText() {
if (expectedLines == null) {
expectedLines = headerFormat.split("(?:\r)?\n|\r");
}
InputFile file = getContext().getJavaScriptFile();
JavaScriptFile file = getContext().getJavaScriptFile();
Copy link
Contributor

Choose a reason for hiding this comment

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

@vilchik-elena why taking all this pain to wrap InputFile inside JavaScriptFile? The only advantage I would see is to isolate the checks from the plugin-api, but we still have it listed as a dependency in the pom (I presume for good reason) and even then I'm not sure it's worth it. Let me know if I'm missing something

@vilchik-elena vilchik-elena merged commit c3d804e into master Nov 29, 2017
@ghost ghost removed the in progress label Nov 29, 2017
@vilchik-elena vilchik-elena deleted the issue-837 branch November 29, 2017 15:57
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.

Drop support for separate coverage reports Support new LTS 6.7
3 participants