Skip to content

Add codespell to CI. #206

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

Merged
merged 1 commit into from
Oct 27, 2020
Merged

Add codespell to CI. #206

merged 1 commit into from
Oct 27, 2020

Conversation

lossyrob
Copy link
Member

This PR adds running codespell to the scripts/test script, which is run by CI. This will fail PRs that have spelling mistakes. A currently empty ignore file is put into place in case codespell fails on any intentional spellings.

Fixes #200

This PR adds running codespell to the scripts/test script, which is
run by CI. This will fail PRs that have spelling mistakes. A currently
empty ignore file is put into place in case codespell fails on any
intentional spellings.

Fixes #200
@codecov-io
Copy link

codecov-io commented Oct 22, 2020

Codecov Report

Merging #206 into develop will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #206   +/-   ##
========================================
  Coverage    92.32%   92.32%           
========================================
  Files           28       28           
  Lines         3349     3349           
========================================
  Hits          3092     3092           
  Misses         257      257           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1fcfb44...11003a8. Read the comment docs.

@lossyrob lossyrob requested a review from schwehr October 22, 2020 21:28
Copy link
Collaborator

@schwehr schwehr left a comment

Choose a reason for hiding this comment

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

I can't figure out how to comment on an empty file...

For .codespellignore, I think you'll need:

ACI
ALOS
NED
UE

@@ -23,6 +23,16 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
# Code formatting
yapf -dpr pystac tests

# Code spelling
codespell -I .codespellignore -f \
pystac/*.py pystac/**/*.py \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not just do dirs? It looks like you are leaving out the test data. There are only a few things needed for the codespellignore for the test data.

codespell -I .codespellignore -f docs pystac scripts tests *.py *.md

Copy link
Member Author

Choose a reason for hiding this comment

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

Trying to just specify directories was including things like docs/_build/html/_static/jquery.js and .ipynb_checkpoints and __pycache__ files for me, and throwing a lot of warnings about binary files.

Does that command cleanly for you?

Copy link
Collaborator

Choose a reason for hiding this comment

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

codespell on my machine doesn't seem to pay attention to .codespellignore, but if you add --skip _build,__pycache__, that seems to work for me minus the two examples files.

codespell --skip _build,__pycache__ -I .codespellignore -f docs pystac scripts tests *.py *.md
tests/data-files/examples/gee-0.6.2/catalog.json:18: ACI ==> ACPI
tests/data-files/examples/gee-0.6.2/catalog.json:438: ALOS ==> ALSO
tests/data-files/examples/gee-0.6.2/catalog.json:443: ALOS ==> ALSO
tests/data-files/examples/gee-0.6.2/catalog.json:448: ALOS ==> ALSO
tests/data-files/examples/gee-0.6.2/catalog.json:453: ALOS ==> ALSO
tests/data-files/examples/gee-0.6.2/catalog.json:2218: NED ==> NEED
tests/data-files/examples/sentinel-0.6.0/sentinel-2-l1c/9/V/catalog.json:1: UE ==> USE, DUE

Copy link
Member Author

Choose a reason for hiding this comment

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

Skipping the directories mentioned worked for avoiding those files, but it ended up picking up my venv files. Also I'll note that I don't think spell checking the data-files is necessary; misspellings from other folk's STAC is harmless and wont' affect tests. I think approach this as being explicit about what we want to include rather than doing everything but specific excludes will make for a better experience.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Really either way is fine and gets the project better coverage than now. Personally, I'd check the data files too. Errors cause friction in unexpected ways for in different circumstances and tend to propagate via copy paste, but these are unlikely to cause too much trouble.

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense. I think keeping it to code and documentation works for now, and we can expand it if we see we're running into situations where we wish we were spell checking stacs that are brought in.

Can you move your review to Approved if this is resolved?

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.

Integrate codespell into CI process.
3 participants