checkmate5 5.1.0.dev3__py3-none-any.whl → 5.1.0.dev4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,182 @@
1
+ Metadata-Version: 2.4
2
+ Name: checkmate5
3
+ Version: 5.1.0.dev4
4
+ Summary: A meta-code checker written in Python.
5
+ Author: Andreas Dewes
6
+ License: AGPL-3.0
7
+ Classifier: Intended Audience :: Developers
8
+ Classifier: Programming Language :: Python
9
+ Classifier: Topic :: Software Development :: Quality Assurance
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE.txt
12
+ Requires-Dist: blitzdb5
13
+ Requires-Dist: pyyaml
14
+ Requires-Dist: sqlalchemy
15
+ Requires-Dist: requests
16
+ Dynamic: license-file
17
+
18
+
19
+ # Welcome to Checkmate!
20
+
21
+
22
+ This is a modified version of original Checkmate.
23
+
24
+ Original author(s), license(s), acknowelegement(s): https://github.com/quantifiedcode/checkmate
25
+
26
+
27
+ ## About
28
+ Checkmate is a cross-language (meta-)tool for static code analysis, written in Python. Unlike other tools, it provides a global overview of the code quality in a project and aims to provide clear, actionable insights to the user.
29
+
30
+
31
+ ## Licences
32
+
33
+ * Checkmate is licensed under the MIT license. To view a copy of this license, visit [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT).
34
+
35
+ * Original Checkmate's parts remain release under MIT License. However modifications are finally released under AGPL-3.0 license (previously LGPL 2.1 with Commons Clause). Please refer to LICENSE for more info.
36
+
37
+
38
+ # Description
39
+
40
+ This guide explains how to configure the backend parameter for Checkmate5 (SQLite/Postgres), details the role and usage of the `pk` ("primary key") parameter, and describes how "snapshots" are used to associate findings with file hashes in project history.
41
+
42
+ ---
43
+
44
+ ## 1. Backend Configuration
45
+
46
+ Checkmate5 supports multiple backend drivers, notably `sqlite` and `sql` (typically PostgreSQL, but could be any SQLAlchemy-supported SQL database).
47
+
48
+ ### How to Specify the Backend
49
+
50
+ You can specify the backend when initializing a new project or via configuration files:
51
+
52
+ #### CLI Options
53
+ - `--backend`: The backend to use. Choices:
54
+ - `"sql"` (default): Use a SQL database (e.g., PostgreSQL, MySQL)
55
+ - `"sqlite"`: Use SQLite
56
+ - `--backend-opts`: Connection string for SQL databases or file path for SQLite
57
+ - `--path`: Directory for the project
58
+ - `--pk`: Set the project's primary key (see next section)
59
+
60
+ #### Example CLI Usage
61
+ ```bash
62
+ checkmate init --backend sql --backend-opts "postgresql://user:password@localhost/dbname" --pk myproject123
63
+ checkmate init --backend sqlite --backend-opts "sqlite:///path/to/db.sqlite"
64
+ ```
65
+
66
+ #### Configuration Structure Example (`.checkmate/config.json`)
67
+ ```json
68
+ {
69
+ "project_id": "myproject123",
70
+ "project_class": "Project",
71
+ "backend": {
72
+ "driver": "sqlite",
73
+ "connection_string": "sqlite:///myproject.db"
74
+ }
75
+ }
76
+ ```
77
+
78
+ ### Backend Parameters
79
+
80
+ - **driver**: `"sql"` or `"sqlite"`
81
+ - **connection_string**: SQLAlchemy-compatible connection string (e.g., `"postgresql://user:pass@host/db"` or `"sqlite:///file.db"`)
82
+
83
+ ### Backend Usage and Methods
84
+ - Backend is used to store and retrieve project data and scan results.
85
+ - Database connections are tested at initialization.
86
+ - Transactions are handled using context managers.
87
+ - Database connections can be closed and disposed when finished.
88
+
89
+ ---
90
+
91
+ ## 2. PK-Key (`pk` parameter): Project Primary Key
92
+
93
+ The `pk` parameter allows you to specify a custom primary key for your project, which is stored as `project_id` in the configuration file.
94
+
95
+ ### Why Use `pk`?
96
+ - **Custom Identification**: Set a meaningful or recognizable ID for your project (e.g., `myproject123`).
97
+ - **Deterministic Reference**: Ensures you can reference your project by a known key in subsequent commands or queries.
98
+ - **Multi-project Management**: Useful for managing multiple projects in the same backend.
99
+
100
+ ### How `pk` is Used
101
+
102
+ - If you supply `--pk` during initialization, it will be used as your project's primary key.
103
+ - If not supplied, a random UUID is generated.
104
+ - The `pk`/`project_id` identifies your project for all backend operations and links snapshots, file revisions, and findings to your project.
105
+
106
+ #### Example Configuration (`.checkmate/config.json`)
107
+ ```json
108
+ {
109
+ "project_id": "myproject123",
110
+ "project_class": "Project",
111
+ "backend": { ... }
112
+ }
113
+ ```
114
+
115
+ ---
116
+
117
+ ## 3. Snapshots: Scanning and Findings by File Hashes in History
118
+
119
+ ### What is a Snapshot?
120
+
121
+ A **Snapshot** captures the state of your project at a specific commit or point in time. It records:
122
+ - The file revisions (with hashes)
123
+ - The results of analyzers (issues found)
124
+ - The project configuration
125
+
126
+ ### How Snapshots are Created
127
+
128
+ - When running analysis (e.g., `checkmate analyze`), Checkmate5 creates a Snapshot for the current state.
129
+ - Snapshots are linked to specific commits (for Git projects) and store the hashes of all analyzed files.
130
+ - The system checks if a file revision with the same hash already exists; if so, it can reuse previous analysis results.
131
+
132
+ ### How Findings Are Associated by File Hash
133
+
134
+ - **FileRevision** objects are created for each file at each commit; their content is hashed.
135
+ - If a file's hash matches a previously analyzed revision, its findings can be reused.
136
+ - Issues found by analyzers are hashed with details to ensure uniqueness and allow deduplication.
137
+
138
+ #### Hash-based File Finding
139
+
140
+ - Each file revision gets a hash based on its content and path.
141
+ - If package databases are involved, a random string may be added to force re-scan.
142
+
143
+ #### Analysis Workflow
144
+
145
+ 1. **Collect file revisions and their hashes**
146
+ 2. **Chunk queries to backend to find previously scanned hashes**
147
+ 3. **Reuse findings for unchanged files**
148
+ 4. **Only analyze new or changed file revisions**
149
+ 5. **Save findings and link them to the snapshot**
150
+
151
+ #### Diffing Snapshots
152
+
153
+ Checkmate can compare ("diff") snapshots to show what changed between two states:
154
+ - Which files were added, deleted, or modified
155
+ - Which issues were added or resolved
156
+
157
+ ---
158
+
159
+ ## Summary Table
160
+
161
+ | Parameter | Description | Example Value |
162
+ |------------------|------------------------------------------------|----------------------------------|
163
+ | `driver` | Backend type | "sqlite" or "sql" |
164
+ | `connection_string` | SQLAlchemy DB connection string | "sqlite:///db.sqlite" |
165
+ | | | "postgresql://user:pass@host/db" |
166
+ | `pk` | Primary key for identifying the project | "myproject123" |
167
+ | `project_id` | Alias in config for pk, used in backend | "myproject123" |
168
+
169
+ | Snapshot Concept | Description |
170
+ |------------------|-----------------------------------------------|
171
+ | FileRevision | Represents a file at a specific commit |
172
+ | hash | SHA-based hash of file contents |
173
+ | Snapshot | State of project at a commit; list of hashes |
174
+ | Issue | Findings from analyzers, linked to hashes |
175
+
176
+ ---
177
+
178
+ ## Further Reading
179
+
180
+ - Backend Implementation: checkmate/lib/backend.py
181
+ - Snapshot & Analysis Logic: checkmate/lib/code/environment.py
182
+ - Git Integration & Snapshots: checkmate/contrib/plugins/git/models.py
@@ -67,9 +67,9 @@ checkmate/scripts/manage.py,sha256=vb4L171yfctLbZpQxn_kZ1hQLtCDqdQQGiq7BJlnQ2A,4
67
67
  checkmate/settings/__init__.py,sha256=z32hPz-kGS-tTGa6dWCFjrrrbS_eagLd-YrqBP3gjWI,33
