Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
include:
# MANDATORY CHECKS USING CURRENT DEVELOPMENT INTERPRETER
- dependencies: >
bandit
libatomic
pylint
python3-dateutil
Expand All @@ -40,6 +39,7 @@ jobs:
python3-justbytes
python3-packaging
python3-psutil
python3-setuptools
python3-wcwidth
task: >
PATH=${PATH}:/github/home/.local/bin PYTHONPATH=./src
Expand Down
12 changes: 0 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
ISORT_MODULES = setup.py bin/stratis src tests

UNITTEST_OPTS = --verbose
#
# Ignore bandit B404 errors. Any import of the subprocess module causes this
# error. We know what we are doing when we import that module and do not
# need to be warned.
BANDIT_SKIP = --skip B404

PYLINT_DISABLE = --disable=fixme

Expand All @@ -15,13 +10,6 @@ lint:
pylint bin/stratis ${PYLINT_DISABLE}
pylint src/stratis_cli --disable=duplicate-code ${PYLINT_DISABLE} --ignore=_introspect.py
pylint tests --disable=duplicate-code ${PYLINT_DISABLE}
bandit setup.py ${BANDIT_SKIP}
bandit bin/stratis ${BANDIT_SKIP}
# Ignore B101 errors. We do not distribute optimized code, i.e., .pyo
# files in Fedora, so we do not need to have concerns that assertions
# are removed by optimization.
bandit --recursive ./src ${BANDIT_SKIP},B101
bandit --recursive ./tests ${BANDIT_SKIP}
pyright

.PHONY: fmt
Expand Down
18 changes: 8 additions & 10 deletions src/stratis_cli/_actions/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# isort: STDLIB
import os
import sys
import xml.etree.ElementTree as ET # nosec B405
import xml.etree.ElementTree as ET

# isort: FIRSTPARTY
from dbus_client_gen import (
Expand Down Expand Up @@ -72,35 +72,33 @@
os.environ.get("STRATIS_DBUS_TIMEOUT", str(DBUS_TIMEOUT_SECONDS * 1000))
)

report_spec = ET.fromstring(SPECS[REPORT_INTERFACE]) # nosec B314
report_spec = ET.fromstring(SPECS[REPORT_INTERFACE])
Report = make_class("Report", report_spec, timeout)

filesystem_spec = ET.fromstring(SPECS[FILESYSTEM_INTERFACE]) # nosec B314
filesystem_spec = ET.fromstring(SPECS[FILESYSTEM_INTERFACE])
Filesystem = make_class("Filesystem", filesystem_spec, timeout)
MOFilesystem = managed_object_class("MOFilesystem", filesystem_spec)
filesystems = mo_query_builder(filesystem_spec)

pool_spec = ET.fromstring(SPECS[POOL_INTERFACE]) # nosec B314
pool_spec = ET.fromstring(SPECS[POOL_INTERFACE])
Pool = make_class("Pool", pool_spec, timeout)
MOPool = managed_object_class("MOPool", pool_spec)
pools = mo_query_builder(pool_spec)

blockdev_spec = ET.fromstring(SPECS[BLOCKDEV_INTERFACE]) # nosec B314
blockdev_spec = ET.fromstring(SPECS[BLOCKDEV_INTERFACE])
MODev = managed_object_class("MODev", blockdev_spec)
devs = mo_query_builder(blockdev_spec)

Manager = make_class(
"Manager", ET.fromstring(SPECS[MANAGER_INTERFACE]), timeout # nosec B314
)
Manager = make_class("Manager", ET.fromstring(SPECS[MANAGER_INTERFACE]), timeout)

ObjectManager = make_class(
"ObjectManager",
ET.fromstring(SPECS["org.freedesktop.DBus.ObjectManager"]), # nosec B314
ET.fromstring(SPECS["org.freedesktop.DBus.ObjectManager"]),
timeout,
)

