godlint 0.1.6__py3-none-win_amd64.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.
|
Binary file
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: godlint
|
|
3
|
+
Version: 0.1.6
|
|
4
|
+
Summary: A deterministic code-policy engine for polyglot repositories.
|
|
5
|
+
Home-page: https://github.com/tomerwave/godlint
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<img src="assets/godlint-icon.svg" width="168" alt="Godlint logo: code brackets and a V mark inside a broken circle">
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<h1 align="center">Godlint</h1>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<strong>One policy engine for every language in your repository.</strong>
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<a href="LICENSE">MIT License</a> ·
|
|
25
|
+
<a href="CONTRIBUTING.md">Contributing</a> ·
|
|
26
|
+
<a href="SECURITY.md">Security</a> ·
|
|
27
|
+
<a href="CODE_OF_CONDUCT.md">Code of Conduct</a>
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
> **Pre-alpha:** Godlint has an early local CLI and its first cross-language rules.
|
|
31
|
+
> Its public API, configuration format, and rule suites are not stable yet.
|
|
32
|
+
|
|
33
|
+
Godlint is an open-source, deterministic code-policy engine for polyglot
|
|
34
|
+
repositories. It will help teams define engineering standards once and enforce them
|
|
35
|
+
consistently across Rust, TypeScript/JavaScript, and Python.
|
|
36
|
+
|
|
37
|
+
Godlint is designed for architecture, reliability, test quality, security, and
|
|
38
|
+
maintainability policies that single-language linters cannot enforce across a whole
|
|
39
|
+
repository. It will complement established tools such as Clippy, ESLint, Ruff, and
|
|
40
|
+
Pyright—not replace them.
|
|
41
|
+
|
|
42
|
+
## What Godlint will provide
|
|
43
|
+
|
|
44
|
+
- One local-first CLI with deterministic pass/fail results.
|
|
45
|
+
- Shared policy concepts with language-aware detection.
|
|
46
|
+
- Repository and cross-language architecture checks.
|
|
47
|
+
- Accountable exceptions: scope, reason, owner, issue, and expiry.
|
|
48
|
+
- Gradual adoption through baselines and diff-aware enforcement.
|
|
49
|
+
- Terminal, JSON, and SARIF reports for local development and CI.
|
|
50
|
+
|
|
51
|
+
## Initial scope
|
|
52
|
+
|
|
53
|
+
The first release will focus on Rust, TypeScript/JavaScript, and Python. The planned
|
|
54
|
+
MVP emphasizes high-confidence rules: file and function size, complexity,
|
|
55
|
+
centralized configuration, swallowed errors, timeouts, test assertions, policy
|
|
56
|
+
hygiene, and import cycles.
|
|
57
|
+
|
|
58
|
+
The project will not use an LLM to decide whether CI passes, replace compilers or
|
|
59
|
+
formatters, or support arbitrary third-party plugins in its early releases.
|
|
60
|
+
|
|
61
|
+
## Status and roadmap
|
|
62
|
+
|
|
63
|
+
See the [rule roadmap](docs/rule-roadmap.md) for the rule families, thresholds, and
|
|
64
|
+
delivery sequence. The implementation sequence is:
|
|
65
|
+
|
|
66
|
+
1. Workspace, CLI, configuration, diagnostics, fixtures, and documentation.
|
|
67
|
+
2. Syntax analysis for all three initial languages and common facts.
|
|
68
|
+
3. High-confidence file and repository rules, exceptions, baseline, and SARIF.
|
|
69
|
+
4. Caching, architecture graph, and GitHub Actions integration.
|
|
70
|
+
5. Optional semantic workers and ecosystem-tool adapters.
|
|
71
|
+
|
|
72
|
+
## Install
|
|
73
|
+
|
|
74
|
+
A prebuilt binary needs no toolchain. Releases carry Linux and macOS on both architectures,
|
|
75
|
+
Windows, and a statically linked Linux build for containers without glibc. Download the archive for
|
|
76
|
+
your platform from the [latest release](https://github.com/tomerwave/godlint/releases/latest), check
|
|
77
|
+
it against the `.sha256` beside it, and put `godlint` on your `PATH`:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
tar -xzf godlint-x86_64-unknown-linux-gnu.tar.gz
|
|
81
|
+
install -m 755 godlint /usr/local/bin/
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
On npm, `npm install --save-dev @godlint/cli` fetches only the binary for your platform and needs no
|
|
85
|
+
Rust toolchain, which is the point: Godlint lints JavaScript, TypeScript and Python, and most people
|
|
86
|
+
working in those languages do not have one. The command it installs is `godlint`; the package is
|
|
87
|
+
scoped because npm holds the bare name too close to an existing one.
|
|
88
|
+
|
|
89
|
+
On PyPI, `pip install godlint` installs the same binary and likewise needs no Rust toolchain.
|
|
90
|
+
|
|
91
|
+
With a Rust toolchain, `cargo install godlint-cli` builds the same binary. The library crate,
|
|
92
|
+
`godlint-core`, is published because the command line depends on it; its API is not stable before
|
|
93
|
+
`1.0`.
|
|
94
|
+
|
|
95
|
+
## Use
|
|
96
|
+
|
|
97
|
+
Godlint enforces nothing until a configuration asks it to. Write `godlint.yaml` at the repository
|
|
98
|
+
root and adopt the suite:
|
|
99
|
+
|
|
100
|
+
```yaml
|
|
101
|
+
version: 1
|
|
102
|
+
suites: [recommended@1]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
godlint check
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`check` reads the current directory when given no paths. It exits non-zero when a finding is at or
|
|
110
|
+
above `fail-on`, which is what makes enforcement one line in CI:
|
|
111
|
+
|
|
112
|
+
```yaml
|
|
113
|
+
- run: godlint check
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Two commands answer the questions that follow. `godlint config validate` rejects a configuration
|
|
117
|
+
before it is trusted, and `godlint suppressions` lists every exemption with its owner and expiry,
|
|
118
|
+
so an exception that has outlived its reason fails the build rather than accumulating quietly.
|
|
119
|
+
|
|
120
|
+
## Local development
|
|
121
|
+
|
|
122
|
+
Godlint currently requires Rust `1.97.1`. After installing Rust with
|
|
123
|
+
[rustup](https://rustup.rs/), run the same checks used by CI:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
cargo fmt --check
|
|
127
|
+
cargo clippy --workspace --all-targets -- -D warnings
|
|
128
|
+
cargo test --workspace
|
|
129
|
+
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps
|
|
130
|
+
cargo run -p godlint-cli -- check .
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
The initial command shell is available with:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
cargo run -p godlint-cli -- --version
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Configuration validation is the first implemented product capability:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
godlint config validate
|
|
143
|
+
godlint config validate --config path/to/godlint.yaml
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The `check` command evaluates the configured rules across Rust,
|
|
147
|
+
TypeScript/JavaScript, and Python source files. Twenty-one rules are implemented:
|
|
148
|
+
|
|
149
|
+
- `maintainability/file-size` — effective lines in a file.
|
|
150
|
+
- `maintainability/function-size` — effective lines in a function.
|
|
151
|
+
- `maintainability/function-nesting` — how deeply control-flow blocks nest inside a
|
|
152
|
+
function.
|
|
153
|
+
- `maintainability/parameter-count` — declared parameters, excluding a method receiver.
|
|
154
|
+
- `maintainability/decision-complexity` — branch points in a function. A `match` or
|
|
155
|
+
`switch` counts once rather than once per arm, and a guard on an arm counts.
|
|
156
|
+
- `maintainability/return-count` — exit paths from a function, explicit or implicit.
|
|
157
|
+
- `maintainability/function-statements` — statements in a function, through nested
|
|
158
|
+
blocks but not into nested functions.
|
|
159
|
+
- `maintainability/empty-function` — function bodies that appear unintentionally empty.
|
|
160
|
+
- `policy/todo-requires-reference` — TODO-style markers that need an issue reference.
|
|
161
|
+
- `style/no-comments` — commentary where the code should speak for itself.
|
|
162
|
+
- `policy/accountable-suppression` — inline suppressions that cannot account for
|
|
163
|
+
themselves.
|
|
164
|
+
- `policy/unused-suppression` — inline suppressions that no longer silence an enabled
|
|
165
|
+
finding.
|
|
166
|
+
- `architecture/restricted-call` — abrupt process exits, plus
|
|
167
|
+
configured direct callees outside their approved paths.
|
|
168
|
+
- `security/no-dynamic-execution` — JavaScript `eval`, `Function`, and `new Function`;
|
|
169
|
+
Python `eval` and `exec`.
|
|
170
|
+
- `security/direct-environment-read` — environment access outside a configuration
|
|
171
|
+
boundary.
|
|
172
|
+
- `reliability/explicit-timer-delay` — JavaScript/TypeScript timers that omit their
|
|
173
|
+
explicit millisecond delay.
|
|
174
|
+
- `logging/no-production-log` — debug logging outside the paths a repository approves.
|
|
175
|
+
- `architecture/restricted-import` — imports of modules a repository puts behind a boundary.
|
|
176
|
+
- `architecture/dependency-boundary` — a dependency that runs against the declared layer order.
|
|
177
|
+
- `security/forbidden-dependency` — an import of a package the project has ruled out.
|
|
178
|
+
- `architecture/filename-case` — a file name that does not follow the convention for its
|
|
179
|
+
extension or its declared scope: `PascalCase` for `.tsx`/`.jsx`, `kebab-case` for other
|
|
180
|
+
JavaScript and TypeScript, `snake_case` for Rust and Python.
|
|
181
|
+
|
|
182
|
+
The call rules read the callee exactly as it is spelled, and the import rules read the
|
|
183
|
+
module the same way. `std::env::var` is matched and the
|
|
184
|
+
aliased `env::var` after `use std::env` is not, because knowing they name the same function
|
|
185
|
+
needs resolution Godlint does not have yet — see
|
|
186
|
+
[the rule roadmap](docs/rule-roadmap.md) for what that defers. They also have no scope
|
|
187
|
+
analysis, so a local binding that shadows a restricted name is reported: a Python parameter
|
|
188
|
+
called `exec`, or a `const process = …` in TypeScript. Enable them deliberately; each is
|
|
189
|
+
off until a repository configures it.
|
|
190
|
+
|
|
191
|
+
One consequence of built-in restrictions being language-bound is worth knowing before you
|
|
192
|
+
write a policy: a name a built-in already claims belongs to that built-in's language. Giving
|
|
193
|
+
`sys.exit` an `allow-in` boundary scopes Python's, and a call spelled `sys.exit` in TypeScript
|
|
194
|
+
is left alone — there is no language key to say which you meant, so the policy is silent rather
|
|
195
|
+
than wrong.
|
|
196
|
+
|
|
197
|
+
A name no built-in claims belongs to no language and applies wherever it is called, which is
|
|
198
|
+
what a policy about `loadConfig` means. `print`, `console.log`, `console.debug` and `dbg!` are
|
|
199
|
+
now in that group rather than the first: `logging/no-production-log` owns them as
|
|
200
|
+
dialect-bound defaults, so naming one under `architecture/restricted-call` restricts it in
|
|
201
|
+
every language. Restrict debug logging through the logging rule, which keeps the binding.
|
|
202
|
+
|
|
203
|
+
A function means the same thing in every language: Rust `fn` items and closures,
|
|
204
|
+
Python `def` functions and lambdas, and JavaScript/TypeScript function declarations,
|
|
205
|
+
function expressions, methods, and arrow functions. Findings below the configured
|
|
206
|
+
`fail-on` severity are reported without failing the command.
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
godlint check
|
|
210
|
+
godlint check crates
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Policy suites
|
|
214
|
+
|
|
215
|
+
A suite names a set of rules and their thresholds so a repository adopts a standard in one
|
|
216
|
+
line rather than twenty-one:
|
|
217
|
+
|
|
218
|
+
```yaml
|
|
219
|
+
version: 1
|
|
220
|
+
suites:
|
|
221
|
+
- recommended@1
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
`recommended@1` enables every rule at `error`. Its thresholds are measured rather than
|
|
225
|
+
borrowed — see [the rule roadmap](docs/rule-roadmap.md) for each number and why.
|
|
226
|
+
|
|
227
|
+
Suites are opt-in: a configuration that names none enforces nothing. A `rules:` entry
|
|
228
|
+
overrides the suite for that rule, in either direction, so a repository can loosen one
|
|
229
|
+
threshold, tighten it, or decline a rule with `severity: off` without abandoning the rest.
|
|
230
|
+
|
|
231
|
+
## Accountable exceptions
|
|
232
|
+
|
|
233
|
+
A single site can be exempted from a rule by a comment that says why, who owns it, and
|
|
234
|
+
when the exemption lapses:
|
|
235
|
+
|
|
236
|
+
```rust
|
|
237
|
+
// godlint-ignore-next-line maintainability/function-size owner=tomer expires=2026-12-31 -- splitting this in #482
|
|
238
|
+
fn long_function() {
|
|
239
|
+
// ...
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
`godlint-ignore-enclosing` applies to the whole function containing it. There is no
|
|
244
|
+
file-wide form — that is what `exclude` is for. `policy/accountable-suppression` reports
|
|
245
|
+
a directive with no reason, an unknown rule, or an expiry in the past; and
|
|
246
|
+
`policy/unused-suppression` reports one that no longer hides an enabled finding. Neither
|
|
247
|
+
policy rule can be suppressed. List every exemption in the repository with:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
godlint suppressions
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
See [inline suppression](docs/suppressions.md) for the full syntax and semantics.
|
|
254
|
+
|
|
255
|
+
## Contributing
|
|
256
|
+
|
|
257
|
+
We welcome early design feedback, rule ideas backed by concrete examples, parser and
|
|
258
|
+
performance research, documentation improvements, and eventually implementation
|
|
259
|
+
contributions. Please read [CONTRIBUTING.md](CONTRIBUTING.md) and abide by the
|
|
260
|
+
[Code of Conduct](CODE_OF_CONDUCT.md).
|
|
261
|
+
|
|
262
|
+
Please do not file security vulnerabilities in public issues; use the process in
|
|
263
|
+
[SECURITY.md](SECURITY.md).
|
|
264
|
+
|
|
265
|
+
## License
|
|
266
|
+
|
|
267
|
+
Godlint is released under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
godlint-0.1.6.data/scripts/godlint.exe,sha256=JCqUqGBj41iOj7jAOLBoEGPef6h9hLeqbYriFieS3eA,5770752
|
|
2
|
+
godlint-0.1.6.dist-info/METADATA,sha256=H_n0F6sax13mDHB2bmSltJE0gyasGbsyAOo9AwspmVs,11437
|
|
3
|
+
godlint-0.1.6.dist-info/WHEEL,sha256=5NaX6Zf7xvpLi0Xi5o_o6esRoEAQtrlqarJrF8o81Uc,111
|
|
4
|
+
godlint-0.1.6.dist-info/RECORD,,
|