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

GitHub Action to run codespell #65

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Jan 26, 2025

These GitHub Action tests would only pass AFTER #63 and #64 (or similar) are merged.

Copy link
Owner

@creachadair creachadair left a comment

Choose a reason for hiding this comment

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

I am not enthusiastic about adding these to the CI, since it means local tests will no longer match what the CI does without the user having to install these tools.

The codespell one seems OK I guess, as it's cosmetic, but the linter seems like overkill given how little the nearly-throwaway Python scripts in this repo change.

@cclauss cclauss changed the title GitHub Action to run codespell and ruff GitHub Action to run codespell Jan 26, 2025
@cclauss
Copy link
Contributor Author

cclauss commented Jan 26, 2025

% ruff check --select=ALL --statistics | sort -k2

 2	A001   	[ ] builtin-variable-shadowing
99	ANN001 	[ ] missing-type-function-argument
 1	ANN002 	[ ] missing-type-args
 1	ANN003 	[ ] missing-type-kwargs
82	ANN201 	[ ] missing-return-type-undocumented-public-function
11	ANN204 	[*] missing-return-type-special-method
 5	ARG001 	[ ] unused-function-argument
 1	B007   	[*] unused-loop-control-variable
 1	C400   	[*] unnecessary-generator-list
 1	C901   	[ ] complex-structure
 1	COM812 	[*] missing-trailing-comma
 7	D100   	[ ] undocumented-public-module
 5	D101   	[ ] undocumented-public-class
21	D102   	[ ] undocumented-public-method
54	D103   	[ ] undocumented-public-function
 4	D105   	[ ] undocumented-magic-method
 6	D107   	[ ] undocumented-public-init
 1	D400   	[*] missing-trailing-period
 3	D401   	[ ] non-imperative-mood
 1	D415   	[*] missing-terminal-punctuation
 2	E101   	[ ] mixed-spaces-and-tabs
 2	E401   	[*] multiple-imports-on-one-line
 4	E501   	[ ] line-too-long
 2	E701   	[ ] multiple-statements-on-one-line-colon
 1	EM101  	[*] raw-string-in-exception
 5	EM103  	[*] dot-format-in-exception
 4	ERA001 	[*] commented-out-code
 1	EXE001 	[ ] shebang-not-executable
 8	F401   	[*] unused-import
 2	FBT002 	[ ] boolean-default-value-positional-argument
 1	FLY002 	[*] static-join-to-f-string
 6	I001   	[*] unsorted-imports
 1	PERF401	[ ] manual-list-comprehension
 1	PLR0912	[ ] too-many-branches
 7	PLR1714	[*] repeated-equality-comparison
11	PLR2004	[ ] magic-value-comparison
 1	PLW2901	[ ] redefined-loop-name
 2	PTH110 	[ ] os-path-exists
 1	PTH113 	[ ] os-path-isfile
 4	PTH123 	[ ] builtin-open
45	Q000   	[*] bad-quotes-inline-string
 3	Q001   	[*] bad-quotes-multiline-string
 5	RET505 	[*] superfluous-else-return
 1	RUF005 	[*] collection-literal-concatenation
 1	S101   	[ ] assert
 6	S311   	[ ] suspicious-non-cryptographic-random-usage
 2	S605   	[ ] start-process-with-a-shell
 1	SIM103 	[*] needless-bool
 1	SIM108 	[*] if-else-block-instead-of-if-exp
 5	SIM109 	[*] compare-with-tuple
 1	SIM110 	[*] reimplemented-builtin
 1	SIM114 	[*] if-with-same-arms
 1	SIM115 	[ ] open-file-with-context-handler
14	T201   	[*] print
 1	TRY003 	[ ] raise-vanilla-args
 3	UP004  	[*] useless-object-inheritance
 2	UP008  	[*] super-call-with-parameters
 2	UP010  	[*] unnecessary-future-import
 3	UP015  	[*] redundant-open-modes
 1	UP030  	[*] format-literals
 8	UP031  	[ ] printf-string-formatting
14	UP032  	[*] f-string
[*] fixable with `ruff check --fix`

- uses: actions/checkout@v4
- uses: codespell-project/actions-codespell@v2
with:
ignore_words_list: inout,numer,passt,statics
Copy link
Owner

@creachadair creachadair Jan 26, 2025

Choose a reason for hiding this comment

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

Hm. If we add a false positive in the future, how will someone know this is where to look for the exceptions list?

I'm definitely sympathetic to the desire for this, and it did find some real fixes, but I'm not convinced this is worth its weight as an ongoing dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could store config in pyproject.toml or close this PR.

Copy link
Owner

@creachadair creachadair Jan 27, 2025

Choose a reason for hiding this comment

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

My concern there is: Given that the Python code here isn't really a "primary" artifact of the repo, I think it would be distracting to litter config files for Python-specific tools (or IDEs, or other ancillary things) into the repo. (Settings for a C linter, on the other hand, would probably be fine, since it's a C library 🙂)

Not that I couldn't be convinced otherwise, but I think I'd rather not add those kinds of files on that basis.

Perhaps a more practical solution would be to add a bit to the README. Why don't we leave the codespell bit hooked up as it is, and I can (separately) add a paragraph there.

@cclauss cclauss force-pushed the codespell-and-ruff branch from a78529e to 5f2a1a0 Compare January 26, 2025 21:49
@cclauss cclauss force-pushed the codespell-and-ruff branch from 5f2a1a0 to fbaf9af Compare January 26, 2025 21:51
@cclauss
Copy link
Contributor Author

cclauss commented Jan 26, 2025

pyproject.toml

[tool.codespell]
ignore-words-list = "inout,numer,passt,statics"

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.

2 participants