Skip to content

Commit fbb0e57

Browse files
committed
Updates
1 parent b825aed commit fbb0e57

File tree

9 files changed

+193
-78
lines changed

9 files changed

+193
-78
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ __pycache__
88
/build
99
/dist
1010
/.mypy_cache
11+
12+
# Devenv
13+
.devenv*
14+
devenv.local.nix

.pre-commit-config.yaml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
repos:
2-
- repo: https://github.com/psf/black
3-
rev: 23.3.0
4-
hooks:
5-
- id: black
6-
types: [python]
7-
8-
92
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.2.1
3+
rev: v0.3.0
114
hooks:
125
- id: ruff
136
language: system
@@ -16,7 +9,7 @@ repos:
169
language: system
1710

1811
- repo: https://github.com/pre-commit/pre-commit-hooks
19-
rev: v4.4.0
12+
rev: v4.5.0
2013
hooks:
2114
- id: trailing-whitespace
2215
- id: end-of-file-fixer

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Collection of useful checks for Django Checks Frameworks
3838

3939
Install with `pip install django-extra-checks`
4040

41-
Add `extra_checks` to `INSTALLED_APPS` (use `extra_checks.apps.ExtraChecksConfig` for Django versions prior to 3.2).
41+
Add `extra_checks` to `INSTALLED_APPS`.
4242

4343
## Settings
4444

devenv.lock

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
{
2+
"nodes": {
3+
"devenv": {
4+
"locked": {
5+
"dir": "src/modules",
6+
"lastModified": 1709300857,
7+
"narHash": "sha256-jkK99RiSt5YfLWj3kAQoB8OB3idxLTdT9kfo/wILbjw=",
8+
"owner": "cachix",
9+
"repo": "devenv",
10+
"rev": "f0319af4f966fb8bc25c6429f4f2e097e79116c2",
11+
"type": "github"
12+
},
13+
"original": {
14+
"dir": "src/modules",
15+
"owner": "cachix",
16+
"repo": "devenv",
17+
"type": "github"
18+
}
19+
},
20+
"flake-compat": {
21+
"flake": false,
22+
"locked": {
23+
"lastModified": 1696426674,
24+
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
25+
"owner": "edolstra",
26+
"repo": "flake-compat",
27+
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
28+
"type": "github"
29+
},
30+
"original": {
31+
"owner": "edolstra",
32+
"repo": "flake-compat",
33+
"type": "github"
34+
}
35+
},
36+
"flake-utils": {
37+
"inputs": {
38+
"systems": "systems"
39+
},
40+
"locked": {
41+
"lastModified": 1701680307,
42+
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
43+
"owner": "numtide",
44+
"repo": "flake-utils",
45+
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
46+
"type": "github"
47+
},
48+
"original": {
49+
"owner": "numtide",
50+
"repo": "flake-utils",
51+
"type": "github"
52+
}
53+
},
54+
"gitignore": {
55+
"inputs": {
56+
"nixpkgs": [
57+
"pre-commit-hooks",
58+
"nixpkgs"
59+
]
60+
},
61+
"locked": {
62+
"lastModified": 1703887061,
63+
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
64+
"owner": "hercules-ci",
65+
"repo": "gitignore.nix",
66+
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
67+
"type": "github"
68+
},
69+
"original": {
70+
"owner": "hercules-ci",
71+
"repo": "gitignore.nix",
72+
"type": "github"
73+
}
74+
},
75+
"nixpkgs": {
76+
"locked": {
77+
"lastModified": 1709386671,
78+
"narHash": "sha256-VPqfBnIJ+cfa78pd4Y5Cr6sOWVW8GYHRVucxJGmRf8Q=",
79+
"owner": "NixOS",
80+
"repo": "nixpkgs",
81+
"rev": "fa9a51752f1b5de583ad5213eb621be071806663",
82+
"type": "github"
83+
},
84+
"original": {
85+
"owner": "NixOS",
86+
"ref": "nixpkgs-unstable",
87+
"repo": "nixpkgs",
88+
"type": "github"
89+
}
90+
},
91+
"nixpkgs-stable": {
92+
"locked": {
93+
"lastModified": 1704874635,
94+
"narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=",
95+
"owner": "NixOS",
96+
"repo": "nixpkgs",
97+
"rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356",
98+
"type": "github"
99+
},
100+
"original": {
101+
"owner": "NixOS",
102+
"ref": "nixos-23.11",
103+
"repo": "nixpkgs",
104+
"type": "github"
105+
}
106+
},
107+
"pre-commit-hooks": {
108+
"inputs": {
109+
"flake-compat": "flake-compat",
110+
"flake-utils": "flake-utils",
111+
"gitignore": "gitignore",
112+
"nixpkgs": [
113+
"nixpkgs"
114+
],
115+
"nixpkgs-stable": "nixpkgs-stable"
116+
},
117+
"locked": {
118+
"lastModified": 1708018599,
119+
"narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=",
120+
"owner": "cachix",
121+
"repo": "pre-commit-hooks.nix",
122+
"rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431",
123+
"type": "github"
124+
},
125+
"original": {
126+
"owner": "cachix",
127+
"repo": "pre-commit-hooks.nix",
128+
"type": "github"
129+
}
130+
},
131+
"root": {
132+
"inputs": {
133+
"devenv": "devenv",
134+
"nixpkgs": "nixpkgs",
135+
"pre-commit-hooks": "pre-commit-hooks"
136+
}
137+
},
138+
"systems": {
139+
"locked": {
140+
"lastModified": 1681028828,
141+
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
142+
"owner": "nix-systems",
143+
"repo": "default",
144+
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
145+
"type": "github"
146+
},
147+
"original": {
148+
"owner": "nix-systems",
149+
"repo": "default",
150+
"type": "github"
151+
}
152+
}
153+
},
154+
"root": "root",
155+
"version": 7
156+
}

