Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

several lint fixes #906

Merged
merged 5 commits into from
Feb 2, 2025
Merged

several lint fixes #906

merged 5 commits into from
Feb 2, 2025

Conversation

cjkrolak
Copy link
Owner

@cjkrolak cjkrolak commented Feb 2, 2025

No description provided.

Copy link

dryrunsecurity bot commented Feb 2, 2025

DryRun Security Summary

The code changes encompass improvements to test suites, documentation, and core functionality across multiple files in the "thermostatsupervisor" application, focusing on enhanced readability, maintainability, and error handling without introducing security vulnerabilities.

Expand for full summary

Summary:

The provided code changes cover a variety of updates across multiple files in the thermostatsupervisor application. The changes primarily focus on improving the test suite, enhancing documentation, and addressing minor issues in the core application functionality.

The changes to the test files, such as test_sht31_integration.py and test_blink_integration.py, aim to improve the readability and maintainability of the integration tests by adding detailed docstrings and enhancing the setup procedures. These changes do not introduce any obvious security vulnerabilities, but it's important to ensure that the tests themselves are designed and executed in a secure manner, considering potential security risks that may arise from interactions with external components.

The updates to the configuration file (conf.py) and the utility functions (utilities.py) are also focused on improving the overall code quality and robustness, without introducing any significant security concerns.

The changes to the core application files, such as sht31.py, mmm.py, and sht31_flask_server.py, primarily address error handling, type annotations, and the parsing of sensor data. These changes aim to improve the reliability and maintainability of the application, but they do not appear to introduce any obvious security vulnerabilities.

However, it's important to note that while these changes do not directly introduce security concerns, the application as a whole should be reviewed for potential security risks, such as input validation, authorization, and secure communication with external components.

Files Changed:

  • tests/unit_test_common.py: Updates to the unit tests for the FunctionalIntegrationTest and SuperviseIntegrationTest classes, improving readability and maintainability.
  • tests/test_blink_integration.py: Improvements to the docstring and setup for the Blink thermostat integration tests.
  • conf.py: Changes to the Sphinx documentation configuration file, including updates to the file header, import statements, and copyright information.
  • tests/test_sht31_integration.py: Enhancements to the docstring and setup for the SHT31 thermostat integration tests.
  • thermostatsupervisor/sht31.py: Improvements to the error handling and retrying logic in the get_metadata function.
  • thermostatsupervisor/utilities.py: A change to the is_valid_file() function to return None when the specified file does not exist.
  • thermostatsupervisor/mmm.py: Updates to the type annotations for the get_metadata and get_latestdata methods.
  • thermostatsupervisor/sht31_flask_server.py: Improvements to the parsing of the wifi signal strength from the iwlist command.

Code Analysis

We ran 9 analyzers against 8 files and 0 analyzers had findings. 9 analyzers had no findings.

View PR in the DryRun Dashboard.

@@ -149,7 +150,7 @@
del retry # not used
return self.get_meta_data_dict(zone)

def get_metadata(self, zone, trait=None, parameter=None) -> (dict, str):
def get_metadata(self, zone, trait=None, parameter=None) -> Union[dict, str]:

Check warning

Code scanning / Prospector (reported by Codacy)

Signature differs from overridden 'get_metadata' method (signature-differs) Warning

Signature differs from overridden 'get_metadata' method (signature-differs)
@@ -18,7 +20,7 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "ThermostatSupervisor"
copyright = "2024, Christopher Krolak"
copyright = "2024, Christopher Krolak" # noqa W0622

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

Constant name "copyright" doesn't conform to UPPER_CASE naming style Warning

Constant name "copyright" doesn't conform to UPPER_CASE naming style
@@ -18,7 +20,7 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "ThermostatSupervisor"
copyright = "2024, Christopher Krolak"
copyright = "2024, Christopher Krolak" # noqa W0622

Check notice

Code scanning / Pylintpython3 (reported by Codacy)

Redefining built-in 'copyright' Note

Redefining built-in 'copyright'
@@ -9,6 +9,7 @@
import traceback
import urllib
from dns.exception import DNSException
from typing import Union

Check warning

Code scanning / Pylintpython3 (reported by Codacy)

standard import "typing.Union" should be placed before third party import "dns.exception.DNSException" Warning

standard import "typing.Union" should be placed before third party import "dns.exception.DNSException"
@@ -149,7 +150,7 @@
del retry # not used
return self.get_meta_data_dict(zone)

def get_metadata(self, zone, trait=None, parameter=None) -> (dict, str):
def get_metadata(self, zone, trait=None, parameter=None) -> Union[dict, str]:

Check notice

Code scanning / Pylintpython3 (reported by Codacy)

Signature differs from overridden 'get_metadata' method Note

Signature differs from overridden 'get_metadata' method
@@ -18,7 +20,7 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "ThermostatSupervisor"
copyright = "2024, Christopher Krolak"
copyright = "2024, Christopher Krolak" # noqa W0622

Check warning

Code scanning / Pylint (reported by Codacy)

Constant name "copyright" doesn't conform to UPPER_CASE naming style Warning

Constant name "copyright" doesn't conform to UPPER_CASE naming style
@@ -18,7 +20,7 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "ThermostatSupervisor"
copyright = "2024, Christopher Krolak"
copyright = "2024, Christopher Krolak" # noqa W0622

Check notice

Code scanning / Pylint (reported by Codacy)

Redefining built-in 'copyright' Note

Redefining built-in 'copyright'
@@ -9,6 +9,7 @@
import traceback
import urllib
from dns.exception import DNSException
from typing import Union

Check warning

Code scanning / Pylint (reported by Codacy)

standard import "from typing import Union" should be placed before "from dns.exception import DNSException" Warning

standard import "from typing import Union" should be placed before "from dns.exception import DNSException"
@@ -149,7 +150,7 @@
del retry # not used
return self.get_meta_data_dict(zone)

def get_metadata(self, zone, trait=None, parameter=None) -> (dict, str):
def get_metadata(self, zone, trait=None, parameter=None) -> Union[dict, str]:

Check notice

Code scanning / Pylint (reported by Codacy)

Signature differs from overridden 'get_metadata' method Note

Signature differs from overridden 'get_metadata' method
@cjkrolak cjkrolak merged commit 0bdb558 into develop Feb 2, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant