behave-lint 1.0.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.
Files changed (195) hide show
  1. behave_lint-1.0.0/.gitignore +65 -0
  2. behave_lint-1.0.0/LICENSE +21 -0
  3. behave_lint-1.0.0/PKG-INFO +284 -0
  4. behave_lint-1.0.0/README.md +235 -0
  5. behave_lint-1.0.0/behave_lint/__init__.py +43 -0
  6. behave_lint-1.0.0/behave_lint/__main__.py +8 -0
  7. behave_lint-1.0.0/behave_lint/autofix/__init__.py +18 -0
  8. behave_lint-1.0.0/behave_lint/autofix/coordinator.py +258 -0
  9. behave_lint-1.0.0/behave_lint/autofix/models.py +122 -0
  10. behave_lint-1.0.0/behave_lint/cli/__init__.py +30 -0
  11. behave_lint-1.0.0/behave_lint/cli/coordinator.py +191 -0
  12. behave_lint-1.0.0/behave_lint/cli/exit_codes.py +79 -0
  13. behave_lint-1.0.0/behave_lint/cli/parser.py +290 -0
  14. behave_lint-1.0.0/behave_lint/cli/router.py +138 -0
  15. behave_lint-1.0.0/behave_lint/config/__init__.py +14 -0
  16. behave_lint-1.0.0/behave_lint/configuration/__init__.py +40 -0
  17. behave_lint-1.0.0/behave_lint/configuration/defaults.py +140 -0
  18. behave_lint-1.0.0/behave_lint/configuration/discovery.py +130 -0
  19. behave_lint-1.0.0/behave_lint/configuration/loader.py +263 -0
  20. behave_lint-1.0.0/behave_lint/configuration/schema.py +162 -0
  21. behave_lint-1.0.0/behave_lint/constants.py +27 -0
  22. behave_lint-1.0.0/behave_lint/diagnostics/__init__.py +38 -0
  23. behave_lint-1.0.0/behave_lint/diagnostics/collector.py +126 -0
  24. behave_lint-1.0.0/behave_lint/diagnostics/dedup.py +47 -0
  25. behave_lint-1.0.0/behave_lint/diagnostics/filters.py +256 -0
  26. behave_lint-1.0.0/behave_lint/diagnostics/sorting.py +48 -0
  27. behave_lint-1.0.0/behave_lint/diagnostics/validation.py +106 -0
  28. behave_lint-1.0.0/behave_lint/engine/__init__.py +12 -0
  29. behave_lint-1.0.0/behave_lint/engine/lint_engine.py +162 -0
  30. behave_lint-1.0.0/behave_lint/errors/__init__.py +48 -0
  31. behave_lint-1.0.0/behave_lint/exceptions.py +218 -0
  32. behave_lint-1.0.0/behave_lint/infrastructure/__init__.py +26 -0
  33. behave_lint-1.0.0/behave_lint/infrastructure/file_discovery.py +84 -0
  34. behave_lint-1.0.0/behave_lint/infrastructure/project_loader.py +140 -0
  35. behave_lint-1.0.0/behave_lint/metadata/__init__.py +8 -0
  36. behave_lint-1.0.0/behave_lint/models/__init__.py +36 -0
  37. behave_lint-1.0.0/behave_lint/models/config.py +82 -0
  38. behave_lint-1.0.0/behave_lint/models/diagnostic.py +100 -0
  39. behave_lint-1.0.0/behave_lint/models/enums.py +216 -0
  40. behave_lint-1.0.0/behave_lint/models/lint_result.py +132 -0
  41. behave_lint-1.0.0/behave_lint/models/rule_metadata.py +122 -0
  42. behave_lint-1.0.0/behave_lint/plugins/__init__.py +17 -0
  43. behave_lint-1.0.0/behave_lint/plugins/manager.py +333 -0
  44. behave_lint-1.0.0/behave_lint/plugins/plugin_info.py +52 -0
  45. behave_lint-1.0.0/behave_lint/py.typed +0 -0
  46. behave_lint-1.0.0/behave_lint/reporters/__init__.py +29 -0
  47. behave_lint-1.0.0/behave_lint/reporters/base.py +62 -0
  48. behave_lint-1.0.0/behave_lint/reporters/console.py +159 -0
  49. behave_lint-1.0.0/behave_lint/reporters/github.py +77 -0
  50. behave_lint-1.0.0/behave_lint/reporters/json_reporter.py +107 -0
  51. behave_lint-1.0.0/behave_lint/reporters/manager.py +110 -0
  52. behave_lint-1.0.0/behave_lint/reporters/markdown.py +118 -0
  53. behave_lint-1.0.0/behave_lint/reporters/sarif.py +151 -0
  54. behave_lint-1.0.0/behave_lint/rules/__init__.py +29 -0
  55. behave_lint-1.0.0/behave_lint/rules/base.py +207 -0
  56. behave_lint-1.0.0/behave_lint/rules/builtin/__init__.py +132 -0
  57. behave_lint-1.0.0/behave_lint/rules/builtin/complexity.py +440 -0
  58. behave_lint-1.0.0/behave_lint/rules/builtin/consistency.py +435 -0
  59. behave_lint-1.0.0/behave_lint/rules/builtin/correctness.py +608 -0
  60. behave_lint-1.0.0/behave_lint/rules/builtin/pedantic.py +366 -0
  61. behave_lint-1.0.0/behave_lint/rules/builtin/step_definitions.py +518 -0
  62. behave_lint-1.0.0/behave_lint/rules/builtin/style.py +472 -0
  63. behave_lint-1.0.0/behave_lint/rules/context.py +102 -0
  64. behave_lint-1.0.0/behave_lint/rules/diagnostic_factory.py +144 -0
  65. behave_lint-1.0.0/behave_lint/rules/executor.py +290 -0
  66. behave_lint-1.0.0/behave_lint/rules/registry.py +211 -0
  67. behave_lint-1.0.0/behave_lint/rules/scope.py +25 -0
  68. behave_lint-1.0.0/behave_lint/rules/validation.py +100 -0
  69. behave_lint-1.0.0/behave_lint/services/__init__.py +8 -0
  70. behave_lint-1.0.0/behave_lint/statistics/__init__.py +8 -0
  71. behave_lint-1.0.0/behave_lint/version.py +10 -0
  72. behave_lint-1.0.0/benchmarks/README.md +33 -0
  73. behave_lint-1.0.0/docs/CHANGELOG.md +57 -0
  74. behave_lint-1.0.0/docs/CODE_OF_CONDUCT.md +56 -0
  75. behave_lint-1.0.0/docs/CONTRIBUTING.md +125 -0
  76. behave_lint-1.0.0/docs/ROADMAP.md +46 -0
  77. behave_lint-1.0.0/docs/SECURITY.md +41 -0
  78. behave_lint-1.0.0/docs/SUPPORTED_VERSIONS.md +44 -0
  79. behave_lint-1.0.0/docs/api/index.md +5 -0
  80. behave_lint-1.0.0/docs/getting-started/installation.md +30 -0
  81. behave_lint-1.0.0/docs/getting-started/quick-start.md +79 -0
  82. behave_lint-1.0.0/docs/guides/ci-cd.md +89 -0
  83. behave_lint-1.0.0/docs/guides/custom-rules.md +194 -0
  84. behave_lint-1.0.0/docs/guides/index.md +6 -0
  85. behave_lint-1.0.0/docs/guides/plugin-development.md +81 -0
  86. behave_lint-1.0.0/docs/guides/pre-commit.md +50 -0
  87. behave_lint-1.0.0/docs/index.md +33 -0
  88. behave_lint-1.0.0/docs/release-checklist.md +42 -0
  89. behave_lint-1.0.0/docs/rules/complexity.md +182 -0
  90. behave_lint-1.0.0/docs/rules/consistency.md +197 -0
  91. behave_lint-1.0.0/docs/rules/correctness.md +231 -0
  92. behave_lint-1.0.0/docs/rules/index.md +36 -0
  93. behave_lint-1.0.0/docs/rules/pedantic.md +191 -0
  94. behave_lint-1.0.0/docs/rules/step-definitions.md +198 -0
  95. behave_lint-1.0.0/docs/rules/style.md +176 -0
  96. behave_lint-1.0.0/docs/usage/auto-fix.md +111 -0
  97. behave_lint-1.0.0/docs/usage/cli-reference.md +86 -0
  98. behave_lint-1.0.0/docs/usage/configuration.md +175 -0
  99. behave_lint-1.0.0/docs/usage/output-formats.md +203 -0
  100. behave_lint-1.0.0/examples/README.md +40 -0
  101. behave_lint-1.0.0/examples/auto-fix/README.md +36 -0
  102. behave_lint-1.0.0/examples/auto-fix/features/after/demo.feature +25 -0
  103. behave_lint-1.0.0/examples/auto-fix/features/before/demo.feature +25 -0
  104. behave_lint-1.0.0/examples/basic-usage/README.md +31 -0
  105. behave_lint-1.0.0/examples/basic-usage/features/cart.feature +35 -0
  106. behave_lint-1.0.0/examples/basic-usage/features/login.feature +23 -0
  107. behave_lint-1.0.0/examples/basic-usage/pyproject.toml +8 -0
  108. behave_lint-1.0.0/examples/ci-cd/.github/workflows/lint.yml +40 -0
  109. behave_lint-1.0.0/examples/ci-cd/README.md +41 -0
  110. behave_lint-1.0.0/examples/ci-cd/features/checkout.feature +19 -0
  111. behave_lint-1.0.0/examples/ci-cd/features/registration.feature +18 -0
  112. behave_lint-1.0.0/examples/ci-cd/pyproject.toml +4 -0
  113. behave_lint-1.0.0/examples/configs/README.md +5 -0
  114. behave_lint-1.0.0/examples/custom-rules/README.md +44 -0
  115. behave_lint-1.0.0/examples/custom-rules/features/demo.feature +13 -0
  116. behave_lint-1.0.0/examples/custom-rules/features/pyproject.toml +3 -0
  117. behave_lint-1.0.0/examples/custom-rules/pyproject.toml +16 -0
  118. behave_lint-1.0.0/examples/custom-rules/src/behave_lint_ex001/__init__.py +71 -0
  119. behave_lint-1.0.0/examples/enterprise/README.md +6 -0
  120. behave_lint-1.0.0/examples/minimal/README.md +14 -0
  121. behave_lint-1.0.0/examples/plugin_config/README.md +5 -0
  122. behave_lint-1.0.0/examples/plugin_reporter/README.md +5 -0
  123. behave_lint-1.0.0/examples/plugin_rule/README.md +5 -0
  124. behave_lint-1.0.0/pyproject.toml +218 -0
  125. behave_lint-1.0.0/scripts/generate_fixtures.py +160 -0
  126. behave_lint-1.0.0/tests/__init__.py +0 -0
  127. behave_lint-1.0.0/tests/architecture/__init__.py +7 -0
  128. behave_lint-1.0.0/tests/architecture/test_package_structure.py +91 -0
  129. behave_lint-1.0.0/tests/conftest.py +14 -0
  130. behave_lint-1.0.0/tests/golden/__init__.py +8 -0
  131. behave_lint-1.0.0/tests/integration/__init__.py +3 -0
  132. behave_lint-1.0.0/tests/integration/test_end_to_end.py +116 -0
  133. behave_lint-1.0.0/tests/performance/__init__.py +7 -0
  134. behave_lint-1.0.0/tests/performance/test_benchmarks.py +103 -0
  135. behave_lint-1.0.0/tests/regression/__init__.py +6 -0
  136. behave_lint-1.0.0/tests/snapshot/__init__.py +7 -0
  137. behave_lint-1.0.0/tests/unit/__init__.py +6 -0
  138. behave_lint-1.0.0/tests/unit/behave_lint/__init__.py +3 -0
  139. behave_lint-1.0.0/tests/unit/behave_lint/autofix/test_coordinator.py +358 -0
  140. behave_lint-1.0.0/tests/unit/behave_lint/autofix/test_integration.py +301 -0
  141. behave_lint-1.0.0/tests/unit/behave_lint/autofix/test_models.py +135 -0
  142. behave_lint-1.0.0/tests/unit/behave_lint/cli/__init__.py +3 -0
  143. behave_lint-1.0.0/tests/unit/behave_lint/cli/test_cli.py +17 -0
  144. behave_lint-1.0.0/tests/unit/behave_lint/cli/test_coordinator.py +88 -0
  145. behave_lint-1.0.0/tests/unit/behave_lint/cli/test_exit_codes.py +92 -0
  146. behave_lint-1.0.0/tests/unit/behave_lint/cli/test_parser.py +166 -0
  147. behave_lint-1.0.0/tests/unit/behave_lint/cli/test_router.py +130 -0
  148. behave_lint-1.0.0/tests/unit/behave_lint/configuration/__init__.py +3 -0
  149. behave_lint-1.0.0/tests/unit/behave_lint/configuration/test_defaults.py +165 -0
  150. behave_lint-1.0.0/tests/unit/behave_lint/configuration/test_discovery.py +101 -0
  151. behave_lint-1.0.0/tests/unit/behave_lint/configuration/test_loader.py +255 -0
  152. behave_lint-1.0.0/tests/unit/behave_lint/configuration/test_schema.py +123 -0
  153. behave_lint-1.0.0/tests/unit/behave_lint/diagnostics/__init__.py +3 -0
  154. behave_lint-1.0.0/tests/unit/behave_lint/diagnostics/test_collector.py +157 -0
  155. behave_lint-1.0.0/tests/unit/behave_lint/diagnostics/test_dedup.py +85 -0
  156. behave_lint-1.0.0/tests/unit/behave_lint/diagnostics/test_filters.py +260 -0
  157. behave_lint-1.0.0/tests/unit/behave_lint/diagnostics/test_sorting.py +108 -0
  158. behave_lint-1.0.0/tests/unit/behave_lint/diagnostics/test_validation.py +94 -0
  159. behave_lint-1.0.0/tests/unit/behave_lint/engine/__init__.py +3 -0
  160. behave_lint-1.0.0/tests/unit/behave_lint/engine/test_lint_engine.py +125 -0
  161. behave_lint-1.0.0/tests/unit/behave_lint/infrastructure/__init__.py +3 -0
  162. behave_lint-1.0.0/tests/unit/behave_lint/infrastructure/test_file_discovery.py +97 -0
  163. behave_lint-1.0.0/tests/unit/behave_lint/infrastructure/test_project_loader.py +130 -0
  164. behave_lint-1.0.0/tests/unit/behave_lint/models/__init__.py +3 -0
  165. behave_lint-1.0.0/tests/unit/behave_lint/models/test_config.py +109 -0
  166. behave_lint-1.0.0/tests/unit/behave_lint/models/test_diagnostic.py +189 -0
  167. behave_lint-1.0.0/tests/unit/behave_lint/models/test_enums.py +137 -0
  168. behave_lint-1.0.0/tests/unit/behave_lint/models/test_lint_result.py +109 -0
  169. behave_lint-1.0.0/tests/unit/behave_lint/models/test_rule_metadata.py +132 -0
  170. behave_lint-1.0.0/tests/unit/behave_lint/plugins/__init__.py +3 -0
  171. behave_lint-1.0.0/tests/unit/behave_lint/plugins/test_manager.py +396 -0
  172. behave_lint-1.0.0/tests/unit/behave_lint/plugins/test_plugin_info.py +79 -0
  173. behave_lint-1.0.0/tests/unit/behave_lint/reporters/__init__.py +3 -0
  174. behave_lint-1.0.0/tests/unit/behave_lint/reporters/test_base.py +74 -0
  175. behave_lint-1.0.0/tests/unit/behave_lint/reporters/test_console.py +118 -0
  176. behave_lint-1.0.0/tests/unit/behave_lint/reporters/test_github.py +120 -0
  177. behave_lint-1.0.0/tests/unit/behave_lint/reporters/test_json.py +152 -0
  178. behave_lint-1.0.0/tests/unit/behave_lint/reporters/test_manager.py +108 -0
  179. behave_lint-1.0.0/tests/unit/behave_lint/reporters/test_markdown.py +107 -0
  180. behave_lint-1.0.0/tests/unit/behave_lint/reporters/test_sarif.py +172 -0
  181. behave_lint-1.0.0/tests/unit/behave_lint/rules/__init__.py +3 -0
  182. behave_lint-1.0.0/tests/unit/behave_lint/rules/builtin/test_complexity.py +280 -0
  183. behave_lint-1.0.0/tests/unit/behave_lint/rules/builtin/test_consistency.py +265 -0
  184. behave_lint-1.0.0/tests/unit/behave_lint/rules/builtin/test_correctness.py +371 -0
  185. behave_lint-1.0.0/tests/unit/behave_lint/rules/builtin/test_pedantic.py +214 -0
  186. behave_lint-1.0.0/tests/unit/behave_lint/rules/builtin/test_step_definitions.py +239 -0
  187. behave_lint-1.0.0/tests/unit/behave_lint/rules/builtin/test_style.py +286 -0
  188. behave_lint-1.0.0/tests/unit/behave_lint/rules/test_base.py +176 -0
  189. behave_lint-1.0.0/tests/unit/behave_lint/rules/test_context.py +72 -0
  190. behave_lint-1.0.0/tests/unit/behave_lint/rules/test_diagnostic_factory.py +138 -0
  191. behave_lint-1.0.0/tests/unit/behave_lint/rules/test_executor.py +353 -0
  192. behave_lint-1.0.0/tests/unit/behave_lint/rules/test_registry.py +243 -0
  193. behave_lint-1.0.0/tests/unit/behave_lint/rules/test_validation.py +171 -0
  194. behave_lint-1.0.0/tests/unit/behave_lint/test_exceptions.py +165 -0
  195. behave_lint-1.0.0/tests/unit/behave_lint/test_package.py +59 -0
