thailint 0.4.0__py3-none-any.whl → 0.4.1__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.
@@ -33,6 +33,7 @@ class MagicNumberConfig:
33
33
  default_factory=lambda: {-1, 0, 1, 2, 3, 4, 5, 10, 100, 1000}
34
34
  )
35
35
  max_small_integer: int = 10
36
+ ignore: list[str] = field(default_factory=list)
36
37
 
37
38
  def __post_init__(self) -> None:
38
39
  """Validate configuration values."""
@@ -69,8 +70,13 @@ class MagicNumberConfig:
69
70
  )
70
71
  max_small_integer = config.get("max_small_integer", 10)
71
72
 
73
+ ignore_patterns = config.get("ignore", [])
74
+ if not isinstance(ignore_patterns, list):
75
+ ignore_patterns = []
76
+
72
77
  return cls(
73
78
  enabled=config.get("enabled", True),
74
79
  allowed_numbers=allowed_numbers,
75
80
  max_small_integer=max_small_integer,
81
+ ignore=ignore_patterns,
76
82
  )
@@ -24,6 +24,7 @@ Implementation: Composition pattern with helper classes, AST-based analysis with
24
24
  """
25
25
 
26
26
  import ast
27
+ from pathlib import Path
27
28
 
28
29
  from src.core.base import BaseLintContext, MultiLanguageLintRule
29
30
  from src.core.linter_utils import load_linter_config
@@ -98,6 +99,48 @@ class MagicNumberRule(MultiLanguageLintRule): # thailint: ignore[srp]
98
99
  return None
99
100
  return load_linter_config(context, "magic_numbers", MagicNumberConfig)
100
101
 
102
+ def _is_file_ignored(self, context: BaseLintContext, config: MagicNumberConfig) -> bool:
103
+ """Check if file matches ignore patterns.
104
+
105
+ Args:
106
+ context: Lint context
107
+ config: Magic numbers configuration
108
+
109
+ Returns:
110
+ True if file should be ignored
111
+ """
112
+ if not config.ignore:
113
+ return False
114
+
115
+ if not context.file_path:
116
+ return False
117
+
118
+ file_path = Path(context.file_path)
119
+ for pattern in config.ignore:
120
+ if self._matches_pattern(file_path, pattern):
121
+ return True
122
+ return False
123
+
124
+ def _matches_pattern(self, file_path: Path, pattern: str) -> bool:
125
+ """Check if file path matches a glob pattern.
126
+
127
+ Args:
128
+ file_path: Path to check
129
+ pattern: Glob pattern (e.g., "test/**", "**/test_*.py", "specific/file.py")
130
+
131
+ Returns:
132
+ True if path matches pattern
133
+ """
134
+ # Try glob pattern matching first (handles **, *, etc.)
135
+ if file_path.match(pattern):
136
+ return True
137
+
138
+ # Also check if pattern is a substring (for partial path matching)
139
+ if pattern in str(file_path):
140
+ return True
141
+
142
+ return False
143
+
101
144
  def _check_python(self, context: BaseLintContext, config: MagicNumberConfig) -> list[Violation]:
102
145
  """Check Python code for magic number violations.
103
146
 
@@ -108,6 +151,9 @@ class MagicNumberRule(MultiLanguageLintRule): # thailint: ignore[srp]
108
151
  Returns:
109
152
  List of violations found in Python code
110
153
  """
154
+ if self._is_file_ignored(context, config):
155
+ return []
156
+
111
157
  tree = self._parse_python_code(context.file_content)
112
158
  if tree is None:
113
159
  return []
@@ -267,6 +313,9 @@ class MagicNumberRule(MultiLanguageLintRule): # thailint: ignore[srp]
267
313
  Returns:
268
314
  List of violations found in TypeScript/JavaScript code
269
315
  """
316
+ if self._is_file_ignored(context, config):
317
+ return []
318
+
270
319
  analyzer = TypeScriptMagicNumberAnalyzer()
271
320
  root_node = analyzer.parse_typescript(context.file_content or "")
272
321
  if root_node is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: thailint
3
- Version: 0.4.0
3
+ Version: 0.4.1
4
4
  Summary: The AI Linter - Enterprise-grade linting and governance for AI-generated code across multiple languages
5
5
  License: MIT
6
6
  Keywords: linter,ai,code-quality,static-analysis,file-placement,governance,multi-language,cli,docker,python
@@ -35,11 +35,20 @@ Description-Content-Type: text/markdown
35
35
 
