Production-grade code normalization tool for encoding, newlines, and whitespace hygiene.
Project description
code-normalizer-pro
code-normalizer-pro is a Python CLI for code normalization, whitespace cleanup, line ending normalization, and encoding normalization across entire repositories.
It helps clean source trees by converting supported text files to UTF-8, normalizing CRLF/LF line endings, removing trailing whitespace, and enforcing a final newline. It is designed for codebase cleanup, CI preparation, refactoring prep, and repository hygiene.
Install
pip install code-normalizer-pro
Quick Start
Preview changes:
code-normalizer-pro . --dry-run -e .py
Apply changes in place:
code-normalizer-pro . --in-place -e .py
Run syntax checks after normalization:
code-normalizer-pro . --dry-run -e .py --check
What This Tool Is For
Use code-normalizer-pro when you need:
- code normalization across a repository
- encoding normalization to UTF-8
- line ending normalization to LF
- whitespace cleanup before commits
- consistent source files before CI or refactoring
- reduced diff noise in Git history
Features
- UTF-8 normalization for supported text encodings
- line ending normalization
- trailing whitespace removal
- final newline enforcement
- dry-run mode
- in-place normalization
- extension filtering
- parallel processing
- incremental caching
- interactive approval mode
- optional syntax checking
- git pre-commit hook installation
Common Workflows
Normalize a full project:
code-normalizer-pro . --in-place
Normalize only Python and JavaScript files:
code-normalizer-pro . -e .py -e .js --in-place
Use parallel processing on a larger codebase:
code-normalizer-pro . --parallel --in-place
Install the pre-commit hook:
code-normalizer-pro --install-hook
Before and After
Before:
def add(a, b):
return a + b
After:
def add(a, b):
return a + b
CLI Options
| Option | Description |
|---|---|
--dry-run |
preview changes without writing files |
--in-place |
modify files directly |
--check |
run syntax validation |
--parallel |
enable multi-core processing |
--workers |
set worker count |
--interactive |
approve changes per file |
--no-cache |
disable incremental cache |
--no-backup |
disable backups |
--install-hook |
install a git pre-commit hook |
-e, --ext |
process only specific extensions |
-v, --verbose |
show detailed output |
Safety
- deterministic, non-semantic cleanup only
- binary files are skipped
- dry-run mode allows safe preview
- backups are enabled by default for in-place edits
- syntax checks can validate normalized output
Supported Encodings
- utf-8
- utf-8-sig
- utf-16
- utf-16-le
- utf-16-be
- windows-1252
- latin-1
- iso-8859-1
Supported Syntax Checks
- Python
- JavaScript
- TypeScript
- Go
- Rust
- C
- C++
- Java
Use Cases
- cleaning legacy repositories
- standardizing source files before CI
- preparing code for linting or formatting
- reducing whitespace-only diffs
- improving repository hygiene for teams
- normalizing files before AI-assisted code workflows
License
MIT License
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file code_normalizer_pro-3.0.4.tar.gz.
File metadata
- Download URL: code_normalizer_pro-3.0.4.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5990c06b4d847fa402bd12f03b45b849bde3f7c0098b9ec56c74799a6653f4e
|
|
| MD5 |
85d7b49f65743b0f4e487bef93c8115b
|
|
| BLAKE2b-256 |
a98e7a6940268d60a604fde871eb8c383cbbdea6ca9fb265697cd48d431ea363
|
File details
Details for the file code_normalizer_pro-3.0.4-py3-none-any.whl.
File metadata
- Download URL: code_normalizer_pro-3.0.4-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a6c73ee77f7aba4c12d09bedd897aff887005b3b0719d5120c4ae69189f55bc
|
|
| MD5 |
f12a0007f822537cd36e33cd414e69f3
|
|
| BLAKE2b-256 |
61c53ce26dadb5c8184154411e3ebe0848fd0b8b7ef7aa58eb0ae319e9256554
|