Tabnine Logo
ScannerReport$Duplicate.getRange
Code IndexAdd Tabnine to your IDE (free)

How to use
getRange
method
in
org.sonar.scanner.protocol.output.ScannerReport$Duplicate

Best Java code snippets using org.sonar.scanner.protocol.output.ScannerReport$Duplicate.getRange (Showing top 5 results out of 315)

origin: SonarSource/sonarqube

private void assertDuplicate(Duplicate d, int otherFileRef, int rangeStartLine, int rangeEndLine) {
 assertThat(d.getOtherFileRef()).isEqualTo(otherFileRef);
 assertThat(d.getRange().getStartLine()).isEqualTo(rangeStartLine);
 assertThat(d.getRange().getEndLine()).isEqualTo(rangeEndLine);
}
origin: SonarSource/sonarqube

private void assertDuplication(Duplication d, int originStartLine, int originEndLine, @Nullable Integer otherFileRef, int rangeStartLine, int rangeEndLine) {
 assertThat(d.getOriginPosition().getStartLine()).isEqualTo(originStartLine);
 assertThat(d.getOriginPosition().getEndLine()).isEqualTo(originEndLine);
 assertThat(d.getDuplicateList()).hasSize(1);
 if (otherFileRef != null) {
  assertThat(d.getDuplicate(0).getOtherFileRef()).isEqualTo(otherFileRef);
 } else {
  assertThat(d.getDuplicate(0).getOtherFileRef()).isEqualTo(0);
 }
 assertThat(d.getDuplicate(0).getRange().getStartLine()).isEqualTo(rangeStartLine);
 assertThat(d.getDuplicate(0).getRange().getEndLine()).isEqualTo(rangeEndLine);
}
origin: SonarSource/sonarqube

@Test
public void testIntraFileDuplications() throws IOException {
 File srcDir = new File(baseDir, "src");
 srcDir.mkdir();
 String content = "Sample xoo\ncontent\nfoo\nbar\nSample xoo\ncontent\n";
 File xooFile = new File(srcDir, "sample.xoo");
 FileUtils.write(xooFile, content);
 AnalysisResult result = tester.newAnalysis()
  .properties(builder
   .put("sonar.sources", "src")
   .put("sonar.cpd.xoo.minimumTokens", "2")
   .put("sonar.cpd.xoo.minimumLines", "2")
   .put("sonar.verbose", "true")
   .build())
  .execute();
 InputFile inputFile = result.inputFile("src/sample.xoo");
 // One clone group
 List<ScannerReport.Duplication> duplicationGroups = result.duplicationsFor(inputFile);
 assertThat(duplicationGroups).hasSize(1);
 ScannerReport.Duplication cloneGroup = duplicationGroups.get(0);
 assertThat(cloneGroup.getOriginPosition().getStartLine()).isEqualTo(1);
 assertThat(cloneGroup.getOriginPosition().getEndLine()).isEqualTo(2);
 assertThat(cloneGroup.getDuplicateList()).hasSize(1);
 assertThat(cloneGroup.getDuplicate(0).getRange().getStartLine()).isEqualTo(5);
 assertThat(cloneGroup.getDuplicate(0).getRange().getEndLine()).isEqualTo(6);
}
origin: org.sonarsource.sonarqube/sonar-server

 @Override
 @Nonnull
 public Duplicate apply(@Nonnull ScannerReport.Duplicate input) {
  if (input.getOtherFileRef() != 0) {
   checkArgument(input.getOtherFileRef() != file.getReportAttributes().getRef(), "file and otherFile references can not be the same");
   return new InProjectDuplicate(
    treeRootHolder.getComponentByRef(input.getOtherFileRef()),
    convert(input.getRange()));
  }
  return new InnerDuplicate(convert(input.getRange()));
 }
}
origin: SonarSource/sonarqube

@Override
@Nonnull
public Duplicate apply(@Nonnull ScannerReport.Duplicate input) {
 if (input.getOtherFileRef() != 0) {
  checkArgument(input.getOtherFileRef() != file.getReportAttributes().getRef(), "file and otherFile references can not be the same");
  Component otherComponent = treeRootHolder.getReportTreeComponentByRef(input.getOtherFileRef());
  if ((analysisMetadataHolder.isShortLivingBranch() || analysisMetadataHolder.isPullRequest()) && otherComponent.getStatus() == Component.Status.SAME) {
   return new InExtendedProjectDuplicate(otherComponent, convert(input.getRange()));
  } else {
   return new InProjectDuplicate(otherComponent, convert(input.getRange()));
  }
 }
 return new InnerDuplicate(convert(input.getRange()));
}
org.sonar.scanner.protocol.outputScannerReport$DuplicategetRange

Popular methods of ScannerReport$Duplicate

  • newBuilder
  • getOtherFileRef

Popular in Java

  • Start an intent from android
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setScale (BigDecimal)
  • compareTo (BigDecimal)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • ImageIO (javax.imageio)
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now