diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 34bcb9a11d..5c051880f6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -28,4 +28,4 @@ Please state your operating system, the RDMO version, and (if applicable) the br ### References / Verweise -* +* diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index c5d2e92343..e9f639996d 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -11,7 +11,7 @@ assignees: '' A clear and concise description of what the problem is, followed by the solution you'd like. -### Affected +### Affected Who is affected by the change (Users, Managers, Admins)? @@ -25,4 +25,4 @@ What sort of related functionality would you like to see in addition? ### References / Verweise -* +* diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index eaf1ae0757..34440010df 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -36,7 +36,6 @@ jobs: key: lint-${{ hashFiles('.pre-commit-config.yaml') }} - name: Run ruff via pre-commit run: pre-commit run --all-files --color=always - continue-on-error: true # TODO: remove once files are reformatted test: runs-on: ubuntu-22.04 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 568b78cc29..6c10207c3d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,9 @@ repos: exclude: error\.xml$ - id: check-yaml - id: end-of-file-fixer + exclude: \.html$|\.txt$ - id: trailing-whitespace + exclude: \.dot$ - id: debug-statements - repo: https://github.com/charliermarsh/ruff-pre-commit rev: v0.0.284 diff --git a/CHANGELOG.md b/CHANGELOG.md index c9e512e9f7..124e0d648a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,7 +100,7 @@ * Add account deletion for LDAP users * Fix attribute export * Fix condition resolution when going backwards -* Prevent overlay errors if custom list is used +* Prevent overlay errors if custom list is used * Various fixes ## RDMO 1.6.2 (Nov 03, 2021) diff --git a/LICENSE b/LICENSE index 6b0b1270ff..d645695673 100644 --- a/LICENSE +++ b/LICENSE @@ -200,4 +200,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - diff --git a/conftest.py b/conftest.py index 0d621acf63..b62eb83355 100644 --- a/conftest.py +++ b/conftest.py @@ -3,6 +3,7 @@ from pathlib import Path import pytest + from django.conf import settings from django.core.management import call_command diff --git a/pyproject.toml b/pyproject.toml index 347e6e998a..f90c529851 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -137,6 +137,7 @@ select = [ ignore = [ "B006", # mutable-argument-default "B007", # unused-loop-control-variable + "B018", # useless-expression "RUF012", # mutable-class-default ] @@ -162,14 +163,20 @@ rest_framework = ["rest_framework"] "rdmo/**/models/__init__.py" = [ "F401", # unused-import ] +"rdmo/**/serializers/v1/__init__.py" = [ + "F401", # unused-import +] "rdmo/**/views/__init__.py" = [ "F401", # unused-import ] -# Ignore certain rules for tests, e.g. usage of assert is allowed "rdmo/**/tests/test_*.py" = [ "S101", # assert "S106", # hardcoded-password-func-arg ] +"testing/config/settings/__init__.py" = [ + "F401", # unused-import + "F403", # undefined-names +] [tool.pytest.ini_options] DJANGO_SETTINGS_MODULE = "config.settings" diff --git a/rdmo/accounts/adapter.py b/rdmo/accounts/adapter.py index a54cae687c..ccc7bf4d25 100644 --- a/rdmo/accounts/adapter.py +++ b/rdmo/accounts/adapter.py @@ -1,6 +1,7 @@ +from django.conf import settings + from allauth.account.adapter import DefaultAccountAdapter from allauth.socialaccount.adapter import DefaultSocialAccountAdapter -from django.conf import settings class AccountAdapter(DefaultAccountAdapter): diff --git a/rdmo/accounts/forms.py b/rdmo/accounts/forms.py index 63fd10ceea..e8e5f3df61 100644 --- a/rdmo/accounts/forms.py +++ b/rdmo/accounts/forms.py @@ -22,7 +22,7 @@ class Meta: fields = ('first_name', 'last_name', 'email') def __init__(self, *args, **kwargs): - super(ProfileForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.fields['first_name'].widget = forms.TextInput(attrs={'placeholder': _('First name')}) self.fields['last_name'].widget = forms.TextInput(attrs={'placeholder': _('Last name')}) @@ -50,7 +50,7 @@ def __init__(self, *args, **kwargs): self.fields[additional_field.key].initial = additional_field_value.value def save(self, *args, **kwargs): - super(ProfileForm, self).save(*args, **kwargs) + super().save(*args, **kwargs) self._save_additional_values() def _save_additional_values(self, user=None): @@ -72,7 +72,7 @@ class SignupForm(ProfileForm): use_required_attribute = False def __init__(self, *args, **kwargs): - super(SignupForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) # add a consent field, the label is added in the template if settings.ACCOUNT_TERMS_OF_USE: diff --git a/rdmo/accounts/models.py b/rdmo/accounts/models.py index 9d9c097a76..226b81f6af 100644 --- a/rdmo/accounts/models.py +++ b/rdmo/accounts/models.py @@ -4,6 +4,7 @@ from django.db.models.signals import post_save from django.dispatch import receiver from django.utils.translation import gettext_lazy as _ + from rdmo.core.models import TranslationMixin diff --git a/rdmo/accounts/serializers/v1.py b/rdmo/accounts/serializers/v1.py index ed9e627b6a..cd7018c4a9 100644 --- a/rdmo/accounts/serializers/v1.py +++ b/rdmo/accounts/serializers/v1.py @@ -2,6 +2,7 @@ from django.contrib.auth import get_user_model from django.contrib.auth.models import Group from django.contrib.sites.models import Site + from rest_framework import serializers from rdmo.projects.models import Membership diff --git a/rdmo/accounts/settings.py b/rdmo/accounts/settings.py index bf92651f87..f978d8fe46 100644 --- a/rdmo/accounts/settings.py +++ b/rdmo/accounts/settings.py @@ -5,7 +5,7 @@ user_view_permission = ( auth_app, auth_model, - 'view_{}'.format(auth_model) + f'view_{auth_model}' ) GROUPS = ( diff --git a/rdmo/accounts/templatetags/accounts_tags.py b/rdmo/accounts/templatetags/accounts_tags.py index 82d08eb6a8..6cadb0d25b 100644 --- a/rdmo/accounts/templatetags/accounts_tags.py +++ b/rdmo/accounts/templatetags/accounts_tags.py @@ -1,6 +1,6 @@ from django import template -from django.utils.translation import gettext_lazy as _ from django.utils.safestring import mark_safe +from django.utils.translation import gettext_lazy as _ from ..utils import get_full_name @@ -15,14 +15,11 @@ def full_name(user): @register.simple_tag() def user_data_as_dl(user): html = '