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.1.tar.gz
.
File metadata
- Download URL: code-scanner-0.1.1.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7ddb9ccdbf8989bc956076a2fb7bfe52740a71908efa70fd5b417aa124eaaf9 |
|
MD5 | c91c78249f007b8bc29b765bab4efd29 |
|
BLAKE2b-256 | 8053c0112992737ea8e093801088ca2aaf8be16b089fc6478d63709a00e5fb53 |
Provenance
File details
Details for the file code_scanner-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: code_scanner-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.2 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 | 48f4a602052a88ae801fba97f70dfbbf564c3e242e664dd9f38ca85847bf4e12 |
|
MD5 | 6e851f539a86be3e9d3d3c6bf8bd2932 |
|
BLAKE2b-256 | b8a6812fc226d8ad293e5dbb2a14ab637d7280a354d63f4f3d9c41e2af1b9e8d |