Skip to content

Commit

Permalink
Add ruff linter (#1397)
Browse files Browse the repository at this point in the history
* Add ruff package

* Auto-fixable errors

* Remove uneccessary imports

* Add ruff to pre-commit

* Fix ruff linting errors

* Remove black formatter

* Add ruff as formatter with file changes

* Add ruff rule to replace isort

* Replace autoflake with ruff rules

* Fix pre-commit config, update djlint

* Update import for HttpResponse

* Updated import rfc822
  • Loading branch information
okaycj authored Apr 17, 2024
1 parent 6d07b93 commit 0d54f0c
Show file tree
Hide file tree
Showing 196 changed files with 63 additions and 346 deletions.
31 changes: 7 additions & 24 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
repos:
- repo: https://github.com/myint/autoflake
rev: v1.4
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.7
hooks:
- id: autoflake
args:
[
"--in-place",
"--recursive",
"--remove-all-unused-imports",
"--expand-star-imports",
"--remove-duplicate-keys",
"--ignore-init-module-imports",
"--remove-unused-variables",
]
language_version: python3.9
- repo: https://github.com/timothycrosley/isort
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 24.3.0
hooks:
- id: black
- repo: https://github.com/Riverside-Healthcare/djLint
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/djlint/djLint
rev: v1.34.1
hooks:
- id: djlint-django
args: ["--profile=django", "--lint", "--reformat", "--quiet"]
- id: djlint-reformat-django
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
Expand Down
2 changes: 1 addition & 1 deletion accounts/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def authenticate(
username: Optional[str] = None,
password: Optional[str] = None,
auth_code: Optional[str] = None,
**kwargs: Any
**kwargs: Any,
) -> Optional[User]:
"""Authentication override."""

Expand Down
3 changes: 1 addition & 2 deletions accounts/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

from bitfield.forms import BitFieldCheckboxSelectMultiple
from django import forms
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
from django.contrib.auth.forms import PasswordChangeForm as DjangoPasswordChangeForm
from django.contrib.auth.forms import UserCreationForm
from django.core.exceptions import ValidationError
from django.forms import EmailField
from django.utils.translation import gettext_lazy as _
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = [("auth", "0008_alter_user_username_max_length")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def goodbye_cos_admin_group(*args, **kwargs):


class Migration(migrations.Migration):

dependencies = [("accounts", "0001_initial")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0003_auto_20170607_1800.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0002_add_cos_admin_group_and_assign_perms")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0004_auto_20170607_1800.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Migration(migrations.Migration):

dependencies = [
("accounts", "0003_auto_20170607_1800"),
("studies", "0002_auto_20170607_1800"),
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0005_auto_20170615_1524.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0004_auto_20170607_1800")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0005_auto_20170621_1843.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0004_auto_20170607_1800")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0006_auto_20170622_1504.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0005_auto_20170621_1843")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0007_auto_20170626_1811.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0006_auto_20170622_1504")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0007_organization_uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0006_auto_20170622_1504")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0008_merge_20170707_1801.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
("accounts", "0007_auto_20170626_1811"),
("accounts", "0007_organization_uuid"),
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0008_merge_20170710_1803.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
("accounts", "0005_auto_20170615_1524"),
("accounts", "0007_auto_20170626_1811"),
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0009_auto_20170710_1438.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0008_merge_20170707_1801")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0010_auto_20170710_1449.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0009_auto_20170710_1438")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0011_merge_20170710_1820.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
("accounts", "0010_auto_20170710_1449"),
("accounts", "0008_merge_20170710_1803"),
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0012_auto_20170718_2114.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0011_merge_20170710_1820")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0013_auto_20170718_2137.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0012_auto_20170718_2114")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0014_auto_20170726_1403.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0013_auto_20170718_2137")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0015_auto_20170805_1827.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0014_auto_20170726_1403")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0015_user_is_researcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0014_auto_20170726_1403")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0016_auto_20170802_2311.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0015_user_is_researcher")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0016_auto_20170805_1855.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0015_auto_20170805_1827")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0017_auto_20170805_2005.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0016_auto_20170805_1855")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0017_create_mit_organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def remove_mit_organization(*args, **kwargs):


class Migration(migrations.Migration):

dependencies = [
("contenttypes", "__latest__"),
("sites", "__latest__"),
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0018_auto_20170805_2012.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0017_auto_20170805_2005")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0019_merge_20170807_1545.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [
("accounts", "0017_create_mit_organization"),
("accounts", "0018_auto_20170805_2012"),
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0020_auto_20170807_1545.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0019_merge_20170807_1545")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0021_auto_20170808_1904.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0020_auto_20170807_1545")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0022_user_contact_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0021_auto_20170808_1904")]

operations = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0022_user_contact_name")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0024_auto_20170814_1542.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0023_demographicdata_lookit_referrer")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0025_auto_20170817_1935.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0024_auto_20170814_1542")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0026_auto_20170823_1352.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0025_auto_20170817_1935")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0027_auto_20170824_1800.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0026_auto_20170823_1352")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0028_auto_20170825_1532.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0027_auto_20170824_1800")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0029_user_former_lookit_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0028_auto_20170825_1532")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0030_child_former_lookit_profile_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0029_user_former_lookit_id")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0031_auto_20170908_0009.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0030_child_former_lookit_profile_id")]

operations = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0031_auto_20170908_0009")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0033_auto_20170908_1234.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0032_demographicdata_former_lookit_annual_income")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0034_auto_20170911_1832.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0033_auto_20170908_1234")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion accounts/migrations/0035_user_linked_former_lookit_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0034_auto_20170911_1832")]

operations = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Migration(migrations.Migration):

dependencies = [("accounts", "0035_user_linked_former_lookit_ids")]

operations = [
Expand Down
Loading

0 comments on commit 0d54f0c

Please sign in to comment.