pgrecon 0.1.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 (109) hide show
  1. pgrecon-0.1.0/.gitattributes +3 -0
  2. pgrecon-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +20 -0
  3. pgrecon-0.1.0/.github/ISSUE_TEMPLATE/rule_request.md +23 -0
  4. pgrecon-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +11 -0
  5. pgrecon-0.1.0/.github/workflows/ci.yml +42 -0
  6. pgrecon-0.1.0/.github/workflows/release.yml +39 -0
  7. pgrecon-0.1.0/.gitignore +19 -0
  8. pgrecon-0.1.0/.pre-commit-config.yaml +49 -0
  9. pgrecon-0.1.0/.python-version +1 -0
  10. pgrecon-0.1.0/CHANGELOG.md +112 -0
  11. pgrecon-0.1.0/CODE_OF_CONDUCT.md +11 -0
  12. pgrecon-0.1.0/CONTRIBUTING.md +68 -0
  13. pgrecon-0.1.0/LICENSE +202 -0
  14. pgrecon-0.1.0/PKG-INFO +219 -0
  15. pgrecon-0.1.0/README.md +193 -0
  16. pgrecon-0.1.0/SECURITY.md +10 -0
  17. pgrecon-0.1.0/examples/README.md +26 -0
  18. pgrecon-0.1.0/examples/dump_oracle21c/check_conditions.csv +11 -0
  19. pgrecon-0.1.0/examples/dump_oracle21c/columns.csv +52 -0
  20. pgrecon-0.1.0/examples/dump_oracle21c/constraint_columns.csv +20 -0
  21. pgrecon-0.1.0/examples/dump_oracle21c/constraints.csv +20 -0
  22. pgrecon-0.1.0/examples/dump_oracle21c/db_links.csv +3 -0
  23. pgrecon-0.1.0/examples/dump_oracle21c/ddl_sequences.sql +5 -0
  24. pgrecon-0.1.0/examples/dump_oracle21c/ddl_tables.sql +113 -0
  25. pgrecon-0.1.0/examples/dump_oracle21c/ddl_views.sql +20 -0
  26. pgrecon-0.1.0/examples/dump_oracle21c/dependencies.csv +18 -0
  27. pgrecon-0.1.0/examples/dump_oracle21c/features.csv +14 -0
  28. pgrecon-0.1.0/examples/dump_oracle21c/index_columns.csv +10 -0
  29. pgrecon-0.1.0/examples/dump_oracle21c/index_expressions.csv +2 -0
  30. pgrecon-0.1.0/examples/dump_oracle21c/indexes.csv +10 -0
  31. pgrecon-0.1.0/examples/dump_oracle21c/meta.csv +6 -0
  32. pgrecon-0.1.0/examples/dump_oracle21c/mviews.csv +3 -0
  33. pgrecon-0.1.0/examples/dump_oracle21c/objects.csv +35 -0
  34. pgrecon-0.1.0/examples/dump_oracle21c/part_indexes.csv +3 -0
  35. pgrecon-0.1.0/examples/dump_oracle21c/part_key_columns.csv +3 -0
  36. pgrecon-0.1.0/examples/dump_oracle21c/part_tables.csv +3 -0
  37. pgrecon-0.1.0/examples/dump_oracle21c/plan_management.csv +0 -0
  38. pgrecon-0.1.0/examples/dump_oracle21c/source.csv +293 -0
  39. pgrecon-0.1.0/examples/dump_oracle21c/synonyms.csv +3 -0
  40. pgrecon-0.1.0/examples/dump_oracle21c/tables.csv +12 -0
  41. pgrecon-0.1.0/examples/dump_oracle21c/triggers.csv +4 -0
  42. pgrecon-0.1.0/pyproject.toml +83 -0
  43. pgrecon-0.1.0/src/pgrecon/__init__.py +5 -0
  44. pgrecon-0.1.0/src/pgrecon/cli.py +327 -0
  45. pgrecon-0.1.0/src/pgrecon/effort.py +161 -0
  46. pgrecon-0.1.0/src/pgrecon/extract/__init__.py +32 -0
  47. pgrecon-0.1.0/src/pgrecon/extract/pgrecon_extract.sql +434 -0
  48. pgrecon-0.1.0/src/pgrecon/extract/pgrecon_extract_legacy.sql +437 -0
  49. pgrecon-0.1.0/src/pgrecon/inventory/__init__.py +5 -0
  50. pgrecon-0.1.0/src/pgrecon/inventory/loader.py +491 -0
  51. pgrecon-0.1.0/src/pgrecon/inventory/schema.sql +239 -0
  52. pgrecon-0.1.0/src/pgrecon/plsql/__init__.py +74 -0
  53. pgrecon-0.1.0/src/pgrecon/plsql/_generated/PlSqlLexer.py +17539 -0
  54. pgrecon-0.1.0/src/pgrecon/plsql/_generated/PlSqlLexerBase.py +7 -0
  55. pgrecon-0.1.0/src/pgrecon/plsql/_generated/PlSqlParser.py +161954 -0
  56. pgrecon-0.1.0/src/pgrecon/plsql/_generated/PlSqlParserBase.py +45 -0
  57. pgrecon-0.1.0/src/pgrecon/plsql/_generated/PlSqlParserListener.py +10911 -0
  58. pgrecon-0.1.0/src/pgrecon/plsql/_generated/PlSqlParserVisitor.py +6068 -0
  59. pgrecon-0.1.0/src/pgrecon/plsql/_generated/README.md +31 -0
  60. pgrecon-0.1.0/src/pgrecon/plsql/_generated/__init__.py +1 -0
  61. pgrecon-0.1.0/src/pgrecon/plsql/walk.py +200 -0
  62. pgrecon-0.1.0/src/pgrecon/rules/__init__.py +142 -0
  63. pgrecon-0.1.0/src/pgrecon/rules/code.py +320 -0
  64. pgrecon-0.1.0/src/pgrecon/rules/columns.py +133 -0
  65. pgrecon-0.1.0/src/pgrecon/rules/engine.py +110 -0
  66. pgrecon-0.1.0/src/pgrecon/rules/objects.py +195 -0
  67. pgrecon-0.1.0/src/pgrecon/rules/packages.py +92 -0
  68. pgrecon-0.1.0/src/pgrecon/rules/performance.py +126 -0
  69. pgrecon-0.1.0/src/pgrecon/rules/sqlconstructs.py +127 -0
  70. pgrecon-0.1.0/src/pgrecon/rules/storage.py +162 -0
  71. pgrecon-0.1.0/src/pgrecon/rules/syspackages.py +80 -0
  72. pgrecon-0.1.0/src/pgrecon/validate.py +18 -0
  73. pgrecon-0.1.0/tests/conftest.py +10 -0
  74. pgrecon-0.1.0/tests/fixtures/dump_basic/check_conditions.csv +3 -0
  75. pgrecon-0.1.0/tests/fixtures/dump_basic/columns.csv +5 -0
  76. pgrecon-0.1.0/tests/fixtures/dump_basic/constraint_columns.csv +5 -0
  77. pgrecon-0.1.0/tests/fixtures/dump_basic/constraints.csv +5 -0
  78. pgrecon-0.1.0/tests/fixtures/dump_basic/db_links.csv +3 -0
  79. pgrecon-0.1.0/tests/fixtures/dump_basic/ddl_tables.sql +20 -0
  80. pgrecon-0.1.0/tests/fixtures/dump_basic/ddl_views.sql +4 -0
  81. pgrecon-0.1.0/tests/fixtures/dump_basic/dependencies.csv +4 -0
  82. pgrecon-0.1.0/tests/fixtures/dump_basic/features.csv +6 -0
  83. pgrecon-0.1.0/tests/fixtures/dump_basic/index_columns.csv +4 -0
  84. pgrecon-0.1.0/tests/fixtures/dump_basic/index_expressions.csv +3 -0
  85. pgrecon-0.1.0/tests/fixtures/dump_basic/indexes.csv +4 -0
  86. pgrecon-0.1.0/tests/fixtures/dump_basic/meta.csv +6 -0
  87. pgrecon-0.1.0/tests/fixtures/dump_basic/objects.csv +7 -0
  88. pgrecon-0.1.0/tests/fixtures/dump_basic/part_key_columns.csv +3 -0
  89. pgrecon-0.1.0/tests/fixtures/dump_basic/part_tables.csv +3 -0
  90. pgrecon-0.1.0/tests/fixtures/dump_basic/source.csv +13 -0
  91. pgrecon-0.1.0/tests/fixtures/dump_basic/synonyms.csv +3 -0
  92. pgrecon-0.1.0/tests/fixtures/dump_basic/tables.csv +3 -0
  93. pgrecon-0.1.0/tests/fixtures/dump_basic/triggers.csv +3 -0
  94. pgrecon-0.1.0/tests/fixtures/dump_korean/meta.csv +4 -0
  95. pgrecon-0.1.0/tests/fixtures/dump_korean/objects.csv +3 -0
  96. pgrecon-0.1.0/tests/fixtures/dump_multilingual/objects.csv +8 -0
  97. pgrecon-0.1.0/tests/fixtures/synthetic/synthetic_schema.sql +410 -0
  98. pgrecon-0.1.0/tests/fixtures/synthetic/synthetic_schema_11g.sql +372 -0
  99. pgrecon-0.1.0/tests/test_cli.py +130 -0
  100. pgrecon-0.1.0/tests/test_effort.py +83 -0
  101. pgrecon-0.1.0/tests/test_loader.py +238 -0
  102. pgrecon-0.1.0/tests/test_plsql.py +41 -0
  103. pgrecon-0.1.0/tests/test_rules.py +563 -0
  104. pgrecon-0.1.0/tests/test_validate.py +21 -0
  105. pgrecon-0.1.0/tests/test_walk.py +203 -0
  106. pgrecon-0.1.0/tools/check_ascii.py +80 -0
  107. pgrecon-0.1.0/tools/check_boundaries.py +48 -0
  108. pgrecon-0.1.0/tools/check_commit.py +92 -0
  109. pgrecon-0.1.0/uv.lock +877 -0
