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

  • Reading from database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • notifyDataSetChanged (ArrayAdapter)
  • putExtra (Intent)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • ImageIO (javax.imageio)
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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