36
36
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
37
37
  [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
38
- [![Tests](https://img.shields.io/badge/tests-253%2F253%20passing-brightgreen.svg)](tests/)
38
+ [![Tests](https://img.shields.io/badge/tests-263%2F263%20passing-brightgreen.svg)](tests/)
39
39
  [![Coverage](https://img.shields.io/badge/coverage-87%25-brightgreen.svg)](htmlcov/)
40
40
 
41
41
  The AI Linter - Enterprise-ready linting and governance for AI-generated code across multiple languages.
42
42
 
43
+ ## Documentation
44
+
45
+ **New to thailint?** Start here:
46
+ - **[Quick Start Guide](docs/quick-start.md)** - Get running in 5 minutes
47
+ - **[Configuration Reference](docs/configuration.md)** - Complete config options for all linters
48
+ - **[Troubleshooting Guide](docs/troubleshooting.md)** - Common issues and solutions
49
+
50
+ **Full Documentation:** Browse the **[docs/](docs/)** folder for comprehensive guides covering installation, all linters, configuration patterns, and integration examples.
51
+
43
52
  ## Overview
44
53
 
45
54
  thailint is a modern, enterprise-ready multi-language linter designed specifically for AI-generated code. It focuses on common mistakes and anti-patterns that AI coding assistants frequently introduce—issues that existing linters don't catch or don't handle consistently across languages.
@@ -55,6 +64,8 @@ We're not trying to replace the wonderful existing linters like Pylint, ESLint,
55
64
 
56
65
  thailint complements your existing linting stack by catching the patterns AI tools repeatedly miss.
57
66
 
67
+ **Complete documentation available in the [docs/](docs/) folder** covering installation, configuration, all linters, and troubleshooting.
68
+
58
69
  ## Features
59
70
 
60
71
  ### Core Capabilities
@@ -151,6 +162,8 @@ thailint dry --config .thailint.yaml src/
151
162
  thailint dry --format json src/
152
163
  ```
153
164
 
165
+ **New to thailint?** See the **[Quick Start Guide](docs/quick-start.md)** for a complete walkthrough including config generation, understanding output, and next steps.
166
+
154
167
  ### Library Mode
155
168
 
156
169
  ```python
@@ -47,9 +47,9 @@ src/linters/file_placement/pattern_validator.py,sha256=eMt5GB5lgJMhhQACOlfDXQFfS
47
47
  src/linters/file_placement/rule_checker.py,sha256=JONXcaYxZ8CM_7Zg6Th01p5cve1rJ8YkReAUJ44nfUg,7795
48
48
  src/linters/file_placement/violation_factory.py,sha256=NkQmBcgpa3g3W2ZdFZNQ5djLVP4x9OKs65d7F1rCKvM,6040
49
49
  src/linters/magic_numbers/__init__.py,sha256=17dkCUf0uiYLvpOZF01VDojj92NzxXZMtRhrSBUzsdc,1689
50
- src/linters/magic_numbers/config.py,sha256=yL4E440FaT1RDsiQgIRcEs-MozMylOubHrQ3rT2usOM,3047
50
+ src/linters/magic_numbers/config.py,sha256=3zV6ZNezouBWUYy4kMw5PUlPNvIWXVwOxTz1moZfRoI,3270
51
51
  src/linters/magic_numbers/context_analyzer.py,sha256=cGXozlKll10Zao56c2E8ThIyH2mSQaPaUau_g7ngRLw,8446
52
- src/linters/magic_numbers/linter.py,sha256=f240nyxsSN9-ttF6c7gA0LNwo6mBd85bWVO2I45G3DI,16354
52
+ src/linters/magic_numbers/linter.py,sha256=_AIlPHVdZIi7hVZ-VmlBLw9OqdVPKAdNzHnPhTSiJb8,17768
53
53
  src/linters/magic_numbers/python_analyzer.py,sha256=0u1cFaaFCqOW5yeW-YbmPoZuVIeN_KtmkFyyxup6aR0,2803
54
54
  src/linters/magic_numbers/typescript_analyzer.py,sha256=DCYRdxjgMd6PkhJWKnc1W-S1T0sa-F9AHCLV2JwcR8g,7468
55
55
  src/linters/magic_numbers/violation_builder.py,sha256=SqIQv3N9lpP2GRC1TC5InrvaEdrAq24V7Ec2Xj5olb0,3308
@@ -76,8 +76,8 @@ src/orchestrator/language_detector.py,sha256=rHyVMApit80NTTNyDH1ObD1usKD8LjGmH3D
76
76
  src/templates/thailint_config_template.yaml,sha256=u8WFv2coE4uqfgf_slw7xjo4kGYIowDm1RIgxsKQzrE,4275
77
77
  src/utils/__init__.py,sha256=NiBtKeQ09Y3kuUzeN4O1JNfUIYPQDS2AP1l5ODq-Dec,125
78
78
  src/utils/project_root.py,sha256=ldv2-XeMT0IElpSgrHdTaP2CUfwmdZix8vQ2qXO1O5s,2735
79
- thailint-0.4.0.dist-info/LICENSE,sha256=kxh1J0Sb62XvhNJ6MZsVNe8PqNVJ7LHRn_EWa-T3djw,1070
80
- thailint-0.4.0.dist-info/METADATA,sha256=c_ZXWle6WqMTEnSzLWodRM38CcS1O4ZnzRbJD0u-IeQ,33249
81
- thailint-0.4.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
82
- thailint-0.4.0.dist-info/entry_points.txt,sha256=l7DQJgU18sVLDpSaXOXY3lLhnQHQIRrSJZTQjG1cEAk,62
83
- thailint-0.4.0.dist-info/RECORD,,
79
+ thailint-0.4.1.dist-info/LICENSE,sha256=kxh1J0Sb62XvhNJ6MZsVNe8PqNVJ7LHRn_EWa-T3djw,1070
80
+ thailint-0.4.1.dist-info/METADATA,sha256=eTR4Su6Xbo9tMZWxoefVZvDUJndYmF0JD6GhfhiVGOk,34038
81
+ thailint-0.4.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
82
+ thailint-0.4.1.dist-info/entry_points.txt,sha256=l7DQJgU18sVLDpSaXOXY3lLhnQHQIRrSJZTQjG1cEAk,62
83
+ thailint-0.4.1.dist-info/RECORD,,