thailint 0.1.0__tar.gz

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,337 @@
1
+ # Changelog
2
+
3
+ **Purpose**: Version history and release notes for all thailint package versions
4
+
5
+ **Scope**: All public releases, API changes, features, bug fixes, and breaking changes
6
+
7
+ **Overview**: Maintains comprehensive version history following Keep a Changelog format. Documents
8
+ all notable changes in each release including new features, bug fixes, breaking changes,
9
+ deprecations, and security updates. Organized by version with release dates. Supports
10
+ automated changelog extraction for GitHub releases and user upgrade planning.
11
+
12
+ **Dependencies**: Semantic versioning (semver.org), Keep a Changelog format (keepachangelog.com)
13
+
14
+ **Exports**: Release history, upgrade guides, breaking change documentation
15
+
16
+ **Related**: pyproject.toml (version configuration), GitHub releases, docs/releasing.md
17
+
18
+ **Implementation**: Keep a Changelog 1.1.0 format with semantic versioning and organized change categories
19
+
20
+ All notable changes to this project will be documented in this file.
21
+
22
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
23
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
24
+
25
+ ## [Unreleased]
26
+
27
+ ## [0.2.0] - 2025-10-07
28
+
29
+ **Nesting Depth Linter Release** - Adds comprehensive nesting depth analysis for Python and TypeScript code. Includes AST-based analysis with tree-sitter, configurable depth limits, and extensive refactoring patterns. Validated on the thai-lint codebase (zero violations after refactoring 23 functions).
30
+
31
+ ### Added
32
+
33
+ - **Nesting Depth Linter** - Complete nesting depth analysis for Python and TypeScript
34
+ - AST-based depth calculation using Python `ast` module and `tree-sitter-typescript`
35
+ - Configurable `max_nesting_depth` (default: 4, thai-lint uses: 3)
36
+ - Detects excessive nesting in if/for/while/with/try/match (Python) and if/for/while/try/switch (TypeScript)
37
+ - Helpful violation messages with refactoring suggestions
38
+ - Depth calculation starts at 1 for function body (matches industry standards)
39
+
40
+ - **CLI Command: `thai-lint nesting`**
41
+ - `thai-lint nesting [PATH]` - Check files for excessive nesting
42
+ - `--max-depth N` - Override configured max depth
43
+ - `--config PATH` - Use specific config file
44
+ - `--format json/text` - Output format selection
45
+ - `--help` - Comprehensive command documentation
46
+
47
+ - **Library API**
48
+ - `nesting_lint(path, max_nesting_depth=4)` - Convenience function
49
+ - `NestingDepthRule` - Direct rule class for advanced usage
50
+ - `from src import nesting_lint, NestingDepthRule` - Exported in package
51
+
52
+ - **Comprehensive Documentation**
53
+ - `docs/nesting-linter.md` - 400+ line comprehensive guide
54
+ - Configuration examples and best practices
55
+ - 5 refactoring patterns with before/after code examples
56
+ - Case study results and time estimates
57
+ - CI/CD integration examples (GitHub Actions, pre-commit hooks)
58
+ - Troubleshooting guide and common issues
59
+
60
+ - **Example Code**
61
+ - `examples/nesting_usage.py` - Library API usage example
62
+ - Configuration templates in docs
63
+
64
+ - **Test Suite**
65
+ - 76 tests for nesting linter (100% passing)
66
+ - Python nesting tests (15 tests)
67
+ - TypeScript nesting tests (15 tests)
68
+ - Configuration tests (8 tests)
69
+ - Integration tests (12 tests)
70
+ - Edge case tests (8 tests)
71
+ - Total project tests: 317 (100% passing, up from 221)
72
+
73
+ - **Refactoring Patterns Documentation**
74
+ - Guard clauses (early returns) - Used in 7 functions
75
+ - Extract method pattern - Used in 13 functions
76
+ - Dispatch pattern (replace if-elif chains) - Used in 5 functions
77
+ - Flatten error handling - Used in 6 functions
78
+ - Invert conditions - Pattern documented
79
+
80
+ ### Changed
81
+
82
+ - **Code Quality Improvements via Dogfooding**
83
+ - Refactored 23 functions with excessive nesting (18 in src/, 5 in tests/examples)
84
+ - Reduced max nesting depth from 4 to 3 project-wide
85
+ - All functions now comply with strict depth limit
86
+ - Improved readability and maintainability across codebase
87
+ - Zero nesting violations in production code
88
+
89
+ - **Test Coverage**
90
+ - Increased from 87% to 90% overall coverage
91
+ - Added 96 new tests (221 → 317)
92
+ - 100% coverage on nesting analyzer modules
93
+
94
+ - **README Updates**
95
+ - Added comprehensive nesting linter section with examples
96
+ - Updated feature list with nesting capabilities
97
+ - Added refactoring patterns and real-world results
98
+ - Updated test badges (317/317 passing, 90% coverage)
99
+
100
+ - **Dependencies**
101
+ - Added `tree-sitter ^0.25.2` for AST parsing
102
+ - Added `tree-sitter-typescript ^0.23.2` for TypeScript support
103
+ - Pure Python solution (no Node.js required)
104
+
105
+ ### Fixed
106
+
107
+ - Ignore directive parser now supports TypeScript comments (`//` and `/* */`)
108
+ - Block ignore directives (`thailint: ignore-start` / `ignore-end`) working correctly
109
+ - Rule matching supports prefix patterns (e.g., "nesting" matches "nesting.excessive-depth")
110
+
111
+ ### Performance
112
+
113
+ - Single file analysis: ~10-30ms (well under 100ms target)
114
+ - 100 files: ~500ms (under 2s target)
115
+ - 1000 files: ~2-3s (under 10s target)
116
+ - AST parsing optimized with caching
117
+
118
+ ### Documentation
119
+
120
+ - Complete nesting linter guide (`docs/nesting-linter.md`)
121
+ - Updated CLI reference with nesting command
122
+ - Configuration examples for nesting rules
123
+ - 5 refactoring patterns with code examples
124
+ - Codebase refactoring case study
125
+
126
+ ### Validation: Codebase Refactoring
127
+
128
+ **Baseline Assessment:**
129
+ - 23 violations (depth 4, max configured: 3)
130
+ - Files: src/cli.py (6), src/config.py (5), orchestrator (3), others (9)
131
+
132
+ **Refactoring Applied:**
133
+ - Time: ~4 hours for 23 functions (~10 min/function average)
134
+ - Patterns: Extract method (13), Guard clauses (7), Dispatch (5), Flatten (6)
135
+ - Tests: 317/317 passing (100%)
136
+ - Quality: Pylint 10.00/10, all complexity A-grade
137
+
138
+ **Results:**
139
+ - Zero nesting violations
140
+ - Improved code readability
141
+ - No functionality broken
142
+ - All integration tests passing
143
+
144
+ ### Infrastructure
145
+
146
+ - Updated Makefile with `make lint-nesting` target
147
+ - Integrated nesting checks into `make lint-full`
148
+ - CI/CD ready (proper exit codes and JSON output)
149
+
150
+ ## [0.1.0] - 2025-10-06
151
+
152
+ **Initial Alpha Release**
153
+
154
+ ### Breaking Changes
155
+
156
+ **Configuration Format Update**: Multi-Linter Top-Level Sections
157
+
158
+ The configuration format has been restructured to support multiple linters with separate top-level sections. This prepares the project for future linters while maintaining a clean separation of concerns.
159
+
160
+ **Old Format** (v0.1.0 and earlier):
161
+ ```yaml
162
+ # .thailint.yaml
163
+ directories:
164
+ src/:
165
+ allow:
166
+ - "^src/.*\\.py$"
167
+ global_patterns:
168
+ deny:
169
+ - pattern: ".*\\.tmp$"
170
+ reason: "No temp files"
171
+ ```
172
+
173
+ **New Format** (v0.2.0+):
174
+ ```yaml
175
+ # .thailint.yaml
176
+ file-placement:
177
+ directories:
178
+ src/:
179
+ allow:
180
+ - "^src/.*\\.py$"
181
+ global_patterns:
182
+ deny:
183
+ - pattern: ".*\\.tmp$"
184
+ reason: "No temp files"
185
+ ```
186
+
187
+ **Migration Steps**:
188
+ 1. Wrap your entire file-placement configuration under a `file-placement:` top-level key
189
+ 2. Use hyphens (`file-placement`) not underscores (`file_placement`)
190
+ 3. Indent all existing configuration one level
191
+ 4. Update any `.thailint.json` files similarly
192
+
193
+ **Rationale**: This change allows multiple linters to coexist cleanly. Future linters like `code-quality:` and `security:` will have their own top-level sections, following the pattern of tools like `pyproject.toml`.
194
+
195
+ ### Added
196
+ - Example configuration files (`.thailint.yaml.example`, `.thailint.json.example`)
197
+ - Documentation for multi-linter configuration format
198
+
199
+ ### Changed
200
+ - Configuration schema now uses top-level linter sections
201
+ - File placement linter looks for config under `file-placement` key (hyphen, not underscore)
202
+
203
+ ### Deprecated
204
+ - Old flat configuration format (still works in v0.1.x but will be removed in v1.0.0)
205
+
206
+ ## [0.1.0] - 2025-10-06
207
+
208
+ **Initial Alpha Release** - This release represents early development status. Core features are functional but the API and configuration formats may change in future releases. Suitable for testing and evaluation.
209
+
210
+ ### Added
211
+ - **Core Framework**: Pluggable linter architecture with base interfaces and rule registry
212
+ - `BaseLintRule` and `BaseLintContext` abstractions
213
+ - Automatic plugin discovery via `RuleRegistry`
214
+ - Binary severity model (ERROR only)
215
+ - Violation dataclass with file, line, rule_id, message, severity
216
+
217
+ - **Configuration System**: Multi-format config loading with 5-level ignore system
218
+ - YAML and JSON config file support
219
+ - 5-level ignore directives (repo, directory, file, method, line)
220
+ - Wildcard rule matching for flexible ignore patterns
221
+ - Config validation and error reporting
222
+
223
+ - **Multi-Language Orchestrator**: File routing and language detection engine
224
+ - Extension-based language detection with shebang fallback
225
+ - Per-language linter routing and execution
226
+ - Context creation and violation aggregation
227
+ - Recursive directory scanning
228
+
229
+ - **File Placement Linter**: Complete file organization linter
230
+ - Pattern-based allow/deny rules with regex support
231
+ - Directory scoping for targeted enforcement
232
+ - Configurable via YAML/JSON with validation
233
+ - Helpful violation suggestions based on file type
234
+ - 81% test coverage, 42/50 tests passing
235
+
236
+ - **CLI Interface**: Professional command-line interface
237
+ - `thailint lint file-placement [PATH]` command
238
+ - Inline JSON rules via `--rules` flag
239
+ - External config via `--config` flag
240
+ - Text and JSON output formats (`--format`)
241
+ - Recursive and non-recursive scanning modes
242
+ - Proper exit codes (0=pass, 1=violations, 2=error)
243
+
244
+ - **Library API**: High-level programmatic interface
245
+ - `Linter` class with config_file and project_root parameters
246
+ - `lint(path, rules=[...])` method for filtered linting
247
+ - Autodiscovery of config files in project root
248
+ - Direct linter imports for backwards compatibility
249
+ - Usage examples (basic, advanced, CI integration)
250
+
251
+ - **Docker Support**: Production-ready containerization
252
+ - Multi-stage Dockerfile with optimized layers
253
+ - Non-root user execution (UID 1000)
254
+ - Volume mounting at `/workspace`
255
+ - 270MB image size (Python 3.11-slim)
256
+ - docker-compose.yml for development workflows
257
+
258
+ - **PyPI Distribution**: Complete packaging and publishing setup
259
+ - PyPI-ready package metadata with classifiers
260
+ - GitHub Actions workflow for automated publishing
261
+ - PyPI Trusted Publishing (OIDC) configuration
262
+ - Automated GitHub releases with changelog extraction
263
+ - MANIFEST.in for clean source distributions
264
+
265
+ - **Comprehensive Testing**: TDD-driven test suite
266
+ - 181+ unit and integration tests
267
+ - 87% overall test coverage
268
+ - pytest with coverage reporting
269
+ - Docker integration tests
270
+
271
+ - **Development Tooling**: Complete quality assurance stack
272
+ - Ruff (linting and formatting)
273
+ - MyPy (strict type checking)
274
+ - Pylint (comprehensive linting)
275
+ - Bandit (security scanning)
276
+ - Xenon (complexity analysis)
277
+ - Pre-commit hooks for quality gates
278
+
279
+ ### Changed
280
+ - Package name: `thai-lint` → `thailint` (PyPI-friendly)
281
+ - CLI command: `thai-lint` → `thailint` (both supported for compatibility)
282
+
283
+ ### Documentation
284
+ - Comprehensive README with installation and usage guides
285
+ - API examples for library usage
286
+ - Docker usage documentation
287
+ - Release process documentation (docs/releasing.md)
288
+ - AI agent guides (.ai/ directory)
289
+
290
+ ### Infrastructure
291
+ - GitHub Actions CI/CD pipelines (test, lint, security)
292
+ - Pre-commit hooks for automated quality checks
293
+ - Poetry-based dependency management
294
+ - Docker multi-stage builds
295
+
296
+ ## [0.0.1] - Initial Development
297
+
298
+ ### Added
299
+ - Basic project structure
300
+ - Poetry configuration
301
+ - Initial CLI scaffold
302
+
303
+ ---
304
+
305
+ ## Version History
306
+
307
+ - **0.1.0** (2025-10-06): Initial alpha release with core feature set
308
+ - **0.0.1**: Initial development version
309
+
310
+ ## Upgrade Guide
311
+
312
+ ### Using Version 0.1.0 (Alpha Release)
313
+
314
+ This is an early alpha release for testing and feedback. Key notes:
315
+
316
+ 1. **CLI Command**: Use `thailint` instead of `thai-lint` (both work)
317
+ 2. **Package Name**: Install as `pip install thailint`
318
+ 3. **Library Import**: Use `from thailint import Linter`
319
+
320
+ ## Contributing
321
+
322
+ When adding entries to this changelog:
323
+
324
+ 1. Add changes to `[Unreleased]` section during development
325
+ 2. Move to versioned section when releasing
326
+ 3. Use categories: Added, Changed, Deprecated, Removed, Fixed, Security
327
+ 4. Include user-facing changes only (not internal refactors)
328
+ 5. Link to issues/PRs when relevant
329
+ 6. Follow Keep a Changelog format
330
+
331
+ ## Links
332
+
333
+ - [PyPI Package](https://pypi.org/project/thailint/)
334
+ - [GitHub Repository](https://github.com/steve-e-jackson/thai-lint)
335
+ - [Issue Tracker](https://github.com/steve-e-jackson/thai-lint/issues)
336
+ - [Keep a Changelog](https://keepachangelog.com/)
337
+ - [Semantic Versioning](https://semver.org/)
thailint-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Steve Jackson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.