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