mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-02-06 11:33:00 +00:00
More constraints on linting (surely removed in the future)
This commit is contained in:
parent
ad2f1391a4
commit
05528cd58c
@ -17,6 +17,3 @@ linters:
|
|||||||
- apk add gcc libc-dev libffi-dev postgresql-dev # Add texlive
|
- apk add gcc libc-dev libffi-dev postgresql-dev # Add texlive
|
||||||
- pip install tox --no-cache-dir
|
- pip install tox --no-cache-dir
|
||||||
script: tox -e linters
|
script: tox -e linters
|
||||||
|
|
||||||
# Be nice to new contributors, but please use `tox`
|
|
||||||
allow_failure: true
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.conf.urls import url, include
|
from django.conf.urls import include, url
|
||||||
from rest_framework import routers
|
from rest_framework import routers
|
||||||
|
|
||||||
from .viewsets import UserViewSet
|
from .viewsets import UserViewSet
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
from django.db.models.signals import pre_save, post_save, post_delete
|
from django.db.models.signals import post_delete, post_save, pre_save
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
|
import getpass
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
from corres2math.middlewares import get_current_authenticated_user, get_current_ip
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from rest_framework.renderers import JSONRenderer
|
from rest_framework.renderers import JSONRenderer
|
||||||
from rest_framework.serializers import ModelSerializer
|
from rest_framework.serializers import ModelSerializer
|
||||||
from corres2math.middlewares import get_current_authenticated_user, get_current_ip
|
|
||||||
|
|
||||||
from .models import Changelog
|
from .models import Changelog
|
||||||
|
|
||||||
import getpass
|
|
||||||
|
|
||||||
|
|
||||||
# Ces modèles ne nécessitent pas de logs
|
# Ces modèles ne nécessitent pas de logs
|
||||||
EXCLUDED = [
|
EXCLUDED = [
|
||||||
@ -59,11 +57,11 @@ def save_object(sender, instance, **kwargs):
|
|||||||
if User.objects.filter(username=username).exists():
|
if User.objects.filter(username=username).exists():
|
||||||
user = User.objects.get(username=username)
|
user = User.objects.get(username=username)
|
||||||
|
|
||||||
|
# On n'enregistre pas les connexions
|
||||||
# noinspection PyProtectedMember
|
# noinspection PyProtectedMember
|
||||||
if user is not None and instance._meta.label_lower == "auth.user" and previous:
|
if user is not None and instance._meta.label_lower == "auth.user" and previous \
|
||||||
# On n'enregistre pas les connexions
|
and instance.last_login != previous.last_login:
|
||||||
if instance.last_login != previous.last_login:
|
return
|
||||||
return
|
|
||||||
|
|
||||||
changed_fields = '__all__'
|
changed_fields = '__all__'
|
||||||
if previous:
|
if previous:
|
||||||
|
@ -4,7 +4,7 @@ from django import forms
|
|||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from .models import Team, Participation
|
from .models import Participation, Team
|
||||||
|
|
||||||
|
|
||||||
class TeamForm(forms.ModelForm):
|
class TeamForm(forms.ModelForm):
|
||||||
|
@ -3,9 +3,9 @@ from django.core.exceptions import PermissionDenied
|
|||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.views.generic import CreateView, FormView, DetailView, RedirectView, UpdateView
|
from django.views.generic import CreateView, DetailView, FormView, RedirectView, UpdateView
|
||||||
|
|
||||||
from .forms import TeamForm, JoinTeamForm, ParticipationForm
|
from .forms import JoinTeamForm, ParticipationForm, TeamForm
|
||||||
from .models import Team
|
from .models import Team
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
from django.db.models.signals import pre_save, post_save
|
from django.db.models.signals import post_save, pre_save
|
||||||
|
|
||||||
|
|
||||||
class RegistrationConfig(AppConfig):
|
class RegistrationConfig(AppConfig):
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
from django import forms
|
||||||
from django.contrib.auth.forms import UserCreationForm
|
from django.contrib.auth.forms import UserCreationForm
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django import forms
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from .models import StudentRegistration, CoachRegistration, AdminRegistration
|
from .models import AdminRegistration, CoachRegistration, StudentRegistration
|
||||||
|
|
||||||
|
|
||||||
class SignupForm(UserCreationForm):
|
class SignupForm(UserCreationForm):
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from corres2math.tokens import email_validation_token
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.template import loader
|
from django.template import loader
|
||||||
@ -5,7 +6,6 @@ from django.utils.encoding import force_bytes
|
|||||||
from django.utils.http import urlsafe_base64_encode
|
from django.utils.http import urlsafe_base64_encode
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from polymorphic.models import PolymorphicModel
|
from polymorphic.models import PolymorphicModel
|
||||||
from corres2math.tokens import email_validation_token
|
|
||||||
|
|
||||||
|
|
||||||
class Registration(PolymorphicModel):
|
class Registration(PolymorphicModel):
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
|
||||||
from .views import SignupView, UserValidationEmailSentView, UserResendValidationEmailView, UserValidateView
|
from .views import SignupView, UserResendValidationEmailView, UserValidateView, UserValidationEmailSentView
|
||||||
|
|
||||||
app_name = "registration"
|
app_name = "registration"
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
|
from corres2math.tokens import email_validation_token
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.shortcuts import resolve_url, redirect
|
from django.shortcuts import redirect, resolve_url
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils.http import urlsafe_base64_decode
|
from django.utils.http import urlsafe_base64_decode
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from django.views.generic import CreateView, TemplateView, DetailView
|
from django.views.generic import CreateView, DetailView, TemplateView
|
||||||
from corres2math.tokens import email_validation_token
|
|
||||||
|
|
||||||
from .forms import SignupForm, StudentRegistrationForm, CoachRegistrationForm
|
from .forms import CoachRegistrationForm, SignupForm, StudentRegistrationForm
|
||||||
|
|
||||||
|
|
||||||
class SignupView(CreateView):
|
class SignupView(CreateView):
|
||||||
|
5
tox.ini
5
tox.ini
@ -11,7 +11,7 @@ deps =
|
|||||||
-r{toxinidir}/requirements.txt
|
-r{toxinidir}/requirements.txt
|
||||||
coverage
|
coverage
|
||||||
commands =
|
commands =
|
||||||
coverage run --omit='*migrations*,apps/scripts*' --source=apps,note_kfet ./manage.py test apps/
|
coverage run --omit='*migrations*,apps/scripts*' --source=apps,tfjm ./manage.py test apps/
|
||||||
coverage report -m
|
coverage report -m
|
||||||
|
|
||||||
[testenv:linters]
|
[testenv:linters]
|
||||||
@ -27,7 +27,6 @@ commands =
|
|||||||
flake8 apps/
|
flake8 apps/
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
ignore = W503, I100, I101
|
|
||||||
exclude =
|
exclude =
|
||||||
.tox,
|
.tox,
|
||||||
.git,
|
.git,
|
||||||
@ -39,7 +38,7 @@ exclude =
|
|||||||
.cache,
|
.cache,
|
||||||
.eggs,
|
.eggs,
|
||||||
*migrations*
|
*migrations*
|
||||||
max-complexity = 15
|
max-complexity = 10
|
||||||
max-line-length = 160
|
max-line-length = 160
|
||||||
import-order-style = google
|
import-order-style = google
|
||||||
application-import-names = flake8
|
application-import-names = flake8
|
||||||
|
Loading…
x
Reference in New Issue
Block a user