@@ -0,0 +1,65 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ *.egg
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+ wheels/
11
+ *.whl
12
+ MANIFEST
13
+
14
+ # Virtual environments
15
+ .venv/
16
+ venv/
17
+ env/
18
+
19
+ # IDE
20
+ .idea/
21
+ .vscode/
22
+ *.swp
23
+ *.swo
24
+ *~
25
+ .DS_Store
26
+
27
+ # Testing
28
+ .pytest_cache/
29
+ .coverage
30
+ .coverage.*
31
+ htmlcov/
32
+ coverage.xml
33
+ .tox/
34
+
35
+ # Mypy
36
+ .mypy_cache/
37
+ .dmypy.json
38
+
39
+ # Ruff
40
+ .ruff_cache/
41
+
42
+ # Cache (behave-lint runtime)
43
+ .cache/
44
+ behave_lint_cache/
45
+
46
+ # Benchmarks
47
+ benchmarks/projects/
48
+ benchmarks/results/
49
+
50
+ # MkDocs
51
+ site/
52
+
53
+ # OS
54
+ Thumbs.db
55
+ ehthumbs.db
56
+ Desktop.ini
57
+ $RECYCLE.BIN/
58
+
59
+ # Temporary
60
+ *.tmp
61
+ *.bak
62
+ *.log
63
+
64
+ # Reference documents (internal design specs, not published)
65
+ ref/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 behave-lint contributors
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.
@@ -0,0 +1,284 @@
1
+ Metadata-Version: 2.4
2
+ Name: behave-lint
3
+ Version: 1.0.0
4
+ Summary: A fast, opinionated, extensible linter for Gherkin .feature files and Behave test suites.
5
+ Project-URL: Homepage, https://github.com/MathiasPaulenko/behave-lint
6
+ Project-URL: Documentation, https://mathiaspaulenko.github.io/behave-lint/
7
+ Project-URL: Repository, https://github.com/MathiasPaulenko/behave-lint
8
+ Project-URL: Issues, https://github.com/MathiasPaulenko/behave-lint/issues
9
+ Project-URL: Changelog, https://github.com/MathiasPaulenko/behave-lint/blob/main/docs/CHANGELOG.md
10
+ Author: Mathias Paulenko, behave-lint contributors
11
+ License-Expression: MIT
12
+ License-File: LICENSE
13
+ Keywords: auto-fix,bdd,behave,ci-cd,code-quality,cucumber,feature-files,gherkin,lint,linter,sarif,static-analysis
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Framework :: Pytest
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: License :: OSI Approved :: MIT License
19
+ Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Software Development :: Quality Assurance
25
+ Classifier: Topic :: Software Development :: Testing
26
+ Classifier: Topic :: Utilities
27
+ Classifier: Typing :: Typed
28
+ Requires-Python: >=3.11
29
+ Requires-Dist: behave-model<2,>=1.0
30
+ Provides-Extra: dev
31
+ Requires-Dist: mypy>=1.10; extra == 'dev'
32
+ Requires-Dist: pre-commit>=3.7; extra == 'dev'
33
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
34
+ Requires-Dist: pytest-xdist>=3.5; extra == 'dev'
35
+ Requires-Dist: pytest>=8.0; extra == 'dev'
36
+ Requires-Dist: ruff>=0.6; extra == 'dev'
37
+ Provides-Extra: docs
38
+ Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
39
+ Requires-Dist: mkdocs>=1.6; extra == 'docs'
40
+ Requires-Dist: mkdocstrings[python]>=0.25; extra == 'docs'
41
+ Requires-Dist: pymdown-extensions>=10.7; extra == 'docs'
42
+ Provides-Extra: release
43
+ Requires-Dist: hatchling>=1.21; extra == 'release'
44
+ Provides-Extra: test
45
+ Requires-Dist: pytest-cov>=5.0; extra == 'test'
46
+ Requires-Dist: pytest-xdist>=3.5; extra == 'test'
47
+ Requires-Dist: pytest>=8.0; extra == 'test'
48
+ Description-Content-Type: text/markdown
49
+
50
+ # behave-lint
51
+
52
+ [![CI](https://github.com/MathiasPaulenko/behave-lint/actions/workflows/ci.yml/badge.svg)](https://github.com/MathiasPaulenko/behave-lint/actions/workflows/ci.yml)
53
+ [![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue.svg)](https://www.python.org/downloads/)
54
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
55
+ [![Code style: Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://docs.astral.sh/ruff/)
56
+
57
+ > A fast, opinionated, extensible linter for Gherkin `.feature` files and Behave test suites.
58
+
59
+ **behave-lint** statically analyzes your Gherkin feature files for
60
+ correctness, consistency, complexity, and style — without executing a
61
+ single test. It ships with **31 built-in rules** across 6 categories,
62
+ supports **auto-fix** for common violations, and outputs in **5 formats**
63
+ including SARIF for GitHub Code Scanning.
64
+
65
+ ## Why behave-lint?
66
+
67
+ | Without behave-lint | With behave-lint |
68
+ |---|---|
69
+ | Duplicate step definitions cause silent match failures | **BD001** detects duplicates at lint time |
70
+ | Inconsistent tag casing breaks CI filters | **BS001** auto-fixes to `snake_case` |
71
+ | Trailing punctuation in steps clutters reports | **BD005** strips it automatically |
72
+ | No Given-When-Then ordering enforcement | **BC001** catches structural violations |
73
+ | Feature files grow unchecked in complexity | **BX001-BX005** enforce limits |
74
+
75
+ ## Installation
76
+
77
+ ```bash
78
+ pip install behave-lint
79
+ ```
80
+
81
+ Or with [uv](https://docs.astral.sh/uv/):
82
+
83
+ ```bash
84
+ uv add behave-lint
85
+ ```
86
+
87
+ ## Quick start
88
+
89
+ ```bash
90
+ # Lint all feature files
91
+ behave-lint features/
92
+
93
+ # Apply safe auto-fixes
94
+ behave-lint features/ --fix
95
+
96
+ # JSON output for CI integration
97
+ behave-lint features/ --json --output-file report.json
98
+
99
+ # SARIF for GitHub Code Scanning
100
+ behave-lint features/ --sarif --output-file results.sarif
101
+
102
+ # List all available rules
103
+ behave-lint --list-rules
104
+
105
+ # Explain a specific rule
106
+ behave-lint --explain BC001
107
+ ```
108
+
109
+ ## Features
110
+
111
+ - **31 built-in rules** across 6 categories: correctness, step
112
+ definitions, consistency, complexity, style, and pedantic.
113
+ - **Auto-fix** — safe, deterministic fixes for common violations
114
+ (`--fix`). Unsafe fixes require `--unsafe-fixes`.
115
+ - **5 output formats** — console (colored), JSON, SARIF, Markdown, and
116
+ GitHub Actions inline annotations.
117
+ - **Zero-config** — sensible defaults work out of the box. Override
118
+ anything via `[tool.behave-lint]` in `pyproject.toml`.
119
+ - **Plugin system** — write custom rules and reporters as Python
120
+ packages. Register via entry points.
121
+ - **CI/CD ready** — deterministic output, clear exit codes, SARIF
122
+ integration with GitHub Code Scanning.
123
+ - **Fast** — sub-second on typical projects through caching and
124
+ parallel execution.
125
+
126
+ ## Rules
127
+
128
+ | Category | Prefix | Rules | Default Severity |
129
+ |----------|--------|-------|------------------|
130
+ | [Correctness](docs/rules/correctness.md) | BC | 6 | Error |
131
+ | [Step Definitions](docs/rules/step-definitions.md) | BD | 5 | Warning |
132
+ | [Consistency](docs/rules/consistency.md) | BK | 5 | Warning / Info |
133
+ | [Complexity](docs/rules/complexity.md) | BX | 5 | Warning |
134
+ | [Style](docs/rules/style.md) | BS | 5 | Warning |
135
+ | [Pedantic](docs/rules/pedantic.md) | BP | 5 | Info |
136
+
137
+ ### Auto-fixable rules
138
+
139
+ | Rule | Fix | Safety |
140
+ |------|-----|--------|
141
+ | BC004 | Replace invalid tag characters with `_` | Safe |
142
+ | BD004 | Convert `{param}` → `<param>` | Safe |
143
+ | BD005 | Remove trailing punctuation from steps | Safe |
144
+ | BS001 | Convert tags to `snake_case` | Safe |
145
+
146
+ ## Configuration
147
+
148
+ Configure behave-lint in your `pyproject.toml`:
149
+
150
+ ```toml
151
+ [tool.behave-lint]
152
+ select = ["BC001", "BC002", "BS001"]
153
+ ignore = ["BP001", "BP002"]
154
+ fail-on = "warning"
155
+ exclude = ["features/wip/"]
156
+
157
+ [tool.behave-lint.severity]
158
+ BK001 = "info"
159
+
160
+ [tool.behave-lint.rules]
161
+ BX001 = { max-steps = 8 }
162
+ BP003 = { min-length = 5 }
163
+ ```
164
+
165
+ **Precedence** (lowest → highest):
166
+
167
+ 1. Built-in defaults
168
+ 2. `pyproject.toml` `[tool.behave-lint]`
169
+ 3. Environment variables (`BEHAVE_LINT_*`)
170
+ 4. CLI flags
171
+
172
+ See the [Configuration guide](docs/usage/configuration.md) for all
173
+ options.
174
+
175
+ ## CI/CD integration
176
+
177
+ ### GitHub Actions with SARIF
178
+
179
+ ```yaml
180
+ - run: pip install behave-lint
181
+ - run: behave-lint features/ --sarif --output-file behave-lint.sarif
182
+ - uses: github/codeql-action/upload-sarif@v3
183
+ with:
184
+ sarif_file: behave-lint.sarif
185
+ ```
186
+
187
+ ### Inline annotations
188
+
189
+ ```yaml
190
+ - run: behave-lint features/ --output github
191
+ ```
192
+
193
+ See the [CI/CD guide](docs/guides/ci-cd.md) for full workflows.
194
+
195
+ ## Output formats
196
+
197
+ | Format | Flag | Use case |
198
+ |--------|------|----------|
199
+ | Console | `--output console` | Local development (default) |
200
+ | JSON | `--json` | CI pipelines, custom tooling |
201
+ | SARIF | `--sarif` | GitHub Code Scanning |
202
+ | Markdown | `--output markdown` | PR comments, reports |
203
+ | GitHub | `--output github` | Inline PR annotations |
204
+
205
+ See the [Output Formats reference](docs/usage/output-formats.md) for
206
+ schema details.
207
+
208
+ ## Examples
209
+
210
+ Runnable example projects in the [`examples/`](examples/) directory:
211
+
212
+ | Example | Description |
213
+ |---------|-------------|
214
+ | [basic-usage](examples/basic-usage/) | Minimal project with configuration |
215
+ | [auto-fix](examples/auto-fix/) | Before/after demo of `--fix` |
216
+ | [ci-cd](examples/ci-cd/) | GitHub Actions with SARIF upload |
217
+ | [custom-rules](examples/custom-rules/) | Custom rule plugin with entry points |
218
+
219
+ ## Documentation
220
+
221
+ ### User guide
222
+
223
+ - [Installation](docs/getting-started/installation.md)
224
+ - [Quick Start](docs/getting-started/quick-start.md)
225
+ - [CLI Reference](docs/usage/cli-reference.md)
226
+ - [Configuration](docs/usage/configuration.md)
227
+ - [Output Formats](docs/usage/output-formats.md)
228
+ - [Auto-Fix](docs/usage/auto-fix.md)
229
+
230
+ ### Rules
231
+
232
+ - [Rules Overview](docs/rules/index.md)
233
+ - [Correctness (BC)](docs/rules/correctness.md)
234
+ - [Step Definitions (BD)](docs/rules/step-definitions.md)
235
+ - [Consistency (BK)](docs/rules/consistency.md)
236
+ - [Complexity (BX)](docs/rules/complexity.md)
237
+ - [Style (BS)](docs/rules/style.md)
238
+ - [Pedantic (BP)](docs/rules/pedantic.md)
239
+
240
+ ### Guides
241
+
242
+ - [CI/CD Integration](docs/guides/ci-cd.md)
243
+ - [Pre-commit Hook](docs/guides/pre-commit.md)
244
+ - [Custom Rules](docs/guides/custom-rules.md)
245
+ - [Plugin Development](docs/guides/plugin-development.md)
246
+
247
+ ### Design documents
248
+
249
+ - [Vision](ref/VISION.md) — project vision and mission
250
+ - [Specification](ref/SPECIFICATION.md) — full feature specification
251
+ - [Architecture](ref/ARCHITECTURE.md) — internal architecture
252
+ - [API](ref/API.md) — public API specification
253
+ - [Rule Engine Design](ref/RULE_ENGINE.md) — rule lifecycle and execution
254
+ - [Rule Taxonomy](ref/RULE_TAXONOMY.md) — rule categories and metadata
255
+ - [Configuration System](ref/CONFIGURATION_SYSTEM.md) — configuration schema
256
+ - [Implementation Roadmap](ref/IMPLEMENTATION_ROADMAP.md) — milestone plan
257
+
258
+ ## Development
259
+
260
+ ```bash
261
+ git clone https://github.com/MathiasPaulenko/behave-lint.git
262
+ cd behave-lint
263
+ uv sync
264
+ uv run pre-commit install
265
+
266
+ # Run tests
267
+ uv run pytest
268
+
269
+ # Lint
270
+ uv run ruff check src/ tests/
271
+
272
+ # Type check
273
+ uv run mypy src/
274
+
275
+ # Build docs
276
+ uv run mkdocs build --strict
277
+ ```
278
+
279
+ See [CONTRIBUTING.md](docs/CONTRIBUTING.md) for detailed contribution
280
+ guidelines, coding standards, and PR workflow.
281
+
282
+ ## License
283
+
284
+ [MIT](LICENSE)
@@ -0,0 +1,235 @@
1
+ # behave-lint
2
+
3
+ [![CI](https://github.com/MathiasPaulenko/behave-lint/actions/workflows/ci.yml/badge.svg)](https://github.com/MathiasPaulenko/behave-lint/actions/workflows/ci.yml)
4
+ [![Python](https://img.shields.io/badge/python-3.11%20%7C%203.12%20%7C%203.13-blue.svg)](https://www.python.org/downloads/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Code style: Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://docs.astral.sh/ruff/)
7
+
8
+ > A fast, opinionated, extensible linter for Gherkin `.feature` files and Behave test suites.
9
+
10
+ **behave-lint** statically analyzes your Gherkin feature files for
11
+ correctness, consistency, complexity, and style — without executing a
12
+ single test. It ships with **31 built-in rules** across 6 categories,
13
+ supports **auto-fix** for common violations, and outputs in **5 formats**
14
+ including SARIF for GitHub Code Scanning.
15
+
16
+ ## Why behave-lint?
17
+
18
+ | Without behave-lint | With behave-lint |
19
+ |---|---|
20
+ | Duplicate step definitions cause silent match failures | **BD001** detects duplicates at lint time |
21
+ | Inconsistent tag casing breaks CI filters | **BS001** auto-fixes to `snake_case` |
22
+ | Trailing punctuation in steps clutters reports | **BD005** strips it automatically |
23
+ | No Given-When-Then ordering enforcement | **BC001** catches structural violations |
24
+ | Feature files grow unchecked in complexity | **BX001-BX005** enforce limits |
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ pip install behave-lint
30
+ ```
31
+
32
+ Or with [uv](https://docs.astral.sh/uv/):
33
+
34
+ ```bash
35
+ uv add behave-lint
36
+ ```
37
+
38
+ ## Quick start
39
+
40
+ ```bash
41
+ # Lint all feature files
42
+ behave-lint features/
43
+
44
+ # Apply safe auto-fixes
45
+ behave-lint features/ --fix
46
+
47
+ # JSON output for CI integration
48
+ behave-lint features/ --json --output-file report.json
49
+
50
+ # SARIF for GitHub Code Scanning
51
+ behave-lint features/ --sarif --output-file results.sarif
52
+
53
+ # List all available rules
54
+ behave-lint --list-rules
55
+
56
+ # Explain a specific rule
57
+ behave-lint --explain BC001
58
+ ```
59
+
60
+ ## Features
61
+
62
+ - **31 built-in rules** across 6 categories: correctness, step
63
+ definitions, consistency, complexity, style, and pedantic.
64
+ - **Auto-fix** — safe, deterministic fixes for common violations
65
+ (`--fix`). Unsafe fixes require `--unsafe-fixes`.
66
+ - **5 output formats** — console (colored), JSON, SARIF, Markdown, and
67
+ GitHub Actions inline annotations.
68
+ - **Zero-config** — sensible defaults work out of the box. Override
69
+ anything via `[tool.behave-lint]` in `pyproject.toml`.
70
+ - **Plugin system** — write custom rules and reporters as Python
71
+ packages. Register via entry points.
72
+ - **CI/CD ready** — deterministic output, clear exit codes, SARIF
73
+ integration with GitHub Code Scanning.
74
+ - **Fast** — sub-second on typical projects through caching and
75
+ parallel execution.
76
+
77
+ ## Rules
78
+
79
+ | Category | Prefix | Rules | Default Severity |
80
+ |----------|--------|-------|------------------|
81
+ | [Correctness](docs/rules/correctness.md) | BC | 6 | Error |
82
+ | [Step Definitions](docs/rules/step-definitions.md) | BD | 5 | Warning |
83
+ | [Consistency](docs/rules/consistency.md) | BK | 5 | Warning / Info |
84
+ | [Complexity](docs/rules/complexity.md) | BX | 5 | Warning |
85
+ | [Style](docs/rules/style.md) | BS | 5 | Warning |
86
+ | [Pedantic](docs/rules/pedantic.md) | BP | 5 | Info |
87
+
88
+ ### Auto-fixable rules
89
+
90
+ | Rule | Fix | Safety |
91
+ |------|-----|--------|
92
+ | BC004 | Replace invalid tag characters with `_` | Safe |
93
+ | BD004 | Convert `{param}` → `<param>` | Safe |
94
+ | BD005 | Remove trailing punctuation from steps | Safe |
95
+ | BS001 | Convert tags to `snake_case` | Safe |
96
+
97
+ ## Configuration
98
+
99
+ Configure behave-lint in your `pyproject.toml`:
100
+
101
+ ```toml
102
+ [tool.behave-lint]
103
+ select = ["BC001", "BC002", "BS001"]
104
+ ignore = ["BP001", "BP002"]
105
+ fail-on = "warning"
106
+ exclude = ["features/wip/"]
107
+
108
+ [tool.behave-lint.severity]
109
+ BK001 = "info"
110
+
111
+ [tool.behave-lint.rules]
112
+ BX001 = { max-steps = 8 }
113
+ BP003 = { min-length = 5 }
114
+ ```
115
+
116
+ **Precedence** (lowest → highest):
117
+
118
+ 1. Built-in defaults
119
+ 2. `pyproject.toml` `[tool.behave-lint]`
120
+ 3. Environment variables (`BEHAVE_LINT_*`)
121
+ 4. CLI flags
122
+
123
+ See the [Configuration guide](docs/usage/configuration.md) for all
124
+ options.
125
+
126
+ ## CI/CD integration
127
+
128
+ ### GitHub Actions with SARIF
129
+
130
+ ```yaml
131
+ - run: pip install behave-lint
132
+ - run: behave-lint features/ --sarif --output-file behave-lint.sarif
133
+ - uses: github/codeql-action/upload-sarif@v3
134
+ with:
135
+ sarif_file: behave-lint.sarif
136
+ ```
137
+
138
+ ### Inline annotations
139
+
140
+ ```yaml
141
+ - run: behave-lint features/ --output github
142
+ ```
143
+
144
+ See the [CI/CD guide](docs/guides/ci-cd.md) for full workflows.
145
+
146
+ ## Output formats
147
+
148
+ | Format | Flag | Use case |
149
+ |--------|------|----------|
150
+ | Console | `--output console` | Local development (default) |
151
+ | JSON | `--json` | CI pipelines, custom tooling |
152
+ | SARIF | `--sarif` | GitHub Code Scanning |
153
+ | Markdown | `--output markdown` | PR comments, reports |
154
+ | GitHub | `--output github` | Inline PR annotations |
155
+
156
+ See the [Output Formats reference](docs/usage/output-formats.md) for
157
+ schema details.
158
+
159
+ ## Examples
160
+
161
+ Runnable example projects in the [`examples/`](examples/) directory:
162
+
163
+ | Example | Description |
164
+ |---------|-------------|
165
+ | [basic-usage](examples/basic-usage/) | Minimal project with configuration |
166
+ | [auto-fix](examples/auto-fix/) | Before/after demo of `--fix` |
167
+ | [ci-cd](examples/ci-cd/) | GitHub Actions with SARIF upload |
168
+ | [custom-rules](examples/custom-rules/) | Custom rule plugin with entry points |
169
+
170
+ ## Documentation
171
+
172
+ ### User guide
173
+
174
+ - [Installation](docs/getting-started/installation.md)
175
+ - [Quick Start](docs/getting-started/quick-start.md)
176
+ - [CLI Reference](docs/usage/cli-reference.md)
177
+ - [Configuration](docs/usage/configuration.md)
178
+ - [Output Formats](docs/usage/output-formats.md)
179
+ - [Auto-Fix](docs/usage/auto-fix.md)
180
+
181
+ ### Rules
182
+
183
+ - [Rules Overview](docs/rules/index.md)
184
+ - [Correctness (BC)](docs/rules/correctness.md)
185
+ - [Step Definitions (BD)](docs/rules/step-definitions.md)
186
+ - [Consistency (BK)](docs/rules/consistency.md)
187
+ - [Complexity (BX)](docs/rules/complexity.md)
188
+ - [Style (BS)](docs/rules/style.md)
189
+ - [Pedantic (BP)](docs/rules/pedantic.md)
190
+
191
+ ### Guides
192
+
193
+ - [CI/CD Integration](docs/guides/ci-cd.md)
194
+ - [Pre-commit Hook](docs/guides/pre-commit.md)
195
+ - [Custom Rules](docs/guides/custom-rules.md)
196
+ - [Plugin Development](docs/guides/plugin-development.md)
197
+
198
+ ### Design documents
199
+
200
+ - [Vision](ref/VISION.md) — project vision and mission
201
+ - [Specification](ref/SPECIFICATION.md) — full feature specification
202
+ - [Architecture](ref/ARCHITECTURE.md) — internal architecture
203
+ - [API](ref/API.md) — public API specification
204
+ - [Rule Engine Design](ref/RULE_ENGINE.md) — rule lifecycle and execution
205
+ - [Rule Taxonomy](ref/RULE_TAXONOMY.md) — rule categories and metadata
206
+ - [Configuration System](ref/CONFIGURATION_SYSTEM.md) — configuration schema
207
+ - [Implementation Roadmap](ref/IMPLEMENTATION_ROADMAP.md) — milestone plan
208
+
209
+ ## Development
210
+
211
+ ```bash
212
+ git clone https://github.com/MathiasPaulenko/behave-lint.git
213
+ cd behave-lint
214
+ uv sync
215
+ uv run pre-commit install
216
+
217
+ # Run tests
218
+ uv run pytest
219
+
220
+ # Lint
221
+ uv run ruff check src/ tests/
222
+
223
+ # Type check
224
+ uv run mypy src/
225
+
226
+ # Build docs
227
+ uv run mkdocs build --strict
228
+ ```
229
+
230
+ See [CONTRIBUTING.md](docs/CONTRIBUTING.md) for detailed contribution
231
+ guidelines, coding standards, and PR workflow.
232
+
233
+ ## License
234
+
235
+ [MIT](LICENSE)
@@ -0,0 +1,43 @@
1
+ """behave-lint — A fast, opinionated, extensible linter for Gherkin .feature files.
2
+
3
+ This package provides static analysis for Behave BDD projects, consuming
4
+ behave-model as its single source of truth.
5
+
6
+ Public API is defined in API.md. Only names explicitly exported here are
7
+ considered stable and publicly supported.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ from behave_lint.configuration.loader import load_config
13
+ from behave_lint.models import (
14
+ AutoFixCapability,
15
+ Category,
16
+ Config,
17
+ Diagnostic,
18
+ FixCost,
19
+ LintResult,
20
+ LintSummary,
21
+ PerformanceImpact,
22
+ RuleExample,
23
+ RuleMetadata,
24
+ Severity,
25
+ )
26
+
27
+ __version__ = "1.0.0"
28
+
29
+ __all__ = [
30
+ "AutoFixCapability",
31
+ "Category",
32
+ "Config",
33
+ "Diagnostic",
34
+ "FixCost",
35
+ "LintResult",
36
+ "LintSummary",
37
+ "PerformanceImpact",
38
+ "RuleExample",
39
+ "RuleMetadata",
40
+ "Severity",
41
+ "__version__",
42
+ "load_config",
43
+ ]
@@ -0,0 +1,8 @@
1
+ """Entry point for ``python -m behave_lint``."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from behave_lint.cli import main
6
+
7
+ if __name__ == "__main__":
8
+ main()
@@ -0,0 +1,18 @@
1
+ """Auto-Fix Coordinator — fix collection, conflict detection, application.
2
+
3
+ Application layer — component C18.
4
+
5
+ See COMPONENT_DESIGN.md Section 5 and RULE_ENGINE.md Section 9.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from behave_lint.autofix.coordinator import FixCoordinator
11
+ from behave_lint.autofix.models import FixEdit, FixRecord, FixResult
12
+
13
+ __all__ = [
14
+ "FixCoordinator",
15
+ "FixEdit",
16
+ "FixRecord",
17
+ "FixResult",
18
+ ]