A simple code scanner tool
Project description
# Scan Code
A simple command-line tool to recursively scan files in a folder and create a text file containing their content. This tool provides flexibility in excluding specific files or patterns during scanning.
## Usage
`bash python scan.py <folder_path> -o <output_file> [-e <exclude_pattern>] `
<folder_path>: Path to the folder to scan.
-o <output_file>: Output text file name. (default: output.txt)
-e <exclude_pattern>: Patterns to exclude files. You can provide multiple patterns separated by space.
## Excluding Files
Exclusion patterns can be specified in the following ways:
Using `.scanignore` File: Create a .scanignore file in your project directory and list the patterns you want to exclude, one per line.
Example .scanignore content:
` .venv/ .pytest_cache/ output.txt __pycache__/ .git/ `
When the tool is run, it will automatically use these patterns for exclusion.
Command Line Argument: You can also specify exclusion patterns directly via the -e or –exclude option when running the tool.
Example:
`bash python scan.py <folder_path> -o <output_file> -e "*.log" "*.tmp" `
In this example, files with the extensions .log and .tmp will be excluded from the scan.
## Installation and Setup
Clone the repository:
`bash git clone https://github.com/matahariramadhan/scan-code.git cd scan-code `
Create a virtual environment:
`bash python -m venv venv `
This will create a virtual environment named venv in your project directory.
Activate the virtual environment:
On Windows:
`bash venv\Scripts\activate `
On macOS and Linux: `bash source venv/bin/activate `
Your command prompt should now show the virtual environment name, indicating it’s active.
Install project dependencies inside the virtual environment:
`bash pip install -r requirements.txt `
## Running Tests
While the virtual environment is active, you can run tests using pytest:
`bash pytest tests/ `
## Running the Scan Tool
Ensure the virtual environment is active, then you can run the scan tool as described in the Usage section.
## Deactivating the Virtual Environment
When you’re done working on your project, deactivate the virtual environment:
`bash deactivate `
This will return you to your global Python environment.
## Contributors
[Matahari Ramadhan](https://github.com/matahariramadhan)
Feel free to contribute by opening issues or pull requests!
—
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file code-scanner-0.1.0.tar.gz
.
File metadata
- Download URL: code-scanner-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a515ee00db0f8869d798e5aceae613fe1d1880f37144afd8494e0fa15640d7ff |
|
MD5 | 397e55ddf8ffe8528615d908799edccf |
|
BLAKE2b-256 | 7b73bbbaa123def8fff80002d45839188ecf0ea47a1ac7fbee9d2706325329f5 |
File details
Details for the file code_scanner-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: code_scanner-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd922fa87a8ad32f1bc7e8ae0b6e3503ca8457c397c2f5f1a67b7ab7fad406cb |
|
MD5 | 2a089be67d4d013a4132874e6f6f785b |
|
BLAKE2b-256 | 3d569df7fb7a5152755002e82a2551cb1debb3ba7d04f5785c694b75b1095396 |