Add spellchecking for camelCase, PascalCase, and kebab-case

This commit is contained in:
Julian Stirling 2026-02-22 11:02:59 +00:00
parent 3f54084d14
commit 66b4a06e87
9 changed files with 40 additions and 8 deletions

29
.codespellrc2 Normal file
View file

@ -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\']+

View file

@ -76,7 +76,10 @@ spelling:
# in .rules_common overwrites any rules defined in .python # in .rules_common overwrites any rules defined in .python
- .rules_common - .rules_common
script: script:
# Run with our standard regex, best for normal text and snake-case
- codespell . - 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 # Python static analysis and formatting with ruff
# Only runs when a .py file is edited # Only runs when a .py file is edited

View file

@ -40,7 +40,7 @@ class BackgroundDetectAlgorithm(lt.Thing):
"""Initialise and create the lock.""" """Initialise and create the lock."""
if self.display_name == "Base Detector": if self.display_name == "Base Detector":
raise NotImplementedError( raise NotImplementedError(
"Do not try to use the BackgroungDetectAlgorithm directly. " "Do not try to use the BackgroundDetectAlgorithm directly. "
" Use a subclass" " Use a subclass"
) )
super().__init__(thing_server_interface) super().__init__(thing_server_interface)

View file

@ -24,19 +24,19 @@ from openflexure_microscope_server.ui import PropertyControl
def test_partial_base_classes(): def test_partial_base_classes():
"""Create a partial class and check it raises the correct errors.""" """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.""" """Some minimal settings for a workflow that doesn't work."""
foo: str = "bar" foo: str = "bar"
class BadWorkflow(ScanWorkflow[MinimalSetings]): class BadWorkflow(ScanWorkflow[MinimalSettings]):
"""Can initialise. Other properties and methods error.""" """Can initialise. Other properties and methods error."""
display_name: str = lt.property(default="Bad Workflow", readonly=True) display_name: str = lt.property(default="Bad Workflow", readonly=True)
bad_workflow = create_thing_without_server(BadWorkflow) bad_workflow = create_thing_without_server(BadWorkflow)
settings = MinimalSetings() settings = MinimalSettings()
with pytest.raises(NotImplementedError): with pytest.raises(NotImplementedError):
bad_workflow.check_before_start(settings) bad_workflow.check_before_start(settings)

View file

@ -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 # The error was raised so we know our custom function was run, check that
# handle_exit wasn't. # handle_exit wasn't.
# Note: that the non-mocked shutdown function is entirely wrapped in a # 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 assert original_mock_handle_exit.call_count == 0

View file

@ -340,7 +340,7 @@ export default {
newValue = Math.min(newValue, this.maximum); 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) { if (multipleOf) {
newValue = Math.round(newValue / multipleOf) * multipleOf; newValue = Math.round(newValue / multipleOf) * multipleOf;
} }

View file

@ -6,8 +6,8 @@
</template> </template>
<script> <script>
import appSettings from "./displaySetttingsComponents/appSettings.vue"; import appSettings from "./displaySettingsComponents/appSettings.vue";
import streamSettings from "./displaySetttingsComponents/streamSettings.vue"; import streamSettings from "./displaySettingsComponents/streamSettings.vue";
// Export main app // Export main app
export default { export default {