Skip to content

Commit

Permalink
Merge pull request #1032 from afuetterer/1005-typos
Browse files Browse the repository at this point in the history
Add `typos` to pre-commit config
  • Loading branch information
afuetterer authored Jul 3, 2024
2 parents f21301b + ae65742 commit fddd019
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!--- * My code follows the code style of this project --->
<!--- * I added tests to cover my changes --->
<!--- * If needed, I updated the documentation --->
<!--- * If needed, I added tranlations if they are needed --->
<!--- * If needed, I added translations if they are needed --->
<!--- * If needed, I added migration files and checked for potential conflicts --->

<!--- This project only accepts pull requests related to open issues. --->
Expand All @@ -18,7 +18,7 @@
## Description
<!--- Describe your changes in detail --->

<!--- Please link to a releated issue here --->
<!--- Please link to a related issue here --->
Related issue: #ISSUE_NUMBER

## Motivation and Context
Expand Down
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,17 @@ repos:
- [email protected]
- [email protected]
- [email protected]
- 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
)$
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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)^.*<!-- spellchecker:disable-line -->$", # for .html files
]
2 changes: 1 addition & 1 deletion rdmo/core/templates/core/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<div class="header-image header-image-2">
<img src="{% static 'core/img/header/collection.jpg' %}"></img>
<p class="attribution">
<a href="https://www.flickr.com/photos/bulle_de/9221247815">Nasssammlung (Christopher Bulle)</a> / <a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0</a>
<a href="https://www.flickr.com/photos/bulle_de/9221247815">Nasssammlung (Christopher Bulle)</a> / <a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0</a> <!-- spellchecker:disable-line -->
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion rdmo/management/assets/js/actions/configActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
Expand Down
6 changes: 3 additions & 3 deletions rdmo/management/assets/js/components/nested/NestedCatalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion rdmo/management/assets/js/components/nested/NestedPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions rdmo/management/assets/js/components/nested/NestedSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions rdmo/management/tests/test_merge_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion rdmo/management/viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion rdmo/projects/tests/test_view_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion rdmo/projects/tests/test_viewset_project_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit fddd019

Please sign in to comment.