Skip to content

Commit

Permalink
Добавлен pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrNazarov committed Dec 8, 2023
1 parent 1623d0e commit 0095acb
Show file tree
Hide file tree
Showing 25 changed files with 146 additions and 30 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/mypy_flake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Установка Poetry
uses: snok/install-poetry@v1
with:
poetry-version: 1.7.0

- name: Извлечение репозитория
uses: actions/checkout@v4

Expand All @@ -35,12 +35,12 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Установка Poetry
uses: snok/install-poetry@v1
with:
poetry-version: 1.7.0

- name: Извлечение репозитория
uses: actions/checkout@v4

Expand Down
44 changes: 44 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-docstring-first
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
exclude: migrations/|.*settings(\.py|/)?
additional_dependencies:
- flake8-isort
- flake8-django

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.0
hooks:
- id: mypy
additional_dependencies:
- django-stubs

- repo: local
hooks:
- id: export-dev-dependencies
name: Export dev Dependencies
language: system
pass_filenames: false
entry: poetry export --without-hashes --dev --output requirements/develop.txt
files: ^(pyproject.toml|poetry.lock)$
- id: export-prod-dependencies
name: Export prod Dependencies
language: system
pass_filenames: false
entry: poetry export --without-hashes --output requirements/production.txt
files: ^(pyproject.toml|poetry.lock)$
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Федерация Адаптивного Хоккея

