Skip to content

Commit

Permalink
even more ruff fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jstucke committed Feb 28, 2024
1 parent f0b1145 commit 537688f
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ def test_get_color_code(self, analysis_plugin, tag, tag_color):
(['a', 'b', 'c'], 'b', ['d', 'e'], ['x'], ['x']),
],
)
def test_get_tags_from_library_list( # noqa: PLR0913
self, analysis_plugin, indicators, behaviour_class, libraries, tags, expected
):
def test_get_tags_from_library_list(self, analysis_plugin, indicators, behaviour_class, libraries, tags, expected):
analysis_plugin._get_tags_from_library_list(libraries, behaviour_class, indicators, tags)
assert tags == expected

Expand All @@ -85,7 +83,7 @@ def test_get_tags_from_library_list( # noqa: PLR0913
(['a', 'b'], 'c', ['b'], ['d', 'e'], ['d', 'e', 'c']),
],
)
def test_get_tags_from_function_list( # noqa: PLR0913
def test_get_tags_from_function_list(
self, analysis_plugin, functions, behaviour_class, indicators, tags, expected_result
):
analysis_plugin._get_tags_from_function_list(functions, behaviour_class, indicators, tags)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def _add_protection_info(hardening_result: list[list[str]]) -> list[HardeningChe
for single_result in hardening_result:
config_key = single_result[0]
actual_value = _detach_actual_value_from_result(single_result)
protection_info = PROTECTS_AGAINST[config_key] if config_key in PROTECTS_AGAINST else []
protection_info = PROTECTS_AGAINST.get(config_key, [])
full_result.append(HardeningCheckResult(*single_result, actual_value, protection_info))
return full_result

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class BadRuleError(ValueError):


class Vulnerability:
def __init__(self, rule, description, reliability, score, link, short_name): # noqa: PLR0913
def __init__(self, rule, description, reliability, score, link, short_name):
try:
self.reliability = str(int(reliability))
self.score = score
Expand Down
6 changes: 3 additions & 3 deletions src/storage/db_interface_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def get_latest_comments(self, limit=10):

# --- generic search ---

def generic_search( # noqa: PLR0913
def generic_search(
self,
search_dict: dict,
skip: int = 0,
Expand Down Expand Up @@ -252,7 +252,7 @@ def generate_file_tree_nodes_for_uid_list(
for entry in file_tree_data:
yield from self.generate_file_tree_level(entry.uid, root_uid, parent_uid, whitelist, entry)

def generate_file_tree_level( # noqa: PLR0913
def generate_file_tree_level(
self,
uid: str,
root_uid: str,
Expand Down Expand Up @@ -308,7 +308,7 @@ def _get_included_files_for_uid_list(session, uid_list: list[str]) -> dict[str,

# --- REST ---

def rest_get_firmware_uids( # noqa: PLR0913
def rest_get_firmware_uids(
self, offset: int, limit: int, query: Optional[dict] = None, recursive=False, inverted=False
):
if query is None:
Expand Down
4 changes: 2 additions & 2 deletions src/storage/entry_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def firmware_from_entry(fw_entry: FirmwareEntry, analysis_filter: list[str] | No
return firmware


def file_object_from_entry( # noqa: PLR0913
def file_object_from_entry(
fo_entry: FileObjectEntry,
analysis_filter: list[str] | None = None,
included_files: set[str] | None = None,
Expand All @@ -43,7 +43,7 @@ def _convert_vfp_entries_to_dict(vfp_list: list[VirtualFilePath]) -> dict[str, l
return result


def _populate_fo_data( # noqa: PLR0913
def _populate_fo_data(
fo_entry: FileObjectEntry,
file_object: FileObject,
analysis_filter: list[str] | None = None,
Expand Down
2 changes: 1 addition & 1 deletion src/test/acceptance/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _add_comment(self, test_client):
items_to_analyze=4 * 2 * 2,
)
@pytest.mark.usefixtures('intercom_backend_binding')
def test_misc( # noqa: PLR0913
def test_misc(
self,
test_client,
workload_statistic,
Expand Down
2 changes: 1 addition & 1 deletion src/test/unit/scheduler/test_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def setup_class(cls):
(' 1.0', '1.1', '1.1', '1.0', False), # invalid version string
],
)
def test_analysis_is_already_in_db_and_up_to_date( # noqa: PLR0913
def test_analysis_is_already_in_db_and_up_to_date(
self, plugin_version, plugin_system_version, analysis_plugin_version, analysis_system_version, expected_output
):
plugin = 'foo'
Expand Down
2 changes: 1 addition & 1 deletion src/test/unit/web_interface/test_app_advanced_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class DbMock(CommonDatabaseMock):
@staticmethod
def generic_search( # noqa: PLR0913
def generic_search(
search_dict: dict,
skip: int = 0, # noqa: ARG004
limit: int = 0, # noqa: ARG004
Expand Down
2 changes: 1 addition & 1 deletion src/test/unit/web_interface/test_plugin_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


class PluginRoutesMock(PluginRoutes):
def __init__(self, app, db=None, intercom=None, api=None, status=None): # noqa: PLR0913
def __init__(self, app, db=None, intercom=None, api=None, status=None):
self._app = app
self._api = api
self.db = db
Expand Down
2 changes: 1 addition & 1 deletion src/test/unit/web_interface/test_quick_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class DbMock(CommonDatabaseMock):
@staticmethod
def generic_search( # noqa: PLR0913
def generic_search(
search_dict: dict,
skip: int = 0, # noqa: ARG004
limit: int = 0, # noqa: ARG004
Expand Down

0 comments on commit 537688f

Please sign in to comment.