Add PyLint ruff checks

This commit is contained in:
Julian Stirling 2025-09-18 14:58:00 +01:00
parent 65f172d650
commit 528c6a2b63
4 changed files with 20 additions and 5 deletions

View file

@ -34,7 +34,7 @@ def configure_logging(log_folder: str) -> None:
root_logger = logging.getLogger()
root_logger.setLevel(logging.INFO)
# Explicitly make OFM_LOG_FILE a global so it can be updated based on log settings
global OFM_LOG_FILE
global OFM_LOG_FILE # noqa: PLW0603
OFM_LOG_FILE = os.path.join(log_folder, "openflexure_microscope.log")
# Add OFM_HANDLER first so it can capture the error log if the

View file

@ -706,7 +706,10 @@ class AutofocusThing(lt.Thing):
sharpness=cam.grab_jpeg_size(stream_name="lores"),
)
def check_stack_result(
# Silence too many returns in this situation as refactoring to reduce returns is
# unlikely to improve readability. This function is basically a complex switch
# statement, having an explicit return after each option is clear.
def check_stack_result( # noqa: PLR0911
self, captures: list[CaptureInfo]
) -> tuple[Literal["success", "continue", "restart"], int]:
"""Check if the sharpest image in a list of captures is central enough.

View file

@ -201,9 +201,13 @@ def adjust_shutter_and_gain_from_raw(
return test.level
def adjust_white_balance_from_raw(
# Explicitly allow this to have 8 arguments as the later arguments are keyword only
# We should be able to enforce this without noqa once PyLint moves PLR0917 out of
# preview
def adjust_white_balance_from_raw( # noqa: PLR0913
camera: Picamera2,
sensor_info: SensorInfo,
*,
percentile: float = 99,
luminance: Optional[np.ndarray] = None,
Cr: Optional[np.ndarray] = None,