#### Описание
Проект для [Федерации адаптивного хоккея](https://paraicehockey.ru/)
Проект для [Федерации адаптивного хоккея](https://paraicehockey.ru/)

# Содержание

Expand Down
2 changes: 1 addition & 1 deletion adaptive_hockey_federation/main/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by Django 4.2.6 on 2023-11-25 14:50

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.7 on 2023-12-08 22:05

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('main', '0002_alter_player_patronymic'),
]

operations = [
migrations.AlterField(
model_name='health',
name='revision',
field=models.CharField(blank=True, max_length=256, verbose_name='Пересмотр класса ХДН'),
),
migrations.AlterField(
model_name='player',
name='sex',
field=models.CharField(blank=True, choices=[('male', 'Мужской'), ('female', 'Женский')], max_length=6, verbose_name='Пол'),
),
]
5 changes: 2 additions & 3 deletions adaptive_hockey_federation/main/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.db import models
from django.db.models import (
CASCADE,
SET_NULL,
Expand Down Expand Up @@ -172,10 +173,9 @@ class Player(BasePerson):
max_length=max(len(sex) for sex, _ in SEX_CHOICES),
choices=SEX_CHOICES,
blank=True,
null=True,
verbose_name='Пол'
)
team = ManyToManyField(
team: models.ManyToManyField = ManyToManyField(
to=Team,
through='PlayerTeam',
verbose_name='Команда'
Expand Down Expand Up @@ -216,7 +216,6 @@ class Health(Model):
revision = CharField(
max_length=NAME_FIELD_LENGTH,
blank=True,
null=True,
verbose_name='Пересмотр класса ХДН',
)
anamnesis = ForeignKey(
Expand Down
1 change: 0 additions & 1 deletion adaptive_hockey_federation/main/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.shortcuts import render


# пример рендера таблиц, удалить после реализации вьюх
CONTEXT_EXAMPLE = {
'table_head': {
Expand Down
5 changes: 2 additions & 3 deletions adaptive_hockey_federation/parser/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ def get_all_files(path: str) -> tuple[list[str], str | None]:
if filename == NUMERIC_STATUSES:
numeric_statuses_filepath = os.path.join(dirpath, filename)
file, extension = os.path.splitext(filename)
if (not file.startswith('~')
and extension in FILES_EXTENSIONS
and file not in FILES_BLACK_LIST):
if (not file.startswith('~') and extension
in FILES_EXTENSIONS and file not in FILES_BLACK_LIST):
files.append(os.path.join(dirpath, filename))
return files, numeric_statuses_filepath

Expand Down
2 changes: 1 addition & 1 deletion adaptive_hockey_federation/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@
</div>
</div>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion adaptive_hockey_federation/templates/includes/button.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
{% if current_url_name == url_name %}bg-[#340061]{% else %}bg-[#64c2d1]{% endif %}">
{{ name }}
</a>
{% endwith %}
{% endwith %}
2 changes: 1 addition & 1 deletion adaptive_hockey_federation/templates/includes/drawer.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
</ul>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% with request.resolver_match.view_name as view_name %}

<li class="nav-item dropdown place-self-center p-0">
<a class="nav-link dropdown-toggle border border-primary bg-white w-44 text-slate-400 p-1.5 text-end" href="#"
<a class="nav-link dropdown-toggle border border-primary bg-white w-44 text-slate-400 p-1.5 text-end" href="#"
role="button" data-bs-toggle="dropdown" aria-expanded="false">
{% if view_name == 'main:users' %}Роль{% endif %}
{% if view_name == 'main:teams' %}Команда{% endif %}
Expand All @@ -16,4 +16,4 @@
<li><a class="dropdown-item" href="#">...</a></li>
</ul>
</li>
{% endwith %}
{% endwith %}
2 changes: 1 addition & 1 deletion adaptive_hockey_federation/templates/includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
</li>
</ul>
</div>
</nav>
</nav>
2 changes: 1 addition & 1 deletion adaptive_hockey_federation/templates/includes/table.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
</tr>
{% endfor %}
</tbody>
</table>
</table>
1 change: 0 additions & 1 deletion adaptive_hockey_federation/users/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.contrib import admin

from users.models import User


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.7 on 2023-12-08 22:05

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('users', '0002_alter_user_first_name_alter_user_last_name'),
]

operations = [
migrations.AlterField(
model_name='user',
name='first_name',
field=models.CharField(default='', max_length=256),
),
migrations.AlterField(
model_name='user',
name='last_name',
field=models.CharField(default='', max_length=256),
),
]
2 changes: 0 additions & 2 deletions adaptive_hockey_federation/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ class User(AbstractUser):
first_name = CharField(
max_length=NAME_MAX_LENGTH,
default='',
null=True,
)
last_name = CharField(
max_length=NAME_MAX_LENGTH,
default='',
null=True,
)
team = ForeignKey(
to=Team,
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ services:

volumes:
static_value:
media_value:
media_value:
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ sleep 5
app/.venv/bin/python manage.py collectstatic --noinput
mv /static/* /app/static/

exec "$@"
exec "$@"
2 changes: 1 addition & 1 deletion nginx/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ server {
location / {
proxy_pass http://site:8000;
}
}
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ django_settings_module = "adaptive_hockey_federation.settings"


[tool.poetry.scripts]
parser = "adaptive_hockey_federation.parser.parser:parsing_file"
parser = "adaptive_hockey_federation.parser.parser:parsing_file"
17 changes: 17 additions & 0 deletions requirements/develop.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
asgiref==3.7.2 ; python_version >= "3.11" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.11" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.11" and python_version < "4.0" and platform_system == "Windows"
django==4.2.7 ; python_version >= "3.11" and python_version < "4.0"
et-xmlfile==1.1.0 ; python_version >= "3.11" and python_version < "4.0"
gunicorn==21.2.0 ; python_version >= "3.11" and python_version < "4.0"
isort==5.12.0 ; python_version >= "3.11" and python_version < "4.0"
mypy-extensions==1.0.0 ; python_version >= "3.11" and python_version < "4.0"
mypy==1.6.0 ; python_version >= "3.11" and python_version < "4.0"
openpyxl-stubs==0.1.25 ; python_version >= "3.11" and python_version < "4.0"
openpyxl==3.1.2 ; python_version >= "3.11" and python_version < "4.0"
packaging==23.2 ; python_version >= "3.11" and python_version < "4.0"
sqlparse==0.4.4 ; python_version >= "3.11" and python_version < "4.0"
types-openpyxl==3.1.0.27 ; python_version >= "3.11" and python_version < "4.0"
typing-extensions==4.8.0 ; python_version >= "3.11" and python_version < "4.0"
tzdata==2023.3 ; python_version >= "3.11" and python_version < "4.0" and sys_platform == "win32"
wrapt==1.16.0 ; python_version >= "3.11" and python_version < "4.0"
16 changes: 16 additions & 0 deletions requirements/production.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
asgiref==3.7.2 ; python_version >= "3.11" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.11" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.11" and python_version < "4.0" and platform_system == "Windows"
django==4.2.7 ; python_version >= "3.11" and python_version < "4.0"
et-xmlfile==1.1.0 ; python_version >= "3.11" and python_version < "4.0"
gunicorn==21.2.0 ; python_version >= "3.11" and python_version < "4.0"
mypy-extensions==1.0.0 ; python_version >= "3.11" and python_version < "4.0"
mypy==1.6.0 ; python_version >= "3.11" and python_version < "4.0"
openpyxl-stubs==0.1.25 ; python_version >= "3.11" and python_version < "4.0"
openpyxl==3.1.2 ; python_version >= "3.11" and python_version < "4.0"
packaging==23.2 ; python_version >= "3.11" and python_version < "4.0"
sqlparse==0.4.4 ; python_version >= "3.11" and python_version < "4.0"
types-openpyxl==3.1.0.27 ; python_version >= "3.11" and python_version < "4.0"
typing-extensions==4.8.0 ; python_version >= "3.11" and python_version < "4.0"
tzdata==2023.3 ; python_version >= "3.11" and python_version < "4.0" and sys_platform == "win32"
wrapt==1.16.0 ; python_version >= "3.11" and python_version < "4.0"
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ exclude =
env/
per-file-ignores =
*/settings.py:E501
max-complexity = 10

max-complexity = 10

0 comments on commit 0095acb

Please sign in to comment.