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

limit report line number #611

Closed
wants to merge 1 commit into from

Conversation

Bertk
Copy link
Contributor

@Bertk Bertk commented Aug 16, 2015

report line number shall not be greater than the existing max. line number
(see also #600).

report line number shall not be greater than the existing max. line
number
/**
* @return returns number of Lines of a File
*/
public static int countLines(String normalPath) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there no core metric we can use to get the line number?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a line number in the size section of the metrics.
http://docs.sonarqube.org/display/SONAR/Metric+definitions#Metricdefinitions-Size
I am not sure whether the line metric is available when the report is consumed.

@@ -239,6 +240,21 @@ private boolean saveViolation(Project project, SensorContext context, String rul
= org.sonar.api.resources.File.fromIOFile(new File(normalPath), project);
Copy link
Collaborator

Choose a reason for hiding this comment

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

fromIOFile is deprecated, see http://javadocs.sonarsource.org/4.5.2/apidocs/deprecated-list.html. So we should use something like:

InputFile file= fs.inputFile(fs.predicates().is(new File(filename)));
int maxLine = file.lines();

InputFile has method lines.

Copy link
Member

Choose a reason for hiding this comment

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

performance needs to be measured...

On Thu, 3 Sep 2015 at 14:52 Günter Wirth [email protected] wrote:

In
sonar-cxx-plugin/src/main/java/org/sonar/plugins/cxx/utils/CxxReportSensor.java
#611 (comment):

@@ -239,6 +240,21 @@ private boolean saveViolation(Project project, SensorContext context, String rul
= org.sonar.api.resources.File.fromIOFile(new File(normalPath), project);

fromIOFile is deprecated, see
http://javadocs.sonarsource.org/4.5.2/apidocs/deprecated-list.html. So we
should use something like:

InputFile file= fs.inputFile(fs.predicates().is(new File(filename)));int maxLine = file.lines();

InputFile has method lines.


Reply to this email directly or view it on GitHub
https://github.com/wenns/sonar-cxx/pull/611/files#r38637121.

@guwirth guwirth closed this in #631 Sep 16, 2015
@guwirth guwirth added the bug label Sep 16, 2015
@guwirth guwirth added this to the M 0.9.4 milestone Sep 16, 2015
Bertk added a commit to Bertk/sonar-cxx that referenced this pull request Oct 1, 2015
There is only one log file for a solution for multiple VS projects (or
modules) which might be located in the parent folder of the project root
folder.

support CppCheck 1.70 new messages

remove deprecated fromIOFile from sensors

- close SonarOpenCommunity#629
- replace File.fromIOFile with FileSystem.inputFile
- replace org.sonar.api.resources.File with org.sonar.api.batch.fs.InputFile
- use org.sonar.api.batch.fs.internal.DefaultFileSystem in unit tests
- add addInputFile to TestUtils: all files listed in report files must be added to DefaultFileSystem
   - for reports with absolute paths there are two versions needed: one for Window and one for Linux
- close SonarOpenCommunity#611, close SonarOpenCommunity#600, close SonarOpenCommunity#625: add fix for https://jira.sonarsource.com/browse/SONAR-6792

support team builds

There is only one log file for a solution for multiple VS projects (or
modules) which might be located in the parent folder of the project root
folder.
@guwirth guwirth mentioned this pull request Oct 25, 2015
@Bertk Bertk deleted the fix-report-max-line branch January 3, 2016 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants