From f1227ed037f0519669cbebe350901d372628006b Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Wed, 29 May 2024 22:08:54 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8(CI)=20fix=20linter=20backend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The linter in the CI was checking only the impress directory. We were passing near some lint issues. Now the linter checks the whole backend directory. --- .github/workflows/impress.yml | 6 +++--- src/backend/demo/management/commands/create_demo.py | 9 ++++++--- src/backend/demo/tests/test_commands_create_demo.py | 2 -- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/impress.yml b/.github/workflows/impress.yml index ae170708..2219733b 100644 --- a/.github/workflows/impress.yml +++ b/.github/workflows/impress.yml @@ -93,11 +93,11 @@ jobs: - name: Install development dependencies run: pip install --user .[dev] - name: Check code formatting with ruff - run: ~/.local/bin/ruff format impress --diff + run: ~/.local/bin/ruff format . --diff - name: Lint code with ruff - run: ~/.local/bin/ruff check impress + run: ~/.local/bin/ruff check . - name: Lint code with pylint - run: ~/.local/bin/pylint impress + run: ~/.local/bin/pylint . test-back: diff --git a/src/backend/demo/management/commands/create_demo.py b/src/backend/demo/management/commands/create_demo.py index 8a26343e..a8d7e598 100644 --- a/src/backend/demo/management/commands/create_demo.py +++ b/src/backend/demo/management/commands/create_demo.py @@ -1,7 +1,6 @@ # ruff: noqa: S311, S106 """create_demo management command""" -import json import logging import random import time @@ -110,10 +109,14 @@ def create_demo(stdout): queue = BulkQueue(stdout) with Timeit(stdout, "Creating Template"): - with open("demo/data/template/code.txt", "r") as text_file: + with open( + file="demo/data/template/code.txt", mode="r", encoding="utf-8" + ) as text_file: code_data = text_file.read() - with open("demo/data/template/css.txt", "r") as text_file: + with open( + file="demo/data/template/css.txt", mode="r", encoding="utf-8" + ) as text_file: css_data = text_file.read() queue.push( diff --git a/src/backend/demo/tests/test_commands_create_demo.py b/src/backend/demo/tests/test_commands_create_demo.py index 27b040c9..057b57e3 100644 --- a/src/backend/demo/tests/test_commands_create_demo.py +++ b/src/backend/demo/tests/test_commands_create_demo.py @@ -1,7 +1,5 @@ """Test the `create_demo` management command""" -from unittest import mock - from django.core.management import call_command from django.test import override_settings