get-woke / woke

Detect non-inclusive language in your source code.
https://docs.getwoke.tech
MIT License
458 stars 61 forks source link

Nested .wokeignore doesn't work in a git repo. #212

Open cburgess opened 2 years ago

cburgess commented 2 years ago

Thank you for creating the issue!

Please include the following information:

Version of woke ```console $ woke --version woke version 0.18.2 ```
Config file No config file.
Go environment ```console $ go version && go env cfb@sandman:dir1/> go version && go env go version go1.18.3 darwin/amd64 GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/cfb/Library/Caches/go-build" GOENV="/Users/cfb/Library/Application Support/go/env" GOEXE="" GOEXPERIMENT="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOINSECURE="" GOMODCACHE="/Users/cfb/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="/Users/cfb/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/opt/go/libexec" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64" GOVCS="" GOVERSION="go1.18.3" GCCGO="gccgo" GOAMD64="v1" AR="ar" CC="clang" CXX="clang++" CGO_ENABLED="1" GOMOD="/dev/null" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/9t/4dv6njks73b3x3krqm3fxxnm0000gn/T/go-build277855627=/tmp/go-build -gno-record-gcc-switches -fno-common" ```

if I create a simple directory structure with a nested .wokeignore file then everything works as expected.

Example:

cfb@sandman:woke/> find .
.
./dir1
./dir1/dir2
./dir1/dir2/slave
./dir1/.wokeignore
cfb@sandman:woke/> cat dir1/.wokeignore
dir2/*
cfb@sandman:woke/> woke
No findings found.
cfb@sandman:woke/> cd dir1/
cfb@sandman:dir1/> woke
No findings found.

However if I do the same thing in a git repo, the nested .wokeignore file is not processed unless I'm in the root of the git checkout.

Example:

cfb@sandman:woke/> git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint:   git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint:   git branch -m <name>
Initialized empty Git repository in /private/tmp/woke/.git/
cfb@sandman:woke/>
cfb@sandman:woke/>
cfb@sandman:woke/> find .
.
./dir1
./dir1/dir2
./dir1/dir2/slave
./dir1/.wokeignore
./.git
./.git/config
./.git/objects
./.git/objects/pack
./.git/objects/info
./.git/HEAD
./.git/info
./.git/info/exclude
./.git/description
./.git/hooks
./.git/hooks/commit-msg.sample
./.git/hooks/pre-rebase.sample
./.git/hooks/pre-commit.sample
./.git/hooks/applypatch-msg.sample
./.git/hooks/fsmonitor-watchman.sample
./.git/hooks/pre-receive.sample
./.git/hooks/prepare-commit-msg.sample
./.git/hooks/post-update.sample
./.git/hooks/pre-merge-commit.sample
./.git/hooks/pre-applypatch.sample
./.git/hooks/pre-push.sample
./.git/hooks/update.sample
./.git/hooks/push-to-checkout.sample
./.git/refs
./.git/refs/heads
./.git/refs/tags
cfb@sandman:woke/> woke
No findings found.
cfb@sandman:woke/> cd dir1/
cfb@sandman:dir1/> woke
dir2/slave:1:1-1: Filename finding: `slave` may be insensitive, use `follower`, `replica`, `standby` instead (error)
github-actions[bot] commented 2 years ago

👋 Thanks for submitting your first issue!

Please be sure to read and follow our Code of Conduct and Contributing guide.

⭐️ Is your org or open source project using woke? If so, we'd love for you to be included in the 'Who uses woke' list at https://github.com/get-woke/woke/blob/main/docs/about.md#who-uses-woke.

cburgess commented 2 years ago

It also look like in this case the .wokeignore file is also being processed for violations.

Example:

cfb@sandman:base-apps/> woke | grep -i black
.wokeignore:2:4-13: `blacklist` may be insensitive, use `denylist`, `blocklist`, `exclusion list` instead (warning)
tag-blacklist.txt