From 325e667594b6c595cd3a75bcac5c9d7d47e25783 Mon Sep 17 00:00:00 2001 From: Heinz-Alexander Fuetterer Date: Thu, 27 Jun 2024 15:59:00 +0200 Subject: [PATCH 1/2] build: add typos to pre-coomit hooks --- .pre-commit-config.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index de5c983b13..257953a755 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,3 +35,17 @@ repos: - eslint@8.54.0 - eslint-plugin-react@7.33.2 - react@18.2.0 + - repo: https://github.com/crate-ci/typos + rev: v1.22.9 + hooks: + - id: typos + exclude: | + (?x)^( + rdmo/locale/.*| + rdmo/.*_de.html$| + rdmo/.*_es.html$| + rdmo/.*_fr.html$| + rdmo/.*_it.html$| + testing/.*.json| + testing/.*.xml + )$ From ae65742bf220547ef5fb21ec4bf42c965d0635be Mon Sep 17 00:00:00 2001 From: Heinz-Alexander Fuetterer Date: Thu, 27 Jun 2024 16:13:18 +0200 Subject: [PATCH 2/2] chore: apply pre-commit hooks --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/PULL_REQUEST_TEMPLATE.md | 4 ++-- pyproject.toml | 7 +++++++ rdmo/core/templates/core/home.html | 2 +- rdmo/management/assets/js/actions/configActions.js | 2 +- .../assets/js/components/nested/NestedCatalog.js | 6 +++--- rdmo/management/assets/js/components/nested/NestedPage.js | 2 +- .../assets/js/components/nested/NestedQuestionSet.js | 2 +- .../assets/js/components/nested/NestedSection.js | 4 ++-- rdmo/management/tests/test_merge_attributes.py | 4 ++-- rdmo/management/viewsets.py | 2 +- rdmo/projects/tests/test_view_issue.py | 2 +- rdmo/projects/tests/test_viewset_project_progress.py | 2 +- 13 files changed, 24 insertions(+), 17 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 5c051880f6..ba4908c216 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -24,7 +24,7 @@ A clear and concise description of what you expected to happen. ### Context / Kontext -Please state your operating system, the RDMO version, and (if applicable) the browser the error occured in. +Please state your operating system, the RDMO version, and (if applicable) the browser the error occurred in. ### References / Verweise diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 786ba0ca55..81722d962a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,7 +6,7 @@ - + @@ -18,7 +18,7 @@ ## Description - + Related issue: #ISSUE_NUMBER ## Motivation and Context diff --git a/pyproject.toml b/pyproject.toml index 23e974baf2..5c09429b51 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -220,3 +220,10 @@ exclude_lines = [ "raise Exception", "except ImportError:" ] + +[tool.typos] # Ref: https://github.com/crate-ci/typos/blob/master/docs/reference.md +# add "spellchecker:disable-line" to ignore specific lines +default.extend-ignore-re = [ + "(?Rm)^.*(#|//)\\s*spellchecker:disable-line$", # for .py files + "(?Rm)^.*$", # for .html files +] diff --git a/rdmo/core/templates/core/home.html b/rdmo/core/templates/core/home.html index bb95e20caa..dcf6e160e9 100644 --- a/rdmo/core/templates/core/home.html +++ b/rdmo/core/templates/core/home.html @@ -29,7 +29,7 @@ diff --git a/rdmo/management/assets/js/actions/configActions.js b/rdmo/management/assets/js/actions/configActions.js index baf9203e5f..ec2a21fb75 100644 --- a/rdmo/management/assets/js/actions/configActions.js +++ b/rdmo/management/assets/js/actions/configActions.js @@ -47,7 +47,7 @@ export function toggleElements(element) { } } -export function toggleDescandants(element, elementType) { +export function toggleDescendants(element, elementType) { return (dispatch) => { findDescendants(element, elementType).forEach(e => dispatch(toggleElements(e))) } diff --git a/rdmo/management/assets/js/components/nested/NestedCatalog.js b/rdmo/management/assets/js/components/nested/NestedCatalog.js index b57840b9c6..3a82efef8b 100644 --- a/rdmo/management/assets/js/components/nested/NestedCatalog.js +++ b/rdmo/management/assets/js/components/nested/NestedCatalog.js @@ -19,9 +19,9 @@ const NestedCatalog = ({ config, catalog, configActions, elementActions }) => { const updateFilterString = (value) => configActions.updateConfig('filter.catalog.search', value) const updateFilterUriPrefix = (value) => configActions.updateConfig('filter.catalog.uri_prefix', value) - const toggleSections = () => configActions.toggleDescandants(catalog, 'sections') - const togglePages = () => configActions.toggleDescandants(catalog, 'pages') - const toggleQuestionSets = () => configActions.toggleDescandants(catalog, 'questionsets') + const toggleSections = () => configActions.toggleDescendants(catalog, 'sections') + const togglePages = () => configActions.toggleDescendants(catalog, 'pages') + const toggleQuestionSets = () => configActions.toggleDescendants(catalog, 'questionsets') const updateDisplayCatalogURI = (value) => configActions.updateConfig('display.uri.catalogs', value) const updateDisplaySectionsURI = (value) => configActions.updateConfig('display.uri.sections', value) diff --git a/rdmo/management/assets/js/components/nested/NestedPage.js b/rdmo/management/assets/js/components/nested/NestedPage.js index 801ddc4640..08751f25a2 100644 --- a/rdmo/management/assets/js/components/nested/NestedPage.js +++ b/rdmo/management/assets/js/components/nested/NestedPage.js @@ -21,7 +21,7 @@ const NestedPage = ({ config, page, configActions, elementActions }) => { const updateFilterString = (uri) => configActions.updateConfig('filter.page.search', uri) const updateFilterUriPrefix = (uriPrefix) => configActions.updateConfig('filter.page.uri_prefix', uriPrefix) - const toggleQuestionSets = () => configActions.toggleDescandants(page, 'questionsets') + const toggleQuestionSets = () => configActions.toggleDescendants(page, 'questionsets') const updateDisplayPagesURI = (value) => configActions.updateConfig('display.uri.pages', value) const updateDisplayQuestionSetsURI = (value) => configActions.updateConfig('display.uri.questionsets', value) diff --git a/rdmo/management/assets/js/components/nested/NestedQuestionSet.js b/rdmo/management/assets/js/components/nested/NestedQuestionSet.js index 70db94a5e0..debed7a6c6 100644 --- a/rdmo/management/assets/js/components/nested/NestedQuestionSet.js +++ b/rdmo/management/assets/js/components/nested/NestedQuestionSet.js @@ -20,7 +20,7 @@ const NestedQuestionSet = ({ config, questionset, configActions, elementActions const updateFilterString = (uri) => configActions.updateConfig('filter.questionset.search', uri) const updateFilterUriPrefix = (uriPrefix) => configActions.updateConfig('filter.questionset.uri_prefix', uriPrefix) - const toggleQuestionSets = () => configActions.toggleDescandants(questionset, 'questionsets') + const toggleQuestionSets = () => configActions.toggleDescendants(questionset, 'questionsets') const updateDisplayQuestionSetsURI = (value) => configActions.updateConfig('display.uri.questionsets', value) const updateDisplayQuestionsURI = (value) => configActions.updateConfig('display.uri.questions', value) diff --git a/rdmo/management/assets/js/components/nested/NestedSection.js b/rdmo/management/assets/js/components/nested/NestedSection.js index 1552ddd0bc..9fa29b6559 100644 --- a/rdmo/management/assets/js/components/nested/NestedSection.js +++ b/rdmo/management/assets/js/components/nested/NestedSection.js @@ -20,8 +20,8 @@ const NestedCatalog = ({ config, section, configActions, elementActions }) => { const updateFilterString = (uri) => configActions.updateConfig('filter.section.search', uri) const updateFilterUriPrefix = (uriPrefix) => configActions.updateConfig('filter.section.uri_prefix', uriPrefix) - const togglePages = () => configActions.toggleDescandants(section, 'pages') - const toggleQuestionSets = () => configActions.toggleDescandants(section, 'questionsets') + const togglePages = () => configActions.toggleDescendants(section, 'pages') + const toggleQuestionSets = () => configActions.toggleDescendants(section, 'questionsets') const updateDisplaySectionURI = (value) => configActions.updateConfig('display.uri.sections', value) const updateDisplayPagesURI = (value) => configActions.updateConfig('display.uri.pages', value) diff --git a/rdmo/management/tests/test_merge_attributes.py b/rdmo/management/tests/test_merge_attributes.py index 3f3ae483e0..c45a21a925 100644 --- a/rdmo/management/tests/test_merge_attributes.py +++ b/rdmo/management/tests/test_merge_attributes.py @@ -188,7 +188,7 @@ def test_command_merge_attributes(db, settings, create_new_merge_attributes_and_ if delete and not failed: - # assert that the source attribut was deleted + # assert that the source attribute was deleted with pytest.raises(Attribute.DoesNotExist): Attribute.objects.get(id=source_attribute.id) else: @@ -235,7 +235,7 @@ def test_command_merge_attributes_for_views(db, settings, create_new_merge_attri stdout=stdout, stderr=stderr, **command_kwargs) if delete and not failed: - # assert that the source attribut was deleted + # assert that the source attribute was deleted with pytest.raises(Attribute.DoesNotExist): Attribute.objects.get(uri=source_attribute_uri) else: diff --git a/rdmo/management/viewsets.py b/rdmo/management/viewsets.py index 08743a5de9..68624c1362 100644 --- a/rdmo/management/viewsets.py +++ b/rdmo/management/viewsets.py @@ -126,6 +126,6 @@ def toggle_site(self, request, pk=None): obj.sites.remove(current_site) else: obj.sites.add(current_site) - # need to return obj element for ElementSucces reducer? + # need to return obj element for ElementSuccess reducer? serializer = self.serializer_class(obj, context={'request': request}) return Response(serializer.data) diff --git a/rdmo/projects/tests/test_view_issue.py b/rdmo/projects/tests/test_view_issue.py index e80a67b4a2..8780c7114f 100644 --- a/rdmo/projects/tests/test_view_issue.py +++ b/rdmo/projects/tests/test_view_issue.py @@ -179,7 +179,7 @@ def test_issue_send_post_email(db, client, username, password, project_id, issue @pytest.mark.parametrize('username,password', users) @pytest.mark.parametrize('issue_id', issues) @pytest.mark.parametrize('project_id', projects) -def test_issue_send_post_attachements(db, client, files, username, password, project_id, issue_id): +def test_issue_send_post_attachments(db, client, files, username, password, project_id, issue_id): client.login(username=username, password=password) issue = Issue.objects.filter(project_id=project_id, id=issue_id).first() diff --git a/rdmo/projects/tests/test_viewset_project_progress.py b/rdmo/projects/tests/test_viewset_project_progress.py index 8b6af4bd9c..02eaabc6b2 100644 --- a/rdmo/projects/tests/test_viewset_project_progress.py +++ b/rdmo/projects/tests/test_viewset_project_progress.py @@ -118,7 +118,7 @@ def test_progress_post_unchanged(db, client): client.login(username='owner', password='owner') project = Project.objects.get(id=1) - project.progress_count = progress_count = 58 # the progres in the fixture is not up-to-date + project.progress_count = progress_count = 58 # the progress in the fixture is not up-to-date project.progress_total = progress_total = 81 project.save() project.refresh_from_db()