Manager0 = make_class(
"Manager0", ET.fromstring(SPECS[MANAGER_0_INTERFACE]), timeout # nosec B314
"Manager0", ET.fromstring(SPECS[MANAGER_0_INTERFACE]), timeout
)

# Do not expect to get coverage on Generation errors.
Expand Down
2 changes: 1 addition & 1 deletion src/stratis_cli/_actions/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def get_pass(prompt: str) -> str:
"Warning: this device is not a TTY so the password may be echoed",
file=sys.stderr,
)
except Exception: # nosec pylint: disable=broad-exception-caught
except Exception: # pylint: disable=broad-exception-caught
pass

password = None
Expand Down
7 changes: 3 additions & 4 deletions tests/_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@ def device_name_list(min_devices=0, max_devices=10, unique=False):
def the_func():
def random_string():
return "".join(
random.choice(string.ascii_uppercase + string.digits) # nosec B311
for _ in range(4)
random.choice(string.ascii_uppercase + string.digits) for _ in range(4)
)

return [
f"/dev/{random_string()}"
for _ in range(random.randrange(min_devices, max_devices + 1)) # nosec B311
for _ in range(random.randrange(min_devices, max_devices + 1))
]

if unique:
Expand Down Expand Up @@ -117,7 +116,7 @@ def setup(self):
"STRATISD environment variable must be set to absolute path of stratisd executable"
) from err
self._stratisd = ( # pylint: disable=attribute-defined-outside-init
subprocess.Popen( # nosec 119
subprocess.Popen(
[os.path.join(stratisd_var), "--sim"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/logical/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"""
# isort: STDLIB
from unittest.mock import patch
from xml.etree import ElementTree # nosect B405
from xml.etree import ElementTree

# isort: FIRSTPARTY
from dbus_client_gen import DbusClientMissingPropertyError, DbusClientUniqueResultError
Expand Down Expand Up @@ -264,7 +264,7 @@ def test_dropping_properties(self):
)

filesystem_spec = SPECS[_actions._constants.FILESYSTEM_INTERFACE]
spec = ElementTree.fromstring(filesystem_spec) # nosec B314
spec = ElementTree.fromstring(filesystem_spec)

for property_name in [
prop.attrib["name"]
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/physical/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# isort: STDLIB
from unittest.mock import patch
from xml.etree import ElementTree # nosec B405
from xml.etree import ElementTree

# isort: FIRSTPARTY
from dbus_client_gen import DbusClientMissingPropertyError, DbusClientUniqueResultError
Expand Down Expand Up @@ -133,7 +133,7 @@ def test_dropping_properties(self):
)

blockdev_spec = SPECS[_actions._constants.BLOCKDEV_INTERFACE]
spec = ElementTree.fromstring(blockdev_spec) # nosec B314
spec = ElementTree.fromstring(blockdev_spec)

for property_name in [
prop.attrib["name"]
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/pool/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# isort: STDLIB
from unittest.mock import patch
from uuid import uuid4
from xml.etree import ElementTree # nosect B405
from xml.etree import ElementTree

# isort: FIRSTPARTY
from dbus_client_gen import DbusClientMissingPropertyError, DbusClientUniqueResultError
Expand Down Expand Up @@ -356,7 +356,7 @@ def test_dropping_properties(self):
)

pool_spec = SPECS[_actions._constants.POOL_INTERFACE]
spec = ElementTree.fromstring(pool_spec) # nosec B314
spec = ElementTree.fromstring(pool_spec)

for property_name in [
prop.attrib["name"] for prop in spec.findall("./property")
Expand Down Expand Up @@ -420,7 +420,7 @@ def test_dropping_properties(self):
)

pool_spec = SPECS[_actions._constants.POOL_INTERFACE]
spec = ElementTree.fromstring(pool_spec) # nosec B314
spec = ElementTree.fromstring(pool_spec)

for property_name in [
prop.attrib["name"] for prop in spec.findall("./property")
Expand Down
Loading