Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sphinx-lint as pre-commit #432

Merged
merged 20 commits into from
Jan 5, 2024
Merged

add sphinx-lint as pre-commit #432

merged 20 commits into from
Jan 5, 2024

Conversation

eviau-artefactual
Copy link
Contributor

Copy link
Member

@replaceafill replaceafill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eviau-artefactual I ran pre-commit on your branch and got several linting errors:

(venv310) replaceafill@vm1:~/archivematica-docs$ pre-commit run --all-files
Sphinx Lint..............................................................Failed
- hook id: sphinx-lint
- exit code: 1

admin-manual/installation-setup/integrations/atom-setup.rst:42: Line ends with dangling hyphen (dangling-hyphen)
admin-manual/security/security.rst:257: found an unbalanced inline literal markup. (unbalanced-inline-literals-delimiters)
admin-manual/security/security.rst:29: Line ends with dangling hyphen (dangling-hyphen)
dev-manual/api/api-reference-archivematica.rst:61: Line ends with dangling hyphen (dangling-hyphen)
dev-manual/api/api-reference-archivematica.rst:192: Line ends with dangling hyphen (dangling-hyphen)
dev-manual/api/api-reference-archivematica.rst:193: Line ends with dangling hyphen (dangling-hyphen)
dev-manual/api/api-reference-archivematica.rst:203: Line ends with dangling hyphen (dangling-hyphen)
dev-manual/api/api-reference-archivematica.rst:336: Line ends with dangling hyphen (dangling-hyphen)
dev-manual/api/api-reference-storage-service.rst:810: Line ends with dangling hyphen (dangling-hyphen)
getting-started/troubleshooting/faq.rst:36: Line ends with dangling hyphen (dangling-hyphen)
getting-started/troubleshooting/error-handling.rst:272: Line ends with dangling hyphen (dangling-hyphen)
user-manual/access/access.rst:94: trailing whitespace (trailing-whitespace)
user-manual/access/access.rst:129: Line ends with dangling hyphen (dangling-hyphen)
user-manual/administer/dashboard-admin.rst:412: Line ends with dangling hyphen (dangling-hyphen)
user-manual/archival-storage/archival-storage.rst:11: trailing whitespace (trailing-whitespace)
user-manual/archival-storage/archival-storage.rst:60: trailing whitespace (trailing-whitespace)
user-manual/archival-storage/archival-storage.rst:70: trailing whitespace (trailing-whitespace)
user-manual/archival-storage/archival-storage.rst:80: trailing whitespace (trailing-whitespace)
user-manual/archival-storage/archival-storage.rst:104: trailing whitespace (trailing-whitespace)
user-manual/archival-storage/archival-storage.rst:122: trailing whitespace (trailing-whitespace)
user-manual/archival-storage/archival-storage.rst:136: trailing whitespace (trailing-whitespace)
user-manual/archival-storage/archival-storage.rst:179: trailing whitespace (trailing-whitespace)

Do you plan to address those in this pull request?

Also, now that we have this hook do you think we should include it in our CI test workflow? That'd guarantee that new linting problems are not introduced if people don't install or run pre-commit in their environments.

@eviau-artefactual
Copy link
Contributor Author

We might want to make the switch to 'list-table' directives instead of full tables... because of https://github.com/sphinx-contrib/sphinx-lint#known-issues

We could also not use sphinx-lint, or (try to) configure it so it ignores tables.

@eviau-artefactual
Copy link
Contributor Author

Do you plan to address those in this pull request?

Last few commits should have solved everything. I did had to had the list-table directives, let me know if this solution works or not... ? thank you for catching the linting errors !

Also, now that we have this hook do you think we should include it in our CI test workflow? That'd guarantee that new linting problems are not introduced if people don't install or run pre-commit in their environments.

Yes, I think this would be a good idea. Should I open another PR or is it good enough to add these changes to this one?

@replaceafill
Copy link
Member

I did had to had the list-table directives, let me know if this solution works or not... ?

That looks fine to me.

Should I open another PR or is it good enough to add these changes to this one?

I'd prefer adding the changes to this one.

@eviau-artefactual
Copy link
Contributor Author

I added the pre-commit as an Action in pre-commit.yml - let me know if that works for you.

This complete this PR I believe - if anything is missing let me know.

Copy link
Member

@replaceafill replaceafill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the pre-commit as an Action in pre-commit.yml - let me know if that works for you.

In most of the Archivematica related repositories we have the lint job in the test.yml workflow:

What do you think of keeping a single workflow with two jobs?

.github/workflows/pre-commit.yml Outdated Show resolved Hide resolved
Comment on lines 12 to 13
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v5

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the change directly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use actions/setup-python@v5?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will make the change.

@eviau-artefactual
Copy link
Contributor Author

Ok, I think I got this to work! Let me know if something else is missing :)

Copy link
Member

@replaceafill replaceafill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.github/workflows/test.yml Outdated Show resolved Hide resolved
@eviau-artefactual eviau-artefactual merged commit 8baced3 into 1.15 Jan 5, 2024
4 checks passed
@eviau-artefactual eviau-artefactual deleted the dev/pre-commit-lint branch February 21, 2024 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem: sphinx-lint returns linting errors in the doc
2 participants