/** * Returns a map of all C style comments. The key is the line number, the * value is a {@link List} of C style comment {@link TextBlock}s * that start at that line. * @return the map of comments * @deprecated Use {@link #getBlockComments()} instead. */ // -@cs[AbbreviationAsWordInName] Can't change yet since class is API. @Deprecated public Map<Integer, List<TextBlock>> getCComments() { return getBlockComments(); }
/** * Collects all the suppression tags for all comments into a list and * sorts the list. */ private void tagSuppressions() { tags.clear(); final FileContents contents = getFileContents(); if (checkCPP) { tagSuppressions(contents.getSingleLineComments().values()); } if (checkC) { final Collection<List<TextBlock>> cComments = contents.getBlockComments().values(); cComments.forEach(this::tagSuppressions); } }
/** * Collects all the suppression tags for all comments into a list and * sorts the list. */ private void tagSuppressions() { tags.clear(); final FileContents contents = getFileContents(); if (checkCPP) { tagSuppressions(contents.getSingleLineComments().values()); } if (checkC) { final Collection<List<TextBlock>> cComments = contents .getBlockComments().values(); cComments.forEach(this::tagSuppressions); } Collections.sort(tags); }
@Override public void beginTree(DetailAST rootAST) { singlelineComments = getFileContents().getSingleLineComments(); blockComments = getFileContents().getBlockComments(); }
.getSingleLineComments(); final Map<Integer, List<TextBlock>> cComments = getFileContents() .getBlockComments(); final Set<Integer> lines = new HashSet<>(); lines.addAll(cppComments.keySet());
@Test public void testExtractBlockComment() { final FileContents fileContents = new FileContents( new FileText(new File("filename"), Arrays.asList(" ", " ", " /* test ", " */ ", " "))); fileContents.reportCComment(3, 2, 4, 2); final Map<Integer, List<TextBlock>> blockComments = fileContents.getBlockComments(); final String[] text = blockComments.get(3).get(0).getText(); assertArrayEquals("Invalid comment text", new String[] {"/* test ", " *"}, text); }
/** * Returns a map of all C style comments. The key is the line number, the * value is a {@link List} of C style comment {@link TextBlock}s * that start at that line. * @return the map of comments * @deprecated Use {@link #getBlockComments()} instead. */ // -@cs[AbbreviationAsWordInName] Can't change yet since class is API. @Deprecated public Map<Integer, List<TextBlock>> getCComments() { return getBlockComments(); }
/** * Collects all the suppression tags for all comments into a list and * sorts the list. */ private void tagSuppressions() { tags.clear(); final FileContents contents = getFileContents(); if (checkCPP) { tagSuppressions(contents.getSingleLineComments().values()); } if (checkC) { final Collection<List<TextBlock>> cComments = contents .getBlockComments().values(); cComments.forEach(this::tagSuppressions); } Collections.sort(tags); }
@Override public void visitToken(final DetailAST ast) { final Set<Entry<Integer, List<TextBlock>>> comments = this.getFileContents().getBlockComments().entrySet(); for (final Entry<Integer, List<TextBlock>> comment : comments) { if (!NoBlockCommentsCheck.isJavadocComment(comment.getValue()) && !NoBlockCommentsCheck.isSeeJavaDoc(comment.getValue())) { this.log(comment.getKey(), "block comments are not allowed"); } } }
/** * Collects all the suppression tags for all comments into a list and * sorts the list. */ private void tagSuppressions() { tags.clear(); final FileContents contents = getFileContents(); if (checkCPP) { tagSuppressions(contents.getSingleLineComments().values()); } if (checkC) { final Collection<List<TextBlock>> cComments = contents.getBlockComments().values(); cComments.forEach(this::tagSuppressions); } }
@Override public void beginTree(DetailAST rootAST) { singlelineComments = getFileContents().getSingleLineComments(); blockComments = getFileContents().getBlockComments(); }
.getSingleLineComments(); final Map<Integer, List<TextBlock>> cComments = getFileContents() .getBlockComments(); final Set<Integer> lines = new HashSet<>(); lines.addAll(cppComments.keySet());