SonarOpenCommunity / sonar-cxx

Undocumented method found JAVA-D1001
Documentation
Minor
6 months ago2 years old
156    }
157  }
158
159  protected void analyzeComplexity(CxxComplexityScope scope) {160    SourceCode code = getContext().peekSourceCode();161    code.setMeasure(CxxMetric.COGNITIVE_COMPLEXITY, scope.getComplexity());162  }163
164}
 84
 85  private Deque<CxxComplexityScope> complexityScopes = null;
 86
 87  private static boolean isElseIf(AstNode node) { 88    return node.is(CxxGrammarImpl.selectionStatement) && node.getToken().getType().equals(CxxKeyword.IF) 89             && node.getParent().getPreviousAstNode().getType().equals(CxxKeyword.ELSE); 90  } 91
 92  @Override
 93  public void init() {
572    newHighlighting.save();
573  }
574
575  private <T extends Serializable> void saveMetric(InputFile file, Metric<T> metric, T value) {576    context.<T>newMeasure()577      .withValue(value)578      .forMetric(metric)579      .on(file)580      .save();581  }582}
Consider adding a doc comment for saveHighlighting
553    cpdTokens.save();
554  }
555
556  private void saveHighlighting(InputFile inputFile, SourceFile sourceFile) {557    NewHighlighting newHighlighting = context.newHighlighting().onFile(inputFile);558559    List<CxxHighlighterVisitor.Highlight> data = (List<CxxHighlighterVisitor.Highlight>) sourceFile.getData(560      CxxMetric.HIGHLIGTHING_DATA);561    data.forEach((item) -> {562      try {563        newHighlighting.highlight(item.startLine, item.startLineOffset, item.endLine, item.endLineOffset,564                                  TypeOfText.forCssClass(item.typeOfText));565      } catch (IllegalArgumentException | IllegalStateException e) {566        // ignore highlight errors: parsing errors could lead to wrong location data567        LOG.debug("Highlighting error in file '{}' at start:{}:{} end:{}:{}", inputFile.filename(),568                  item.startLine, item.startLineOffset, item.endLine, item.endLineOffset);569      }570    });571572    newHighlighting.save();573  }574
575  private <T extends Serializable> void saveMetric(InputFile file, Metric<T> metric, T value) {
576    context.<T>newMeasure()
536    fileLinesContext.save();
537  }
538
539  private void saveCpdTokens(InputFile inputFile, SourceFile sourceFile) {540    NewCpdTokens cpdTokens = context.newCpdTokens().onFile(inputFile);541542    List<CxxCpdVisitor.CpdToken> data = (List<CxxCpdVisitor.CpdToken>) sourceFile.getData(CxxMetric.CPD_TOKENS_DATA);543    data.forEach((item) -> {544      try {545        TextRange range = inputFile.newRange(item.startLine, item.startCol, item.endLine, item.endCol);546        cpdTokens.addToken(range, item.token);547      } catch (IllegalArgumentException | IllegalStateException e) {548        // ignore range errors: parsing errors could lead to wrong location data549        LOG.debug("CPD error in file '{}' at line:{}, column:{}", inputFile.filename(), item.startLine, item.startCol);550      }551    });552553    cpdTokens.save();554  }555
556  private void saveHighlighting(InputFile inputFile, SourceFile sourceFile) {
557    NewHighlighting newHighlighting = context.newHighlighting().onFile(inputFile);