-
Notifications
You must be signed in to change notification settings - Fork 363
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
Conversation
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) { |
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 there no core metric we can use to get the line number?
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.
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); |
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.
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.
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.
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.
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.
report line number shall not be greater than the existing max. line number
(see also #600).