-
- Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
Milestone
Description
I have read check documentation: https://checkstyle.org/checks/misc/todocomment.html
I have downloaded the latest cli from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
https://google.github.io/styleguide/javaguide.html#s4.8.6.2-todo-comments
A TODO comment begins with the word TODO in all caps, a following colon
Config:
<?xml version="1.0"?> <!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd"> <module name="Checker"> <module name="TreeWalker"> <module name="TodoComment"/> </module> </module>Code:
/** some javadoc. */ public class Test { void myFunc(int i) { // todo: implementing // EXPECTED VIOLATION } void myFunc1(int i) { // Todo: implementing // EXPECTED VIOLATION } void myFunc2(int i) { // toDo: implementing // EXPECTED VIOLATION } void myFunc3(int i) { // TODO: implementing // ok } }CLI:
$ java -jar checkstyle-10.26.1-all.jar -c try_config.xml Test.java Starting audit... [ERROR] /mnt/5D92528E6B945467/test/testing/Test.java:16:7: Comment matches to-do format 'TODO:'. [TodoComment] Audit done. Checkstyle ends with 1 errors. As a part of the fix, we need to add TodoCheck to the google config and validate TODO is all in caps.