- ☑️ Scan a project folder
- ☑️ Search for files with a specific extension(s)
- ☑️ Count the total number of files by extension
- ☑️ Count the total sum of lines of code (ignoring empty lines)
- ☑️ Calculate the average, median, and standard deviation of the lines of code
- ☑️ Ignore specified folder(s)
- ☑️ Generate a tiny markdown report
- ☑️ Colorized output
- ☑️ Written in Rust
- Rust. Ensure that Rust is installed on your system. You can install Rust from rust-lang.org.
Clone the repository and build the project:
git clone https://github.com/RustamIrzaev/source-code-scanner.git
cd source-code-scanner
cargo build --release # builds the project
cd target/release # switch to where the executable is placed
./source-code-scanner -f <FOLDER> -e <EXT> # run! (see options below)
Simple run:
./source-code-scanner -f <folder_path> -e <file_extension>
With ignored folders:
./source-code-scanner -f <folder_path> -e <file_extension> -i <folder1>,<folder2>
With hardcoded ignored folders:
./source-code-scanner -f <folder_path> -e <file_extension> --hce
Real example (with report generation and an extended statistics):
./source-code-scanner -f /home/user/projects/my_project -e rs -i target,.git -r -s
-f
/--folder
- the path to a project folder
- usage
-f <folder>
-e
/--extensions
- the file extension of the files to be scanned (comma separated)
- usage
-e <extension1>,<extension2>
-i
/--ignore
- the list of folders to be ignored, comma separated
- usage
-i <folder1>,<folder2>,<folder3>
-r
/--report
: generate a small markdown report (*.md extension)-s
/--stats
: show additional summary statistics (average, median, std deviation)
--hce
: use hardcoded list of ignored folders (see below). Please note that-i
parameter has higher priority than this one--max-depth
- the maximum depth of the folder scanning (default: 10)
- usage
--max-depth <depth>
-V
/--version
: prints the version of the program-h
/--help
: prints the help message
The report is generated in the project folder with the name report_scs.md
.
The demo report is available here.
At this moment, the list of ignored folders are hardcoded:
.idea
, .git
, node_modules
, obj
, bin
, build
, out
, dist
.
However, you can change this directly from the code - see hardcoded.rs
file for a EXCLUDE_FOLDERS_EMBEDDED
slice.
The source code is available under the MIT license. See the LICENSE file for more info.