diff --git a/.pylintrc b/.pylintrc
deleted file mode 100644
index 115a5c9a..00000000
--- a/.pylintrc
+++ /dev/null
@@ -1,473 +0,0 @@
-[MASTER]
-
-# A comma-separated list of package or module names from where C extensions may
-# be loaded. Extensions are loading into the active Python interpreter and may
-# run arbitrary code
-extension-pkg-whitelist=lxml
-
-# Add files or directories to the blacklist. They should be base names, not
-# paths.
-ignore=CVS
-
-# Add files or directories matching the regex patterns to the blacklist. The
-# regex matches against base names, not paths.
-ignore-patterns=setup.py
-
-# Pickle collected data for later comparisons.
-persistent=yes
-
-# When enabled, pylint would attempt to guess common misconfiguration and emit
-# user-friendly hints instead of false-positive error messages
-suggestion-mode=yes
-
-# Allow loading of arbitrary C extensions. Extensions are imported into the
-# active Python interpreter and may run arbitrary code.
-unsafe-load-any-extension=no
-
-# Pylint plugins to load
-load-plugins=pylint_django
-
-django-settings-module=pheme.settings
-
-[MESSAGES CONTROL]
-
-# Only show warnings with the listed confidence levels. Leave empty to show
-# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
-confidence=
-
-# Disable the message, report, category or checker with the given id(s). You
-# can either give multiple identifiers separated by comma (,) or put this
-# option multiple times (only on the command line, not in the configuration
-# file where it should appear only once).You can also use "--disable=all" to
-# disable everything first and then reenable specific checks. For example, if
-# you want to run only the similarities checker, you can use "--disable=all
-# --enable=similarities". If you want to run only the classes checker, but have
-# no Warning level messages displayed, use"--disable=all --enable=classes
-# --disable=W"
-
-# bad-continuation is disabled because of a bug in pylint.
-# See https://github.com/ambv/black/issues/48 and https://github.com/PyCQA/pylint/issues/289
-
-disable=len-as-condition,
- attribute-defined-outside-init,
- missing-docstring,
- bad-continuation,
- E1136,
- R
-
-#disable=print-statement,
-# parameter-unpacking,
-# unpacking-in-except,
-# old-raise-syntax,
-# backtick,
-# long-suffix,
-# old-ne-operator,
-# old-octal-literal,
-# import-star-module-level,
-# non-ascii-bytes-literal,
-# raw-checker-failed,
-# bad-inline-option,
-# locally-disabled,
-# locally-enabled,
-# file-ignored,
-# suppressed-message,
-# useless-suppression,
-# deprecated-pragma,
-# apply-builtin,
-# basestring-builtin,
-# buffer-builtin,
-# cmp-builtin,
-# coerce-builtin,
-# execfile-builtin,
-# file-builtin,
-# long-builtin,
-# raw_input-builtin,
-# reduce-builtin,
-# standarderror-builtin,
-# unicode-builtin,
-# xrange-builtin,
-# coerce-method,
-# delslice-method,
-# getslice-method,
-# setslice-method,
-# no-absolute-import,
-# old-division,
-# dict-iter-method,
-# dict-view-method,
-# next-method-called,
-# metaclass-assignment,
-# indexing-exception,
-# raising-string,
-# reload-builtin,
-# oct-method,
-# hex-method,
-# nonzero-method,
-# cmp-method,
-# input-builtin,
-# round-builtin,
-# intern-builtin,
-# unichr-builtin,
-# map-builtin-not-iterating,
-# zip-builtin-not-iterating,
-# range-builtin-not-iterating,
-# filter-builtin-not-iterating,
-# using-cmp-argument,
-# eq-without-hash,
-# div-method,
-# idiv-method,
-# rdiv-method,
-# exception-message-attribute,
-# invalid-str-codec,
-# sys-max-int,
-# bad-python3-import,
-# deprecated-string-function,
-# deprecated-str-translate-call,
-# deprecated-itertools-function,
-# deprecated-types-field,
-# next-method-defined,
-# dict-items-not-iterating,
-# dict-keys-not-iterating,
-# dict-values-not-iterating
-
-# Enable the message, report, category or checker with the given id(s). You can
-# either give multiple identifier separated by comma (,) or put this option
-# multiple time (only on the command line, not in the configuration file where
-# it should appear only once). See also the "--disable" option for examples.
-enable=c-extension-no-member
-
-
-[REPORTS]
-
-# Python expression which should return a note less than 10 (10 is the highest
-# note). You have access to the variables errors warning, statement which
-# respectively contain the number of errors / warnings messages and the total
-# number of statements analyzed. This is used by the global evaluation report
-# (RP0004).
-evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
-
-# Template used to display messages. This is a python new-style format string
-# used to format the message information. See doc for all details
-#msg-template=
-
-# Set the output format. Available formats are text, parseable, colorized, json
-# and msvs (visual studio).You can also give a reporter class, eg
-# mypackage.mymodule.MyReporterClass.
-output-format=text
-
-# Tells whether to display a full report or only the messages
-reports=no
-
-# Deactivate the evaluation score.
-score=no
-
-
-[REFACTORING]
-
-# Maximum number of nested blocks for function / method body
-max-nested-blocks=5
-
-# Complete name of functions that never returns. When checking for
-# inconsistent-return-statements if a never returning function is called then
-# it will be considered as an explicit return statement and no message will be
-# printed.
-never-returning-functions=optparse.Values,sys.exit
-
-
-[VARIABLES]
-
-# List of additional names supposed to be defined in builtins. Remember that
-# you should avoid to define new builtins when possible.
-additional-builtins=
-
-# Tells whether unused global variables should be treated as a violation.
-allow-global-unused-variables=yes
-
-# List of strings which can identify a callback function by name. A callback
-# name must start or end with one of those strings.
-callbacks=cb_,
- _cb
-
-# A regular expression matching the name of dummy variables (i.e. expectedly
-# not used).
-dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
-
-# Argument names that match this expression will be ignored. Default to name
-# with leading underscore
-ignored-argument-names=_.*|^ignored_|^unused_
-
-# Tells whether we should check for unused import in __init__ files.
-init-import=no
-
-# List of qualified module names which can have objects that can redefine
-# builtins.
-redefining-builtins-modules=six.moves,past.builtins,future.builtins
-
-
-[MISCELLANEOUS]
-
-# List of note tags to take in consideration, separated by a comma.
-notes=FIXME,
- XXX,
- TODO
-
-
-[BASIC]
-
-# Regular expression which should only match correct argument names
-argument-rgx=[a-z_][a-z0-9_]{1,40}$
-
-# Regular expression which should only match correct instance attribute names
-attr-rgx=[a-z_][a-z0-9_]{1,40}$
-
-# Bad variable names which should always be refused, separated by a comma
-bad-names=foo,
- bar,
- baz,
- toto,
- tutu,
- tata
-
-# Regular expression matching correct class attribute names.
-class-attribute-rgx=([a-z_][a-z0-9_]{1,40})|([A-Z_][A-Z0-9_]{1,30})$
-
-# Naming style matching correct class names
-class-naming-style=PascalCase
-
-# Naming style matching correct constant names
-const-naming-style=UPPER_CASE
-
-# Minimum line length for functions/classes that require docstrings, shorter
-# ones are exempt.
-docstring-min-length=3
-
-# Regular expression which should only match correct function names
-function-rgx=[a-z_][a-z0-9_]+$
-
-# Good variable names which should always be accepted, separated by a comma
-good-names=e,
- f,
- i,
- j,
- k,
- ex,
- Run,
- logger,
- _
-
-# Include a hint for the correct naming format with invalid-name
-include-naming-hint=yes
-
-# Regular expression matching correct inline iteration names.
-inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
-
-# Regular expression which should only match correct method names
-method-rgx=[a-z_][a-z0-9_]+$
-
-# Regular expression which should only match correct module names
-module-rgx=([a-z]+)|(test_*)|(__main__)$
-
-# Regular expression which should only match function or class names that do
-# not require a docstring.
-no-docstring-rgx=^_
-
-# List of decorators that produce properties, such as abc.abstractproperty. Add
-# to this list to register other decorators that produce valid properties.
-property-classes=abc.abstractproperty
-
-# Regular expression which should only match correct variable names
-variable-rgx=[a-z_][a-z0-9_]+$
-
-
-[SIMILARITIES]
-
-# Ignore comments when computing similarities.
-ignore-comments=yes
-
-# Ignore docstrings when computing similarities.
-ignore-docstrings=yes
-
-# Ignore imports when computing similarities.
-ignore-imports=no
-
-# Minimum lines number of a similarity.
-min-similarity-lines=4
-
-
-[LOGGING]
-
-# Logging modules to check that the string format arguments are in logging
-# function parameter format
-logging-modules=logging
-
-
-[TYPECHECK]
-
-# List of decorators that produce context managers, such as
-# contextlib.contextmanager. Add to this list to register other decorators that
-# produce valid context managers.
-contextmanager-decorators=contextlib.contextmanager
-
-# List of members which are set dynamically and missed by pylint inference
-# system, and so shouldn't trigger E1101 when accessed. Python regular
-# expressions are accepted.
-generated-members=
-
-# Tells whether missing members accessed in mixin class should be ignored. A
-# mixin class is detected if its name ends with "mixin" (case insensitive).
-ignore-mixin-members=yes
-
-# This flag controls whether pylint should warn about no-member and similar
-# checks whenever an opaque object is returned when inferring. The inference
-# can return multiple potential results while evaluating a Python object, but
-# some branches might not be evaluated, which results in partial inference. In
-# that case, it might be useful to still emit no-member and other checks for
-# the rest of the inferred objects.
-ignore-on-opaque-inference=yes
-
-# List of class names for which member attributes should not be checked (useful
-# for classes with dynamically set attributes). This supports the use of
-# qualified names.
-ignored-classes=optparse.Values,thread._local,_thread._local
-
-# List of module names for which member attributes should not be checked
-# (useful for modules/projects where namespaces are manipulated during runtime
-# and thus existing member attributes cannot be deduced by static analysis. It
-# supports qualified module names, as well as Unix pattern matching.
-ignored-modules=
-
-# Show a hint with possible names when a member name was not found. The aspect
-# of finding the hint is based on edit distance.
-missing-member-hint=yes
-
-# The minimum edit distance a name should have in order to be considered a
-# similar match for a missing member name.
-missing-member-hint-distance=1
-
-# The total number of similar names that should be taken in consideration when
-# showing a hint for a missing member.
-missing-member-max-choices=1
-
-
-[FORMAT]
-
-# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
-expected-line-ending-format=LF
-
-# Regexp for a line that is allowed to be longer than the limit.
-ignore-long-lines=^\s*(# )??$
-
-# Number of spaces of indent required inside a hanging or continued line.
-indent-after-paren=4
-
-# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
-# tab).
-indent-string=' '
-
-# Maximum number of characters on a single line.
-max-line-length=80
-
-# Maximum number of lines in a module
-max-module-lines=1000
-
-# Allow the body of a class to be on the same line as the declaration if body
-# contains single statement.
-single-line-class-stmt=no
-
-# Allow the body of an if to be on the same line as the test if there is no
-# else.
-single-line-if-stmt=no
-
-
-[IMPORTS]
-
-# Allow wildcard imports from modules that define __all__.
-allow-wildcard-with-all=no
-
-# Analyse import fallback blocks. This can be used to support both Python 2 and
-# 3 compatible code, which means that the block might have code that exists
-# only in one or another interpreter, leading to false positives when analysed.
-analyse-fallback-blocks=no
-
-# Deprecated modules which should not be used, separated by a comma
-deprecated-modules=optparse,tkinter.tix
-
-# Create a graph of external dependencies in the given file (report RP0402 must
-# not be disabled)
-ext-import-graph=
-
-# Create a graph of every (i.e. internal and external) dependencies in the
-# given file (report RP0402 must not be disabled)
-import-graph=
-
-# Create a graph of internal dependencies in the given file (report RP0402 must
-# not be disabled)
-int-import-graph=
-
-# Force import order to recognize a module as part of the standard
-# compatibility libraries.
-known-standard-library=
-
-# Force import order to recognize a module as part of a third party library.
-known-third-party=enchant
-
-
-[DESIGN]
-
-# Maximum number of arguments for function / method
-max-args=15
-
-# Maximum number of attributes for a class (see R0902).
-max-attributes=20
-
-# Maximum number of boolean expressions in a if statement
-max-bool-expr=5
-
-# Maximum number of branch for function / method body
-max-branches=12
-
-# Maximum number of locals for function / method body
-max-locals=15
-
-# Maximum number of parents for a class (see R0901).
-max-parents=7
-
-# Maximum number of public methods for a class (see R0904).
-max-public-methods=30
-
-# Maximum number of return / yield for function / method body
-max-returns=6
-
-# Maximum number of statements in function / method body
-max-statements=50
-
-# Minimum number of public methods for a class (see R0903).
-min-public-methods=0
-
-
-[CLASSES]
-
-# List of method names used to declare (i.e. assign) instance attributes.
-defining-attr-methods=__init__,
- __new__,
- setUp
-
-# List of member names, which should be excluded from the protected access
-# warning.
-exclude-protected=_asdict,
- _fields,
- _replace,
- _source,
- _make
-
-# List of valid names for the first argument in a class method.
-valid-classmethod-first-arg=cls
-
-# List of valid names for the first argument in a metaclass class method.
-valid-metaclass-classmethod-first-arg=mcs
-
-
-[EXCEPTIONS]
-
-# Exceptions that will emit a warning when being caught. Defaults to
-# "Exception"
-overgeneral-exceptions=builins.Exception
diff --git a/pheme/__init__.py b/pheme/__init__.py
index 14dc1281..1a3dcf32 100644
--- a/pheme/__init__.py
+++ b/pheme/__init__.py
@@ -17,4 +17,4 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from .version import __version__
+from .version import __version__ # noqa: F401
diff --git a/pheme/authentication.py b/pheme/authentication.py
index 786c7466..c577a82a 100644
--- a/pheme/authentication.py
+++ b/pheme/authentication.py
@@ -18,17 +18,15 @@
import logging
from typing import Callable, Tuple, Union
-from rest_framework.authentication import BaseAuthentication
-from rest_framework import exceptions
-from rest_framework.request import HttpRequest
-
import requests
-from requests.models import Response
import xmltodict
+from requests.models import Response
+from rest_framework import exceptions
+from rest_framework.authentication import BaseAuthentication
+from rest_framework.request import HttpRequest
from pheme import settings
-
logger: logging.Logger = logging.getLogger(__name__)
# pylint falsely identifies Union as unsubscriptable-object in python 3.9
diff --git a/pheme/datalink.py b/pheme/datalink.py
index 3f78eb1c..8d54541e 100644
--- a/pheme/datalink.py
+++ b/pheme/datalink.py
@@ -15,8 +15,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-import urllib
import base64
+import urllib
def as_datalink(data: bytes, file_format: str) -> str:
diff --git a/pheme/parameter.py b/pheme/parameter.py
index 820161c3..69fa2c1a 100644
--- a/pheme/parameter.py
+++ b/pheme/parameter.py
@@ -15,25 +15,26 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-import mimetypes
+import json
import logging
-from typing import Dict, Callable
+import mimetypes
from pathlib import Path
-import json
+from typing import Callable, Dict
+
import rest_framework
from django.core.files.uploadedfile import UploadedFile
from rest_framework.decorators import (
api_view,
+ authentication_classes,
parser_classes,
renderer_classes,
- authentication_classes,
)
from rest_framework.request import HttpRequest
from rest_framework.response import Response
-from pheme.datalink import as_datalink
-from pheme import settings
-import pheme.authentication
+import pheme.authentication
+from pheme import settings
+from pheme.datalink import as_datalink
logger = logging.getLogger(__name__)
diff --git a/pheme/parser/xml.py b/pheme/parser/xml.py
index 3e5d0d1b..cc9d6c51 100644
--- a/pheme/parser/xml.py
+++ b/pheme/parser/xml.py
@@ -23,8 +23,8 @@
reliable for our usecase.
"""
-from rest_framework.parsers import BaseParser
import xmltodict
+from rest_framework.parsers import BaseParser
class XMLFormParser(BaseParser):
diff --git a/pheme/renderer.py b/pheme/renderer.py
index d8dfa1fc..3361fe29 100644
--- a/pheme/renderer.py
+++ b/pheme/renderer.py
@@ -16,11 +16,12 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from typing import List, Dict, Generator, Union
-from io import StringIO
from csv import DictWriter
-from rest_framework.renderers import BaseRenderer
+from io import StringIO
+from typing import Dict, Generator, List, Union
+
import xmltodict
+from rest_framework.renderers import BaseRenderer
class CSVRenderer(BaseRenderer):
diff --git a/pheme/settings.py b/pheme/settings.py
index b767c49e..ab941364 100644
--- a/pheme/settings.py
+++ b/pheme/settings.py
@@ -28,9 +28,9 @@
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
-from pathlib import Path
-import secrets
import os
+import secrets
+from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
__configured_base = os.environ.get("PHEME_BASE_PATH")
diff --git a/pheme/storage.py b/pheme/storage.py
index 2e8f08d1..55975f5c 100644
--- a/pheme/storage.py
+++ b/pheme/storage.py
@@ -16,8 +16,8 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from uuid import uuid4
from typing import Dict
+from uuid import uuid4
from django.core.cache import cache
diff --git a/pheme/templatetags/charts/__init__.py b/pheme/templatetags/charts/__init__.py
index 98c0b863..f07e1574 100644
--- a/pheme/templatetags/charts/__init__.py
+++ b/pheme/templatetags/charts/__init__.py
@@ -17,6 +17,7 @@
# along with this program. If not, see .
from typing import Dict
+
from django import template
_severity_class_colors = {
diff --git a/pheme/templatetags/charts/h_bar.py b/pheme/templatetags/charts/h_bar.py
index 9e4aaaf0..62c4c9fd 100644
--- a/pheme/templatetags/charts/h_bar.py
+++ b/pheme/templatetags/charts/h_bar.py
@@ -19,16 +19,17 @@
import itertools
from typing import Dict
-from PIL import ImageFont
+
from django.utils.safestring import SafeText
+from PIL import ImageFont
+
from pheme.templatetags.charts import (
- register,
_severity_class_colors,
build_legend,
calculate_legend_start_height,
+ register,
)
-
__ORIENTATION_LINE_TEMPLATE = """
"""
@@ -138,7 +139,7 @@ def h_bar_chart(
font = ImageFont.truetype(font_file_name, font_size)
# add 87.5 + 10 for legend
max_hostname_len = (
- max(
+ max( # noqa: PLW3301
max(font.getlength(k) for k in data.keys()),
font.getlength(x_title),
)
@@ -148,7 +149,7 @@ def h_bar_chart(
except OSError:
# multiply by 1.25 for kerning and add 87.5 for legend
max_hostname_len = (
- max(max(len(k) for k in data.keys()), len(x_title))
+ max(max(len(k) for k in data.keys()), len(x_title)) # noqa: PLW3301
* font_size
* 1.25
+ 87.5
diff --git a/pheme/templatetags/charts/pie.py b/pheme/templatetags/charts/pie.py
index d7e4d713..a815c8f5 100644
--- a/pheme/templatetags/charts/pie.py
+++ b/pheme/templatetags/charts/pie.py
@@ -18,12 +18,14 @@
# along with this program. If not, see .
import math
from typing import Dict
+
from django.utils.safestring import SafeText
+
from pheme.templatetags.charts import (
- calculate_legend_start_height,
- register,
_severity_class_colors,
build_legend,
+ calculate_legend_start_height,
+ register,
)
__PIE_CHART_TEMPLATE = """
diff --git a/pheme/templatetags/charts/treemap.py b/pheme/templatetags/charts/treemap.py
index 0431b815..36a0e7f5 100644
--- a/pheme/templatetags/charts/treemap.py
+++ b/pheme/templatetags/charts/treemap.py
@@ -33,9 +33,9 @@
from pheme.templatetags.charts import (
_severity_class_colors,
- register,
build_legend,
calculate_legend_start_height,
+ register,
)
__ELEMENT_TEMPLATE = """
diff --git a/pheme/templatetags/dynamic_template.py b/pheme/templatetags/dynamic_template.py
index f8d35fb1..a86c1984 100644
--- a/pheme/templatetags/dynamic_template.py
+++ b/pheme/templatetags/dynamic_template.py
@@ -23,10 +23,10 @@
as a dependency upfront.
"""
-from django.utils.safestring import mark_safe, SafeString
from django import template
-from pheme.parameter import load_params
+from django.utils.safestring import SafeString, mark_safe
+from pheme.parameter import load_params
register = template.Library()
diff --git a/pheme/templatetags/readable_timeformat.py b/pheme/templatetags/readable_timeformat.py
index a6002fe6..8f191b53 100644
--- a/pheme/templatetags/readable_timeformat.py
+++ b/pheme/templatetags/readable_timeformat.py
@@ -22,9 +22,9 @@
2001-07-22T09:15:37Z -> Sun, Jul 22, 2001 09 AM UTC
"""
from datetime import datetime
-from django.utils.safestring import SafeText, SafeString
-from django import template
+from django import template
+from django.utils.safestring import SafeString, SafeText
register = template.Library()
diff --git a/pheme/transformation/__init__.py b/pheme/transformation/__init__.py
index 6f4203e8..a3dd2700 100644
--- a/pheme/transformation/__init__.py
+++ b/pheme/transformation/__init__.py
@@ -16,4 +16,4 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from . import scanreport
+from . import scanreport # noqa: F401
diff --git a/pheme/transformation/scanreport/__init__.py b/pheme/transformation/scanreport/__init__.py
index 336e94b7..4b252e4d 100644
--- a/pheme/transformation/scanreport/__init__.py
+++ b/pheme/transformation/scanreport/__init__.py
@@ -16,4 +16,4 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from . import gvmd, renderer
+from . import gvmd, renderer # noqa: F401
diff --git a/pheme/transformation/scanreport/gvmd.py b/pheme/transformation/scanreport/gvmd.py
index ae9f4416..1ba64e9a 100644
--- a/pheme/transformation/scanreport/gvmd.py
+++ b/pheme/transformation/scanreport/gvmd.py
@@ -27,10 +27,8 @@
"""
import logging
import time
-
from typing import Dict, List, Optional
-
from pheme.transformation.scanreport.model import (
# Equipment,
Overview,
diff --git a/pheme/transformation/scanreport/renderer.py b/pheme/transformation/scanreport/renderer.py
index 12a9454f..5518585c 100644
--- a/pheme/transformation/scanreport/renderer.py
+++ b/pheme/transformation/scanreport/renderer.py
@@ -17,19 +17,19 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
import logging
-from typing import Dict
-
from base64 import b64encode
+from typing import Dict
from django.core.cache import cache
-from django.template import Template, Context
+from django.template import Context, Template
from rest_framework import renderers
from rest_framework.request import Request
from weasyprint import CSS, HTML
-from pheme.settings import DEBUG
-from pheme.parameter import load_params
+
from pheme.authentication import get_username_role
from pheme.errors import TemplateNotFoundError
+from pheme.parameter import load_params
+from pheme.settings import DEBUG
logger = logging.getLogger(__name__)
@@ -150,7 +150,7 @@ def _replace_inline_svg_with_img_tags(
def enforce_limit(
data: Dict, parameter: Dict, format_type: str = "pdf"
) -> Dict:
- if not "results" in data:
+ if "results" not in data:
return data
limits = parameter.get("limits", {}).get(format_type, {})
diff --git a/pheme/urls.py b/pheme/urls.py
index d916d843..090cf786 100644
--- a/pheme/urls.py
+++ b/pheme/urls.py
@@ -33,9 +33,10 @@
"""
from django.urls import path
+
+import pheme.parameter
import pheme.version
import pheme.views
-import pheme.parameter
urlpatterns = [
path(
diff --git a/pheme/version/__init__.py b/pheme/version/__init__.py
index 4d32769b..71338fc8 100644
--- a/pheme/version/__init__.py
+++ b/pheme/version/__init__.py
@@ -16,4 +16,4 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from .__version__ import __version__
+from .__version__ import __version__ # noqa: F401
diff --git a/pheme/views.py b/pheme/views.py
index fe019199..7eed1b52 100644
--- a/pheme/views.py
+++ b/pheme/views.py
@@ -17,16 +17,16 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
import dataclasses
+
import rest_framework.renderers
from rest_framework.decorators import api_view, parser_classes, renderer_classes
-from rest_framework.response import Response
from rest_framework.request import Request
-
+from rest_framework.response import Response
from pheme.parser.xml import XMLFormParser, XMLParser
+from pheme.renderer import CSVRenderer, MarkDownTableRenderer, XMLRenderer
+from pheme.storage import load, store
from pheme.transformation import scanreport
-from pheme.storage import store, load
-from pheme.renderer import MarkDownTableRenderer, XMLRenderer, CSVRenderer
from pheme.transformation.scanreport import model
from pheme.version import __version__
diff --git a/poetry.lock b/poetry.lock
index 09ffa4fb..cb853355 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -86,19 +86,19 @@ autohooks = ">=21.6.0"
black = ">=20.8"
[[package]]
-name = "autohooks-plugin-pylint"
-version = "23.10.0"
-description = "An autohooks plugin for python code linting via pylint"
+name = "autohooks-plugin-ruff"
+version = "24.1.0"
+description = "An autohooks plugin for python code formatting via ruff"
optional = false
python-versions = ">=3.9,<4.0"
files = [
- {file = "autohooks_plugin_pylint-23.10.0-py3-none-any.whl", hash = "sha256:49e1e60b81f48ca17d55a6660bff9aae0e9bd8cda2ec6f4ef1237b2f86475682"},
- {file = "autohooks_plugin_pylint-23.10.0.tar.gz", hash = "sha256:ed2f82ba89d28f772562794734eb37ae630b7a3011526e9cdfc13240865b0359"},
+ {file = "autohooks_plugin_ruff-24.1.0-py3-none-any.whl", hash = "sha256:2a072805b60abb63311abab84a6600cde9112840ab68f39af53f517648341651"},
+ {file = "autohooks_plugin_ruff-24.1.0.tar.gz", hash = "sha256:1a8dd732a2e7215c1c66faa79ac499195859c499af7ce52284ee6003ece4f25c"},
]
[package.dependencies]
-autohooks = ">=2.2.0"
-pylint = ">=2.8.3"
+autohooks = ">=23.4.0"
+ruff = ">=0.0.272"
[[package]]
name = "black"
@@ -1722,6 +1722,33 @@ dev = ["build (>=0.7.0)", "pre-commit (>=2.20.0)", "pytest (>=7.0.1)", "pytest-c
doc = ["pytoolconfig[doc]", "sphinx (>=4.5.0)", "sphinx-autodoc-typehints (>=1.18.1)", "sphinx-rtd-theme (>=1.0.0)"]
release = ["pip-tools (>=6.12.1)", "toml (>=0.10.2)", "twine (>=4.0.2)"]
+[[package]]
+name = "ruff"
+version = "0.6.1"
+description = "An extremely fast Python linter and code formatter, written in Rust."
+optional = false
+python-versions = ">=3.7"
+files = [
+ {file = "ruff-0.6.1-py3-none-linux_armv6l.whl", hash = "sha256:b4bb7de6a24169dc023f992718a9417380301b0c2da0fe85919f47264fb8add9"},
+ {file = "ruff-0.6.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:45efaae53b360c81043e311cdec8a7696420b3d3e8935202c2846e7a97d4edae"},
+ {file = "ruff-0.6.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:bc60c7d71b732c8fa73cf995efc0c836a2fd8b9810e115be8babb24ae87e0850"},
+ {file = "ruff-0.6.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2c7477c3b9da822e2db0b4e0b59e61b8a23e87886e727b327e7dcaf06213c5cf"},
+ {file = "ruff-0.6.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3a0af7ab3f86e3dc9f157a928e08e26c4b40707d0612b01cd577cc84b8905cc9"},
+ {file = "ruff-0.6.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:392688dbb50fecf1bf7126731c90c11a9df1c3a4cdc3f481b53e851da5634fa5"},
+ {file = "ruff-0.6.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:5278d3e095ccc8c30430bcc9bc550f778790acc211865520f3041910a28d0024"},
+ {file = "ruff-0.6.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fe6d5f65d6f276ee7a0fc50a0cecaccb362d30ef98a110f99cac1c7872df2f18"},
+ {file = "ruff-0.6.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b2e0dd11e2ae553ee5c92a81731d88a9883af8db7408db47fc81887c1f8b672e"},
+ {file = "ruff-0.6.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d812615525a34ecfc07fd93f906ef5b93656be01dfae9a819e31caa6cfe758a1"},
+ {file = "ruff-0.6.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:faaa4060f4064c3b7aaaa27328080c932fa142786f8142aff095b42b6a2eb631"},
+ {file = "ruff-0.6.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:99d7ae0df47c62729d58765c593ea54c2546d5de213f2af2a19442d50a10cec9"},
+ {file = "ruff-0.6.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9eb18dfd7b613eec000e3738b3f0e4398bf0153cb80bfa3e351b3c1c2f6d7b15"},
+ {file = "ruff-0.6.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:c62bc04c6723a81e25e71715aa59489f15034d69bf641df88cb38bdc32fd1dbb"},
+ {file = "ruff-0.6.1-py3-none-win32.whl", hash = "sha256:9fb4c4e8b83f19c9477a8745e56d2eeef07a7ff50b68a6998f7d9e2e3887bdc4"},
+ {file = "ruff-0.6.1-py3-none-win_amd64.whl", hash = "sha256:c2ebfc8f51ef4aca05dad4552bbcf6fe8d1f75b2f6af546cc47cc1c1ca916b5b"},
+ {file = "ruff-0.6.1-py3-none-win_arm64.whl", hash = "sha256:3bc81074971b0ffad1bd0c52284b22411f02a11a012082a76ac6da153536e014"},
+ {file = "ruff-0.6.1.tar.gz", hash = "sha256:af3ffd8c6563acb8848d33cd19a69b9bfe943667f0419ca083f8ebe4224a3436"},
+]
+
[[package]]
name = "semver"
version = "3.0.2"
@@ -2050,4 +2077,4 @@ tracking = ["sentry-sdk"]
[metadata]
lock-version = "2.0"
python-versions = "^3.9"
-content-hash = "6b715aebb104837cbe3aaced9d97bda24b8608e459c5018e10aaf091d076f54f"
+content-hash = "fbfbaadf964d6a75f002d238511a9c9efa4acc8f6d8aa2c1353d89a254bb4d90"
diff --git a/pyproject.toml b/pyproject.toml
index c25462bf..5dadcea4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -39,7 +39,7 @@ pytest-cov = ">=4.0.0"
pytest-django = ">=3.9"
pytest-env = ">=0.8.1"
autohooks = ">=23.1.0"
-autohooks-plugin-pylint = ">=22.8.1"
+autohooks-plugin-ruff = ">=24.1.0"
autohooks-plugin-black = ">=22.11.0"
rope = ">=0.17,<1.14"
pontos = ">=21.6.3"
@@ -64,9 +64,16 @@ exclude = '''
'''
[tool.autohooks]
-pre-commit = ['autohooks.plugins.black', 'autohooks.plugins.pylint']
+pre-commit = ['autohooks.plugins.black', 'autohooks.plugins.ruff']
mode = "poetry"
+[tool.ruff]
+line-length = 80
+target-version = "py39"
+
+[tool.ruff.lint]
+extend-select = ["I", "PLE", "PLW"]
+
[tool.pontos.version]
version-module-file = "pheme/version/__version__.py"
diff --git a/tests/__init__.py b/tests/__init__.py
index 311a5c5e..6c2f9419 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -15,4 +15,4 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-from . import generate_test_data
+from . import generate_test_data # noqa: F401
diff --git a/tests/test_format_time.py b/tests/test_format_time.py
index 65bcd45e..fac5764e 100644
--- a/tests/test_format_time.py
+++ b/tests/test_format_time.py
@@ -1,8 +1,8 @@
from django.urls import reverse
from rest_framework.test import APIClient
-from tests.test_report_generation import test_http_accept
from pheme.settings import SECRET_KEY
+from tests.test_report_generation import test_http_accept
def test_format_time_within_template():
diff --git a/tests/test_get_username_and_role.py b/tests/test_get_username_and_role.py
index c3e8bbd2..26388a4b 100644
--- a/tests/test_get_username_and_role.py
+++ b/tests/test_get_username_and_role.py
@@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
from unittest.mock import patch
+
from pheme.authentication import get_username_role
GSAD_FAKE_RESPONSE = """
diff --git a/tests/test_gvmd_scanreport_datatransformation.py b/tests/test_gvmd_scanreport_datatransformation.py
index b60b3b67..b8459ce5 100644
--- a/tests/test_gvmd_scanreport_datatransformation.py
+++ b/tests/test_gvmd_scanreport_datatransformation.py
@@ -18,10 +18,10 @@
# along with this program. If not, see .
import pytest
+
from pheme.transformation.scanreport.gvmd import (
transform,
)
-
from tests.generate_test_data import gen_report
oids = [f"oid_{i}" for i in range(5)]
diff --git a/tests/test_parameter.py b/tests/test_parameter.py
index ab0cbc1a..32103e6a 100644
--- a/tests/test_parameter.py
+++ b/tests/test_parameter.py
@@ -16,9 +16,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
from unittest.mock import patch
+
import pytest
-from rest_framework.test import APIClient
from rest_framework.reverse import reverse
+from rest_framework.test import APIClient
+
from pheme.settings import SECRET_KEY
diff --git a/tests/test_report_data_description.py b/tests/test_report_data_description.py
index 2cd5e776..b2750e82 100644
--- a/tests/test_report_data_description.py
+++ b/tests/test_report_data_description.py
@@ -17,8 +17,8 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from rest_framework.test import APIClient
from django.urls import reverse
+from rest_framework.test import APIClient
def test_markdown_description_without_error():
diff --git a/tests/test_report_generation.py b/tests/test_report_generation.py
index 2402b5b1..b370c675 100644
--- a/tests/test_report_generation.py
+++ b/tests/test_report_generation.py
@@ -17,8 +17,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see .
-from unittest.mock import patch
from typing import List, Optional
+from unittest.mock import patch
+
import pytest
from django.core.cache import cache
from django.urls import reverse
@@ -27,7 +28,6 @@
from pheme.datalink import as_datalink
from pheme.settings import SECRET_KEY
from pheme.transformation.scanreport import renderer
-
from tests.generate_test_data import gen_report