Skip to content

Commit

Permalink
Fix: Remove errors and warning raised by pylint 2.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernricks committed Mar 22, 2023
1 parent 605fda5 commit 05ba0b5
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 22 deletions.
9 changes: 1 addition & 8 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,6 @@ max-line-length=80
# Maximum number of lines in a module
max-module-lines=1000

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator

# 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
Expand Down Expand Up @@ -472,4 +465,4 @@ valid-metaclass-classmethod-first-arg=mcs

# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception
overgeneral-exceptions=builtins.Exception
9 changes: 1 addition & 8 deletions scripts/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,6 @@ max-line-length=80
# Maximum number of lines in a module
max-module-lines=1000

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator

# 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
Expand Down Expand Up @@ -470,4 +463,4 @@ valid-metaclass-classmethod-first-arg=mcs

# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception
overgeneral-exceptions=builtins.Exception
4 changes: 2 additions & 2 deletions scripts/check-gmp.gmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def is_old_report(self, last_scan_end, params_used):

# Retrieve the scan_end value
self.cursor.execute(
"SELECT scan_end, params_used FROM Report WHERE" " host=?",
"SELECT scan_end, params_used FROM Report WHERE host=?",
(self.host,),
)
db_entry = self.cursor.fetchone()
Expand All @@ -202,7 +202,7 @@ def is_old_report(self, last_scan_end, params_used):
new = parse_date(last_scan_end)

logger.debug(
"Old time (from db): %s\n" "New time (from rp): %s", old, new
"Old time (from db): %s\nNew time (from rp): %s", old, new
)

if new <= old and params_used == db_entry[1]:
Expand Down
4 changes: 2 additions & 2 deletions scripts/monthly-report.gmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def check_args(args: Namespace) -> None:
message = """
This script will display all vulnerabilities from the hosts of the
reports in a given month!
1. <month> -- month of the monthly report
2. <year> -- year of the monthly report
Expand Down Expand Up @@ -97,7 +97,7 @@ def print_result_tables(gmp: Gmp, reports_xml: Element) -> None:

for host in res.xpath("report/report/host"):
hostname = host.xpath(
'detail/name[text()="hostname"]/../' "value/text()"
'detail/name[text()="hostname"]/../value/text()'
)
if len(hostname) > 0:
hostname = str(hostname[0])
Expand Down
2 changes: 1 addition & 1 deletion scripts/send-delta-emails.gmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def execute_send_delta_emails(sc: sched.scheduler, **kwargs: dict) -> None:
continue

if reports[0].xpath(
"report/user_tags/tag/" 'name[text()="delta_alert_sent"]'
'report/user_tags/tag/name[text()="delta_alert_sent"]'
):
print(" Delta report for latest finished report already sent")
continue
Expand Down
2 changes: 1 addition & 1 deletion tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def resolve_raises_error():
@patch("gvmtools.parser.Config")
def test_config_load_raises_error(self, config_mock, path_mock):
def config_load_error():
raise Exception
raise Exception # pylint: disable=broad-exception-raised

config = unittest.mock.MagicMock()
config.load = unittest.mock.MagicMock(side_effect=config_load_error)
Expand Down

0 comments on commit 05ba0b5

Please sign in to comment.