Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable more rules for ruff #562

Merged
merged 26 commits into from
Jul 5, 2024
Merged

Enable more rules for ruff #562

merged 26 commits into from
Jul 5, 2024

Conversation

Mogost
Copy link
Member

@Mogost Mogost commented Jul 3, 2024

No description provided.

@Mogost Mogost self-assigned this Jul 3, 2024
@Mogost Mogost requested review from sergei-iurchenko and Natim July 3, 2024 16:21
Copy link

codecov bot commented Jul 3, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 8 lines in your changes missing coverage. Please review.

Project coverage is 90.18%. Comparing base (ef24fcb) to head (68a1c50).
Report is 17 commits behind head on master.

Files Patch % Lines
constance/admin.py 57.14% 2 Missing and 1 partial ⚠️
constance/backends/database.py 0.00% 1 Missing ⚠️
constance/backends/memory.py 66.66% 1 Missing ⚠️
constance/backends/redisd.py 85.71% 1 Missing ⚠️
constance/base.py 66.66% 0 Missing and 1 partial ⚠️
constance/test/unittest.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #562      +/-   ##
==========================================
+ Coverage   89.92%   90.18%   +0.26%     
==========================================
  Files          31       32       +1     
  Lines        1032     1080      +48     
  Branches      104      158      +54     
==========================================
+ Hits          928      974      +46     
- Misses         69       71       +2     
  Partials       35       35              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

constance/admin.py Outdated Show resolved Hide resolved
constance/apps.py Outdated Show resolved Hide resolved
@Natim
Copy link
Contributor

Natim commented Jul 3, 2024

Good job 👍

Copy link
Contributor

@sergei-iurchenko sergei-iurchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new breath in old codebase!

tests/backends/test_database.py Outdated Show resolved Hide resolved
constance/apps.py Show resolved Hide resolved
constance/backends/redisd.py Show resolved Hide resolved
constance/backends/redisd.py Show resolved Hide resolved
constance/models.py Show resolved Hide resolved
example/cheeseshop/settings.py Show resolved Hide resolved

class ConstanceConfig(AppConfig):
name = 'constance'
verbose_name = _('Constance')
default_auto_field = 'django.db.models.AutoField'

def ready(self):
from . import checks
checks.register(check_fieldsets, 'constance')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to register check here. They are registered automatically in decorator while loading module. Only import is required here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just reused practice from django.

https://github.com/django/django/blob/f302343380c77e1eb5dab3b64dd70895a95926ca/django/contrib/sites/apps.py#L17

I'm not too fond of import which is not clearly understandable.

import this
The Zen of Python, by Tim Peters
...
Explicit is better than implicit.

@Mogost
Copy link
Member Author

Mogost commented Jul 5, 2024

@sergei-iurchenko @Natim thank you for the review! 🦸‍♂️

@Mogost Mogost merged commit 8c6552f into jazzband:master Jul 5, 2024
10 of 11 checks passed
@Mogost Mogost deleted the ruff-2 branch July 5, 2024 14:38

from django.core import checks
from django.core.checks import CheckMessage
from django.utils.translation import gettext_lazy as _


@checks.register('constance')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants