Skip to content

Commit

Permalink
Validate issue line number
Browse files Browse the repository at this point in the history
  • Loading branch information
nbihan-mediware committed Nov 29, 2018
1 parent ab702a2 commit 471a0f0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pipeline {
agent any
agent any
stages {
stage('Clean') {
steps {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>com.stepstone.sonar.plugin</groupId>
<artifactId>sonar-coldfusion-plugin</artifactId>
<packaging>sonar-plugin</packaging>
<version>1.6.2-SNAPSHOT</version>
<version>1.6.3-SNAPSHOT</version>

<name>SonarQube Coldfusion Analyzer</name>
<description>Enables scanning of ColdFusion source files</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private void handleIssueTag(IssueAttributes issueAttributes) throws XMLStreamExc
LocationAttributes locationAttributes = new LocationAttributes(stream);
InputFile inputFile = fs.inputFile(fs.predicates().hasAbsolutePath(locationAttributes.getFile().get()));
if(inputFile == null){
LOGGER.error("File {} is null",locationAttributes.getFile().get());
LOGGER.error("File {} is null", locationAttributes.getFile().get());
}
createNewIssue(issueAttributes, locationAttributes, inputFile);
}
Expand All @@ -113,6 +113,11 @@ private void createNewIssue(IssueAttributes issueAttributes, LocationAttributes
return;
}

if(locationAttributes.getLine().isPresent() && locationAttributes.getLine().get()>inputFile.lines()){
LOGGER.error("Problem creating issue for file {}, issue is line {} but file has {} lines", inputFile, locationAttributes.getLine().get(), inputFile.lines());
return;
}

LOGGER.debug("create New Issue {} for file {}", issueAttributes, inputFile.filename());
final NewIssue issue = sensorContext.newIssue();

Expand Down

0 comments on commit 471a0f0

Please sign in to comment.