diff --git a/check_version_sync.py b/check_version_sync.py index 23c13b1b..40a4628e 100755 --- a/check_version_sync.py +++ b/check_version_sync.py @@ -14,7 +14,8 @@ with open(os.path.join("webapp", "package.json"), "r", encoding="utf-8") as json py_ver = pyproject_data["project"]["version"] js_ver = webapp_data["version"] -assert py_ver == js_ver, ( +# Allow an assert here as this is a CI script, not production code. +assert py_ver == js_ver, ( # noqa S101 "The python and javascript version numbers should match.\n" f"Python version: {py_ver}\n" f"Javascript version: {js_ver}\n" diff --git a/pyproject.toml b/pyproject.toml index 9957a3b6..3cef0b2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -126,6 +126,7 @@ select = [ "N", # PEP8 naming "D", # Docstring checks "ERA001", # Commented out code! + "S101",# No asserts! "ANN", ] @@ -139,14 +140,10 @@ ignore = [ ] [tool.ruff.lint.per-file-ignores] -# Tests are currently not fully docstring-ed, we'll ignore this for now. -"tests/*" = [ - "B018", # Complaining about useless attribute access in tests, but we need them to check errors are raised - "ANN", # Tests are not typehinted for fixtures etc -] -"hardware-specific-tests/*" = [ +"{tests,integration-tests,hardware-specific-tests}/**" = [ "B018", # Complaining about useless attribute access in tests, but we need them to check errors are raised "ANN", # Tests are not typehinted for fixtures etc + "S101", # Allow asserts in tests ] [tool.ruff.lint.pydocstyle] diff --git a/src/openflexure_microscope_server/things/camera/picamera_tuning_file_utils.py b/src/openflexure_microscope_server/things/camera/picamera_tuning_file_utils.py index 00e5a0d3..f86753c7 100644 --- a/src/openflexure_microscope_server/things/camera/picamera_tuning_file_utils.py +++ b/src/openflexure_microscope_server/things/camera/picamera_tuning_file_utils.py @@ -38,7 +38,8 @@ def set_static_lst( adaptive tweaking by the algorithm. """ for table in luminance, cr, cb: - assert np.array(table).shape == (12, 16), "Lens shading tables must be 12x16!" + if np.array(table).shape != (12, 16): + raise ValueError("Lens shading tables must be 12x16!") alsc = Picamera2.find_tuning_algo(tuning, "rpi.alsc") alsc["n_iter"] = 0 # disable the adaptive part alsc["luminance_strength"] = 1.0