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 makefile targets to install codespell and verify using codespell #3630

Merged
merged 1 commit into from
Jul 17, 2023

Conversation

nawazkh
Copy link
Member

@nawazkh nawazkh commented Jun 15, 2023

What type of PR is this?
/kind cleanup

What this PR does / why we need it:

  • Adds two makefile targets
    • make codespell installs codespell binary in the hack/tools/bin/codespell/ dir
    • make verify-codespell runs $(CODESPELL) $(ROOT_DIR) --ignore-words=$(ROOT_DIR)/.codespellignore --skip="*.git,*_artifacts,*.sum,$(ROOT_DIR)/hack" at the root of the codebase.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):

  • make verify should help users in correcting codespell errors before raising a PR.

Special notes for your reviewer:

  • You may notice that codespell gets installed in hack/tools/bin/codespell directory. That is because installing codespell brings along other dependencies. I tried using pip --no-deps install .. codespell but could not get rid of other dependencies you see in the picture below.
    Screenshot 2023-06-21 at 2 59 20 PM
  • cherry-pick candidate

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 15, 2023
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 15, 2023
@codecov
Copy link

codecov bot commented Jun 15, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.08 ⚠️

Comparison is base (dd692a8) 54.05% compared to head (8b5d353) 53.98%.

❗ Current head 8b5d353 differs from pull request most recent head 782f15d. Consider uploading reports for the commit 782f15d to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3630      +/-   ##
==========================================
- Coverage   54.05%   53.98%   -0.08%     
==========================================
  Files         186      185       -1     
  Lines       18833    18700     -133     
==========================================
- Hits        10181    10096      -85     
+ Misses       8105     8061      -44     
+ Partials      547      543       -4     

see 15 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@nawazkh

This comment was marked as outdated.

@nawazkh nawazkh force-pushed the fix_codespell_err branch from 6629184 to 2340280 Compare June 21, 2023 21:58
Comment on lines +859 to +869
mv $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR)/bin/$(CODESPELL_BIN) $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR); \
rm -r $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR)/bin; \
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to move codespell from $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR)/bin/$(CODESPELL_BIN) to $(TOOLS_BIN_DIR)/$(CODESPELL_DIST_DIR) to avoid running into ModuleNotFoundError: No module named 'codespell_lib' errors.

@nawazkh
Copy link
Member Author

nawazkh commented Jun 21, 2023

/cc @mboersma

@k8s-ci-robot k8s-ci-robot requested a review from mboersma June 21, 2023 22:06
@nawazkh
Copy link
Member Author

nawazkh commented Jun 22, 2023

/retest

@nawazkh
Copy link
Member Author

nawazkh commented Jun 26, 2023

/test pull-cluster-api-provider-azure-e2e-aks

@mboersma
Copy link
Contributor

I think this makes sense, because it's not a good experience to have your PR blocked by a linter that you can't run locally first.

It looks good to me overall. I'll try it out.

@jackfrancis
Copy link
Contributor

If we ship this change we'll want to ship it simultaneously with a removal of the github action, otherwise we're running it twice on each PR (see the pull-cluster-api-provider-azure-verify job that ran as part of this PR, for example).

I assume the reason we've been doing the github action up until now is because no one wanted to do the chop wood / carry water work (until @nawazkh now, I mean!) of integrating this into our local CI interfaces?

@nawazkh
Copy link
Member Author

nawazkh commented Jun 29, 2023

If we ship this change we'll want to ship it simultaneously with a removal of the github action, otherwise we're running it twice on each PR (see the pull-cluster-api-provider-azure-verify job that ran as part of this PR, for example).

I think that's a fair ask, thanks for pointing me to it.
I am in favor of removing the GitHub action, because the PR's make verify-codespell achieves the same as done in the Github action. In addition to that, pull-cluster-api-provider-azure-verify is most likely to block a codespell error than a GitHub action.

@nawazkh nawazkh force-pushed the fix_codespell_err branch from 2340280 to 8b5d353 Compare June 30, 2023 00:48
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 30, 2023
@nawazkh nawazkh force-pushed the fix_codespell_err branch from 8b5d353 to 4255030 Compare June 30, 2023 00:54
@nawazkh
Copy link
Member Author

nawazkh commented Jun 30, 2023

Commit 8b5d353 removes the codespell GitHub action.

@nawazkh nawazkh force-pushed the fix_codespell_err branch from 4255030 to 21def33 Compare July 7, 2023 17:29
@nawazkh
Copy link
Member Author

nawazkh commented Jul 7, 2023

/cc @CecileRobertMichon

Copy link
Contributor

@CecileRobertMichon CecileRobertMichon left a comment

Choose a reason for hiding this comment

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

Tried this locally and it worked great, thanks @nawazkh! One small comment about adding pip to developer docs

@nawazkh nawazkh force-pushed the fix_codespell_err branch from 21def33 to 6681a94 Compare July 7, 2023 19:43
Makefile Outdated Show resolved Hide resolved
@nawazkh nawazkh force-pushed the fix_codespell_err branch from 6681a94 to a6cc9f1 Compare July 7, 2023 20:21
Copy link
Contributor

@CecileRobertMichon CecileRobertMichon left a comment

Choose a reason for hiding this comment

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

/lgtm
/assign @mboersma

I really like that we're no longer using codespell @ head with this change so we won't be broken by codespell updates like we have in the past

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 7, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 03803808eeed16afc928dec612cdf912d8c7ae16

@CecileRobertMichon
Copy link
Contributor

@nawazkh any idea why the broken lints github action is failing?

@nawazkh
Copy link
Member Author

nawazkh commented Jul 7, 2023

@nawazkh any idea why the broken lints github action is failing?

Looks like it is pointing to some broken links. I have seen such linter links fix themselves up, but I am not sure if I should update them this time.


FILE: ./docs/book/src/topics/ssh-access.md
[✖] https://azure.microsoft.com/en-us/services/azure-bastion/

3 links checked.

ERROR: 1 dead links found!
[✖] https://azure.microsoft.com/en-us/services/azure-bastion/ → Status: 0

FILE: ./docs/book/src/topics/custom-dns.md

1 links checked.

FILE: ./docs/book/src/topics/getting-started.md
[✖] https://azure.microsoft.com/en-us/

9 links checked.

ERROR: 1 dead links found!
[✖] https://azure.microsoft.com/en-us/ → Status: 0

@nawazkh nawazkh force-pushed the fix_codespell_err branch from a6cc9f1 to f8fb641 Compare July 7, 2023 22:49
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 7, 2023
- adds target to install codespell v2.2.5 at hack/tools/bin/codespell
- adds a target to verify codebase with installed codespell bin
- remove codespell github action
@nawazkh nawazkh force-pushed the fix_codespell_err branch from f8fb641 to 782f15d Compare July 13, 2023 22:43
@nawazkh
Copy link
Member Author

nawazkh commented Jul 13, 2023

Ready for review! :)

@nawazkh
Copy link
Member Author

nawazkh commented Jul 14, 2023

/retest

Copy link
Contributor

@mboersma mboersma left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Tested locally, make verify-codespell seems to work as advertised. Thanks @nawazkh!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 17, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 3a180a9160aea7ea00ae18910952168899530c34

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mboersma

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 17, 2023
@k8s-ci-robot k8s-ci-robot merged commit b7a0d41 into kubernetes-sigs:main Jul 17, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.11 milestone Jul 17, 2023
@nawazkh nawazkh deleted the fix_codespell_err branch August 31, 2023 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants