https://github.com/copyleaks/token-counter
Simple script to forecast credits usage for source code scans on Copyleaks
https://github.com/copyleaks/token-counter
Last synced: 9 months ago
JSON representation
Simple script to forecast credits usage for source code scans on Copyleaks
- Host: GitHub
- URL: https://github.com/copyleaks/token-counter
- Owner: Copyleaks
- License: bsd-2-clause
- Created: 2024-05-26T12:39:45.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-19T14:03:05.000Z (almost 2 years ago)
- Last Synced: 2025-10-13T15:38:51.833Z (9 months ago)
- Language: Python
- Size: 11.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Token Counter
Token Counter is a python script written by Copyleaks, to forecast credits usage for source code scans on the Copyleaks platform.
## Help
```bash
python3 main.py -h
output:
usage: main.py [-h] --directory DIRECTORY
options:
-h, --help show this help message and exit
--directory DIRECTORY, -d DIRECTORY
Directory to scan for source code files
```
## Usage
```bash
python3 main.py -d CODE_DIRECTORY
```
## Example
```bash
python3 main.py -d CODE_DIRECTORY
```
output:
```bash
74 files found
*.py:
Files: 36
Tokens: 36,960
Average Token count: 1,027
*.cs:
Files: 21
Tokens: 9,301
Average Token count: 443
*.java:
Files: 2
Tokens: 6,189
Average Token count: 3,095
*.js:
Files: 5
Tokens: 937
Average Token count: 188
*.css:
Files: 1
Tokens: 125
Average Token count: 125
*.php:
Files: 2
Tokens: 576
Average Token count: 288
*.rb:
Files: 2
Tokens: 247
Average Token count: 124
*.scala:
Files: 2
Tokens: 664
Average Token count: 332
*.swift:
Files: 2
Tokens: 1,157
Average Token count: 579
```