devenv.nix

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{ pkgs, ... }:
2+
3+
{
4+
packages = [ pkgs.uv ];
5+
6+
env.PYTHONUNBUFFERED = "1";
7+
env.PYTHONPATH = "src";
8+
env.DJANGO_SETTINGS_MODULE = "tests.settings";
9+
10+
languages.python.enable = true;
11+
languages.python.package = pkgs.python312;
12+
13+
scripts."app.test".exec = "pytest $@";
14+
scripts."app.install".exec = "uv pip install -e .[dev,test] && pre-commit install";
15+
scripts."app.typecheck".exec = "mypy src/extra_checks tests";
16+
scripts."app.lint".exec = "pre-commit run -a";
17+
}

devenv.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
inputs:
2+
nixpkgs:
3+
url: github:NixOS/nixpkgs/nixpkgs-unstable

shell.nix

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/extra_checks/ast/protocols.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,36 @@
55

66
class ArgASTProtocol(Protocol):
77
@property
8-
def is_callable(self) -> bool:
9-
...
8+
def is_callable(self) -> bool: ...
109

1110
@property
12-
def callable_func_name(self) -> Optional[str]:
13-
...
11+
def callable_func_name(self) -> Optional[str]: ...
1412

15-
def get_call_first_args(self) -> Any:
16-
...
13+
def get_call_first_args(self) -> Any: ...
1714

1815

1916
class FieldASTProtocol(Protocol):
20-
def get_arg(self, name: str) -> Optional[ArgASTProtocol]:
21-
...
17+
def get_arg(self, name: str) -> Optional[ArgASTProtocol]: ...
2218

2319

2420
class ModelASTProtocol(Protocol):
2521
@property
2622
def field_nodes(
2723
self,
28-
) -> Iterable[Tuple[models.fields.Field, "FieldASTDisableCommentProtocol"]]:
29-
...
24+
) -> Iterable[Tuple[models.fields.Field, "FieldASTDisableCommentProtocol"]]: ...
3025

31-
def has_meta_var(self, name: str) -> bool:
32-
...
26+
def has_meta_var(self, name: str) -> bool: ...
3327

3428

3529
class DisableCommentProtocol(Protocol):
36-
def is_disabled_by_comment(self, check_id: str) -> bool:
37-
...
30+
def is_disabled_by_comment(self, check_id: str) -> bool: ...
3831

3932

4033
class ModelASTDisableCommentProtocol(
4134
ModelASTProtocol, DisableCommentProtocol, Protocol
42-
):
43-
...
35+
): ...
4436

4537

4638
class FieldASTDisableCommentProtocol(
4739
FieldASTProtocol, DisableCommentProtocol, Protocol
48-
):
49-
...
40+
): ...

tests/example/serializers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ class DisableCheckSerializer(serializers.ModelSerializer):
2121
first_name = serializers.CharField()
2222

2323
def method_with_meta_class(self):
24-
class Meta:
25-
...
24+
class Meta: ...
2625

2726
# extra-checks-disable-next-line drf-model-serializer-extra-kwargs
2827
class Meta:

0 commit comments

Comments
 (0)