1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-05 02:06:52 +00:00

More constraints on linting (surely removed in the future)

This commit is contained in:
Yohann D'ANELLO 2020-09-24 12:06:33 +02:00
parent ad2f1391a4
commit 05528cd58c
12 changed files with 23 additions and 29 deletions

View File

@ -17,6 +17,3 @@ linters:
- apk add gcc libc-dev libffi-dev postgresql-dev # Add texlive
- pip install tox --no-cache-dir
script: tox -e linters
# Be nice to new contributors, but please use `tox`
allow_failure: true

View File

@ -1,5 +1,5 @@
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 .viewsets import UserViewSet

View File

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later
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 _

View File

@ -1,15 +1,13 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
import getpass
from corres2math.middlewares import get_current_authenticated_user, get_current_ip
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from rest_framework.renderers import JSONRenderer
from rest_framework.serializers import ModelSerializer
from corres2math.middlewares import get_current_authenticated_user, get_current_ip
from .models import Changelog
import getpass
# Ces modèles ne nécessitent pas de logs
EXCLUDED = [
@ -59,11 +57,11 @@ def save_object(sender, instance, **kwargs):
if User.objects.filter(username=username).exists():
user = User.objects.get(username=username)
# On n'enregistre pas les connexions
# noinspection PyProtectedMember
if user is not None and instance._meta.label_lower == "auth.user" and previous:
# On n'enregistre pas les connexions
if instance.last_login != previous.last_login:
return
if user is not None and instance._meta.label_lower == "auth.user" and previous \
and instance.last_login != previous.last_login:
return
changed_fields = '__all__'
if previous:

View File

@ -4,7 +4,7 @@ from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
from .models import Team, Participation
from .models import Participation, Team
class TeamForm(forms.ModelForm):

View File

@ -3,9 +3,9 @@ from django.core.exceptions import PermissionDenied
from django.db import transaction
from django.urls import reverse_lazy
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

View File

@ -1,5 +1,5 @@
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):

View File

@ -1,9 +1,9 @@
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django import forms
from django.utils.translation import gettext_lazy as _
from .models import StudentRegistration, CoachRegistration, AdminRegistration
from .models import AdminRegistration, CoachRegistration, StudentRegistration
class SignupForm(UserCreationForm):

View File

@ -1,3 +1,4 @@
from corres2math.tokens import email_validation_token
from django.contrib.sites.models import Site
from django.db import models
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.translation import gettext_lazy as _
from polymorphic.models import PolymorphicModel
from corres2math.tokens import email_validation_token
class Registration(PolymorphicModel):

View File

@ -1,6 +1,6 @@
from django.urls import path
from .views import SignupView, UserValidationEmailSentView, UserResendValidationEmailView, UserValidateView
from .views import SignupView, UserResendValidationEmailView, UserValidateView, UserValidationEmailSentView
app_name = "registration"

View File

@ -1,16 +1,16 @@
from corres2math.tokens import email_validation_token
from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
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.utils.http import urlsafe_base64_decode
from django.utils.translation import gettext_lazy as _
from django.views.generic import CreateView, TemplateView, DetailView
from corres2math.tokens import email_validation_token
from django.views.generic import CreateView, DetailView, TemplateView
from .forms import SignupForm, StudentRegistrationForm, CoachRegistrationForm
from .forms import CoachRegistrationForm, SignupForm, StudentRegistrationForm
class SignupView(CreateView):

View File

@ -11,7 +11,7 @@ deps =
-r{toxinidir}/requirements.txt
coverage
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
[testenv:linters]
@ -27,7 +27,6 @@ commands =
flake8 apps/
[flake8]
ignore = W503, I100, I101
exclude =
.tox,
.git,
@ -39,7 +38,7 @@ exclude =
.cache,
.eggs,
*migrations*
max-complexity = 15
max-complexity = 10
max-line-length = 160
import-order-style = google
application-import-names = flake8