Skip to content

Commit 0ecbda2

Browse files
authored
Merge pull request #176 from Integration-Automation/dev
Clear post-merge Sonar hotspot and Codacy findings
2 parents 241b812 + 021d006 commit 0ecbda2

5 files changed

Lines changed: 10 additions & 4 deletions

File tree

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# -- Project information -----------------------------------------------------
1212

1313
project = 'AutoControl'
14-
copyright = '2020 ~ Now, JE-Chen' # noqa: A001 # reason: Sphinx-required name
14+
copyright = '2020 ~ Now, JE-Chen' # noqa: A001 # pylint: disable=redefined-builtin # reason: Sphinx-required name
1515
author = 'JE-Chen'
1616
release = '0.0.179'
1717

je_auto_control/utils/clipboard/clipboard.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def _linux_get() -> str:
143143
if cmd is None:
144144
raise RuntimeError("Install xclip or xsel for Linux clipboard support")
145145
read_cmd = cmd + ["-o"] if cmd[0] == "xclip" else cmd + ["--output"]
146+
# nosemgrep: python.lang.security.audit.dangerous-subprocess-use-audit.dangerous-subprocess-use-audit
146147
result = subprocess.run( # nosec B603 # reason: argv from allowlist (xclip/xsel) discovered via shutil.which
147148
read_cmd, capture_output=True, check=True, timeout=5,
148149
)
@@ -154,6 +155,7 @@ def _linux_set(text: str) -> None:
154155
if cmd is None:
155156
raise RuntimeError("Install xclip or xsel for Linux clipboard support")
156157
write_cmd = cmd + ["-i"] if cmd[0] == "xclip" else cmd + ["--input"]
158+
# nosemgrep: python.lang.security.audit.dangerous-subprocess-use-audit.dangerous-subprocess-use-audit
157159
subprocess.run( # nosec B603 # reason: argv from allowlist (xclip/xsel) discovered via shutil.which
158160
write_cmd, input=text.encode("utf-8"),
159161
check=True, timeout=5,

je_auto_control/utils/rest_api/rest_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class _JSONHandler(BaseHTTPRequestHandler):
2525
server_version = "AutoControlREST/1.0"
2626

2727
# Suppress default stderr access logs — route through the project logger.
28-
def log_message(self, fmt: str, *args: Any) -> None:
28+
def log_message(self, format, *args) -> None: # noqa: A002 # pylint: disable=redefined-builtin # reason: stdlib BaseHTTPRequestHandler override
2929
autocontrol_logger.info("rest-api %s - %s",
30-
self.address_string(), fmt % args)
30+
self.address_string(), format % args)
3131

3232
def do_GET(self) -> None: # noqa: N802 # reason: stdlib API
3333
parsed = urlparse(self.path)

je_auto_control/utils/shell_process/shell_exec.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def exec_shell(self, shell_command: Union[str, List[str]]) -> None:
5151
try:
5252
self.exit_program()
5353
args = _normalize_command(shell_command)
54+
# nosemgrep: python.lang.security.audit.dangerous-subprocess-use-audit.dangerous-subprocess-use-audit
5455
self.process = subprocess.Popen( # nosec B603 # reason: shell=False, argv list validated via _normalize_command
5556
args,
5657
stdout=subprocess.PIPE,

test/unit_test/headless/test_rest_server.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ def rest_server():
1616
server.stop(timeout=1.0)
1717

1818

19+
_TEST_SCHEME = "http" # NOSONAR: S5332 # reason: localhost-only ephemeral test server; TLS is out of scope here
20+
21+
1922
def _request(server, path, method="GET", body=None):
2023
host, port = server.address
21-
url = f"http://{host}:{port}{path}"
24+
url = f"{_TEST_SCHEME}://{host}:{port}{path}"
2225
data = None
2326
headers = {}
2427
if body is not None:

0 commit comments

Comments
 (0)