code-analyzerx v1.0.0
Code Analyzer
A command-line tool to analyze code files and provide detailed statistics such as line count, word count, comment count, and code complexity.
Features
- Line Count: Total lines and non-empty lines in the file.
 - Word Count: Total words in the file.
 - Character Count: Total characters in the file.
 - Comment Count: Number of single-line and multi-line comments.
 - Keyword Frequency: Frequency of common keywords (e.g., 
if,else,for,function). - Function Detection: List of detected functions in the file.
 - Code Complexity: Number of conditionals and loops.
 - Export Results: Save analysis results to a JSON file.
 - Visual Appeal: Colorful console output and formatted tables.
 
Installation
You can install the package globally using npm:
npm install -g code-analyzerUsage
Run the tool from the command line by passing the path to the file you want to analyze:
code-analyzer <file-path>Example
code-analyzer ./src/index.jsOutput
Code Analysis Results:
File Path: ./src/index.js
File Type: .js
Total Lines: 120
Non-Empty Lines: 90
Total Words: 500
Total Characters: 3000
Comment Count: 15
Code Complexity (Conditionals/Loops): 8
Keyword Frequency: { if: 5, else: 3, for: 2, while: 1, function: 4, return: 3, const: 10, let: 5, var: 0 }
Functions Detected: 'main', 'calculate', 'render'
Summary:
Most Frequent Keyword: const (10 occurrences) Total Functions Detected: 3 Code Complexity Rating: Medium Analysis completed in 0.45 seconds.
## Options
- `--verbose`: Display additional details, such as the full list of comments.
- `--export-csv`: Export results to a CSV file.
- `--help`: Show usage instructions.
### Example with Options
```bash
code-analyzer ./src/index.js --verbose --export-csvDevelopment
Installation
Clone the repository:
git clone https://github.com/elyashium/CLI-code_analyserNavigate to the project directory:
cd code-analyzerInstall dependencies:
npm installRunning Locally
To test the package locally, use npm link:
npm linkThen run the tool:
code-analyzer ./path/to/your/file.jsContributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
 Create a new branch:
git checkout -b feature/your-featureCommit your changes:
git commit -m "Add your feature"Push to the branch:
git push origin feature/your-featureOpen a pull request.
Dependencies
- chalk: For colorful console output.
 
License
This project is licensed under the MIT License. See the LICENSE file for details.
Author
Your Name
GitHub 
Support
If you find this tool useful, consider giving it a ⭐️ on GitHub!
8 months ago