Blinter 1.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Blinter
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: Blinter is a linter for Windows batch files. It provides comprehensive static analysis to identify syntax errors, security vulnerabilities, performance issues and style problems.
|
|
5
|
+
Author-email: tboy1337 <check@my-website.com>
|
|
6
|
+
Maintainer-email: tboy1337 <check@my-website.com>
|
|
7
|
+
License: CRL
|
|
8
|
+
Project-URL: Homepage, https://github.com/tboy1337/Blinter
|
|
9
|
+
Project-URL: Documentation, https://github.com/tboy1337/Blinter
|
|
10
|
+
Project-URL: Repository, https://github.com/tboy1337/Blinter.git
|
|
11
|
+
Project-URL: Issues, https://github.com/tboy1337/Blinter/issues
|
|
12
|
+
Keywords: lint,python,windows,analysis,script,linting,linter,static-analysis,static,batch,batch-file,cmd,batch-script,batchfile,bat,script-analysis
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: Other/Proprietary License
|
|
16
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
24
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
25
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
26
|
+
Classifier: Topic :: System :: Systems Administration
|
|
27
|
+
Classifier: Environment :: Console
|
|
28
|
+
Requires-Python: >=3.9
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE.md
|
|
31
|
+
Requires-Dist: chardet
|
|
32
|
+
Provides-Extra: dev
|
|
33
|
+
Requires-Dist: pytest; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-timeout; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-xdist; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-mock; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
39
|
+
Requires-Dist: pytest-html; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-json-report; extra == "dev"
|
|
41
|
+
Requires-Dist: pytest-benchmark; extra == "dev"
|
|
42
|
+
Requires-Dist: pytest-rerunfailures; extra == "dev"
|
|
43
|
+
Requires-Dist: pylint; extra == "dev"
|
|
44
|
+
Requires-Dist: mypy; extra == "dev"
|
|
45
|
+
Requires-Dist: autopep8; extra == "dev"
|
|
46
|
+
Requires-Dist: black; extra == "dev"
|
|
47
|
+
Requires-Dist: isort; extra == "dev"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+
# Blinter ๐
|
|
51
|
+
|
|
52
|
+
**Blinter** is a linter for Windows batch files (`.bat` and `.cmd`). It provides comprehensive static analysis to identify syntax errors, security vulnerabilities, performance issues and style problems. Blinter helps you write safer, more reliable and maintainable batch scripts. Even in 2025, batch files deserve professional tooling! ๐ป
|
|
53
|
+
|
|
54
|
+
- โ
**Configurable Options** - Configurable rules, logging, robust error handling
|
|
55
|
+
- โ
**Unicode Support** - Support for international characters and filenames
|
|
56
|
+
- โ
**Performance Optimized** - Handles large files (10MB+) efficiently
|
|
57
|
+
|
|
58
|
+
## Features โจ
|
|
59
|
+
|
|
60
|
+
### ๐ **Rule Categories**
|
|
61
|
+
- **114 Built-in Rules** across 5 severity levels
|
|
62
|
+
- **Error Level (E001-E999)**: Critical syntax errors that prevent execution
|
|
63
|
+
- **Warning Level (W001-W999)**: Potential runtime issues and bad practices
|
|
64
|
+
- **Style Level (S001-S999)**: Code formatting and readability improvements
|
|
65
|
+
- **Security Level (SEC001+)**: Security vulnerabilities and dangerous operations
|
|
66
|
+
- **Performance Level (P001-P999)**: Optimization opportunities and efficiency improvements
|
|
67
|
+
|
|
68
|
+
๐ **For complete rule descriptions with examples and implementation details, see [docs/Batch-File-Linter-Requirements.md](docs/Batch-File-Linter-Requirements.md)**
|
|
69
|
+
|
|
70
|
+
### ๐ **Output Format**
|
|
71
|
+
- **Rule Codes**: Each issue has a unique identifier (e.g., E002, W005, SEC003)
|
|
72
|
+
- **Clear Explanations**: Detailed descriptions of why each issue matters
|
|
73
|
+
- **Actionable Recommendations**: Specific guidance on how to fix problems
|
|
74
|
+
- **Line-by-Line Analysis**: Precise location of every issue
|
|
75
|
+
- **Context Information**: Additional details about detected problems
|
|
76
|
+
|
|
77
|
+
### ๐ **Advanced Analysis**
|
|
78
|
+
- **Static Code Analysis**: Detects unreachable code and logic errors
|
|
79
|
+
- **Advanced Variable Expansion**: Validates percent-tilde syntax (%~n1), string operations, and SET /A arithmetic
|
|
80
|
+
- **Command-Specific Validation**: FOR loop variations, IF statement best practices, deprecated command detection
|
|
81
|
+
- **Variable Tracking**: Identifies undefined variables and unsafe usage patterns
|
|
82
|
+
- **Security Scanning**: Path traversal attacks, command injection risks, unsafe temp file creation
|
|
83
|
+
- **Performance Optimization**: DIR flag optimization, unnecessary output detection, string operation efficiency
|
|
84
|
+
- **Cross-Platform Compatibility**: Warns about Windows version issues and deprecated commands
|
|
85
|
+
- **Large File Handling**: Efficiently processes files up to 10MB+ with performance warnings
|
|
86
|
+
- **Robust Encoding Detection**: Handles UTF-8, UTF-16, Latin-1 and 6 more encoding formats
|
|
87
|
+
|
|
88
|
+
## Installation ๐ ๏ธ
|
|
89
|
+
|
|
90
|
+
### Prerequisites
|
|
91
|
+
- **Python 3.9+** (required)
|
|
92
|
+
|
|
93
|
+
### Quick Install
|
|
94
|
+
|
|
95
|
+
1. Clone the repository:
|
|
96
|
+
```cmd
|
|
97
|
+
git clone https://github.com/tboy1337/Blinter.git
|
|
98
|
+
cd Blinter
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
2. (Optional) Create a virtual environment:
|
|
102
|
+
```cmd
|
|
103
|
+
python -m venv venv
|
|
104
|
+
venv\Scripts\activate
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
3. (Optional but recommended) Install dependencies:
|
|
108
|
+
```cmd
|
|
109
|
+
pip install -r requirements.txt
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Usage ๐
|
|
113
|
+
|
|
114
|
+
### Basic Usage
|
|
115
|
+
|
|
116
|
+
```cmd
|
|
117
|
+
# Analyze a single batch file
|
|
118
|
+
python blinter.py script.bat
|
|
119
|
+
|
|
120
|
+
# Analyze all batch files in a directory (recursive)
|
|
121
|
+
python blinter.py /path/to/batch/files
|
|
122
|
+
|
|
123
|
+
# Analyze batch files in directory only (non-recursive)
|
|
124
|
+
python blinter.py /path/to/batch/files --no-recursive
|
|
125
|
+
|
|
126
|
+
# Analyze with summary
|
|
127
|
+
python blinter.py script.bat --summary
|
|
128
|
+
|
|
129
|
+
# Get help
|
|
130
|
+
python blinter.py --help
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Command Line Options
|
|
134
|
+
|
|
135
|
+
- `<path>`: Path to a batch file (`.bat` or `.cmd`) OR directory containing batch files
|
|
136
|
+
- `--summary`: Display summary statistics of issues found
|
|
137
|
+
- `--severity`: Show detailed severity level breakdown (always included)
|
|
138
|
+
- `--no-recursive`: When processing directories, only analyze files in the specified directory (not subdirectories)
|
|
139
|
+
- `--help`: Show help menu and rule categories
|
|
140
|
+
|
|
141
|
+
### ๐ **Programmatic API Usage**
|
|
142
|
+
|
|
143
|
+
Blinter provides a powerful Python API for integration into your applications:
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
import blinter
|
|
147
|
+
|
|
148
|
+
# Basic usage
|
|
149
|
+
issues = blinter.lint_batch_file("script.bat")
|
|
150
|
+
for issue in issues:
|
|
151
|
+
print(f"Line {issue.line_number}: {issue.rule.name} ({issue.rule.code})")
|
|
152
|
+
print(f" {issue.rule.explanation}")
|
|
153
|
+
print(f" Fix: {issue.rule.recommendation}")
|
|
154
|
+
|
|
155
|
+
# Advanced configuration
|
|
156
|
+
issues = blinter.lint_batch_file(
|
|
157
|
+
"script.bat",
|
|
158
|
+
max_line_length=100, # Custom line length limit
|
|
159
|
+
enable_style_rules=False, # Disable style checks
|
|
160
|
+
enable_performance_rules=True # Keep performance checks
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
# Thread-safe design allows safe concurrent usage
|
|
164
|
+
# You can implement your own concurrent processing if needed
|
|
165
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
166
|
+
|
|
167
|
+
files = ["script1.bat", "script2.cmd", "script3.bat"]
|
|
168
|
+
with ThreadPoolExecutor(max_workers=4) as executor:
|
|
169
|
+
results = list(executor.map(blinter.lint_batch_file, files))
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### ๐ง **Configuration Options**
|
|
173
|
+
|
|
174
|
+
| Parameter | Type | Default | Description |
|
|
175
|
+
|-----------|------|---------|-------------|
|
|
176
|
+
| `file_path` | `str` | Required | Path to batch file to analyze |
|
|
177
|
+
| `max_line_length` | `int` | `120` | Maximum line length for S011 rule |
|
|
178
|
+
| `enable_style_rules` | `bool` | `True` | Enable/disable style-related rules |
|
|
179
|
+
| `enable_performance_rules` | `bool` | `True` | Enable/disable performance rules |
|
|
180
|
+
|
|
181
|
+
*Note: Security rules are always enabled for safety.*
|
|
182
|
+
|
|
183
|
+
### Supported File Types
|
|
184
|
+
- `.bat` files (traditional batch files)
|
|
185
|
+
- `.cmd` files (recommended for modern Windows)
|
|
186
|
+
- **Unicode filenames** and international characters supported
|
|
187
|
+
- **Large files** (10MB+) handled efficiently with performance monitoring
|
|
188
|
+
|
|
189
|
+
### ๐ **Directory Processing**
|
|
190
|
+
|
|
191
|
+
Blinter can analyze entire directories of batch files with powerful options:
|
|
192
|
+
|
|
193
|
+
- **Recursive Analysis**: Automatically finds and processes all `.bat` and `.cmd` files in directories and subdirectories
|
|
194
|
+
- **Non-Recursive Mode**: Use `--no-recursive` to analyze only files in the specified directory
|
|
195
|
+
- **Batch Processing**: Handles multiple files efficiently with consolidated reporting
|
|
196
|
+
- **Error Resilience**: Continues processing other files even if some files have encoding or permission issues
|
|
197
|
+
- **Progress Tracking**: Shows detailed results for each file plus combined summary statistics
|
|
198
|
+
|
|
199
|
+
**Examples:**
|
|
200
|
+
```cmd
|
|
201
|
+
# Analyze all batch files in project directory and subdirectories
|
|
202
|
+
python blinter.py ./my-batch-scripts
|
|
203
|
+
|
|
204
|
+
# Analyze only batch files in current directory (no subdirectories)
|
|
205
|
+
python blinter.py . --no-recursive
|
|
206
|
+
|
|
207
|
+
# Get combined summary for entire directory
|
|
208
|
+
python blinter.py ./scripts --summary
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## ๐ฅ **Integration Example**
|
|
212
|
+
|
|
213
|
+
### CI/CD Integration
|
|
214
|
+
```yaml
|
|
215
|
+
# Example GitHub Actions workflow
|
|
216
|
+
- name: Lint Batch Files
|
|
217
|
+
run: |
|
|
218
|
+
python -c "
|
|
219
|
+
import blinter
|
|
220
|
+
import sys
|
|
221
|
+
issues = blinter.lint_batch_file('deploy.bat')
|
|
222
|
+
errors = [i for i in issues if i.rule.severity.value == 'Error']
|
|
223
|
+
if errors:
|
|
224
|
+
print(f'Found {len(errors)} critical errors!')
|
|
225
|
+
sys.exit(1)
|
|
226
|
+
print(f'โ
Batch file passed with {len(issues)} total issues')
|
|
227
|
+
"
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Contributing ๐ค
|
|
231
|
+
|
|
232
|
+
**Contributions are welcome!**
|
|
233
|
+
|
|
234
|
+
### Ways to Contribute
|
|
235
|
+
- ๐ Report bugs or issues
|
|
236
|
+
- ๐ก Suggest new rules or features
|
|
237
|
+
- ๐ Improve documentation
|
|
238
|
+
- ๐งช Add test cases
|
|
239
|
+
- ๐ง Submit bug fixes or enhancements
|
|
240
|
+
|
|
241
|
+
## License ๐
|
|
242
|
+
|
|
243
|
+
This project is licensed under the CRL License - see [LICENSE.md](./LICENSE.md) for details.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
blinter.py,sha256=5rvlIkYNjYR9jVCQZi4M4UIkJpVmYnKFddmw9TQhI2E,158354
|
|
2
|
+
blinter-1.0.2.dist-info/licenses/LICENSE.md,sha256=NYP65MjIOiBIzSEUIwUQw56lJYkP_7nGPFfgIgyl-iI,3035
|
|
3
|
+
blinter-1.0.2.dist-info/METADATA,sha256=XZfzkjkBOLnQ571JuG9idb9Q46eErrSm32QxcCj1wFQ,9553
|
|
4
|
+
blinter-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
blinter-1.0.2.dist-info/entry_points.txt,sha256=rkLMjl2Ejrf1wbd1Z7EYXekuaQohDVF-GC7GwM4LG4Y,41
|
|
6
|
+
blinter-1.0.2.dist-info/top_level.txt,sha256=LCBquhrhgiIfOiECNjdsL1L0c5NMbk61N8GDq7Mu7Uo,8
|
|
7
|
+
blinter-1.0.2.dist-info/RECORD,,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Commercial Restricted License (CRL)
|
|
2
|
+
|
|
3
|
+
**Version 1.1**
|
|
4
|
+
|
|
5
|
+
**Copyright (c) 2025 tboy1337**
|
|
6
|
+
|
|
7
|
+
## Grant of Rights
|
|
8
|
+
|
|
9
|
+
Subject to the terms and conditions of this license, the copyright holder grants you a worldwide, royalty-free, non-exclusive license to use, copy, modify, and distribute this software and associated documentation files (the "Software") for **Non-Commercial Use** only.
|
|
10
|
+
|
|
11
|
+
## Definitions
|
|
12
|
+
|
|
13
|
+
**"Non-Commercial Use"** means use of the Software that is not primarily intended for or directed toward commercial advantage or monetary compensation. Non-Commercial Use includes:
|
|
14
|
+
|
|
15
|
+
- Personal use, learning, and experimentation
|
|
16
|
+
- Academic research and education
|
|
17
|
+
- Open source projects that are not monetized
|
|
18
|
+
- Internal evaluation within a commercial organization (limited to 30 days)
|
|
19
|
+
- Use by registered non-profit organizations for their non-profit activities
|
|
20
|
+
|
|
21
|
+
**"Commercial Use"** means any use of the Software that is primarily intended for or directed toward commercial advantage or monetary compensation, including but not limited to:
|
|
22
|
+
|
|
23
|
+
- Use in any product or service that generates revenue
|
|
24
|
+
- Use by for-profit organizations in their business operations
|
|
25
|
+
- Integration into commercial software or services
|
|
26
|
+
- Use in providing paid consulting, support, or services
|
|
27
|
+
- Use in any business process that contributes to revenue generation
|
|
28
|
+
- Use by organizations with annual revenue exceeding $100,000 USD
|
|
29
|
+
|
|
30
|
+
**Note:** Any Commercial Use of the Software requires a separate commercial license from the copyright holder.
|
|
31
|
+
|
|
32
|
+
## Conditions
|
|
33
|
+
|
|
34
|
+
For Non-Commercial Use, you may:
|
|
35
|
+
|
|
36
|
+
- Use, copy, and modify the Software
|
|
37
|
+
- Distribute copies of the Software
|
|
38
|
+
- Distribute your modifications under this same license
|
|
39
|
+
|
|
40
|
+
You must:
|
|
41
|
+
|
|
42
|
+
- Include this license notice in all copies or substantial portions of the Software
|
|
43
|
+
- Not remove or alter any copyright notices
|
|
44
|
+
|
|
45
|
+
## Restrictions
|
|
46
|
+
|
|
47
|
+
You may not:
|
|
48
|
+
|
|
49
|
+
- Use the Software for Commercial Use without a commercial license
|
|
50
|
+
- Sublicense the Software under different terms
|
|
51
|
+
- Use the Software in any way that violates applicable laws
|
|
52
|
+
- Remove, obscure, or modify any licensing, copyright, or other legal notices
|
|
53
|
+
|
|
54
|
+
## No Warranty
|
|
55
|
+
|
|
56
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
57
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
58
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
59
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
60
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
61
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
62
|
+
SOFTWARE.
|
|
63
|
+
|
|
64
|
+
## Termination
|
|
65
|
+
|
|
66
|
+
This license terminates automatically if you violate any of its terms. Upon termination, you must cease all use and distribution of the Software and destroy all copies in your possession.
|
|
67
|
+
|
|
68
|
+
## Governing Law
|
|
69
|
+
|
|
70
|
+
This license shall be governed by and construed in accordance with the laws of the United Kingdom, without regard to its conflict of law provisions.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
blinter
|