68
68
  checkmate/settings/base.py,sha256=3WBXZITqoWepIja96bo5JTi-TDpQALPTCugL0E8z-yE,4551
69
69
  checkmate/settings/defaults.py,sha256=qZqK82L4Qb96JkUP7J240rL_SPa3CNi3emZBh2LvSf4,1825
70
- checkmate5-5.1.0.dev3.dist-info/licenses/LICENSE.txt,sha256=SGQTFjJQjkYGoK1PCFfMKpfgRLm3yL0h9Mq2o26sm2E,151451
71
- checkmate5-5.1.0.dev3.dist-info/METADATA,sha256=ssdg5PpeWSzv8_OaJT7gDBoJ9-sFyy6f0Vy6oCHh0KA,1286
72
- checkmate5-5.1.0.dev3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
- checkmate5-5.1.0.dev3.dist-info/entry_points.txt,sha256=FbGnau5C4z98WmBYpMJqUzobQEr1AIi9aZApSavNojQ,60
74
- checkmate5-5.1.0.dev3.dist-info/top_level.txt,sha256=tl6eIJXedpLZbcbmYEwlhEzuTaSt0TvIRUesOb8gtng,10
75
- checkmate5-5.1.0.dev3.dist-info/RECORD,,
70
+ checkmate5-5.1.0.dev4.dist-info/licenses/LICENSE.txt,sha256=SGQTFjJQjkYGoK1PCFfMKpfgRLm3yL0h9Mq2o26sm2E,151451
71
+ checkmate5-5.1.0.dev4.dist-info/METADATA,sha256=tO8lYZxV8mWijVRnkpDTrMf8dxfyDV94dLUMIxxyLYw,7148
72
+ checkmate5-5.1.0.dev4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
73
+ checkmate5-5.1.0.dev4.dist-info/entry_points.txt,sha256=FbGnau5C4z98WmBYpMJqUzobQEr1AIi9aZApSavNojQ,60
74
+ checkmate5-5.1.0.dev4.dist-info/top_level.txt,sha256=tl6eIJXedpLZbcbmYEwlhEzuTaSt0TvIRUesOb8gtng,10
75
+ checkmate5-5.1.0.dev4.dist-info/RECORD,,
@@ -1,35 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: checkmate5
3
- Version: 5.1.0.dev3
4
- Summary: A meta-code checker written in Python.
5
- Author: Andreas Dewes
6
- License: AGPL-3.0
7
- Classifier: Intended Audience :: Developers
8
- Classifier: Programming Language :: Python
9
- Classifier: Topic :: Software Development :: Quality Assurance
10
- Description-Content-Type: text/markdown
11
- License-File: LICENSE.txt
12
- Requires-Dist: blitzdb5
13
- Requires-Dist: pyyaml
14
- Requires-Dist: sqlalchemy
15
- Requires-Dist: requests
16
- Dynamic: license-file
17
-
18
-
19
- # Welcome to Checkmate!
20
-
21
-
22
- This is a modified version of original Checkmate.
23
-
24
- Original author(s), license(s), acknowelegement(s): https://github.com/quantifiedcode/checkmate
25
-
26
-
27
- ## About
28
- Checkmate is a cross-language (meta-)tool for static code analysis, written in Python. Unlike other tools, it provides a global overview of the code quality in a project and aims to provide clear, actionable insights to the user.
29
-
30
-
31
- ## Licences
32
-
33
- * Checkmate is licensed under the MIT license. To view a copy of this license, visit [https://opensource.org/licenses/MIT](https://opensource.org/licenses/MIT).
34
-
35
- * Original Checkmate's parts remain release under MIT License. However modifications are finally released under AGPL-3.0 license (previously LGPL 2.1 with Commons Clause). Please refer to LICENSE for more info.