thailint 0.5.0__py3-none-any.whl → 0.7.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: thailint
3
- Version: 0.5.0
3
+ Version: 0.7.0
4
4
  Summary: The AI Linter - Enterprise-grade linting and governance for AI-generated code across multiple languages
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -37,9 +37,10 @@ Description-Content-Type: text/markdown
37
37
 
38
38
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
39
39
  [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
40
- [![Tests](https://img.shields.io/badge/tests-393%2F393%20passing-brightgreen.svg)](tests/)
40
+ [![Tests](https://img.shields.io/badge/tests-571%2F571%20passing-brightgreen.svg)](tests/)
41
41
  [![Coverage](https://img.shields.io/badge/coverage-87%25-brightgreen.svg)](htmlcov/)
42
42
  [![Documentation Status](https://readthedocs.org/projects/thai-lint/badge/?version=latest)](https://thai-lint.readthedocs.io/en/latest/?badge=latest)
43
+ [![SARIF 2.1.0](https://img.shields.io/badge/SARIF-2.1.0-orange.svg)](docs/sarif-output.md)
43
44
 
44
45
  The AI Linter - Enterprise-ready linting and governance for AI-generated code across multiple languages.
45
46
 
@@ -73,6 +74,11 @@ thailint complements your existing linting stack by catching the patterns AI too
73
74
 
74
75
  ### Core Capabilities
75
76
  - **File Placement Linting** - Enforce project structure and organization
77
+ - **File Header Linting** - Validate documentation headers in source files
78
+ - Python, TypeScript, JavaScript, Bash, Markdown, CSS support
79
+ - Mandatory field validation (Purpose, Scope, Overview)
80
+ - Atemporal language detection (no dates, "currently", "now")
81
+ - Language-specific header format parsing
76
82
  - **Magic Numbers Linting** - Detect unnamed numeric literals that should be constants
77
83
  - Python and TypeScript support with AST analysis
78
84
  - Context-aware detection (ignores constants, test files, range() usage)
@@ -158,11 +164,17 @@ thailint dry .
158
164
  # Check for magic numbers
159
165
  thailint magic-numbers src/
160
166
 
167
+ # Check file headers
168
+ thailint file-header src/
169
+
161
170
  # With config file
162
171
  thailint dry --config .thailint.yaml src/
163
172
 
164
173
  # JSON output for CI/CD
165
174
  thailint dry --format json src/
175
+
176
+ # SARIF output for GitHub Code Scanning
177
+ thailint nesting --format sarif src/ > results.sarif
166
178
  ```
167
179
 
168
180
  **New to thailint?** See the **[Quick Start Guide](https://thai-lint.readthedocs.io/en/latest/quick-start/)** for a complete walkthrough including config generation, understanding output, and next steps.
@@ -869,6 +881,136 @@ def get_ports(): # thailint: ignore[magic-numbers] - Standard ports
869
881
 
870
882
  See **[How to Ignore Violations](https://thai-lint.readthedocs.io/en/latest/how-to-ignore-violations/)** and **[Magic Numbers Linter Guide](https://thai-lint.readthedocs.io/en/latest/magic-numbers-linter/)** for complete documentation.
871
883
 
884
+ ## File Header Linter
885
+
886
+ ### Overview
887
+
888
+ The file header linter validates that source files have proper documentation headers containing required fields (Purpose, Scope, Overview) and don't use temporal language (dates, "currently", "now"). It enforces consistent documentation patterns across entire codebases.
889
+
890
+ ### Why File Headers?
891
+
892
+ File headers serve as **self-documentation** that helps developers (and AI assistants) quickly understand:
893
+
894
+ - **Purpose**: What does this file do?
895
+ - **Scope**: What area of the system does it cover?
896
+ - **Dependencies**: What does it rely on?
897
+ - **Exports**: What does it provide to other modules?
898
+
899
+ ### Quick Start
900
+
901
+ ```bash
902
+ # Check file headers in current directory
903
+ thailint file-header .
904
+
905
+ # Check specific directory
906
+ thailint file-header src/
907
+
908
+ # Get JSON output
909
+ thailint file-header --format json src/
910
+
911
+ # Get SARIF output for CI/CD
912
+ thailint file-header --format sarif src/ > results.sarif
913
+ ```
914
+
915
+ ### Configuration
916
+
917
+ Add to `.thailint.yaml`:
918
+
919
+ ```yaml
920
+ file-header:
921
+ enabled: true
922
+ mandatory_fields:
923
+ - Purpose
924
+ - Scope
925
+ - Overview
926
+ ignore:
927
+ - "**/__init__.py"
928
+ - "**/migrations/**"
929
+ ```
930
+
931
+ ### Example Violation
932
+
933
+ **Code without proper header:**
934
+ ```python
935
+ import os
936
+
937
+ def process_data():
938
+ pass
939
+ ```
940
+
941
+ **Violation messages:**
942
+ ```
943
+ src/utils.py:1 - Missing mandatory field: Purpose
944
+ src/utils.py:1 - Missing mandatory field: Scope
945
+ src/utils.py:1 - Missing mandatory field: Overview
946
+ ```
947
+
948
+ **Refactored with header:**
949
+ ```python
950
+ """
951
+ Purpose: Data processing utilities for ETL pipeline
952
+
953
+ Scope: Data transformation layer, used by batch processing jobs
954
+
955
+ Overview: Provides data transformation functions for the ETL pipeline.
956
+ Handles parsing, validation, and normalization of incoming data.
957
+
958
+ Dependencies: os, json
959
+
960
+ Exports: process_data(), validate_input(), transform_record()
961
+ """
962
+ import os
963
+
964
+ def process_data():
965
+ pass
966
+ ```
967
+
968
+ ### Atemporal Language Detection
969
+
970
+ The linter detects temporal language that becomes stale:
971
+
972
+ **Temporal (flagged):**
973
+ ```python
974
+ """
975
+ Purpose: Authentication module
976
+
977
+ Overview: Currently handles OAuth. This was recently updated.
978
+ Created: 2024-01-15. Will be extended in the future.
979
+ """
980
+ ```
981
+
982
+ **Atemporal (correct):**
983
+ ```python
984
+ """
985
+ Purpose: Authentication module
986
+
987
+ Overview: Handles OAuth authentication with Google and GitHub.
988
+ Implements authorization code flow with PKCE for security.
989
+ """
990
+ ```
991
+
992
+ ### Language Support
993
+
994
+ - **Python**: Module docstrings (`"""..."""`)
995
+ - **TypeScript/JavaScript**: JSDoc comments (`/** ... */`)
996
+ - **Bash**: Hash comments after shebang (`# ...`)
997
+ - **Markdown**: YAML frontmatter (`---...---`)
998
+ - **CSS/SCSS**: Block comments (`/* ... */`)
999
+
1000
+ ### Ignoring Violations
1001
+
1002
+ ```python
1003
+ # File-level ignore
1004
+ # thailint: ignore-file[file-header]
1005
+
1006
+ # Line-level ignore for atemporal violation
1007
+ """
1008
+ Overview: Created 2024-01-15. # thailint: ignore[file-header]
1009
+ """
1010
+ ```
1011
+
1012
+ See **[How to Ignore Violations](https://thai-lint.readthedocs.io/en/latest/how-to-ignore-violations/)** and **[File Header Linter Guide](https://thai-lint.readthedocs.io/en/latest/file-header-linter/)** for complete documentation.
1013
+
872
1014
  ## Pre-commit Hooks
873
1015
 
874
1016
  Automate code quality checks before every commit and push with pre-commit hooks.
@@ -1153,11 +1295,13 @@ docker run --rm -v /path/to/workspace:/workspace \
1153
1295
  - **[CLI Reference](https://thai-lint.readthedocs.io/en/latest/cli-reference/)** - All CLI commands and options
1154
1296
  - **[Deployment Modes](https://thai-lint.readthedocs.io/en/latest/deployment-modes/)** - CLI, Library, and Docker usage
1155
1297
  - **[File Placement Linter](https://thai-lint.readthedocs.io/en/latest/file-placement-linter/)** - Detailed linter guide
1298
+ - **[File Header Linter](https://thai-lint.readthedocs.io/en/latest/file-header-linter/)** - File header validation guide
1156
1299
  - **[Magic Numbers Linter](https://thai-lint.readthedocs.io/en/latest/magic-numbers-linter/)** - Magic numbers detection guide
1157
1300
  - **[Nesting Depth Linter](https://thai-lint.readthedocs.io/en/latest/nesting-linter/)** - Nesting depth analysis guide
1158
1301
  - **[SRP Linter](https://thai-lint.readthedocs.io/en/latest/srp-linter/)** - Single Responsibility Principle guide
1159
1302
  - **[DRY Linter](https://thai-lint.readthedocs.io/en/latest/dry-linter/)** - Duplicate code detection guide
1160
1303
  - **[Pre-commit Hooks](https://thai-lint.readthedocs.io/en/latest/pre-commit-hooks/)** - Automated quality checks
1304
+ - **[SARIF Output Guide](docs/sarif-output.md)** - SARIF format for GitHub Code Scanning and CI/CD
1161
1305
  - **[Publishing Guide](https://thai-lint.readthedocs.io/en/latest/releasing/)** - Release and publishing workflow
1162
1306
  - **[Publishing Checklist](https://thai-lint.readthedocs.io/en/latest/publishing-checklist/)** - Post-publication validation
1163
1307
 
@@ -1168,6 +1312,8 @@ See [`examples/`](examples/) directory for working code:
1168
1312
  - **[basic_usage.py](examples/basic_usage.py)** - Simple library API usage
1169
1313
  - **[advanced_usage.py](examples/advanced_usage.py)** - Advanced patterns and workflows
1170
1314
  - **[ci_integration.py](examples/ci_integration.py)** - CI/CD integration example
1315
+ - **[sarif_usage.py](examples/sarif_usage.py)** - SARIF output format examples
1316
+ - **[file_header_usage.py](examples/file_header_usage.py)** - File header validation examples
1171
1317
 
1172
1318
  ## Project Structure
1173
1319
 
@@ -2,17 +2,19 @@ src/__init__.py,sha256=f601zncODr2twrUHqTLS5wyOdZqZi9tMjAe2INhRKqU,2175
2
2
  src/analyzers/__init__.py,sha256=fFloZtjkBGwYbAhKTxS3Qy3yDr2_3i3WSfKTw1mAioo,972
3
3
  src/analyzers/typescript_base.py,sha256=4I7fAcMOAY9vY1AXh52QpohgFmguBECwOkvBRP4zCS4,5054
4
4
  src/api.py,sha256=pJ5l3qxccKBEY-BkANwzTgLAl1ZFq7OP6hx6LSxbhDw,4664
5
- src/cli.py,sha256=t72ZeeBpXJTIR1Gx_nIak-ZlUJhfXhEORXNNcjdp2-I,51820
5
+ src/cli.py,sha256=H8DAOCRIu4pK2fbTqryJ0arwKmJ9w3kkeRdtC-FVdAY,55579
6
6
  src/config.py,sha256=2ebAjIpAhw4bHbOxViEA5nCjfBlDEIrMR59DBrzcYzM,12460
7
7
  src/core/__init__.py,sha256=5FtsDvhMt4SNRx3pbcGURrxn135XRbeRrjSUxiXwkNc,381
8
8
  src/core/base.py,sha256=Eklcagi2ktfY4Kytl_ObXov2U49N9OGDpw4cu4PUzGY,7824
9
- src/core/cli_utils.py,sha256=rYOJz4mnr8RLP-nJdHOy-GJyxGNqkWtK3_rvKriHXj4,6083
9
+ src/core/cli_utils.py,sha256=vKw0jF1rZv_N7gbzvV5TeO9rV5VPfd89fneKrglQ2Hs,6502
10
10
  src/core/config_parser.py,sha256=zAY4bDptNlVID0a4JDXN0YlUKXLM92cFqTAwhp_8uGc,4183
11
11
  src/core/linter_utils.py,sha256=4jmC2YfpPvGhS_XHlHXa5SBIJh9CQlNj5zuW_GpdPKc,5273
12
- src/core/registry.py,sha256=IMkic1ukmo8HCX1TY5YoKjwKT_IT-ZmVx6sdntC5X2M,3289
12
+ src/core/registry.py,sha256=yRA8mQLiZwjmgxl1wSTgdj1cuo_QXuRdrXt3NpCBUgE,3285
13
13
  src/core/rule_discovery.py,sha256=smxJ9PEyMqEAIicsWaHOaSHD1PHUAOeFZT_a3DNRwgE,4163
14
14
  src/core/types.py,sha256=dIYLaCDNtCAzVaplx5S5yxywkLIuX0BN9No_l2zCfV0,2887
15
15
  src/core/violation_builder.py,sha256=7AQODqxwc3qp_4m1MPzknkeNGlht1LsDjPsTPpWAGJY,4678
16
+ src/formatters/__init__.py,sha256=yE1yIL8lplTMEjsmQm7F-kOMaYq7OjmbFuiwwK0D-gM,815
17
+ src/formatters/sarif.py,sha256=gGOwb_v7j4mx4bpvV1NNDd-JyHH8i8XX89iQ6uRSvG4,7050
16
18
  src/linter_config/__init__.py,sha256=_I2VVlZlfKyT-tKukuUA5-aVcHLOe3m6C2cev43AiEc,298
17
19
  src/linter_config/ignore.py,sha256=S2Ub0CCOOC-wpU5Y_EodMprciw18fgWcnp4z_h1MYNk,19638
18
20
  src/linter_config/loader.py,sha256=HB09W-uVsEcgCbvUwUHS5Jm2n0bqBXA3744vMc4GAqk,2542
@@ -38,16 +40,21 @@ src/linters/dry/violation_builder.py,sha256=EUiEQIOZjzAoHEqZiIR8WZP8m4dgqJjcveR5
38
40
  src/linters/dry/violation_filter.py,sha256=aTOMz8kXG2sZlSVcf3cAxgxHs7f2kBXInfr1V_04fUQ,3125
39
41
  src/linters/dry/violation_generator.py,sha256=cc6aKvTxtHSZm0F7Y-gL1bmD3JUphRmAvcbqk9aUzGg,6128
40
42
  src/linters/file_header/__init__.py,sha256=S3a2xrOlxnNWD02To5K2ZwILsNEvSj1IvUAH8RjgOV4,791
41
- src/linters/file_header/atemporal_detector.py,sha256=Rbjs2GHsgO-1r2kUHUuDRsX3XAX0INFZWVrKoUh5v-8,3104
42
- src/linters/file_header/config.py,sha256=1pjfa0hIUEiE0riMLTH9FQiETXfEkhAFuv1HBx0SGgI,2073
43
- src/linters/file_header/field_validator.py,sha256=bR0xZ5DhPHBE8lopbcaNwJr0auZlNDkCwml3Q8_7XOY,2380
44
- src/linters/file_header/linter.py,sha256=ISNnt-YMgkKQl4psVLefp5P7qTQ6wIGidq4dTkTNbaI,11228
45
- src/linters/file_header/python_parser.py,sha256=TcnA8OCbHK3YtixmFwSP7OCvxjjGLZBioez9wVukz28,2951
46
- src/linters/file_header/violation_builder.py,sha256=yDNqsZ-hDnURpph9oZNj2lCkJgd_7hprjk3Fr0iPphs,2653
43
+ src/linters/file_header/atemporal_detector.py,sha256=bgQJPDuJj1J5gHKIIOz1TYbBwu8GHrcMafWFVqZ_zZE,3192
44
+ src/linters/file_header/base_parser.py,sha256=HbuJpXQ4V3zTDTP_D0iFqoT7kab6gk8A1lZdlqCb6tc,3202
45
+ src/linters/file_header/bash_parser.py,sha256=ZnPleRD4c16ibYMBc682N9W-Qgtz9lKtLSqSmbo7oqg,2147
46
+ src/linters/file_header/config.py,sha256=Ewrln4W4QDnInTgWr8WgSlQEjAuDyMbUuh9GHAa9a4c,4030
47
+ src/linters/file_header/css_parser.py,sha256=ijpGMixg2ZqNWWdiZjSNtMXCOhm6XDfSY7OU68B9fS8,2332
48
+ src/linters/file_header/field_validator.py,sha256=uASqHj7ID4JJZzgc6X3SmRRLWV35NnX2iZElCt3HW1o,2830
49
+ src/linters/file_header/linter.py,sha256=rbfpHBCCn0cRKUyadc2luZSQay_gJfVC79JcqkwUMb4,12192
50
+ src/linters/file_header/markdown_parser.py,sha256=dmrB8JCxKTHyw-qMU6S-UjKaFbqJ6ZQY1f23tND5_Jo,4964
51
+ src/linters/file_header/python_parser.py,sha256=RTOeEt1b3tCvFWbZIt89awQA37CUOSBIGagEYnayn-M,1432
52
+ src/linters/file_header/typescript_parser.py,sha256=R11Vkr6dUVaU8t90m8rrkMzODtBYk7u-TYFsMDRwzX8,2532
53
+ src/linters/file_header/violation_builder.py,sha256=HPYTmrcCmcO6Dx5dhmj85zZgEBM5EZqTgql-0CA0A0k,2745
47
54
  src/linters/file_placement/__init__.py,sha256=vJ43GZujcbAk-K3DwfsQZ0J3yP_5G35CKssatLyntXk,862
48
55
  src/linters/file_placement/config_loader.py,sha256=Of5sTG2S-04efn3KOlXrSxpMcC1ipBpSvCjtJOMmWno,2640
49
56
  src/linters/file_placement/directory_matcher.py,sha256=YaBeLGiT4bgqN_v4FmEmSASOBxkMC1lyEYpL17wLIDY,2607
50
- src/linters/file_placement/linter.py,sha256=HtQf08UmKCe5YAHoPvVgWmxdUFu6ZeP2qicg-q7BgzM,14438
57
+ src/linters/file_placement/linter.py,sha256=A4mndpyIyxEzq64rLw2ILNA7APx_QmwzUfnhB0PyuCs,14190
51
58
  src/linters/file_placement/path_resolver.py,sha256=S6g7xOYsoSc0O_RDJh8j4Z2klcwzp16rSUfEAErGOTI,1972
52
59
  src/linters/file_placement/pattern_matcher.py,sha256=3HZWYgQKXz_y13z3lO1YHn51khCaiGOrneGxKXGWGw0,1898
53
60
  src/linters/file_placement/pattern_validator.py,sha256=eMt5GB5lgJMhhQACOlfDXQFfSfNrOY-wJN1JanGka6Q,3717
@@ -68,11 +75,11 @@ src/linters/nesting/typescript_analyzer.py,sha256=wO6p6QNnyW1uaieTCZjaqR56C68Aji
68
75
  src/linters/nesting/typescript_function_extractor.py,sha256=dDB1otJnFMCo-Pj4mTr4gekKe7V4ArOAtX6gV0dBDc4,4494
69
76
  src/linters/nesting/violation_builder.py,sha256=sMHS45F2lrA1WYrG3Uug8HfeRPljnXcyJPHSe2F76Bs,4828
70
77
  src/linters/print_statements/__init__.py,sha256=yhvdTFSqBB4UDreeadTHKFzhayxeT6JkF3yxUHMgn1g,1893
71
- src/linters/print_statements/config.py,sha256=GTYIAVovc6e7i4eTrSl2D0Nmf55U5bpEd7FI6Knx_CE,3133
72
- src/linters/print_statements/linter.py,sha256=MieQfEdmVJoiRR7Aa2-OW2RnOC4Cheu0jgDezc-ndH8,14572
73
- src/linters/print_statements/python_analyzer.py,sha256=5bzYWLKqQOW0xnsZYZgUJh6sl3SYDKdQe_BAw93HTug,5543
74
- src/linters/print_statements/typescript_analyzer.py,sha256=aKTA2E96qxA1PzsRVL5DLYE-abCFM67OGhqU-9iFgzA,5265
75
- src/linters/print_statements/violation_builder.py,sha256=z01K-2kpR9VnGo_S9hcU0Y6_QMol0XxxnJxj36GdL7E,3426
78
+ src/linters/print_statements/config.py,sha256=rth3XmzqZGzXkRXDIVZswdtNOXIe1vIRaF46tVLKnyQ,3041
79
+ src/linters/print_statements/linter.py,sha256=J23gtU6FQ2uH2Sj38PPRiV4k2HU0uto2Bqf2D28pKrI,14630
80
+ src/linters/print_statements/python_analyzer.py,sha256=SyCkh8HkYAfcSM7LCwDE1ahhxwPgrlnSVLs1iRemyaw,5461
81
+ src/linters/print_statements/typescript_analyzer.py,sha256=v2R6ZG80eTQq92oE3Y3E4ZwUfBmXwB9G5QKftqbRbD8,5155
82
+ src/linters/print_statements/violation_builder.py,sha256=Vs5m3AnWjrQqQHf6JJDaPP5B1V3YNl5pepG_oiTJnx4,3333
76
83
  src/linters/srp/__init__.py,sha256=GbhaSB2_AYY-mWgG_ThbyAcDXoVZuB5eLzguoShf38w,3367
77
84
  src/linters/srp/class_analyzer.py,sha256=wuwviwhN1F_VVPaQ3pZvffmY3e9ToxPNJhv6BjhsgZc,3761
78
85
  src/linters/srp/config.py,sha256=hTxrM21HIOmg0sM6eJ_h3hRnuxqRZEgs13Ie97-PDr4,3397
@@ -89,8 +96,8 @@ src/orchestrator/language_detector.py,sha256=rHyVMApit80NTTNyDH1ObD1usKD8LjGmH3D
89
96
  src/templates/thailint_config_template.yaml,sha256=vxyhRRi25_xOnHDRx0jzz69dgPqKU2IU5-YFGUoX5lM,4953
90
97
  src/utils/__init__.py,sha256=NiBtKeQ09Y3kuUzeN4O1JNfUIYPQDS2AP1l5ODq-Dec,125
91
98
  src/utils/project_root.py,sha256=b3YTEGTa9RPcOeHn1IByMMWyRiUabfVlpnlektL0A0o,6156
92
- thailint-0.5.0.dist-info/METADATA,sha256=anESyXpJOqYeRjeHVOOL38dY56zD0XLPkCMmUNBKfx8,37838
93
- thailint-0.5.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
94
- thailint-0.5.0.dist-info/entry_points.txt,sha256=l7DQJgU18sVLDpSaXOXY3lLhnQHQIRrSJZTQjG1cEAk,62
95
- thailint-0.5.0.dist-info/licenses/LICENSE,sha256=kxh1J0Sb62XvhNJ6MZsVNe8PqNVJ7LHRn_EWa-T3djw,1070
96
- thailint-0.5.0.dist-info/RECORD,,
99
+ thailint-0.7.0.dist-info/METADATA,sha256=DiyHLUK6NNz3o2MtQsJPJX-3PWdUX0vyMt2SsSI3ot0,41840
100
+ thailint-0.7.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
101
+ thailint-0.7.0.dist-info/entry_points.txt,sha256=l7DQJgU18sVLDpSaXOXY3lLhnQHQIRrSJZTQjG1cEAk,62
102
+ thailint-0.7.0.dist-info/licenses/LICENSE,sha256=kxh1J0Sb62XvhNJ6MZsVNe8PqNVJ7LHRn_EWa-T3djw,1070
103
+ thailint-0.7.0.dist-info/RECORD,,