linti 0.4.2__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.
Files changed (94) hide show
  1. linti-0.4.2/LICENSE +202 -0
  2. linti-0.4.2/PKG-INFO +323 -0
  3. linti-0.4.2/README.md +307 -0
  4. linti-0.4.2/pyproject.toml +39 -0
  5. linti-0.4.2/setup.cfg +4 -0
  6. linti-0.4.2/src/linti/__init__.py +9 -0
  7. linti-0.4.2/src/linti/cli/__init__.py +1 -0
  8. linti-0.4.2/src/linti/cli/auto_fixer.py +218 -0
  9. linti-0.4.2/src/linti/cli/config_loader.py +56 -0
  10. linti-0.4.2/src/linti/cli/file_linter.py +280 -0
  11. linti-0.4.2/src/linti/cli/issue_reporter.py +210 -0
  12. linti-0.4.2/src/linti/cli/main.py +130 -0
  13. linti-0.4.2/src/linti/cli/rule_explainer.py +126 -0
  14. linti-0.4.2/src/linti/config.py +246 -0
  15. linti-0.4.2/src/linti/lexer/__init__.py +0 -0
  16. linti-0.4.2/src/linti/lexer/lexer.py +317 -0
  17. linti-0.4.2/src/linti/lexer/token.py +151 -0
  18. linti-0.4.2/src/linti/lexer/token_window.py +31 -0
  19. linti-0.4.2/src/linti/linter/__init__.py +0 -0
  20. linti-0.4.2/src/linti/linter/lint_context.py +72 -0
  21. linti-0.4.2/src/linti/linter/lint_issue.py +27 -0
  22. linti-0.4.2/src/linti/linter/linter.py +115 -0
  23. linti-0.4.2/src/linti/linter/noqa.py +201 -0
  24. linti-0.4.2/src/linti/loader/__init__.py +35 -0
  25. linti-0.4.2/src/linti/loader/base.py +83 -0
  26. linti-0.4.2/src/linti/loader/ti_loader.py +41 -0
  27. linti-0.4.2/src/linti/loader/yaml_loader.py +297 -0
  28. linti-0.4.2/src/linti/parser/ast.py +205 -0
  29. linti-0.4.2/src/linti/parser/parser.py +605 -0
  30. linti-0.4.2/src/linti/rules/Rule.py +157 -0
  31. linti-0.4.2/src/linti/rules/__init__.py +15 -0
  32. linti-0.4.2/src/linti/rules/documentation/__init__.py +1 -0
  33. linti-0.4.2/src/linti/rules/documentation/docstring_region_rule.py +222 -0
  34. linti-0.4.2/src/linti/rules/format/__init__.py +0 -0
  35. linti-0.4.2/src/linti/rules/format/indentation_rule.py +181 -0
  36. linti-0.4.2/src/linti/rules/format/keyword_casing_rule.py +195 -0
  37. linti-0.4.2/src/linti/rules/format/newline_per_statement_rule.py +88 -0
  38. linti-0.4.2/src/linti/rules/format/no_multiple_spaces_rule.py +67 -0
  39. linti-0.4.2/src/linti/rules/format/no_space_before_semicolon_rule.py +76 -0
  40. linti-0.4.2/src/linti/rules/format/no_trailing_whitespace_rule.py +65 -0
  41. linti-0.4.2/src/linti/rules/format/one_space_inside_parentheses_rule.py +122 -0
  42. linti-0.4.2/src/linti/rules/format/whitespace_after_comma_rule.py +84 -0
  43. linti-0.4.2/src/linti/rules/format/whitespace_around_operators_rule.py +119 -0
  44. linti-0.4.2/src/linti/rules/naming/__init__.py +0 -0
  45. linti-0.4.2/src/linti/rules/naming/naming_rule.py +215 -0
  46. linti-0.4.2/src/linti/rules/naming/parameter_naming_rule.py +104 -0
  47. linti-0.4.2/src/linti/rules/naming/variable_naming_rule.py +49 -0
  48. linti-0.4.2/src/linti/rules/rule_factory.py +118 -0
  49. linti-0.4.2/src/linti/rules/semantic/__init__.py +0 -0
  50. linti-0.4.2/src/linti/rules/semantic/constant_rule.py +83 -0
  51. linti-0.4.2/src/linti/rules/semantic/docstring_region_rule.py +10 -0
  52. linti-0.4.2/src/linti/rules/semantic/execute_command_rule.py +71 -0
  53. linti-0.4.2/src/linti/rules/semantic/item_skip_rule.py +80 -0
  54. linti-0.4.2/src/linti/rules/semantic/odbc_open_parameter_rule.py +114 -0
  55. linti-0.4.2/src/linti/rules/semantic/process_call_literal_rule.py +79 -0
  56. linti-0.4.2/src/linti/rules/semantic/process_quit_rule.py +131 -0
  57. linti-0.4.2/src/linti/rules/semantic/readonly_parameter_variable_rule.py +110 -0
  58. linti-0.4.2/src/linti/semantic/type_inference.py +103 -0
  59. linti-0.4.2/src/linti.egg-info/PKG-INFO +323 -0
  60. linti-0.4.2/src/linti.egg-info/SOURCES.txt +92 -0
  61. linti-0.4.2/src/linti.egg-info/dependency_links.txt +1 -0
  62. linti-0.4.2/src/linti.egg-info/entry_points.txt +2 -0
  63. linti-0.4.2/src/linti.egg-info/requires.txt +6 -0
  64. linti-0.4.2/src/linti.egg-info/top_level.txt +1 -0
  65. linti-0.4.2/tests/test_auto_fixer.py +271 -0
  66. linti-0.4.2/tests/test_block_context.py +82 -0
  67. linti-0.4.2/tests/test_block_stack.py +129 -0
  68. linti-0.4.2/tests/test_config_find_and_load.py +171 -0
  69. linti-0.4.2/tests/test_constant_rule.py +38 -0
  70. linti-0.4.2/tests/test_docstring_region_rule.py +301 -0
  71. linti-0.4.2/tests/test_execute_command_rule.py +45 -0
  72. linti-0.4.2/tests/test_indentation_rule.py +50 -0
  73. linti-0.4.2/tests/test_issue_reporter.py +124 -0
  74. linti-0.4.2/tests/test_item_skip_rule.py +140 -0
  75. linti-0.4.2/tests/test_keyword_casing.py +227 -0
  76. linti-0.4.2/tests/test_lexer.py +277 -0
  77. linti-0.4.2/tests/test_linter.py +36 -0
  78. linti-0.4.2/tests/test_loop_counter_rule.py +105 -0
  79. linti-0.4.2/tests/test_newline_per_statement_rule.py +180 -0
  80. linti-0.4.2/tests/test_noqa.py +362 -0
  81. linti-0.4.2/tests/test_odbc_open_parameter_rule.py +56 -0
  82. linti-0.4.2/tests/test_parameter_naming_rule.py +105 -0
  83. linti-0.4.2/tests/test_parser.py +681 -0
  84. linti-0.4.2/tests/test_predefined_variables.py +119 -0
  85. linti-0.4.2/tests/test_process_call_literal_rule.py +50 -0
  86. linti-0.4.2/tests/test_process_quit_rule.py +191 -0
  87. linti-0.4.2/tests/test_readonly_parameter_variable_rule.py +207 -0
  88. linti-0.4.2/tests/test_resilient.py +47 -0
  89. linti-0.4.2/tests/test_select_rules.py +145 -0
  90. linti-0.4.2/tests/test_tokenwindow.py +38 -0
  91. linti-0.4.2/tests/test_type_inference.py +25 -0
  92. linti-0.4.2/tests/test_variable_naming_rule.py +105 -0
  93. linti-0.4.2/tests/test_whitespace_rules.py +429 -0
  94. linti-0.4.2/tests/test_yaml_loader.py +234 -0
