sarj-sql-lint 0.44.2__tar.gz → 0.45.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 (54) hide show
  1. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/PKG-INFO +2 -2
  2. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/pyproject.toml +2 -2
  3. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/__main__.py +2 -6
  4. sarj_sql_lint-0.45.0/src/sarj_sql_lint/postgres_policy.py +14 -0
  5. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/no_analytical_queries_in_transactional_db.py +8 -8
  6. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/.gitignore +0 -0
  7. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/LICENSE +0 -0
  8. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/README.md +0 -0
  9. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/__init__.py +0 -0
  10. {sarj_sql_lint-0.44.2/src/sarj_sql_lint/rules → sarj_sql_lint-0.45.0/src/sarj_sql_lint}/_aggregate_identity.py +0 -0
  11. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/_autofix_index_name.py +0 -0
  12. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/_autofix_literals.py +0 -0
  13. {sarj_sql_lint-0.44.2/src/sarj_sql_lint/rules → sarj_sql_lint-0.45.0/src/sarj_sql_lint}/_explain.py +0 -0
  14. {sarj_sql_lint-0.44.2/src/sarj_sql_lint/rules → sarj_sql_lint-0.45.0/src/sarj_sql_lint}/_policy_source.py +0 -0
  15. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/_postgres.py +0 -0
  16. {sarj_sql_lint-0.44.2/src/sarj_sql_lint/rules → sarj_sql_lint-0.45.0/src/sarj_sql_lint}/_postgres_ctas.py +0 -0
  17. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/_version.py +0 -0
  18. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/autofix.py +0 -0
  19. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/py.typed +0 -0
  20. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rule_base.py +0 -0
  21. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/__init__.py +0 -0
  22. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/_column_contracts.py +0 -0
  23. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/_constraint_analysis.py +0 -0
  24. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/_copy_input.py +0 -0
  25. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/_index_analysis.py +0 -0
  26. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/_registry.py +0 -0
  27. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/add_constraint_requires_not_valid.py +0 -0
  28. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/combine_alter_table.py +0 -0
  29. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/declared_column_bounds.py +0 -0
  30. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/enforce_timestamptz.py +0 -0
  31. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/excessive_commentary.py +0 -0
  32. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/idempotent_ddl.py +0 -0
  33. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/index_budget.py +0 -0
  34. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/index_concurrently.py +0 -0
  35. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/insert_requires_on_conflict.py +0 -0
  36. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/invalid_concurrent_ddl.py +0 -0
  37. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/invalid_postgres_ddl.py +0 -0
  38. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/mixed_migration_phases.py +0 -0
  39. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/new_table_inline_constraints.py +0 -0
  40. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/no_application_schema_check.py +0 -0
  41. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/no_comment_cruft.py +0 -0
  42. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/no_create_trigger.py +0 -0
  43. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/no_database_functions.py +0 -0
  44. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/no_duplicate_index.py +0 -0
  45. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/no_migration_comments.py +0 -0
  46. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/no_noop_migration_down.py +0 -0
  47. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/no_null_comparison.py +0 -0
  48. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/no_offset_pagination.py +0 -0
  49. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/no_pg_enum.py +0 -0
  50. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/prefer_constrained_status.py +0 -0
  51. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/prefer_jsonb.py +0 -0
  52. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/prefer_text_over_varchar.py +0 -0
  53. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/prefer_uuidv7_default.py +0 -0
  54. {sarj_sql_lint-0.44.2 → sarj_sql_lint-0.45.0}/src/sarj_sql_lint/rules/require_fk_index.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: sarj-sql-lint
3
- Version: 0.44.2
3
+ Version: 0.45.0
4
4
  Summary: Deterministic PostgreSQL migration rules for safe, repeatable schema changes.
5
5
  Project-URL: Homepage, https://code-standards.sarj.ai/rules/sql/
6
6
  Project-URL: Documentation, https://code-standards.sarj.ai/rules/sql/
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3
17
17
  Classifier: Programming Language :: Python :: 3.14
18
18
  Classifier: Topic :: Software Development :: Quality Assurance
19
19
  Requires-Python: >=3.14
20
- Requires-Dist: sarj-rule-contracts==0.6.2
20
+ Requires-Dist: sarj-rule-contracts==0.7.0
21
21
  Requires-Dist: sqlglot==30.24.0
22
22
  Requires-Dist: typer==0.27.3
23
23
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "sarj-sql-lint"
3
- version = "0.44.2"
3
+ version = "0.45.0"
4
4
  description = "Deterministic PostgreSQL migration rules for safe, repeatable schema changes."
5
5
  readme = "README.md"
6
6
  authors = [{ name = "sarj-ai" }]
@@ -15,7 +15,7 @@ classifiers = [
15
15
  "Programming Language :: Python :: 3.14",
16
16
  "Topic :: Software Development :: Quality Assurance",
17
17
  ]
18
- dependencies = ["sarj-rule-contracts==0.6.2", "sqlglot==30.24.0", "typer==0.27.3"]
18
+ dependencies = ["sarj-rule-contracts==0.7.0", "sqlglot==30.24.0", "typer==0.27.3"]
19
19
 
