Comet is a command-line tool for scanning, managing, and documenting code comments across multiple languages. It helps developers detect, remove, or export comments with ease—keeping code clean, consistent, and well-documented.
- Multi-Language Support: Detects comments in various programming languages (Go, Python, C, and more) based on file type.
- Automatic Documentation: Saves all comments in a structured format in
comments.txt, including file paths and line numbers. - Optional Comment Removal: Prompts you to remove comments during the scan process, with a simple "yes/no" option.
- Directory Scanning: Easily scan an entire project or specific directory for comments.
Comet automatically identifies comments based on file type, using the correct delimiter:
| Language | Extension | Comment Syntax |
|---|---|---|
| Go | .go |
// |
| Python | .py |
# |
| C | .c |
//, /*...*/ |
| Java | .java |
//, /*...*/ |
Additional languages can be easily configured as needed.
-
Clone the Repository
git clone https://github.com/anandukch/comet.git cd comet -
Install Dependencies Ensure you have Go installed on your system. Run:
go mod tidy
-
Build the CLI
go build
Run Comet to scan for comments in the current directory:
./cometProvide a project path to scan for comments in that specific folder:
./comet /path/to/your/projectAfter scanning, Comet will generate a comments.txt file in the project root with a structured list of comments:
/path/to/your/file.go
Line 3: // This is a comment
Line 15: // Another comment
/path/to/your/file.py
Line 8: # Python comment exampleWhen prompted, you can remove all detected comments by typing "y" (or keep them by typing "n"). This removes comments directly from the files scanned.
Starting comment scan in directory: /path/to/your/project
Comment found at /path/to/your/file.go:3 - // Initial setup
Comment found at /path/to/your/file.go:15 - // Deprecated function
Would you like to remove the comments? (y/n): y
Comments removed and saved to comments.txt