linti-0.4.2/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
linti-0.4.2/PKG-INFO ADDED
@@ -0,0 +1,323 @@
1
+ Metadata-Version: 2.4
2
+ Name: linti
3
+ Version: 0.4.2
4
+ Summary: A linter for TM1 TI scripts
5
+ Author-email: Florian Scherzberg <florian.scherzberg@deutschebahn.com>
6
+ License-Expression: Apache-2.0
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: typer[all]>=0.9.0
11
+ Requires-Dist: pyyaml>=6.0
12
+ Requires-Dist: pydantic>=2.0.0
13
+ Provides-Extra: dev
14
+ Requires-Dist: pytest; extra == "dev"
15
+ Dynamic: license-file
16
+
17
+ # Linti
18
+
19
+ ## Description
20
+
21
+ A linter for TM1 TurboIntegrator (TI) code that enforces consistent formatting and best practices. Originally started as an internal project at Deutsche Bahn AG, it is now opened to the community. Contributions are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
22
+
23
+ ## Name Origin
24
+
25
+ The name "Linti" is a wordplay on "lint" and "TI" (TurboIntegrator). The "-i" ending is commonly used in German nicknames and was chosen intentionally as a small tribute to the project's German roots.
26
+
27
+ ## Motivation
28
+
29
+ TurboIntegrator processes are the backbone of any TM1 application, yet there has never been a dedicated linter for TI code. Teams rely on manual code reviews and informal conventions that inevitably drift
30
+ over time. We built Linti to close that gap — giving TM1 developers the same kind of automated quality checks that are standard in every other programming ecosystem.
31
+
32
+ We decided to open-source Linti because the TM1 community is relatively small. A linter only becomes truly useful when it reflects the collective experience of many teams, not just one. By publishing it, we hope to invite contributions from other TM1 practitioners and give back to a community that has always been generous with knowledge.
33
+
34
+ ## Compatibility Notice
35
+
36
+ This project is an independent compatibility tool for TurboIntegrator (TI) scripts used in TM1.
37
+
38
+ It is not affiliated with, endorsed by, sponsored by, or maintained by IBM. TM1, Planning Analytics, and related product names are referenced for compatibility and identification purposes only.
39
+
40
+ ## Feature
41
+
42
+ * Lexer
43
+ * Linter
44
+ * Rules
45
+ * Parser (AST)
46
+ * Formatter
47
+
48
+ ## Soonish
49
+
50
+ * Loader feature (e.g., TI from JSON)
51
+
52
+ ## Install via Pypi
53
+
54
+ The linter is available on PyPI and can be installed using `pip install linti`.
55
+
56
+ ## Configuration
57
+
58
+ The linter can be configured using a `linti.yaml` configuration file. The file is automatically discovered and loaded from the same directory as the TI file being analyzed.
59
+
60
+ ### Automatic Configuration Discovery
61
+
62
+ Place a `linti.yaml` file in your project. The linter searches upward from the file being linted until it finds a `linti.yaml`, reaches a project root (`.git`, `pyproject.toml`, `setup.cfg`, `setup.py`), or hits the filesystem root.
63
+
64
+ ```bash
65
+ my-project/
66
+ ├── linti.yaml # Applies to all TI files below
67
+ ├── processes/
68
+ │ ├── process1.ti
69
+ │ └── process2.ti
70
+ └── special/
71
+ ├── linti.yaml # Overrides for this directory
72
+ └── process3.ti
73
+ ```
74
+
75
+ When you run `linti processes/process1.ti`, the linter walks up and finds `my-project/linti.yaml`. Files in `special/` use their own local config instead.
76
+
77
+ ### Custom Configuration File
78
+
79
+ You can also specify a custom configuration file:
80
+
81
+ ```bash
82
+ linti process.ti --config custom-config.yaml
83
+ ```
84
+
85
+ ### Configuration Options
86
+
87
+ A typical `linti.yaml` file looks like this:
88
+
89
+ ```yaml
90
+ rules:
91
+ # F110 - Keyword Casing
92
+ # Enforces consistent casing for keywords (IF, ENDIF, ELSE, WHILE, END)
93
+ # Supported styles: uppercase, lowercase, camelcase
94
+ keyword_casing:
95
+ enabled: true
96
+ style: uppercase
97
+
98
+ # F310 - Block Indentation
99
+ # Enforces indentation for IF/WHILE blocks
100
+ # size: number of spaces per indentation level
101
+ indentation:
102
+ enabled: true
103
+ size: 4
104
+
105
+ # N110 - Variable Prefix Naming
106
+ # Enforces TM1 naming conventions
107
+ # - Numeric variables must start with 'n'
108
+ # - String variables must start with 's'
109
+ variable_prefix:
110
+ enabled: true
111
+ # Allow constants to start with 'c' (e.g., cRate, cMessage)
112
+ # When enabled, constants may only be assigned once.
113
+ allow_constant_prefix: false
114
+ ```
115
+
116
+ `rules.one_space_before_equals` has been removed with rule `F210`. If it is still present in an older config, linti warns and ignores it.
117
+
118
+ ### All rules
119
+
120
+ For a complete reference of all linting rules with detailed configuration examples and usage instructions, see [ALL_RULES.md](ALL_RULES.md).
121
+
122
+ ### Disabling Rules
123
+
124
+ To disable a specific rule, set `enabled: false`:
125
+
126
+ ```yaml
127
+ rules:
128
+ keyword_casing:
129
+ enabled: false
130
+ variable_prefix:
131
+ enabled: true
132
+ ```
133
+
134
+ ### Inline Suppression (`noqa`)
135
+
136
+ You can suppress specific rules directly in TI code using `# noqa` comments.
137
+ TI uses `#` for comments, so the syntax feels natural.
138
+
139
+ #### Trailing comment — suppress current line
140
+
141
+ ```
142
+ nVar=1; # noqa: F220
143
+ ```
144
+
145
+ #### Standalone comment — suppress the next code line
146
+
147
+ ```
148
+ # noqa: F110
149
+ if(nVar = 1);
150
+ ```
151
+
152
+ #### Procedure-level — first comment before any code suppresses the entire file/procedure
153
+
154
+ ```
155
+ # noqa: S320, S310
156
+ ExecuteCommand(sCmd, 1);
157
+ RunProcess(pProcess);
158
+ ```
159
+
160
+ #### Region — suppress a block of lines
161
+
162
+ ```
163
+ # noqa-begin: F110
164
+ if(nVar = 1);
165
+ endif;
166
+ # noqa-end: F110
167
+ ```
168
+
169
+ Multiple rule IDs can be combined with commas: `# noqa: F110, N110, S220`
170
+
171
+ ## CLI Usage
172
+
173
+ ### Basic Usage
174
+
175
+ ```bash
176
+ # Lint a single file
177
+ linti process.ti
178
+
179
+ # Lint with additional debug output
180
+ linti process.ti --tokens
181
+ linti process.ti --ast
182
+ linti process.ti --tokens --ast
183
+
184
+ # Lint with custom configuration
185
+ linti process.ti --config my-config.yaml
186
+
187
+ # Auto-fix issues
188
+ linti process.ti --auto-fix
189
+
190
+ # Lint a YAML ProcessObject file
191
+ linti process.yaml --auto-fix
192
+
193
+ # Lint all YAML files in a directory
194
+ linti processes/ --auto-fix
195
+ ```
196
+
197
+ ### Command Help
198
+
199
+ ```bash
200
+ linti --help
201
+ ```
202
+
203
+ ### Selecting Specific Rules
204
+
205
+ Use the `--select` option to run only specific rules or groups of rules:
206
+
207
+ ```bash
208
+ # Run a specific rule
209
+ linti process.ti --select F110
210
+
211
+ # Run all rules in a category (e.g., all Format rules)
212
+ linti process.ti --select F
213
+
214
+ # Run all rules in a subcategory (e.g., all F1xx - Casing rules)
215
+ linti process.ti --select F1
216
+
217
+ # Run multiple rules or groups (comma-separated)
218
+ linti process.ti --select F110,S220
219
+ linti process.ti --select F,N1,S3
220
+
221
+ # Combining with other options
222
+ linti process.ti --select F --auto-fix
223
+ linti process.ti --select N,S --tokens
224
+ ```
225
+
226
+ **Selection patterns:**
227
+ - `D`, `F`, `N`, `S` – Select all rules in a category
228
+ - `D4`, `F1`, `F2`, `F3`, `N1`, `N2`, `S1`, `S2`, `S3` – Select all rules in a subcategory
229
+ - `D410`, `F110`, `S220` – Select a specific rule
230
+
231
+ ### Listing Rules
232
+
233
+ Use the `explain` subcommand to inspect available rules and view detailed guidance for one rule.
234
+
235
+ ```bash
236
+ # List all rules with short description and auto-fix support
237
+ linti explain
238
+
239
+ # Explain a specific rule in detail
240
+ linti explain F110
241
+ ```
242
+
243
+
244
+ ## Rule Groups
245
+
246
+ Rules are organized into three main categories, each with a hierarchical numbering scheme. The categorization helps identify the type of violation and group related rules together.
247
+
248
+ ### Format Rules (F1xx, F2xx, F3xx)
249
+ Formatting and code style rules:
250
+
251
+ - **F1xx - Casing**: Keyword capitalization and case consistency
252
+ - `F110` - Keyword Casing
253
+
254
+ - **F2xx - Spacing**: Whitespace and spacing requirements
255
+ - `F220` - Whitespace Around Operators
256
+ - `F230` - Whitespace After Comma
257
+ - `F240` - No Space Before Semicolon
258
+ - `F250` - One Space Inside Parentheses
259
+ - `F260` - No Multiple Spaces
260
+ - `F270` - No Trailing Whitespace
261
+
262
+ - **F3xx - Structure**: Indentation, line breaks, and code layout
263
+ - `F310` - Block Indentation
264
+ - `F320` - One Statement Per Line
265
+
266
+ ### Naming Rules (N1xx, N2xx)
267
+ Variable and parameter naming conventions:
268
+
269
+ - **N1xx - Prefix Naming**: Variable prefix conventions (n, s, c prefixes)
270
+ - `N110` - Variable Prefix Naming
271
+
272
+ - **N2xx - Metadata Naming**: Naming conventions for specific declarations
273
+ - `N210` - Parameter Naming
274
+ - `N220` - Data Source Variable Naming
275
+
276
+ ### Documentation Rules (D4xx)
277
+ Documentation and process docstring validation:
278
+
279
+ - **D4xx - Docstrings**: Required docstring regions and headers
280
+ - `D410` - Docstring Region
281
+
282
+ ### Semantic Rules (S1xx, S2xx, S3xx)
283
+ Logic, control flow, and semantic validation:
284
+
285
+ - **S1xx - Control Flow**: Process execution and control flow patterns
286
+ - `S110` - ProcessQuit Placement
287
+ - `S120` - ItemSkip Block Usage
288
+
289
+ - **S2xx - Immutability**: Variable mutability and assignment constraints
290
+ - `S210` - Read-only Parameters and Variables
291
+ - `S220` - Single-assignment Constants
292
+
293
+ - **S3xx - Security/Calls**: Security-sensitive operations and function calls
294
+ - `S310` - Literal Process Calls
295
+ - `S320` - No ExecuteCommand
296
+ - `S330` - ODBCOpen Password Parameter
297
+
298
+ Use `linti explain` to list all rules or `linti explain <RULE_ID>` for detailed information about a specific rule.
299
+
300
+ ### Auto-Fix Feature
301
+
302
+ The linter can automatically fix keyword casing issues (F110: Keyword Casing) and block indentation issues (F310: Block Indentation) using the `--auto-fix` flag:
303
+
304
+ ## TM1 Block Context Awareness
305
+
306
+ The linter understands TM1's four execution blocks when linting YAML ProcessObject files:
307
+
308
+ - **Prolog**: Initialization and setup code
309
+ - **Metadata**: Dimension/hierarchy manipulation code
310
+ - **Data**: Record-by-record data processing
311
+ - **Epilog**: Finalization and cleanup code
312
+
313
+ Rules can use block context to enforce block-specific requirements. For example:
314
+ - The ProcessQuit rule only allows `ProcessQuit()` in IF/ELSE blocks within Prolog or Epilog
315
+ - Rules could require certain variable naming patterns based on the block
316
+
317
+ When linting plain `.ti` files, the block context is `None` and rules apply generic validation.
318
+
319
+ ## License
320
+
321
+ This project is licensed under the **Apache License 2.0**. See the [LICENSE](LICENSE) file for details.
322
+
323
+ The full license text is also available at the [Apache Software Foundation](https://www.apache.org/licenses/LICENSE-2.0).