Skip to content

Commit 7541406

Browse files
committed
Release 0.9.0
1 parent 67ba9f3 commit 7541406

File tree

5 files changed

+32
-18
lines changed

5 files changed

+32
-18
lines changed

CHANGELOG.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22

33
### Unreleased
44

5+
### 0.9.0
6+
7+
- Disable checks with `extra-checks-disable-next-line` comment
8+
- Deprecate `@ignore_checks`
9+
- Make ast parsing lazy
10+
- Add global log level
11+
512
### 0.8.0
613

714
- Add checks:
8-
- `field-choices-constraint`
15+
- `field-choices-constraint`
916

1017
### 0.7.1
1118

@@ -15,13 +22,13 @@
1522

1623
- Check `field-foreign-key-index` now accepts `when: indexes` instead of `when: unique_toegether` because now it search for duplicate indexes in `Meta.indexes`, `Meta.unique_toegether` and `Meta.constraints`
1724
- Add checks:
18-
- `no-unique-together`
19-
- `no-index-together`
25+
- `no-unique-together`
26+
- `no-index-together`
2027

2128
### 0.6.0
2229

2330
- Add checks:
24-
- `field-default-null`
31+
- `field-default-null`
2532

2633
### 0.5.0
2734

@@ -37,9 +44,9 @@
3744

3845
- Add infra for rest framework serializers checks
3946
- Add checks:
40-
- `drf-model-serializer-extra-kwargs`
41-
- `drf-model-serializer-meta-attribute`
42-
- `model-admin`
47+
- `drf-model-serializer-extra-kwargs`
48+
- `drf-model-serializer-meta-attribute`
49+
- `model-admin`
4350

4451
### 0.3.0
4552

README.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,21 @@ EXTRA_CHECKS = {
3333

3434
#### Ignoring check problems
3535

36-
To ignore all warnings on some object you can use `ignore_checks` decorator:
36+
Use `extra-checks-disable-next-line` comment to disable checks:
3737

3838
```python
39-
from extra_checks import ignore_checks, CheckID
40-
41-
@ignore_checks("model-attribute", "X011", CheckID.X050)
39+
# disable specific checks on model
40+
# extra-checks-disable-next-line model-attribute, model-admin
4241
class MyModel(models.Model):
42+
# disable all checks on image field
43+
# extra-checks-disable-next-line
4344
image = models.ImageField()
45+
46+
# separate comments and check's codes are aslo supported
47+
# extra-checks-disable-next-line X014
48+
# extra-checks-disable-next-line no-unique-together
49+
class Meta:
50+
...
4451
```
4552

4653
Another way is to specify type of the object that need to be ignored in `ignore_types` option:
@@ -77,10 +84,10 @@ EXTRA_CHECKS = {
7784
- **field-null** - don't pass `null=False` to model fields (this is django default).
7885
- **field-foreign-key-db-index** - ForeignKey fields must specify `db_index` explicitly (to apply only to fields in indexes: `when: indexes`).
7986
- **field-default-null** - If field nullable (`null=True`), then
80-
`default=None` argument is redundant and should be removed.
81-
**WARNING** Be aware that setting is database dependent,
82-
eg. Oracle interprets empty strings as nulls as a result
83-
django uses empty string instead of null as default.
87+
`default=None` argument is redundant and should be removed.
88+
**WARNING** Be aware that setting is database dependent,
89+
eg. Oracle interprets empty strings as nulls as a result
90+
django uses empty string instead of null as default.
8491
- **field-choices-constraint** - Fields with choices must have companion CheckConstraint to enforce choices on database level, [details](https://adamj.eu/tech/2020/01/22/djangos-field-choices-dont-constrain-your-data/).
8592

8693
### DRF Serializers

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = django-extra-checks
3-
version = 0.8.0
3+
version = 0.9.0
44
author = Konstantin Alekseev
55
author_email = [email protected]
66
description = Collection of useful checks for Django Checks Framework

src/extra_checks/registry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def is_healthy(self) -> bool:
144144
def ignore_checks(self, *args: Union[CheckId, str]) -> Callable[[Any], Any]:
145145
checks = ", ".join([c.value if isinstance(c, CheckId) else c for c in args])
146146
warnings.warn(
147-
f'@ignore_checks is deprecated and will be removed in version 0.10.0, replace it with comment "# extra-checks-disable-next-line {checks}"',
147+
f'@ignore_checks is deprecated and will be removed in version 0.11.0, replace it with comment "# extra-checks-disable-next-line {checks}"',
148148
DeprecationWarning,
149149
)
150150

tests/example/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class DisableManyChecksModel(models.Model):
212212
text_fail2 = models.TextField(null=True)
213213

214214
# disable two checks with separate comments
215-
# extra-checks-disable-next-line no-index-together
215+
# extra-checks-disable-next-line X014
216216
# extra-checks-disable-next-line no-unique-together
217217
class Meta:
218218
unique_together = ("text_fail", "text_fail2")

0 commit comments

Comments
 (0)