Skip to content

Commit

Permalink
Ruff: Solve F821
Browse files Browse the repository at this point in the history
  • Loading branch information
kiblik committed Jul 4, 2024
1 parent a309c71 commit 1f0c35a
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 5 deletions.
2 changes: 0 additions & 2 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ ignore =
E128
# Line break occurred before a binary operator (conflicting with black)
W503
# undefined file name excpetion
F821

# We should not touch migrations that are already used, but check new migrations
per-file-ignores =
Expand Down
1 change: 1 addition & 0 deletions dojo/management/commands/jira_async_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.utils import timezone
from jira.exceptions import JIRAError

import dojo.jira_link.helper as jira_helper
from dojo.models import Dojo_User, Finding, Notes, User

"""
Expand Down
7 changes: 7 additions & 0 deletions dojo/management/commands/rename_mend_findings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import logging
import re

from django.core.management.base import BaseCommand
from pytz import timezone

from dojo.celery import app
from dojo.models import Finding, Test_Type
from dojo.utils import get_system_setting

logger = logging.getLogger(__name__)

locale = timezone(get_system_setting('time_zone'))

Expand Down
7 changes: 6 additions & 1 deletion dojo/management/commands/test_celery_decorator.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@

import logging
from functools import wraps

from django.core.management.base import BaseCommand

# from dojo.utils import get_system_setting, do_dedupe_finding, dojo_async_task
from dojo.celery import app

# from dojo.utils import get_system_setting, do_dedupe_finding, dojo_async_task
from dojo.decorators import dojo_async_task, dojo_model_from_id, dojo_model_to_id
from dojo.models import Finding, Notes
from dojo.utils import test_valentijn

logger = logging.getLogger(__name__)


class Command(BaseCommand):
help = "Command to do some tests with celery and decorators. Just committing it so 'we never forget'"
Expand Down
2 changes: 2 additions & 0 deletions dojo/tools/qualys_webapp/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import xml.etree.ElementTree
from datetime import datetime

from urlparse import urlparse

from dojo.models import Endpoint, Finding

try:
Expand Down
3 changes: 2 additions & 1 deletion tests/zap.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import collections
import re
import socket
import sys
import time
from urllib.parse import urlparse

Expand Down Expand Up @@ -53,7 +54,7 @@ class Main:
loginUrl = "http://os.environ['DD_BASE_URL']/login"
# loginUrlregex = "\Q" + loginUrl + "\E.*"
# The above line is flake8 violation as \Q and \E are not supported by python
loginURLregex = re.escape(loginURL)
loginURLregex = re.escape(loginUrl)
result = zap.context.exclude_from_context(contextname, ".*logout.*", apikey)
result = zap.context.exclude_from_context(contextname, ".*/static/.*", apikey)

Expand Down
1 change: 1 addition & 0 deletions unittests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def test_file_existence(self):
f = os.path.join(basedir, 'dojo', 'tools', parser_dir.name, file.name)
read_true = False
with open(f) as f:
i = 0
for line in f.readlines():
if read_true is True:
if ('"utf-8"' in str(line) or "'utf-8'" in str(line) or '"utf-8-sig"' in str(line) or "'utf-8-sig'" in str(line)) and i <= 4:
Expand Down
2 changes: 1 addition & 1 deletion unittests/tools/test_api_sonarqube_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Tool_Type,
)
from dojo.tools.api_sonarqube.parser import ApiSonarQubeParser
from unittests.dojo_test_case import DojoTestCase
from unittests.dojo_test_case import DojoTestCase, get_unit_tests_path


def dummy_product(self, *args, **kwargs):
Expand Down

0 comments on commit 1f0c35a

Please sign in to comment.