20
20
  [project.scripts]
21
21
  sarj-sql-lint = "sarj_sql_lint.__main__:main"
@@ -7,7 +7,7 @@ import stat
7
7
  import sys
8
8
  from typing import TYPE_CHECKING, Annotated
9
9
 
10
- from sarj_rule_contracts import NewlinePolicy, RuleId, fix_file
10
+ from sarj_rule_contracts import NewlinePolicy, RuleId, fix_file, iter_source_files
11
11
  import typer
12
12
 
13
13
  from sarj_sql_lint import __version__
@@ -188,11 +188,7 @@ def main(argv: list[str] | None = None) -> int:
188
188
 
189
189
 
190
190
  def _iter_directory_inputs(p: Path) -> Iterator[Path]:
191
- for child in p.rglob("*.sql"):
192
- if not child.is_file():
193
- continue
194
- if any(part in SKIP_DIR_NAMES for part in child.parts):
195
- continue
191
+ for child in iter_source_files(p, suffixes=frozenset({".sql"}), skip_dirs=SKIP_DIR_NAMES):
196
192
  try:
197
193
  if child.stat().st_size > MAX_FILE_BYTES:
198
194
  continue
@@ -0,0 +1,14 @@
1
+ from sarj_sql_lint._aggregate_identity import aggregate_name as aggregate_name
2
+ from sarj_sql_lint._policy_source import normalize_group_comments as normalize_group_comments
3
+
4
+
5
+ def normalize_postgres_ctas(source: str) -> str:
6
+ from sarj_sql_lint._postgres_ctas import normalize_postgres_ctas as normalize # ruff: ignore[import-outside-top-level] -- defer SQLGlot until a candidate query requires normalization.
7
+
8
+ return normalize(source)
9
+
10
+
11
+ def normalize_postgres_explain(source: str) -> str:
12
+ from sarj_sql_lint._explain import normalize_postgres_explain as normalize # ruff: ignore[import-outside-top-level] -- defer SQLGlot until a candidate EXPLAIN requires normalization.
13
+
14
+ return normalize(source)
@@ -5,6 +5,12 @@ from pathlib import PurePosixPath
5
5
  import re
6
6
  from typing import TYPE_CHECKING, final, override
7
7
 
8
+ from sarj_sql_lint._aggregate_identity import (
9
+ aggregate_name,
10
+ aggregate_offset,
11
+ contains_aggregate_spelling,
12
+ )
13
+ from sarj_sql_lint._policy_source import normalize_group_comments
8
14
  from sarj_sql_lint.rule_base import (
9
15
  AutofixPolicy,
10
16
  DefaultLevel,
@@ -20,12 +26,6 @@ from sarj_sql_lint.rule_base import (
20
26
  is_dump_file,
21
27
  source_location,
22
28
  )
23
- from sarj_sql_lint.rules._aggregate_identity import (
24
- aggregate_name,
25
- aggregate_offset,
26
- contains_aggregate_spelling,
27
- )
28
- from sarj_sql_lint.rules._policy_source import normalize_group_comments
29
29
 
30
30
 
31
31
  if TYPE_CHECKING:
@@ -76,7 +76,7 @@ def _statements(source: str, dialect: str) -> Iterator[_ParsedStatement]:
76
76
  from sqlglot.errors import SqlglotError # ruff: ignore[import-outside-top-level] -- paired with the lazy parser.
77
77
  from sqlglot.tokenizer_core import TokenType # ruff: ignore[import-outside-top-level] -- split statements without splitting quoted values.
78
78
 
79
- from sarj_sql_lint.rules._postgres_ctas import normalize_postgres_ctas # ruff: ignore[import-outside-top-level] -- preserve COPY boundaries before and CTAS grammar after executing EXPLAIN normalization.
79
+ from sarj_sql_lint._postgres_ctas import normalize_postgres_ctas # ruff: ignore[import-outside-top-level] -- preserve COPY boundaries before and CTAS grammar after executing EXPLAIN normalization.
80
80
 
81
81
  parameters = _POSTGRES_PLACEHOLDER if dialect == "postgres" else _PLACEHOLDER
82
82
  prepared = parameters.sub(lambda match: ("%" if match.group() == "%%" else "?").ljust(len(match.group())), source)
@@ -84,7 +84,7 @@ def _statements(source: str, dialect: str) -> Iterator[_ParsedStatement]:
84
84
  prepared = normalize_postgres_ctas(prepared)
85
85
  try:
86
86
  if dialect == "postgres" and "EXPLAIN" in prepared.upper():
87
- from sarj_sql_lint.rules._explain import normalize_postgres_explain # ruff: ignore[import-outside-top-level] -- expose only proven executing EXPLAIN queries.
87
+ from sarj_sql_lint._explain import normalize_postgres_explain # ruff: ignore[import-outside-top-level] -- expose only proven executing EXPLAIN queries.
88
88
 
89
89
  prepared = normalize_postgres_explain(prepared)
90
90
  prepared = normalize_postgres_ctas(prepared)
File without changes
File without changes