Codota Logo
ScannerReport$Duplicate.newBuilder
Code IndexAdd Codota to your IDE (free)

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

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

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Dictionary d =
  • Codota Iconnew Hashtable()
  • Codota IconBundle bundle;bundle.getHeaders()
  • Codota Iconnew Properties()
  • Smart code suggestions by Codota
}
origin: SonarSource/sonarqube

@VisibleForTesting final void saveDuplications(final DefaultInputComponent component, List<CloneGroup> duplications) {
 if (duplications.size() > MAX_CLONE_GROUP_PER_FILE) {
  LOG.warn("Too many duplication groups on file {}. Keep only the first {} groups.", component, MAX_CLONE_GROUP_PER_FILE);
 }
 Iterable<ScannerReport.Duplication> reportDuplications = duplications.stream()
  .limit(MAX_CLONE_GROUP_PER_FILE)
  .map(
   new Function<CloneGroup, Duplication>() {
    private final ScannerReport.Duplication.Builder dupBuilder = ScannerReport.Duplication.newBuilder();
    private final ScannerReport.Duplicate.Builder blockBuilder = ScannerReport.Duplicate.newBuilder();
    @Override
    public ScannerReport.Duplication apply(CloneGroup input) {
     return toReportDuplication(component, dupBuilder, blockBuilder, input);
    }
   })::iterator;
 publisher.getWriter().writeComponentDuplications(component.scannerId(), reportDuplications);
}
origin: SonarSource/sonarqube

@Test
public void write_duplications() {
 assertThat(underTest.hasComponentData(FileStructure.Domain.DUPLICATIONS, 1)).isFalse();
 ScannerReport.Duplication duplication = ScannerReport.Duplication.newBuilder()
  .setOriginPosition(ScannerReport.TextRange.newBuilder()
   .setStartLine(1)
   .setEndLine(5)
   .build())
  .addDuplicate(ScannerReport.Duplicate.newBuilder()
   .setOtherFileRef(2)
   .setRange(ScannerReport.TextRange.newBuilder()
    .setStartLine(6)
    .setEndLine(10)
    .build())
   .build())
  .build();
 underTest.writeComponentDuplications(1, asList(duplication));
 assertThat(underTest.hasComponentData(FileStructure.Domain.DUPLICATIONS, 1)).isTrue();
 File file = underTest.getFileStructure().fileFor(FileStructure.Domain.DUPLICATIONS, 1);
 assertThat(file).exists().isFile();
 try (CloseableIterator<ScannerReport.Duplication> duplications = Protobuf.readStream(file, ScannerReport.Duplication.parser())) {
  ScannerReport.Duplication dup = duplications.next();
  assertThat(dup.getOriginPosition()).isNotNull();
  assertThat(dup.getDuplicateList()).hasSize(1);
 }
}
origin: SonarSource/sonarqube

@Test
public void read_duplications() {
 ScannerReportWriter writer = new ScannerReportWriter(dir);
 writer.writeMetadata(ScannerReport.Metadata.newBuilder()
  .setRootComponentRef(1).build());
 writer.writeComponent(ScannerReport.Component.newBuilder()
  .setRef(1).build());
 ScannerReport.Duplication duplication = ScannerReport.Duplication.newBuilder()
  .setOriginPosition(ScannerReport.TextRange.newBuilder()
   .setStartLine(1)
   .setEndLine(5)
   .build())
  .addDuplicate(ScannerReport.Duplicate.newBuilder()
   .setOtherFileRef(2)
   .setRange(ScannerReport.TextRange.newBuilder()
    .setStartLine(6)
    .setEndLine(10)
    .build())
   .build())
  .build();
 writer.writeComponentDuplications(1, asList(duplication));
 ScannerReportReader sut = new ScannerReportReader(dir);
 assertThat(sut.readComponentDuplications(1)).hasSize(1);
}
origin: SonarSource/sonarqube

private static ScannerReport.Duplicate createInnerDuplicate(int line) {
 return ScannerReport.Duplicate.newBuilder()
  .setRange(singleLineTextRange(line))
  .build();
}
origin: SonarSource/sonarqube

private static ScannerReport.Duplicate createInProjectDuplicate(int componentRef, int line) {
 return ScannerReport.Duplicate.newBuilder()
  .setOtherFileRef(componentRef)
  .setRange(singleLineTextRange(line))
  .build();
}
origin: org.sonarsource.sonarqube/sonar-scanner-engine

@VisibleForTesting final void saveDuplications(final DefaultInputComponent component, List<CloneGroup> duplications) {
 if (duplications.size() > MAX_CLONE_GROUP_PER_FILE) {
  LOG.warn("Too many duplication groups on file {}. Keep only the first {} groups.", component, MAX_CLONE_GROUP_PER_FILE);
 }
 Iterable<ScannerReport.Duplication> reportDuplications = duplications.stream()
  .limit(MAX_CLONE_GROUP_PER_FILE)
  .map(
   new Function<CloneGroup, Duplication>() {
    private final ScannerReport.Duplication.Builder dupBuilder = ScannerReport.Duplication.newBuilder();
    private final ScannerReport.Duplicate.Builder blockBuilder = ScannerReport.Duplicate.newBuilder();
    @Override
    public ScannerReport.Duplication apply(CloneGroup input) {
     return toReportDuplication(component, dupBuilder, blockBuilder, input);
    }
   })::iterator;
 publisher.getWriter().writeComponentDuplications(component.scannerId(), reportDuplications);
}
org.sonar.scanner.protocol.outputScannerReport$DuplicatenewBuilder

Popular methods of ScannerReport$Duplicate

  • getOtherFileRef
  • getRange

Popular in Java

  • Parsing JSON documents to java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • requestLocationUpdates (LocationManager)
  • setRequestProperty (URLConnection)
    Sets the general request property. If a property with the key already exists, overwrite its value wi
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Dictionary (java.util)
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to valu
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now