@@ -0,0 +1,3 @@
1
+ # Normalize all text files to LF in the repository and in checkouts,
2
+ # so builds behave identically on Windows and Linux.
3
+ * text=auto eol=lf
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Bug report
3
+ about: Something behaves incorrectly
4
+ ---
5
+
6
+ ## What happened
7
+
8
+ ## What you expected
9
+
10
+ ## How to reproduce
11
+
12
+ Include the command, the relevant part of the dump or fixture if
13
+ possible (redact anything sensitive), and the full error output.
14
+
15
+ ## Environment
16
+
17
+ - pgrecon version:
18
+ - Python version:
19
+ - OS:
20
+ - Source database version (if relevant):
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: Rule request
3
+ about: Propose a new assessment rule
4
+ ---
5
+
6
+ ## What should be detected
7
+
8
+ Describe the Oracle construct or feature and why it matters for a
9
+ PostgreSQL migration.
10
+
11
+ ## Suggested severity
12
+
13
+ info / low / medium / high / blocker, and why.
14
+
15
+ ## PostgreSQL remedy
16
+
17
+ How is this typically handled on the PostgreSQL side? Public references
18
+ welcome.
19
+
20
+ ## Sample DDL or PL/SQL
21
+
22
+ A minimal example that should trigger the rule (this becomes the
23
+ fixture test).
@@ -0,0 +1,11 @@
1
+ ## What
2
+
3
+ One or two sentences: the problem and what this change does about it.
4
+
5
+ ## Checklist
6
+
7
+ - [ ] Commit messages follow the project style (area prefix, imperative
8
+ subject, body explains why)
9
+ - [ ] Tests added or updated; `uv run pytest` passes
10
+ - [ ] `uv run ruff check .` and `uv run mypy src` pass
11
+ - [ ] Plain ASCII only (fixtures exempt)
@@ -0,0 +1,42 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.11", "3.12", "3.13"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - uses: astral-sh/setup-uv@v5
18
+ with:
19
+ python-version: ${{ matrix.python-version }}
20
+
21
+ - name: Install dependencies
22
+ run: uv sync --dev
23
+
24
+ - name: Lint
25
+ run: |
26
+ uv run ruff check .
27
+ uv run ruff format --check .
28
+
29
+ - name: Type check
30
+ run: uv run mypy src
31
+
32
+ - name: ASCII policy
33
+ run: uv run python tools/check_ascii.py
34
+
35
+ - name: Import boundaries
36
+ run: uv run python tools/check_boundaries.py
37
+
38
+ - name: Commit message style
39
+ run: uv run python tools/check_commit.py --head
40
+
41
+ - name: Tests
42
+ run: uv run pytest --cov --cov-fail-under=85
@@ -0,0 +1,39 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - uses: astral-sh/setup-uv@v5
17
+
18
+ - name: Build distributions
19
+ run: uv build
20
+
21
+ - uses: actions/upload-artifact@v4
22
+ with:
23
+ name: dist
24
+ path: dist/
25
+
26
+ publish:
27
+ needs: build
28
+ runs-on: ubuntu-latest
29
+ environment: pypi
30
+ permissions:
31
+ id-token: write
32
+ steps:
33
+ - uses: actions/download-artifact@v4
34
+ with:
35
+ name: dist
36
+ path: dist/
37
+
38
+ - name: Publish to PyPI
39
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,19 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ build/
6
+ dist/
7
+ .venv/
8
+
9
+ # Tooling caches
10
+ .pytest_cache/
11
+ .mypy_cache/
12
+ .ruff_cache/
13
+ .coverage
14
+ htmlcov/
15
+
16
+ # Local working files
17
+ *.db
18
+ *.log
19
+ dump/
@@ -0,0 +1,49 @@
1
+ default_install_hook_types: [pre-commit, commit-msg]
2
+
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: v5.0.0
6
+ hooks:
7
+ - id: check-added-large-files
8
+ exclude: ^src/pgrecon/plsql/_generated/
9
+ - id: end-of-file-fixer
10
+ exclude: ^(tests/fixtures/|examples/dump_|src/pgrecon/plsql/_generated/)
11
+ - id: trailing-whitespace
12
+ exclude: ^(tests/fixtures/|examples/dump_|src/pgrecon/plsql/_generated/)
13
+ - id: check-merge-conflict
14
+
15
+ - repo: https://github.com/astral-sh/ruff-pre-commit
16
+ rev: v0.6.9
17
+ hooks:
18
+ - id: ruff
19
+ args: [--fix]
20
+ - id: ruff-format
21
+
22
+ - repo: https://github.com/gitleaks/gitleaks
23
+ rev: v8.21.2
24
+ hooks:
25
+ - id: gitleaks
26
+
27
+ - repo: local
28
+ hooks:
29
+ - id: mypy
30
+ name: mypy
31
+ entry: uv run mypy src
32
+ language: system
33
+ pass_filenames: false
34
+ types: [python]
35
+ - id: ascii-check
36
+ name: ascii-check
37
+ entry: uv run python tools/check_ascii.py
38
+ language: system
39
+ pass_filenames: false
40
+ - id: import-boundaries
41
+ name: import-boundaries
42
+ entry: uv run python tools/check_boundaries.py
43
+ language: system
44
+ pass_filenames: false
45
+ - id: commit-msg-style
46
+ name: commit-msg-style
47
+ entry: uv run python tools/check_commit.py
48
+ language: system
49
+ stages: [commit-msg]
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,112 @@
1
+ # Changelog
2
+
3
+ Release notes are written by hand, grouped by area. Dates use YYYY-MM-DD.
4
+
5
+ ## 0.1.0 - 2026-08-14
6
+
7
+ First public release: offline extraction, a queryable inventory, and a
8
+ 61-rule assessment engine, verified end to end against real Oracle XE
9
+ 11g and 21c instances.
10
+
11
+ Extraction
12
+
13
+ - Offline SQL*Plus script over dictionary views only; SELECT
14
+ statements a DBA can review line by line. DDL via DBMS_METADATA,
15
+ structured facts (constraints, indexes, partitioning, synonyms,
16
+ triggers, database links) via dedicated spools. LONG-typed dictionary
17
+ columns (check conditions, index expressions) read through PL/SQL
18
+ chunkers.
19
+ - Legacy script variant for Oracle 9.2 through 11.1: hand-built CSV
20
+ for old SQL*Plus clients, DDL reconstructed from the catalog instead
21
+ of DBMS_METADATA, byte-safe line chunking for pre-10.2 DBMS_OUTPUT
22
+ limits.
23
+ - Runtime guards stop a too-old client or server with a message
24
+ pointing at the right variant instead of spooling a broken dump.
25
+ pgrecon script --source-version picks the variant automatically.
26
+ - Performance posture is extracted: partitioned-index locality,
27
+ per-object parallel degree, query-rewrite and refresh settings of
28
+ materialized views, and SQL plan baselines and stored outlines
29
+ (outlines only on the legacy tier).
30
+ - Scripts instruct the DBA to export NLS_LANG=.AL32UTF8 so dumps spool
31
+ as UTF-8 regardless of the database character set.
32
+
33
+ Inventory
34
+
35
+ - SQLite database with seventeen fact tables covering objects, tables,
36
+ columns, source, dependencies, features, DDL, constraints and their
37
+ columns, check conditions, indexes with columns and expressions,
38
+ partitioning, synonyms, triggers, and database links.
39
+ - Extracted DDL is parsed with sqlglot's Oracle dialect. The stored
40
+ text stays verbatim; parsing runs on a normalized copy that strips
41
+ DBMS_METADATA artifacts (constraint-state keywords, identity column
42
+ options, the VIRTUAL marker). Parse failures and opaque fallback
43
+ parses are recorded as data.
44
+ - Loads tolerate partial dumps and real SQL*Plus quirks such as the
45
+ blank line that opens every spool.
46
+ - Dumps in any encoding load without crashing: undecodable bytes
47
+ degrade to replacement characters and leave a warning row in the
48
+ inventory, and pgrecon load --encoding recovers full fidelity when
49
+ the code page is known. Verified with Korean, Chinese, Japanese,
50
+ Hebrew, Arabic, Cyrillic, and German object names.
51
+
52
+ PL/SQL analysis
53
+
54
+ - Stored units are parsed at load time with a full PL/SQL grammar
55
+ (grammars-v4 via ANTLR, vendored as generated code so installation
56
+ never needs Java). Parsing tries fast SLL prediction first, retries
57
+ in full LL only when that bails, and records the outcome per unit.
58
+ - A tree walk plus a token-channel scan store migration-relevant
59
+ facts in the inventory: transaction control, dynamic SQL, GOTO,
60
+ FORALL, collection types, autonomous transactions, swallowed
61
+ exceptions, SYSDATE, DECODE, ROWNUM, pipelined functions, implicit
62
+ cursor attributes, CONNECT BY, and (+) joins.
63
+ - Code rules read those facts first, so constructs sitting in
64
+ comments or string literals stop producing findings. Units that
65
+ fail to parse keep token-level coverage, and inventories loaded by
66
+ older versions still report through the same fallback.
67
+ - Call sites land in a plsql_calls table (caller, callee, line): the
68
+ supplied-package rules read it instead of matching text, and it is
69
+ the raw material for dependency clustering in the report stage.
70
+
71
+ Rules
72
+
73
+ - 61 deterministic rules across data types, storage, PL/SQL code, SQL
74
+ constructs, package structure, system package usage, schema
75
+ objects, and performance. Every rule ships with fixture tests.
76
+ - ROWID, UROWID, and BFILE columns get type rules, and ROWID usage in
77
+ code is read from the token stream: ctid is not a stable row
78
+ address, and BFILE has no counterpart at all.
79
+ - The empty-string trap gets its own rule: Oracle treats '' as NULL
80
+ and PostgreSQL does not, so every empty-string literal is a site
81
+ where behavior changes silently. The lexer tells a real '' from the
82
+ escaped quote in 'don''t', which text matching cannot.
83
+ - The performance category starts with optimizer hints: statements
84
+ tuned by hand for Oracle's planner are marked for a fresh plan on
85
+ PostgreSQL instead of a blind rewrite.
86
+ - Findings carry a stable rule id, severity, the object, and the
87
+ evidence seen, including source line numbers for code findings.
88
+ - Parse failures surface as findings (R-DDL-01, R-DDL-02) so nothing
89
+ drops out of the assessment silently.
90
+
91
+ CLI
92
+
93
+ - pgrecon script, load, report, and info. Reports print text or JSON;
94
+ the JSON payload includes a severity summary and a provisional
95
+ effort-point total.
96
+ - pgrecon -v logs progress and per-unit parse warnings to stderr;
97
+ stdout stays clean for report output, and logs never carry PL/SQL
98
+ body text.
99
+ - Remedies are part of the output: report --remedies appends each
100
+ fired rule's guidance with its helping extension, pgrecon explain
101
+ shows one rule's writeup or lists the catalog, and the JSON payload
102
+ carries a rules map with title, severity, effort, remedy, and
103
+ extension for every rule that fired.
104
+ - pgrecon estimate prices the migration in person-days from named
105
+ components: baseline, schema conversion, finding remediation with
106
+ severity-dependent repetition discounts, code volume, and data
107
+ movement, with a testing-and-stabilization factor range on top.
108
+ Every run prints its assumptions, and the JSON output carries the
109
+ same breakdown.
110
+ - A bundled example dump (examples/dump_oracle21c, extracted from a
111
+ real Oracle XE 21c instance) makes the whole pipeline runnable
112
+ without an Oracle installation.
@@ -0,0 +1,11 @@
1
+ # Code of conduct
2
+
3
+ Participation in this project is expected to be professional: technical
4
+ arguments about code and design are welcome, personal attacks and
5
+ harassment are not. Assume good faith, review the work rather than the
6
+ person, and keep discussions on the record in issues and pull requests.
7
+
8
+ Unacceptable behavior can be reported privately to
9
+ muzzammil@umaish.com. Reports are handled confidentially. Maintainers
10
+ may remove comments, reject contributions, or ban contributors whose
11
+ behavior violates this standard.
@@ -0,0 +1,68 @@
1
+ # Contributing
2
+
3
+ ## Build and test
4
+
5
+ Requires Python 3.11 or newer, and uv.
6
+
7
+ uv sync
8
+ uv run pytest
9
+ uv run ruff check .
10
+ uv run ruff format --check .
11
+ uv run mypy src
12
+ uv run pre-commit install # once, to enable the local hooks
13
+
14
+ ## Commit conventions
15
+
16
+ Commit style follows the PostgreSQL and Linux kernel projects, not
17
+ "conventional commits".
18
+
19
+ area: short imperative summary, no trailing period
20
+
21
+ Body wrapped at 72 columns. State the problem, then the fix and the
22
+ reasoning. Complete sentences. The message must make sense without
23
+ the diff.
24
+
25
+ - Area prefixes: extract, inventory, rules, report, cli, docs, build,
26
+ tests.
27
+ - One logical change per commit. No "WIP", no "misc", no "update file".
28
+ - Plain ASCII everywhere: source, comments, docs, commit messages.
29
+ No emoji, no unicode symbols. Two narrow exemptions exist for
30
+ encoding tests: files under tests/fixtures and examples/, and string
31
+ literals inside test modules, where the test data itself is the
32
+ point. Comments, identifiers, and docstrings stay ASCII even in
33
+ tests; src/ is strict with no exception. tools/check_ascii.py
34
+ enforces exactly this.
35
+ - History is linear: rebase onto main and fast-forward. No merge
36
+ commits.
37
+
38
+ ## Code conventions
39
+
40
+ - Comments explain why, not what. Dense where logic is subtle, absent
41
+ where the code is obvious.
42
+ - Catch the exception you expect; never a bare except; never swallow an
43
+ error silently. A parse failure is recorded data, not a crash.
44
+ - No dead code, no commented-out blocks, no speculative abstractions.
45
+ - SQL uses bound parameters. Identifier quoting goes through a shared
46
+ helper.
47
+
48
+ ## How changes land
49
+
50
+ Pull requests are the transport; history stays linear. Merge commits
51
+ are disabled on the repository.
52
+
53
+ - A series whose commits each follow the style above lands by rebase
54
+ and merge, keeping every commit and its author intact.
55
+ - A messy series lands by squash and merge, with the final message
56
+ written to the same standard.
57
+ - CI validates the head commit message of every pull request with
58
+ tools/check_commit.py, along with lint, types, tests, and the ASCII
59
+ and import-boundary checks.
60
+
61
+ Contributor authorship is always preserved: your commits land under
62
+ your name.
63
+
64
+ ## Adding a rule
65
+
66
+ Every rule ships with fixture tests: sample input in tests/fixtures and
67
+ an assertion of the expected findings. A rule without tests will not be
68
+ merged.
pgrecon-0.1.0/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.