-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 codespell to validate spelling mistakes in code. #4817
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan 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 |
@@ -49,11 +49,11 @@ func pruneContainersCmd(c *cliconfig.PruneContainersValues) error { | |||
reader := bufio.NewReader(os.Stdin) | |||
fmt.Printf(`WARNING! This will remove all stopped containers. | |||
Are you sure you want to continue? [y/N] `) | |||
ans, err := reader.ReadString('\n') | |||
answer, err := reader.ReadString('\n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like this. Can we restrict to comments only? I don't want a spell-checker telling me what my variable names can and cannot be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, and we can tell the codespeller to ignore certain names, in this case I actually liked the change, since I was not crazy about ans.
Makefile
Outdated
@@ -530,7 +534,7 @@ validate.completions: completions/bash/podman | |||
. completions/bash/podman | |||
if [ -x /bin/zsh ]; then /bin/zsh completions/zsh/_podman; fi | |||
|
|||
validate: gofmt .gitvalidation validate.completions golangci-lint man-page-check | |||
validate: gofmt .gitvalidation validate.completions golangci-lint man-page-check codespell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just concerned about codespell being a bit overzealous and keeping the build from happening. Will it just ping a warning or stop the submit from going forward?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have this on by default, and see if it causes issues, once I get it into a good state. I think this would help us keep this clean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Off the bat, this will run first from the gate task here. Adding things to the container image is easy, see contrib/gate/Dockerfile
. Do that in a separate PR, and once merged, quay will automatically build the image (can be confirmed by logging in and checking it on quay). Then, re-running the jobs here will start using the new image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have disabled it by default for now, so we can get this PR merged, and then we can figure out how to get the CI system to gate on it in a future PR.
libpod/container_internal_linux.go
Outdated
@@ -1365,7 +1365,7 @@ func (c *Container) getHosts() string { | |||
} | |||
|
|||
// generatePasswd generates a container specific passwd file, | |||
// iff g.config.User is a number | |||
// if g.config.User is a number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely wrong - iff is accepted terminology
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, codespell is too strict in some cases. golangci-lint does spellchecks already but less strict. Maybe we can run it periodically but not make it part of the CI?
pkg/spec/storage.go
Outdated
@@ -789,7 +789,7 @@ func (config *CreateConfig) getTmpfsMounts() (map[string]spec.Mount, error) { | |||
return m, nil | |||
} | |||
|
|||
// AddContainerInitBinary adds the init binary specified by path iff the | |||
// AddContainerInitBinary adds the init binary specified by path if the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, iff is valid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I will revert and make iff valid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
if err != nil { | ||
return errors.Wrapf(err, "error reading input") | ||
} | ||
if strings.ToLower(ans)[0] != 'y' { | ||
if strings.ToLower(answer)[0] != 'y' { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This right here is an example of a change that I don't think should keep a build from completing. 'answer' is better for sure, but not a stopper in my book.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is better.
@@ -19,7 +19,7 @@ | |||
%endif | |||
|
|||
# %if ! 0% {?gobuild:1} | |||
%define gobuild(o:) go build -tags="$BUILDTAGS" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**}; | |||
%define gobuild(o:) go build -tags="$BUILDTAGS" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|of -An -tx1|tr -d ' \\n')" -a -v -x %{?**}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a valid change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, I thought I reverted, this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, looks like it got merged.
@@ -52,7 +52,7 @@ To view a container's logs: | |||
``` | |||
podman logs -t b3f2436bdb978c1d33b1387afb5d7ba7e3243ed2ce908db431ac0069da86cb45 | |||
|
|||
2017/08/07 10:16:21 Seeked /var/log/crio/pods/eb296bd56fab164d4d3cc46e5776b54414af3bf543d138746b25832c816b933b/c49f49788da14f776b7aa93fb97a2a71f9912f4e5a3e30397fca7dfe0ee0367b.log - &{Offset:0 Whence:0} | |||
2017/08/07 10:16:21 Sought /var/log/crio/pods/eb296bd56fab164d4d3cc46e5776b54414af3bf543d138746b25832c816b933b/c49f49788da14f776b7aa93fb97a2a71f9912f4e5a3e30397fca7dfe0ee0367b.log - &{Offset:0 Whence:0} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the log message is generated by: https://github.com/hpcloud/tail/blob/master/tail.go#L244
Should we replace it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope should be reverted.
@@ -52,7 +52,7 @@ To view a container's logs: | |||
``` | |||
podman logs -t b3f2436bdb978c1d33b1387afb5d7ba7e3243ed2ce908db431ac0069da86cb45 | |||
|
|||
2017/08/07 10:16:21 Seeked /var/log/crio/pods/eb296bd56fab164d4d3cc46e5776b54414af3bf543d138746b25832c816b933b/c49f49788da14f776b7aa93fb97a2a71f9912f4e5a3e30397fca7dfe0ee0367b.log - &{Offset:0 Whence:0} | |||
2017/08/07 10:16:21 Sought /var/log/crio/pods/eb296bd56fab164d4d3cc46e5776b54414af3bf543d138746b25832c816b933b/c49f49788da14f776b7aa93fb97a2a71f9912f4e5a3e30397fca7dfe0ee0367b.log - &{Offset:0 Whence:0} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably should not change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope these should be eliminated
@cevich Do I need to rebuild AMI to get codespell installed? |
Possibly, depends on how it's being called. Installing at runtime is possible if you can find all the places it's required, but will slow down testing for everyone and reduce automation reliability slightly. Let me take a peek at what you have here, then I can make better suggestions... |
...https://github.com/containers/libpod/pull/4817/files#r364406947 I don't recall if we run 'make validate' from anywhere else (or it gets called by a dependency). Getting past the gate job should be easy, then we'll know if it breaks elsewhere. If so, I can help deal with that. |
Fix all errors found by codespell Signed-off-by: Daniel J Walsh <[email protected]>
@TomSweeneyRedHat @mheon @vrothberg Since codespell is no longer blocking can we get his merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
FWIW, I too like the ans to answer variable name change, I just didn't want changes like that holding up a PR in test.
/lgtm |
Fix all errors found by codespell
Signed-off-by: Daniel J Walsh [email protected]