diff --git a/.codespellrc2 b/.codespellrc2 new file mode 100644 index 00000000..b4de4caf --- /dev/null +++ b/.codespellrc2 @@ -0,0 +1,29 @@ +[codespell] +# A seperate RC file for detecting camelCase, PascalCase, and kebab-case errors +# A little more prone to fals positives than our standard regex, aslo fails to detect +# hyphenated words in the dictonary. + +# Same as the main RC-file except for also excludes CHANGELOG as this is well covered +# by the normal RC file, and we get false positives from git hashes. +skip = node_modules, + *-lock.json, + *.git, + *.pyc, + __pycache__, + ./build, + ./dist, + ./apidocs, + ./openflexure, + ./htmlcov, + ./src/openflexure_microscope_server/static, + .venv, + *.egg-info, + report.xml, + CHANGELOG.md + +# Ignores split by | +# Ignore hexadecimal numbers preceded by # +# Ignore FoV +ignore-regex = #[0-9A-Fa-f]{3,8}\b|\bFoV\b + +regex = [A-Z]?[a-z\']+ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3a136e37..8b9efdd1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -76,7 +76,10 @@ spelling: # in .rules_common overwrites any rules defined in .python - .rules_common script: + # Run with our standard regex, best for normal text and snake-case - codespell . + # Run again with a second regex that finds issues in camelCase, PascalCasem and kebab-case + - codespell --config .codespellrc2 . # Python static analysis and formatting with ruff # Only runs when a .py file is edited diff --git a/src/openflexure_microscope_server/things/background_detect.py b/src/openflexure_microscope_server/things/background_detect.py index 3627ca18..e00efd55 100644 --- a/src/openflexure_microscope_server/things/background_detect.py +++ b/src/openflexure_microscope_server/things/background_detect.py @@ -40,7 +40,7 @@ class BackgroundDetectAlgorithm(lt.Thing): """Initialise and create the lock.""" if self.display_name == "Base Detector": raise NotImplementedError( - "Do not try to use the BackgroungDetectAlgorithm directly. " + "Do not try to use the BackgroundDetectAlgorithm directly. " " Use a subclass" ) super().__init__(thing_server_interface) diff --git a/tests/unit_tests/test_scan_workflows.py b/tests/unit_tests/test_scan_workflows.py index b408db06..38ca6d61 100644 --- a/tests/unit_tests/test_scan_workflows.py +++ b/tests/unit_tests/test_scan_workflows.py @@ -24,19 +24,19 @@ from openflexure_microscope_server.ui import PropertyControl def test_partial_base_classes(): """Create a partial class and check it raises the correct errors.""" - class MinimalSetings(BaseModel): + class MinimalSettings(BaseModel): """Some minimal settings for a workflow that doesn't work.""" foo: str = "bar" - class BadWorkflow(ScanWorkflow[MinimalSetings]): + class BadWorkflow(ScanWorkflow[MinimalSettings]): """Can initialise. Other properties and methods error.""" display_name: str = lt.property(default="Bad Workflow", readonly=True) bad_workflow = create_thing_without_server(BadWorkflow) - settings = MinimalSetings() + settings = MinimalSettings() with pytest.raises(NotImplementedError): bad_workflow.check_before_start(settings) diff --git a/tests/unit_tests/test_server_config.py b/tests/unit_tests/test_server_config.py index 0fb64182..61a3bb85 100644 --- a/tests/unit_tests/test_server_config.py +++ b/tests/unit_tests/test_server_config.py @@ -49,7 +49,7 @@ def test_monkey_patched_handle_exit(side_effect, mocker): # The error was raised so we know our custom function was run, check that # handle_exit wasn't. # Note: that the non-mocked shutdown function is entirely wrapped in a - # try/except BaseExcpetion, so that handle_exit will always run. + # try/except BaseException, so that handle_exit will always run. assert original_mock_handle_exit.call_count == 0 diff --git a/webapp/src/components/labThingsComponents/inputFromSchema.vue b/webapp/src/components/labThingsComponents/inputFromSchema.vue index 3b726b29..5b251e2d 100644 --- a/webapp/src/components/labThingsComponents/inputFromSchema.vue +++ b/webapp/src/components/labThingsComponents/inputFromSchema.vue @@ -340,7 +340,7 @@ export default { newValue = Math.min(newValue, this.maximum); } - // If mulipleOf is validated on server then enforce it. + // If multipleOf is validated on server then enforce it. if (multipleOf) { newValue = Math.round(newValue / multipleOf) * multipleOf; } diff --git a/webapp/src/components/tabContentComponents/settingsComponents/displaySettings.vue b/webapp/src/components/tabContentComponents/settingsComponents/displaySettings.vue index 4a5476ba..3dd1122b 100644 --- a/webapp/src/components/tabContentComponents/settingsComponents/displaySettings.vue +++ b/webapp/src/components/tabContentComponents/settingsComponents/displaySettings.vue @@ -6,8 +6,8 @@