|
|
|
@ -428,10 +428,10 @@ public class CxxSquidSensor implements ProjectSensor { |
|
|
|
|
|
|
|
|
|
private void saveMeasures(InputFile inputFile, SourceCode sourceCode) { |
|
|
|
|
InputComponent input = inputFile; |
|
|
|
|
if(sourceCode instanceof SourceFile){ |
|
|
|
|
if (sourceCode instanceof SourceFile) { |
|
|
|
|
// NOSONAR
|
|
|
|
|
noSonarFilter.noSonarInFile(inputFile, ((SourceFile)sourceCode).getNoSonarTagLines()); |
|
|
|
|
}else{ |
|
|
|
|
noSonarFilter.noSonarInFile(inputFile, ((SourceFile) sourceCode).getNoSonarTagLines()); |
|
|
|
|
} else { |
|
|
|
|
input = context.project(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -501,23 +501,27 @@ public class CxxSquidSensor implements ProjectSensor { |
|
|
|
|
|
|
|
|
|
RuleKey ruleKey = checks.ruleKey(checker); |
|
|
|
|
if (ruleKey != null) { |
|
|
|
|
var newIssue = context.newIssue().forRule(RuleKey.of(repositoryKey, ruleKey.rule())); |
|
|
|
|
var location = newIssue.newLocation(); |
|
|
|
|
if(sourceCode instanceof SourceFile){ |
|
|
|
|
location.on(inputFile).at(inputFile.selectLine(line)); |
|
|
|
|
}else{ |
|
|
|
|
location.on(context.project()); |
|
|
|
|
} |
|
|
|
|
location.message(message.getText(Locale.CHINA)); |
|
|
|
|
try { |
|
|
|
|
var newIssue = context.newIssue().forRule(RuleKey.of(repositoryKey, ruleKey.rule())); |
|
|
|
|
var location = newIssue.newLocation(); |
|
|
|
|
if (sourceCode instanceof SourceFile) { |
|
|
|
|
location.on(inputFile).at(inputFile.selectLine(line)); |
|
|
|
|
} else { |
|
|
|
|
location.on(context.project()); |
|
|
|
|
} |
|
|
|
|
location.message(message.getText(Locale.CHINA)); |
|
|
|
|
|
|
|
|
|
newIssue.at(location); |
|
|
|
|
newIssue.save(); |
|
|
|
|
newIssue.at(location); |
|
|
|
|
newIssue.save(); |
|
|
|
|
}catch (Exception e){ |
|
|
|
|
LOG.error("save issue error, rule key: {}", message); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
LOG.debug("Unknown rule key: %s", message); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(sourceCode instanceof SourceFile) { |
|
|
|
|
if (sourceCode instanceof SourceFile) { |
|
|
|
|
var sourceFile = (SourceFile) sourceCode; |
|
|
|
|
if (MultiLocatitionSquidCheck.hasMultiLocationCheckMessages(sourceFile)) { |
|
|
|
|
for (var issue : MultiLocatitionSquidCheck.getMultiLocationCheckMessages(sourceFile)) { |
|
|
|
@ -542,7 +546,7 @@ public class CxxSquidSensor implements ProjectSensor { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void saveFileLinesContext(InputFile inputFile, SourceCode sourceCode) { |
|
|
|
|
if(sourceCode instanceof SourceProject || inputFile == null){ |
|
|
|
|
if (sourceCode instanceof SourceProject || inputFile == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// measures for the lines of file
|
|
|
|
@ -569,7 +573,7 @@ public class CxxSquidSensor implements ProjectSensor { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void saveCpdTokens(InputFile inputFile, SourceCode sourceCode) { |
|
|
|
|
if(sourceCode instanceof SourceProject || inputFile == null){ |
|
|
|
|
if (sourceCode instanceof SourceProject || inputFile == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
NewCpdTokens cpdTokens = context.newCpdTokens().onFile(inputFile); |
|
|
|
@ -589,7 +593,7 @@ public class CxxSquidSensor implements ProjectSensor { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void saveHighlighting(InputFile inputFile, SourceCode sourceCode) { |
|
|
|
|
if(sourceCode instanceof SourceProject || inputFile == null){ |
|
|
|
|
if (sourceCode instanceof SourceProject || inputFile == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
NewHighlighting newHighlighting = context.newHighlighting().onFile(inputFile); |
|
|
|
|