Code Monkey home page Code Monkey logo

woke's People

Contributors

armanrahman22 avatar bachand avatar caitlinelfring avatar cjwatson avatar cognitivegears avatar dependabot[bot] avatar discentem avatar eedorenko avatar fossabot avatar github-actions[bot] avatar glutexo avatar hamptonmakes avatar hindividual avatar jeremydelacruz avatar kslhacks avatar markusthoemmes avatar mattn avatar mkcomer avatar nicorikken avatar petesfrench avatar platinummonkey avatar renovate[bot] avatar richterdavid avatar sebastien-rosset avatar smooshy avatar snickerbockers avatar sxd avatar syohex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

woke's Issues

brew install fails on Mac with M1 chip

Could you please add arm64 in goreleaser, to build woke for M1?

The installation fails now with an error:

Brew

brew install get-woke/tap/woke
==> Tapping get-woke/tap
Cloning into '/opt/homebrew/Library/Taps/get-woke/homebrew-tap'...
remote: Enumerating objects: 148, done.
remote: Counting objects: 100% (148/148), done.
remote: Compressing objects: 100% (74/74), done.
remote: Total 148 (delta 37), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (148/148), 15.95 KiB | 2.66 MiB/s, done.
Resolving deltas: 100% (37/37), done.
Error: Invalid formula: /opt/homebrew/Library/Taps/get-woke/homebrew-tap/Formula/woke.rb
formulae require at least a URL
Error: Cannot tap get-woke/tap: invalid syntax in tap!

cURL

curl -sSfL https://git.io/getwoke | \
  bash -s -- -b /usr/local/bin
get-woke/woke crit platform darwin/arm64 is not supported.  Make sure this script is up-to-date and file request at https://github.com/get-woke/woke/issues/new

Community-driven rule list

Is your feature request related to a problem? Please describe.
We are looking for a single tool to scan our code for problematic language. There are at least three types of problematic language that I think can be scanned:

  1. Non inclusive terms
    a. Awesome. Seems like woke is perfect for this.
    b. Corporations should be able to share this effort both to maintain the evolving word list and suggested replacements as well as the scanning tools.
  2. Corporate terms
    a. Like the name of unannounced products that developers might be thinking about but shouldn't mention in comments
    b. Seems like woke is perfect for this since we can pass exact word lists to it
  3. Vulgarity and slurs
    a. Developers shouldn't but sometimes they put swear words in their comments
    b. I would hope it never happens but you could imagine people potentially putting slurs into their comments as well
    c. I suppose we could handle vulgarity and slurs like we handle corporate terms but this seems much better as a community initiative

Describe the solution you'd like
A maintained word list for vulgarity and slurs.

Describe alternatives you've considered
We could do it ourselves but we want to share this with the community and have confidence that we are using appropriate word lists.

Additional context
It seems like a fair number of folks are building similar word lists. INI, inclusivelint. We should share a word list I think.

Add checks for filenames

Is your feature request related to a problem? Please describe.
Sometimes, offending words aren't only used inside files but also for their names, e.g. whitelist_test.go.

Describe the solution you'd like
We should check that too, probably reporting the issue as line 1 in the file to stay compatible with reviewdog etc.

Describe alternatives you've considered
I've done that through grep and friends but... meh.


This tool is awesome ๐Ÿ™‚. I'd be happy to take a crack at implementing the file name checking if you're accepting PRs.

Ability to pull in rules from remote repos

Link to original issue on forked repo: inclusive-dev-tools#1

Problem Statement

Right now the code looks locally for the rules file, but we want to be able to source it from any public URL to allow for reuse of external rule sets

Acceptance Criteria

  • Ability to run the linter on a publicly accessible ruleset file by pointing to it in the cli arguments. e.g. woke -u https://raw.githubusercontent.com/get-woke/woke/main/example.yaml

Investigate `filepath.WalkDir` to replace `fastwalk`

filepath.WalkDir was added in go 1.16 (https://tip.golang.org/doc/go1.16#path/filepath), which does not call os.Lstat on every visited file or directory, which filepath.Walk does.

This is the reason I went with fastwalk (more details here: https://github.com/s12chung/fastwalk/wiki)

Acceptance criteria

  • Replace fastwalk with filepath.WalkDir in
    func Walk(root string, walkFn func(path string, typ os.FileMode) error) error {
    return fastwalk.Walk(root, func(path string, typ os.FileMode) error {
    path = filepath.Clean(path)
    if typ.IsDir() && isDotGit(path) {
    return filepath.SkipDir
    }
    return walkFn(path, typ)
    })
    }
    . The same behavior should be expected
  • Measure performance impact of filepath.WalkDir vs fastwalk (ie benchmark/pprof) and record results here
  • Determine if fastwalk should be replaced

Woke v0.18.0 fails to install from source due to replace directive

Hello! Recently we started running into issues installing woke. After some investigation it seems to be due to this recent change: #117.

Currently we are installing woke by running:

go install github.com/get-woke/woke@latest

Unfortunately after the recent changes it now results in this error:

  go: downloading github.com/get-woke/woke v0.18.0
  go install github.com/get-woke/woke@latest: github.com/get-woke/[email protected]
  	The go.mod file for the module providing named packages contains one or
  	more replace directives. It must not contain directives that would cause
  	it to be interpreted differently than if it were the main module.

Reading through the woke docs, the recommended way to install from source is to run:

go get -u github.com/get-woke/woke

However, the recommended command results in a warning:

go get: installing executables with 'go get' in module mode is deprecated.
	Use 'go install pkg@version' instead.
	For more information, see https://golang.org/doc/go-get-install-deprecation
	or run 'go help get' or 'go help install'.

Reading through the document linked in the warning, it seems like this method will stop working in Go 1.18. The document recommends using go install instead. Unfortunately go install doesn't like replace directives. I found this thread in the Go issue tracker discussing it: golang/go#44840. Please correct me if I have said anything that is incorrect or partially incorrect. This is my first time running into this issue with a tool.

I didn't look into the context of why the replace directive was added to woke. I am not sure if it is easy to remove or if there is a better solution that achieves all of the desired goals.

My current workaround is to install v0.17.0 instead of latest.

Package dependencies can bypass our ignore rules

Overview

In our JS project managed with yarn, we want to ignore anything located in the node_modules folder (our dependencies), so we added node_modules in our .wokeignore file.

Somehow, we have a node_modules dependency (npm-normalize-package-bin) that includes a .gitignore file. In this file, there are some ignore exceptions noted as !some_path_to_include.

With an anterior version of woke, this whole directory was ignored as expected. But with v0.18.1 (probably related to #117), the some_path_to_include is not ignored anymore. Is there any way to force any file located into node_modules to be ignored?

Steps to reproduce

$ mkdir test-woke
$ cd test-woke
$ yarn init -y
$ yarn add npm-normalize-package-bin
$ echo "node_modules" > .wokeignore

Actual result (some node_modules file is not ignored):

$ woke
node_modules/npm-normalize-package-bin/package-lock.json:1582:73-77: `GUys` may be insensitive, use `folks`, `people`, `you all`, `y'all`, `yinz` instead (error)
      "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",
                                                                         ^

Expected result (all node_modules files are ignored):

$ woke
No findings found.

Additional information

Version of woke
$ woke --version
woke version 0.18.1
Config file
$ cat .woke.yml
cat: .woke.yml: No such file or directory
Go environment
$ go version && go env
go version go1.18.1 darwin/amd64
GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/xxx/Library/Caches/go-build"
GOENV="/Users/xxx/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/xxx/go/pkg/mod"
GONOPROXY="github.com/xxx"
GONOSUMDB="github.com/xxx"
GOOS="darwin"
GOPATH="/Users/xxx/go"
GOPRIVATE="github.com/xxx"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.18.1/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.18.1/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.18.1"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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/xxx=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
$ woke --debug
2022-05-11T11:31:54+02:00 DBG woke version 0.18.1 built from 939e604 on 2022-03-19T15:45:29Z
2022-05-11T11:31:54+02:00 DBG no config file loaded, using only default rules
2022-05-11T11:31:54+02:00 DBG default rules rules=["whitelist","blacklist","master-slave","slave","grandfathered","man-hours","sanity","dummy","guys","whitebox","blackbox"]
2022-05-11T11:31:54+02:00 DBG all enabled rules rules=["whitelist","blacklist","master-slave","slave","grandfathered","man-hours","sanity","dummy","guys","whitebox","blackbox"]
2022-05-11T11:31:54+02:00 DBG Could Not Find Root Git Folder
2022-05-11T11:31:54+02:00 DBG finished compiling ignores durationMS=2.166872
2022-05-11T11:31:54+02:00 DBG created new printer printer=text
2022-05-11T11:31:54+02:00 DBG process files path=. type=parallel
2022-05-11T11:31:54+02:00 DBG skipping content file=. reason="file is a directory"
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=0.672365 file=.
2022-05-11T11:31:54+02:00 DBG skipping file=node_modules reason="ignored file"
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=0.374578 file=.gitignore
2022-05-11T11:31:54+02:00 DBG skipping file=node_modules/.yarn-integrity reason="ignored file"
2022-05-11T11:31:54+02:00 DBG skipping file=node_modules/npm-normalize-package-bin reason="ignored file"
2022-05-11T11:31:54+02:00 DBG skipping content file=node_modules/npm-normalize-package-bin/test reason="file is a directory"
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=0.212282 file=node_modules/npm-normalize-package-bin/test
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=0.8495 file=yarn.lock
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=0.987997 file=package.json
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=0.339032 file=node_modules/npm-normalize-package-bin/.gitignore
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=0.21564 file=node_modules/npm-normalize-package-bin/.github/settings.yml
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=0.853529 file=node_modules/npm-normalize-package-bin/README.md
2022-05-11T11:31:54+02:00 DBG skipping content file=node_modules/npm-normalize-package-bin/.github reason="file is a directory"
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=0.346777 file=node_modules/npm-normalize-package-bin/.github
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=0.934917 file=node_modules/npm-normalize-package-bin/package.json
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=1.426737 file=node_modules/npm-normalize-package-bin/index.js
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=1.212664 file=node_modules/npm-normalize-package-bin/LICENSE
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=1.36334 file=node_modules/npm-normalize-package-bin/test/nobin.js
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=1.20234 file=node_modules/npm-normalize-package-bin/test/array.js
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=1.615487 file=node_modules/npm-normalize-package-bin/test/string.js
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=3.003684 file=node_modules/npm-normalize-package-bin/test/object.js
2022-05-11T11:31:54+02:00 DBG finished processing findings durationMS=53.227105 file=node_modules/npm-normalize-package-bin/package-lock.json
node_modules/npm-normalize-package-bin/package-lock.json:1582:73-77: `GUys` may be insensitive, use `folks`, `people`, `you all`, `y'all`, `yinz` instead (error)
      "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",
                                                                         ^
2022-05-11T11:31:54+02:00 DBG woke completed durationMS=60.148751

Use word boundaries (\b) or ChangeInCase to reduce false positives

I have a "redline" rule in a woke config.

However, in some code, I found this example that I don't believe should be causing a violation (IMO):

const measuredLineHeight = getComputedStyle(el).lineHeight;

Which contains the substring, but I think might have enough signal to not marked.

  • Yes, I've searched similar issues on GitHub and didn't find any.

Kinda, #58 is similar-ish (except that in my case I do want the code to be checked).

  • Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of woke
$ woke --version
woke version 0.9.0
Config file
$ cat .woke.yml
rules:
  - name: redline
    terms:
      - redline
    alternatives:
      - annotate
Go environment
$ go version && go env
go: command not found
Verbose output of running
$ woke --debug
2021-05-25T10:18:40-07:00 DBG woke version 0.9.0 built from 4e1a9a0 on 2021-05-22T15:23:11Z
2021-05-25T10:18:40-07:00 DBG loaded config file config=/path/to/woke-repro/.woke.yml
2021-05-25T10:18:40-07:00 DBG rules enabled rules=["redline","whitelist","blacklist","master-slave","slave","grandfathered","man-hours","sanity","dummy","guys","whitebox","blackbox"]
2021-05-25T10:18:40-07:00 DBG skipping ignorefile error="open .gitignore: no such file or directory" file=.gitignore
2021-05-25T10:18:40-07:00 DBG skipping ignorefile error="open .wokeignore: no such file or directory" file=.wokeignore
2021-05-25T10:18:40-07:00 DBG finished compiling ignores durationMS=0.127734
2021-05-25T10:18:40-07:00 DBG created new printer printer=text
2021-05-25T10:18:40-07:00 DBG process files path=. type=parallel
2021-05-25T10:18:40-07:00 DBG skipping file=.woke.yml reason="ignored file"
2021-05-25T10:18:40-07:00 DBG skipping content file=. reason="file is a directory"
2021-05-25T10:18:40-07:00 DBG finished processing violations durationMS=0.191194 file=.
2021-05-25T10:18:40-07:00 DBG finished processing violations durationMS=0.126851 file=test.js
test.js:1:11-18: `redLine` may be insensitive, use `annotate` instead (error)
const measuredLineHeight = getComputedStyle(el).lineHeight;
           ^
2021-05-25T10:18:40-07:00 DBG woke completed durationMS=1.012913

Name change

The term "Woke" is ableist and non inclusive word, and excludes people with narcolepsy and may make them feel bad and/or hurt.

suggested change:
Change project name to "inclusive language tool"

Other possible changes:

  • adding a trigger warning at the top of the repo.

Apply wokeignore rules on their own line to the following line

Is your feature request related to a problem? Please describe.
In some of our projects, we use Google Java Format. This disallows end-line comments, so an alternative to end-line wokeignore comments would be ideal. Some SQL interpreters also disallow end-line comments, and I'm sure there are other languages/tools that behave the same way.

Describe the solution you'd like
The ability to have wokeignore comments apply to the following line would be great. I know woke doesn't understand language conventions for comments, so I was thinking of something like: If no characters on the line (apart from those composing the wokeignore:rule=<rule list> string) are alphabetic characters, then apply the rule to the next line. This would cover <!-- comment -->, # comment, -- comment, // comment, etc.

In C++, this could be done with iswalpha(). Hopefully there is something similar in Go.

Describe alternatives you've considered
None.

Additional context
N/A

Performance issues when compiling ignores and .wokeignore not being applied

Thank you for creating the issue!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of woke
$ woke --version
# woke version 0.19.0
Config file

No config file.

Go environment

Some characters omitted with *.

$ go version && go env
T:\****\Tools\Woke>go version && go env
go version go1.19.1 windows/amd64
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\****\AppData\Local\go-build
set GOENV=C:\Users\****\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\****\go\pkg\mod
set GONOPROXY=*.****.com
set GONOSUMDB=*.****.com
set GOOS=windows
set GOPATH=C:\Users\****\go
set GOPRIVATE=*.****.com
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.19.1
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\****\AppData\Local\Temp\go-build4222856944=/tmp/go-build -gno-record-gcc-switches

When running woke at the root of a large repository, it takes substantially longer to run due to searching for ignore files.

Running woke at the root of my repository (some text omitted with *):

T:\****>Tools\Woke\windows\woke.exe T:\****\Tools\Woke\windows\test.txt --debug
2022-10-18T13:12:39-07:00 DBG woke version 0.19.0 built from e588a3e on 2022-07-28T22:46:26Z
2022-10-18T13:12:39-07:00 DBG Adding custom ruleset from filename="T:\\****\\.woke.yaml"
2022-10-18T13:12:39-07:00 DBG loaded config file config="T:\\****\\.woke.yaml"
2022-10-18T13:12:39-07:00 DBG config rules rules=["blacklist","dummy","fluffer","grandfather","male/female connector","man-hours","master","master-slave","slave","whitelist"]
2022-10-18T13:12:39-07:00 DBG default rules rules=["whitelist","blacklist","master-slave","slave","grandfathered","man-hours","sanity","dummy","guys","whitebox","blackbox"]
2022-10-18T13:12:39-07:00 DBG all enabled rules rules=["blacklist","dummy","fluffer","grandfather","male/female connector","man-hours","master","master-slave","slave","whitelist","grandfathered","sanity","guys","whitebox","blackbox"]
2022-10-18T13:12:39-07:00 DBG Could Not Find Root Git Folder
2022-10-18T13:13:10-07:00 DBG finished compiling ignores durationMS=30881.2372
2022-10-18T13:13:10-07:00 DBG created new printer printer=text
2022-10-18T13:13:10-07:00 DBG process files path="T:\\****\\Tools\\Woke\\windows\\test.txt" type=parallel
2022-10-18T13:13:10-07:00 DBG finished processing findings durationMS=0.5496 file=T:/****/Tools/Woke/windows/test.txt
T:/****/Tools/Woke/windows/test.txt:1:0-5: `slave` may be insensitive, use `follower`, `replica`, `standby`, `secondary`, `worker`, `passive`, `child`, `agent`, `node`, `helper`, `responder`, `subscriber` instead (error)
slave
^
T:/****/Tools/Woke/windows/test.txt:2:0-6: `master` may be insensitive, use `primary`, `main`, `parent`, `leader`, `central`, `active` instead (error)
master
^
2022-10-18T13:13:10-07:00 DBG woke completed durationMS=30896.5485

vs running inside the some nested folders:

T:\****\Tools\Woke>windows\woke.exe T:\****\Tools\Woke\windows\test.txt --debug
2022-10-18T13:15:17-07:00 DBG woke version 0.19.0 built from e588a3e on 2022-07-28T22:46:26Z
2022-10-18T13:15:17-07:00 DBG Adding custom ruleset from filename="T:\\****\\Tools\\Woke\\.woke.yaml"
2022-10-18T13:15:17-07:00 DBG loaded config file config="T:\\****\\Tools\\Woke\\.woke.yaml"
2022-10-18T13:15:17-07:00 DBG config rules rules=["blacklist","dummy","fluffer","grandfather","male/female connector","man-hours","master","master-slave","slave","whitelist"]
2022-10-18T13:15:17-07:00 DBG default rules rules=["whitelist","blacklist","master-slave","slave","grandfathered","man-hours","sanity","dummy","guys","whitebox","blackbox"]
2022-10-18T13:15:17-07:00 DBG all enabled rules rules=["blacklist","dummy","fluffer","grandfather","male/female connector","man-hours","master","master-slave","slave","whitelist","grandfathered","sanity","guys","whitebox","blackbox"]
2022-10-18T13:15:17-07:00 DBG Could Not Find Root Git Folder
2022-10-18T13:15:17-07:00 DBG finished compiling ignores durationMS=0.5214
2022-10-18T13:15:17-07:00 DBG created new printer printer=text
2022-10-18T13:15:17-07:00 DBG process files path="T:\\****\\Tools\\Woke\\windows\\test.txt" type=parallel
2022-10-18T13:15:17-07:00 DBG finished processing findings durationMS=0.5231 file=T:/****/Tools/Woke/windows/test.txt
T:/****/Tools/Woke/windows/test.txt:1:0-5: `slave` may be insensitive, use `follower`, `replica`, `standby`, `secondary`, `worker`, `passive`, `child`, `agent`, `node`, `helper`, `responder`, `subscriber` instead (error)
slave
^
T:/****/Tools/Woke/windows/test.txt:2:0-6: `master` may be insensitive, use `primary`, `main`, `parent`, `leader`, `central`, `active` instead (error)
master
^
2022-10-18T13:15:17-07:00 DBG woke completed durationMS=13.8008

As you can see, it takes about a full 30 seconds each time woke runs to compile the ignores. The repository is quite large (about 400 GB) so this is an unusual use case. I'd also like to note that using woke version 0.17.1 does not have this issue.

Also could potentially be another issue, but I'm having troubles with .wokeignore not properly ignoring some paths in 0.19.0 which doesn't seem to occur in 0.17.1. It looks like directories specifically aren't properly ignored if you specify full paths, meaning a difference in running command line like this:

Not properly ignored and will find my test.txt with non-inclusive language:

T:\****>Tools\Woke\windows\woke.exe T:\****\Woke\windows

Properly ignored by .wokeignore:

T:\****>Tools\Woke\windows\woke.exe Tools\Woke\windows

Tests fail with local ~/.woke.yaml file

Thank you for creating the issue!

  • [ X ] Yes, I've searched similar issues on GitHub and didn't find any.
  • [ X ] Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of woke
$ woke --version
# paste output here

./bin/woke --version
woke version 0.17.0
Config file
$ cat .woke.yml
# paste output here

rules:
  - name: slave
    terms:
      - slave
    alternatives:
      - worker
      - subordinate
      - replica
      - agent
      - secondary
Go environment
$ go version && go env
# paste output here

โฏ go version && go env
go version go1.16.2 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/cognitivegears/.cache/go-build"
GOENV="/home/cognitivegears/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/cognitivegears/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/cognitivegears/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.16"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.16/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/cognitivegears/Documents/projects/woke/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1090954941=/tmp/go-build -gno-record-gcc-switches"

Verbose output of running
$ woke --debug
# paste output here

N/A

Issue: Executing the go tests fails if a ~/.woke.yaml file is present. This only happens if the tests for woke/cmd are not cached. In order to duplicate with the test cached, run go test -count=1 ./... with a ~/.woke.yaml file in place.

Below is the results from a sample test run on my machine:

Test run with ~/.woke.yaml present
?   	github.com/get-woke/woke	[no test files]
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"Using config file: /home/cognitivegears/.woke.yaml"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"Using config file: /home/cognitivegears/.woke.yaml"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"Using config file: /home/cognitivegears/.woke.yaml"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"Using config file: /home/cognitivegears/.woke.yaml"}
--- FAIL: TestInitConfig (0.00s)
    --- FAIL: TestInitConfig/no_config (0.00s)
        root_test.go:68:
            	Error Trace:	root_test.go:68
            	Error:      	Not equal:
            	            	expected: ""
            	            	actual  : "/home/cognitivegears/.woke.yaml"
            	            	
            	            	Diff:
            	            	--- Expected
            	            	+++ Actual
            	            	@@ -1 +1 @@
            	            	-
            	            	+/home/cognitivegears/.woke.yaml
            	Test:       	TestInitConfig/no_config
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"woke version main built from 000000 on today"}
{"level":"debug","filename":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"Adding custom ruleset from"}
{"level":"debug","config":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"loaded config file"}
{"level":"debug","error":"open .gitignore: no such file or directory","file":".gitignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .ignore: no such file or directory","file":".ignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .wokeignore: no such file or directory","file":".wokeignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .git/info/exclude: no such file or directory","file":".git/info/exclude","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","durationMS":0.087487,"time":"2021-11-16T21:01:11-06:00","message":"finished compiling ignores"}
{"level":"debug","printer":"text","time":"2021-11-16T21:01:11-06:00","message":"created new printer"}
{"level":"debug","path":"../testdata/good.yml","type":"parallel","time":"2021-11-16T21:01:11-06:00","message":"process files"}
{"level":"debug","durationMS":0.047839,"file":"../testdata/good.yml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.459426,"time":"2021-11-16T21:01:11-06:00","message":"woke completed"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"woke version main built from 000000 on today"}
{"level":"debug","filename":"../testdata/.woke-custom-exit-success.yaml","time":"2021-11-16T21:01:11-06:00","message":"Adding custom ruleset from"}
{"level":"debug","config":"../testdata/.woke-custom-exit-success.yaml","time":"2021-11-16T21:01:11-06:00","message":"loaded config file"}
{"level":"debug","error":"open .gitignore: no such file or directory","file":".gitignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .ignore: no such file or directory","file":".ignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .wokeignore: no such file or directory","file":".wokeignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .git/info/exclude: no such file or directory","file":".git/info/exclude","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","durationMS":0.064392,"time":"2021-11-16T21:01:11-06:00","message":"finished compiling ignores"}
{"level":"debug","printer":"text","time":"2021-11-16T21:01:11-06:00","message":"created new printer"}
{"level":"debug","path":"../testdata/good.yml","type":"parallel","time":"2021-11-16T21:01:11-06:00","message":"process files"}
{"level":"debug","durationMS":0.063209,"file":"../testdata/good.yml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.230766,"time":"2021-11-16T21:01:11-06:00","message":"woke completed"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"woke version main built from 000000 on today"}
{"level":"debug","filename":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"Adding custom ruleset from"}
{"level":"debug","config":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"loaded config file"}
{"level":"debug","error":"open .gitignore: no such file or directory","file":".gitignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .ignore: no such file or directory","file":".ignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .wokeignore: no such file or directory","file":".wokeignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .git/info/exclude: no such file or directory","file":".git/info/exclude","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","durationMS":0.057834,"time":"2021-11-16T21:01:11-06:00","message":"finished compiling ignores"}
{"level":"debug","printer":"text","time":"2021-11-16T21:01:11-06:00","message":"created new printer"}
{"level":"debug","path":"../testdata","type":"parallel","time":"2021-11-16T21:01:11-06:00","message":"process files"}
{"level":"debug","durationMS":0.122945,"file":"../testdata/invalid.yaml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","file":"../testdata","reason":"file is a directory","time":"2021-11-16T21:01:11-06:00","message":"skipping content"}
{"level":"debug","durationMS":0.019636,"file":"../testdata","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.041956,"file":"../testdata/good.yml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.052006,"file":"../testdata/whitelist.yml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.052756,"file":"../testdata/.woke-custom-exit-success.yaml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.758427,"time":"2021-11-16T21:01:11-06:00","message":"woke completed"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"woke version main built from 000000 on today"}
{"level":"debug","filename":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"Adding custom ruleset from"}
{"level":"debug","config":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"loaded config file"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"disabling default rules"}
{"level":"debug","error":"open .gitignore: no such file or directory","file":".gitignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .ignore: no such file or directory","file":".ignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .wokeignore: no such file or directory","file":".wokeignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .git/info/exclude: no such file or directory","file":".git/info/exclude","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","durationMS":0.053914,"time":"2021-11-16T21:01:11-06:00","message":"finished compiling ignores"}
{"level":"debug","printer":"text","time":"2021-11-16T21:01:11-06:00","message":"created new printer"}
{"level":"debug","path":"../testdata","type":"parallel","time":"2021-11-16T21:01:11-06:00","message":"process files"}
{"level":"debug","durationMS":0.121333,"file":"../testdata/invalid.yaml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","file":"../testdata","reason":"file is a directory","time":"2021-11-16T21:01:11-06:00","message":"skipping content"}
{"level":"debug","durationMS":0.020675,"file":"../testdata","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.038437,"file":"../testdata/good.yml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.04781,"file":"../testdata/whitelist.yml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.052806,"file":"../testdata/.woke-custom-exit-success.yaml","time":"2021-11-16T21:01:11-06:00","message":"finished processing findings"}
{"level":"debug","durationMS":0.722755,"time":"2021-11-16T21:01:11-06:00","message":"woke completed"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"woke version main built from 000000 on today"}
{"level":"debug","filename":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"Adding custom ruleset from"}
{"level":"debug","config":"/home/cognitivegears/.woke.yaml","time":"2021-11-16T21:01:11-06:00","message":"loaded config file"}
{"level":"debug","error":"open .gitignore: no such file or directory","file":".gitignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .ignore: no such file or directory","file":".ignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .wokeignore: no such file or directory","file":".wokeignore","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","error":"open .git/info/exclude: no such file or directory","file":".git/info/exclude","time":"2021-11-16T21:01:11-06:00","message":"skipping ignorefile"}
{"level":"debug","durationMS":0.066092,"time":"2021-11-16T21:01:11-06:00","message":"finished compiling ignores"}
{"level":"debug","durationMS":0.321887,"time":"2021-11-16T21:01:11-06:00","message":"woke completed"}
{"level":"debug","time":"2021-11-16T21:01:11-06:00","message":"woke version main built from 000000 on today"}
{"level":"debug","filename":"../testdata/invalid.yaml","time":"2021-11-16T21:01:11-06:00","message":"Adding custom ruleset from"}
{"level":"debug","durationMS":0.072278,"time":"2021-11-16T21:01:11-06:00","message":"woke completed"}
--- FAIL: TestRunE (0.00s)
    --- FAIL: TestRunE/no_rules_enabled (0.00s)
        root_test.go:133:
            	Error Trace:	root_test.go:133
            	Error:      	An error is expected but got nil.
            	Test:       	TestRunE/no_rules_enabled
        root_test.go:134:
            	Error Trace:	root_test.go:134
            	Error:      	Target error should be in err chain:
            	            	expected: "no rules enabled: either configure rules in your config file or remove the `--disable-default-rules` flag"
            	            	in chain:
            	Test:       	TestRunE/no_rules_enabled
FAIL
FAIL	github.com/get-woke/woke/cmd	0.008s
?   	github.com/get-woke/woke/cmd/docs	[no test files]
ok  	github.com/get-woke/woke/pkg/config	0.620s
ok  	github.com/get-woke/woke/pkg/ignore	0.019s
?   	github.com/get-woke/woke/pkg/output	[no test files]
ok  	github.com/get-woke/woke/pkg/parser	0.012s
ok  	github.com/get-woke/woke/pkg/printer	0.010s
ok  	github.com/get-woke/woke/pkg/result	0.006s
ok  	github.com/get-woke/woke/pkg/rule	0.010s
ok  	github.com/get-woke/woke/pkg/util	0.002s
ok  	github.com/get-woke/woke/pkg/walker	0.002s
FAIL

Ability to disable default rules

Is your feature request related to a problem? Please describe.
The default rules are a great starting point, but for those who would like to completely customize their own ruleset, there should be the ability to completely disable the default rules

Describe the solution you'd like
A cli option like --disable-default-rules to disable all default rules

Describe alternatives you've considered
The current way to disable default rules is outlined in https://github.com/get-woke/woke#disabling-default-rules, but if you want to disable them all, you need to do this for every rule.

Additional context
Add any other context or screenshots about the feature request here.

woke check fails for git submodules

Hi, it seems that woke version 0.18.1 has a bug handling git submodules. I think the problem is with the fix to this woke issue (#102), causing woke to look for the .git/info/exclude directory, and throwing an error if it doesn't find it (instead of just moving on):

14-Apr [21:24:03.052]  Error: open .../.git/info/exclude: not a directory

The problem is that git submodules don't have a .git/ directory, only a .git file.

  • [ x ] Yes, I've searched similar issues on GitHub and didn't find any.
  • [ x ] Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of woke
$ woke --version
woke version 0.18.1
Config file

Default

Go environment
$ go version && go env
# paste output here
Verbose output of running
$ woke --debug
2022-04-19T09:47:28+02:00 DBG woke version 0.18.1 built from 939e604 on 2022-03-19T15:45:29Z
2022-04-19T09:47:28+02:00 DBG no config file loaded, using only default rules
2022-04-19T09:47:28+02:00 DBG default rules rules=["whitelist","blacklist","master-slave","slave","grandfathered","man-hours","sanity","dummy","guys","whitebox","blackbox"]
2022-04-19T09:47:28+02:00 DBG all enabled rules rules=["whitelist","blacklist","master-slave","slave","grandfathered","man-hours","sanity","dummy","guys","whitebox","blackbox"]
2022-04-19T09:47:28+02:00 DBG finished compiling ignores durationMS=148.256037
2022-04-19T09:47:28+02:00 DBG woke completed durationMS=148.479722
Error: open /Users/.../.git/info/exclude: not a directory
Usage:
  woke [globs ...] [flags]

Flags:
  -c, --config string           Config file (default is .woke.yaml in current directory, or $HOME)
      --debug                   Enable debug logging
      --disable-default-rules   Disable the default ruleset
      --exit-1-on-failure       Exit with exit code 1 on failures
  -h, --help                    help for woke
      --no-ignore               Ignored files in .gitignore, .ignore, .wokeignore, .git/info/exclude, and inline ignores are processed
  -o, --output string           Output type [text,simple,github-actions,json,sonarqube] (default "text")
      --stdin                   Read from stdin
  -v, --version                 version for woke

2022-04-19T09:47:28+02:00 FTL  error="open /Users/.../.git/info/exclude: not a directory"

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

Thank you for creating the issue!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of woke
$ woke --version
woke version 0.18.2
Config file

No config file.

Go environment
$ 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)

Woke as Linux packages

Is your feature request related to a problem? Please describe.
The only options for Linux installation currently are installation via shell script, download of release and manual install, docker, or build from source. Particularly for companies, it may make it easier for them to approve woke and get it installed across systems however if it was available as Linux packages. Unfortunately, I believe some companies may be unwilling or less likely to install a tool if it is not on major package repositories as larger companies often keep their own mirrors of these public repositories and install from them, rather than having direct internet access to servers or direct installation of binaries.

Describe the solution you'd like
I'd like to see woke available as Linux packages (ideally on central repositories) including RPM (YUM), PKG (APT), AppImage, Snap, Flatpak, possibly others.

Describe alternatives you've considered
No real alternative except to not make them available.

Additional context
None

Add multiarch support to container image

Describe the solution you'd like
GoReleaser should support the build of container manifest with the multiarch images insides

Additional context
GoReleaser already support docker manifest for this, and this will help to run the woke
container inside a Raspberry Pi 4

Community Tools

Is your feature request related to a problem? Please describe.
By all measures woke is a successful project. It is in active use by multiple companies and individuals. According to the main repository page there are over 20 contributors. Also you have done a fantastic job of quickly responding to feature requests and pull requests. I know that I would like to find additional ways to help and I'm sure there are others that feel the same way. To that end, I'd like to suggest that it would be great to add some tools for enhancing collaboration for both contributors and users.

Describe the solution you'd like
Some examples of tools that could be helpful:

  • A collaboration tool such as Discord, IRC, Slack, Mattermost, etc
    • Bounce ideas off of other contributors, see if anyone is already working on a feature, etc
    • Place for users to post questions and get help, or collaborate on ways to implement woke at their companies or projects
    • Discuss ways to increase exposure of woke
    • Announcements
  • Mailing list (notification of new releases, etc)
  • Expanded getwoke.tech (roadmap, etc)

Describe alternatives you've considered
N/A

Additional context
N/A

Apply different rules to different paths/files

Is your feature request related to a problem? Please describe.
Hi, I'm an engineer working on Legends of Runeterra, a video game (https://playruneterra.com/en-us/). We're using woke to clean up problematic terminology in our code to make it more inclusive :) But one problem we have is that we want to filter out terms like "grandfather", but they do sometimes show up in some of our content in a contextually-appropriate way. For example, we have a card in the game named Grandfather Rumul (https://leagueoflegends.fandom.com/wiki/Grandfather_Rumul_(Legends_of_Runeterra)) and we don't want to block commits or break builds for this usage. Currently I'm dealing with this in our .woke.yaml like this:

  # we will error on "grandfathered" but not on "grandfather" because we have a card named "Grandfather Rumul"
  - name: grandfathered
    terms:
      - grandfathered
    alternatives:
      - legacy status
      - legacy
    options:
      word_boundary: true

But this means we might not catch some inappropriate usages of "grandfather" in code. woke does allow for inline ignores, but we have a lot of generated yaml (Unity prefabs - https://docs.unity3d.com/Manual/Prefabs.html) that we can't easily put inline ignores in. We could just ignore all of these generated yaml files, but again that means we might not catch other inappropriately used terms, so it feels like we're a bit stuck.

Describe the solution you'd like
I'm looking for guidance/suggestions of how to deal with this, or perhaps some sort of feature we could contribute to woke that might help with this. Perhaps something like a regex or glob filter field we could add for each term in .woke.yaml so we could apply specific rules to specific filename patterns?

Describe alternatives you've considered

  • some complex custom scripts to run woke in several passes using different config files
  • leaving some files unscanned/unchecked
  • leaving some terms unenforced

Thank you for taking the time to read this!

Use a test rule for tests instead of default rules

Is your feature request related to a problem? Please describe.
A lot of tests have insensitive words that would be violations if not ignored by woke. Instead of using the default rules in tests, there should be test rule(s) that don't use insensitive language.

Describe the solution you'd like
Use a test rule, and not the default rules for tests
pkg/**/*_test.go should be removed from the .wokeignore file

Describe alternatives you've considered
None

Additional context
None

Implementation question

Is your feature request related to a problem? Please describe.

Iโ€™m just wondering if you could take a moment to add how governance for this product is done. Who/whom decides which particular words must be struck out and who decides which are included? It seems to me - naively - that working out without context - which words may or may not offend (or make feel included) any of 7 billion people, many hundreds of languages, vast amounts of cultural differences and a huge diversity (old meaning - meaning โ€œdifference in substanceโ€ not new meaning โ€œdifference in appearance or sexual preference/identityโ€) is a really hard problem requiring global expertise and a vast team of linguistic experts. How did you manage that? Words - over time and through context - accrue a staggering number of potential meanings - sometimes - as in the case of โ€œsillyโ€ acquiring the reverse meaning to their original (in so far as we can know it) form (it likely meant โ€œblessedโ€ in older English). It must take a huge amount of perception and genius to sift through all of this. How is it done?

https://www.etymonline.com/word/silly

Describe the solution you'd like

A clear and concise description of how which words are โ€œnon-inclusiveโ€ and which words are โ€œinclusiveโ€ is decided and how that decision is normalised globally across culture and contexts. And how tie breaks are resolved where one community may find one word non- inclusive and another may not (given the vast range of possible offences that may be caused across communities - this is a non trivial problem). Also what is done about words which may not be offensive in English but which if taken as Spanish words - for example - could possibly offend someone - that seems tricky too.

Describe alternatives you've considered

I havenโ€™t - I donโ€™t think this problem is practically solvable. Frank discussion between individuals as individuals generally works well though.

Additional context

Cf On Liberty - John Stuart Mill, the later works of George Orwell, The Open Society and its Enemies by Popper, any decent history of 20th century communism, Cynical Theories by Lindsay and Pluckrose ... etc...

`grandfathered` alternatives are confusing

I've seen grandfathered and grandfathered in as verbs (e.g. the wiki page for Grandfather clause), and I don't think the alternative of legacy status serves as a good replacement. I'm not sure legacy status really captures what I understand grandfathered to mean ("allowed even though it is out of line with current policy because it existed prior to the implementation of current policy"). Perhaps deprecated, though that has other implications? I'm sorry, I don't have a clear suggestion at the moment, but I wanted to bring it up for the chance at a discussion before I forgot about it.

- name: grandfathered
terms:
- grandfathered
alternatives:
- legacy status

Suggestion to improve "glob" expansion in documentation

Thank you for creating the issue!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc). This is a doc-only issue.

In the documentation at https://github.com/get-woke/woke/blame/main/docs/usage.md#L30-L33:

To change this, supply a space-separated list of globs as the first argument.

I suggest removing "as the first argument". Since the patterns are space-separated, they are interpreted by the shell as multiple arguments. woke parses all arguments, not just the first argument.

This can be something like **/*.go, or a space-separated list of filenames.

It would be worth clarifying the glob expansion is performed by the shell. woke itself is not doing any globbing expansion. In particular, given the ambiguity of the documentation, one might expect the pattern below to be expanded by woke, but it's not.

woke '**/*.go'

This is a bit confusing because different shells have different globbing behaviors. Some shells do not support the double star glob pattern. In bash >= 4, the double star is used as an extended file match globbing operator, meaning it matches filenames and directories recursively. However, the exact behavior depends on the globstar value:

shopt -s globstar ; woke **/*.go
shopt -u globstar ; woke **/*.go

How about adding support for glob expansion in woke? This would provide consistent and deterministic results that do not depend on the shell glob expansion.

Please include the following information:

Version of woke
$ woke --version
# paste output here
woke version 0.18.2
Config file
$ cat .woke.yml
# paste output here
N/A
Go environment
$ go version && go env
# paste output here
N/A
Verbose output of running
$ woke --debug
# paste output here
N/A

--stdin not working?

I tried the README example for running woke on stdin and it didn't work:

echo "This has whitelist from stdin" | woke --stdin
No violations found. Stay woke โœŠ

I just tried installing with:

curl -sSfL https://git.io/getwoke | \
  bash -s -- -b /usr/local/bin

My version:

woke --version
# woke version 0.9.0

The same issue if I try the go get route as well.

Woke doesn't account for .git/info/excludes

Thank you for creating the issue!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of woke
$ woke --version
# woke version main

(it's 0.9.3 though)

Config file Default
Go environment
$ go version && go env
go version go1.16.5 darwin/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/nkrichevsky/Library/Caches/go-build"
GOENV="/Users/nkrichevsky/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/nkrichevsky/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/nkrichevsky/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.16.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.16.5/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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/gj/6g23qq697ddc5mx6ry8ypdy80000gp/T/go-build1660822404=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
$ ~/go/bin/woke --debug
2021-07-15T18:58:17-04:00 DBG woke version main built from 000000 on today
2021-07-15T18:58:17-04:00 DBG rules enabled rules=["whitelist","blacklist","master-slave","slave","grandfathered","man-hours","sanity","dummy","guys","whitebox","blackbox"]
2021-07-15T18:58:17-04:00 DBG skipping ignorefile error="open .gitignore: no such file or directory" file=.gitignore
2021-07-15T18:58:17-04:00 DBG skipping ignorefile error="open .wokeignore: no such file or directory" file=.wokeignore
2021-07-15T18:58:17-04:00 DBG finished compiling ignores durationMS=0.446858
2021-07-15T18:58:17-04:00 DBG created new printer printer=text
2021-07-15T18:58:17-04:00 DBG process files path=. type=parallel
2021-07-15T18:58:17-04:00 DBG finished processing findings durationMS=0.239601 file=ignoreme
2021-07-15T18:58:17-04:00 DBG skipping content file=. reason="file is a directory"
2021-07-15T18:58:17-04:00 DBG finished processing findings durationMS=0.671263 file=.
ignoreme:1:0-9: `whitelist` may be insensitive, use `allowlist`, `inclusion list` instead (warning)
whitelist
^
2021-07-15T18:58:17-04:00 DBG woke completed durationMS=4.136938

I use .git/info/exclude to exclude files that don't belong in .gitignore (i.e. that the rest of my team doesn't need to worry about). However, woke does not respect this.

[~/Documents/code/test] nkrichevsky@nkrichevsky-mbp$ cat .git/info/exclude
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
ignoreme
[~/Documents/code/test] nkrichevsky@nkrichevsky-mbp$ ~/go/bin/woke
ignoreme:1:0-9: `whitelist` may be insensitive, use `allowlist`, `inclusion list` instead (warning)
whitelist
^

default rules set doesn't appear to be valid yaml

Hi, thank you for building this tool! I'm evaluating it for use on my team's project :)

I've been testing out the configuration options, including writing my own rules yaml file. The default rules set (https://github.com/get-woke/woke/blob/main/pkg/rule/default.yaml) noted in the README (https://github.com/get-woke/woke#rules) seemed like a good starting point, since it has many of the same terms and suggested alternatives as my own team would like to use.

However, when I pasted this default rules set into my local .woke.yaml, woke fails with a yaml parsing error - yaml: unmarshal errors:\n line 2: cannot unmarshal !!seq into config.Config. I was able to work around this by adding a top level rules: entry in the yaml, but this definitely confused me for a good 30 minutes or so :)

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Please include the following information:

Woke v0.9.1
$ woke --version
# paste output here
woke version 0.9.1
Config file
$ cat .woke.yml
# paste output here

# Most of these are based on https://twitter.com/TwitterEng/status/1278733303508418560
- name: whitelist
  terms:
    - whitelist
    - white-list
    - whitelisted
    - white-listed
  alternatives:
    - allowlist
    - inclusion list
  severity: warning
  note: "The underlying assumption of the whitelist/blacklist metaphor is that white = good and black = bad. Because colors in and of themselves have no predetermined meaning, any meaning we assign to them is cultural: for example, the color red in many Southeast Asian countries is lucky, and is often associated with events like marriages, whereas the color white carries the same connotations in many European countries. In the case of whitelist/blacklist, the terms originate in the publishing industry โ€“ one dominated by the USA and England, two countries which participated in slavery and which grapple with their racist legacies to this day."

- name: blacklist
  terms:
    - blacklist
    - black-list
    - blacklisted
    - black-listed
  alternatives:
    - denylist
    - blocklist
    - exclusion list
  severity: warning
  note: "The underlying assumption of the whitelist/blacklist metaphor is that white = good and black = bad. Because colors in and of themselves have no predetermined meaning, any meaning we assign to them is cultural: for example, the color red in many Southeast Asian countries is lucky, and is often associated with events like marriages, whereas the color white carries the same connotations in many European countries. In the case of whitelist/blacklist, the terms originate in the publishing industry โ€“ one dominated by the USA and England, two countries which participated in slavery and which grapple with their racist legacies to this day."

- name: master-slave
  terms:
    - master-slave
    - master/slave
  alternatives:
    - leader/follower
    - primary/replica
    - primary/standby

- name: slave
  terms:
    - slave
  alternatives:
    - follower
    - replica
    - standby

- name: grandfathered
  terms:
    - grandfathered
  alternatives:
    - legacy status

- name: man-hours
  terms:
    - man hours
    - man-hours
  alternatives:
    - person hours
    - engineer hours

- name: sanity
  terms:
    - sanity
  alternatives:
    - confidence
    - quick check
    - coherence check

- name: dummy
  terms:
    - dummy
  alternatives:
    - placeholder
    - sample

- name: guys
  terms:
    - guys
  alternatives:
    - folks
    - people
    - you all
    - y'all
    - yinz

- name: whitebox
  terms:
    - white-box
    - whitebox
    - white box
  alternatives:
    - open-box

- name: blackbox
  terms:
    - black-box
    - blackbox
    - black box
  alternatives:
    - closed-box
Go environment
$ go version && go env
# paste output here
go not installed - running windows binaries from https://github.com/get-woke/woke/releases/tag/v0.9.1
Verbose output of running
$ woke --debug
# paste output here
2021-06-21T14:47:42-07:00 DBG woke version 0.9.1 built from 0dc3fe3 on 2021-06-20T17:59:32Z
2021-06-21T14:47:42-07:00 DBG woke completed durationMS=0.6245
Error: yaml: unmarshal errors:
  line 2: cannot unmarshal !!seq into config.Config
Usage:
  woke [globs ...] [flags]

Flags:
  -c, --config string       Config file (default is .woke.yaml in current directory, or $HOME)
      --debug               Enable debug logging
      --exit-1-on-failure   Exit with exit code 1 on failures
  -h, --help                help for woke
      --no-ignore           Ignored files in .gitignore/.wokeignore and inline ignores are processed
  -o, --output string       Output type [text,simple,github-actions,json] (default "text")
      --stdin               Read from stdin
  -v, --version             version for woke

2021-06-21T14:47:42-07:00 FTL  error="yaml: unmarshal errors:\n  line 2: cannot unmarshal !!seq into config.Config"

Configuration section for output

Is your feature request related to a problem? Please describe.
Not a problem, exactly, though currently the "Success Error Message" doesn't make sense by itself, as the output of that could/should vary per output type. Also, without an output section in the config I was unable to add "effortMinutes" to the sonarqube output since that is likely to vary per team.

Describe the solution you'd like
I'd like to see a section of the configuration file for output configuration (per file type.) Something like:

output:
- type: text
exitCodeOnFindings: 1
printColor: true
includeOriginalLine: true
successMessage: "No findings found. YAY!"
- type: sonarqube
exitCodeOnFindings: 0
sonarEffortMinutes: 10

Describe alternatives you've considered
None - this would just add additional functionality for the system.

Additional context
I've been thinking about two other output types that could be useful - CSV (for importing into Excel, etc) and HTML (to give a pretty report for viewing/printing). Both of theses formats could also use additional output options (whether to include headings for CSV, and template locations etc for HTML.) I'll put in a separate Feature Request or PR for these, but these are just examples of other types that could use an output section. In addition, with this change I think we could also potentially collapse the simple and text outputs into a single output type if that is desirable.

New release

Hi,

could we please have a new release? I'd like to especially have #155 included to be able to use woke as a pre-commit hook.

Thank you!

Add "--fix" feature

Most linters have the ability to automatically fix any violations that are found. Some examples:

This feature will also allow woke to take advantage of GitHub suggestions using something like reviewdog/action-suggester

A caveat with this feature is this should be a "best effort" fix and doesn't guarantee that the fixes it makes will produce functioning code as renaming variables/functions/methods/classes can have far-ranging implications and therefore, using this feature shouldn't be done with blind trust.

Features

  • Opt-in only (disabled by default)
  • Uses the first "alternative" for replacement
  • Should be able to write fixes to files as well as write the diff to stdout
    • Something similar to gofmt -w
-w
  Do not print reformatted sources to standard output.
  If a file's formatting is different from gofmt's, overwrite it
  with gofmt's version. If an error occurred during overwriting,
  the original file is restored from an automatic backup.

woke panics if a wokeignore comment is at the start of a line.

Thank you for creating the issue!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Toy example of the issue:

[~/Documents/code/woke] nkrichevsky@nkrichevsky-mbp$ cat blah.txt
/* wokeignore:rule=master-slave */ master-slave
[~/Documents/code/woke] nkrichevsky@nkrichevsky-mbp$ ./woke blah.txt
panic: runtime error: slice bounds out of range [:103] with length 47

goroutine 34 [running]:
github.com/get-woke/woke/pkg/result.FindResults(0xc00017b5e0, 0x7ffeefbff3af, 0x8, 0xc0000aa000, 0x2f, 0x1, 0x0, 0x0, 0x0)
    /Users/nkrichevsky/Documents/code/woke/pkg/result/lineresult.go:53 +0x445
github.com/get-woke/woke/pkg/parser.(*Parser).generateFileFindings(0xc000198e10, 0xc000092000, 0x0, 0x0, 0x0)
    /Users/nkrichevsky/Documents/code/woke/pkg/parser/findings.go:73 +0x5a5
github.com/get-woke/woke/pkg/parser.(*Parser).generateFileFindingsFromFilename(0xc000198e10, 0x7ffeefbff3af, 0x8, 0x0, 0x0, 0x0)
    /Users/nkrichevsky/Documents/code/woke/pkg/parser/findings.go:23 +0xcf
github.com/get-woke/woke/pkg/parser.(*Parser).processFiles.func1(0xc0001bc820, 0xc000198e10, 0x7ffeefbff3af, 0x8)
    /Users/nkrichevsky/Documents/code/woke/pkg/parser/parser.go:91 +0x6b
created by github.com/get-woke/woke/pkg/parser.(*Parser).processFiles
    /Users/nkrichevsky/Documents/code/woke/pkg/parser/parser.go:88 +0x9e

I think this is due to the fact that unicode.ReplacementChar is actually a three byte symbol (see: https://play.golang.org/p/Jl1WrtoRDM0), so the index within the re function is at the wrong offset. (indeed, changing it from unicode.ReplacementChar to an underscore removes the panic, but I don't know if this is a suitable solution).

Please include the following information:

Version of woke
$ go run main.go --version
woke version main (it's v0.10.1)
Config file

Default

Go environment
$ go version && go env
go version go1.16.5 darwin/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/nkrichevsky/Library/Caches/go-build"
GOENV="/Users/nkrichevsky/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/nkrichevsky/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/nkrichevsky/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.16.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.16.5/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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/gj/6g23qq697ddc5mx6ry8ypdy80000gp/T/go-build2259988605=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
$ ./woke --debug blah.txt
2021-07-21T13:22:59-04:00 DBG woke version main built from 000000 on today
2021-07-21T13:22:59-04:00 DBG rules enabled rules=["whitelist","blacklist","master-slave","slave","grandfathered","man-hours","sanity","dummy","guys","whitebox","blackbox"]
2021-07-21T13:22:59-04:00 DBG adding ignorefile file=.gitignore
2021-07-21T13:22:59-04:00 DBG adding ignorefile file=.wokeignore
2021-07-21T13:22:59-04:00 DBG adding ignorefile file=.git/info/exclude
2021-07-21T13:22:59-04:00 DBG finished compiling ignores durationMS=0.760226
2021-07-21T13:22:59-04:00 DBG created new printer printer=text
2021-07-21T13:22:59-04:00 DBG process files path=blah.txt type=parallel
2021-07-21T13:22:59-04:00 DBG ignoring via in-line file=blah.txt line=1 rule=master-slave
2021-07-21T13:22:59-04:00 DBG finished processing findings durationMS=0.325451 file=blah.txt
panic: runtime error: slice bounds out of range [:103] with length 47

goroutine 34 [running]:
github.com/get-woke/woke/pkg/result.FindResults(0xc0001295e0, 0x7ffeefbff3af, 0x8, 0xc000226000, 0x2f, 0x1, 0x0, 0x0, 0x0)
    /Users/nkrichevsky/Documents/code/woke/pkg/result/lineresult.go:53 +0x445
github.com/get-woke/woke/pkg/parser.(*Parser).generateFileFindings(0xc0001451d0, 0xc00020e000, 0x0, 0x0, 0x0)
    /Users/nkrichevsky/Documents/code/woke/pkg/parser/findings.go:73 +0x5a5
github.com/get-woke/woke/pkg/parser.(*Parser).generateFileFindingsFromFilename(0xc0001451d0, 0x7ffeefbff3af, 0x8, 0x0, 0x0, 0x0)
    /Users/nkrichevsky/Documents/code/woke/pkg/parser/findings.go:23 +0xcf
github.com/get-woke/woke/pkg/parser.(*Parser).processFiles.func1(0xc000168c40, 0xc0001451d0, 0x7ffeefbff3af, 0x8)
    /Users/nkrichevsky/Documents/code/woke/pkg/parser/parser.go:91 +0x6b
created by github.com/get-woke/woke/pkg/parser.(*Parser).processFiles
    /Users/nkrichevsky/Documents/code/woke/pkg/parser/parser.go:88 +0x9e

Woke fails to work with word boundary on file names

Please see PR #93 for my submission of a fix for this issue. As the title says, although word boundaries are supported in options, they do not currently effect matching on filenames. Also created an issue in addition to the PR to include the detailed info below:

Thanks so much for this excellent tool!

  • [ X ] Yes, I've searched similar issues on GitHub and didn't find any.
  • [ X ] Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of woke
$ woke --version
woke version 0.9.1
Config file
$ cat .woke.yml
rules:
  - name: master
    terms:
      - master
    alternatives:
      - main
      - original
      - source
      - primary
      - coordinator
    options:
      word_boundary: true
  - name: slave
    terms:
      - slave
    alternatives:
      - follower
      - replica
      - standby
      - agent
      - secondary
Go environment
$ go version && go env
go version go1.16.2 linux/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/cognitivegears/.cache/go-build"
GOENV="/home/cognitivegears/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/cognitivegears/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/cognitivegears/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.16"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.16/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.16.2"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1570773687=/tmp/go-build -gno-record-gcc-switches"
Verbose output of running
โฏ woke --debug master.txt
2021-07-02T14:46:19-05:00 DBG woke version 0.9.1 built from 0dc3fe3 on 2021-06-20T17:59:32Z
2021-07-02T14:46:19-05:00 DBG loaded config file config=/home/cognitivegears/.woke.yaml
2021-07-02T14:46:19-05:00 DBG rules enabled rules=["master","slave","whitelist","blacklist","master-slave","grandfathered","man-hours","sanity","dummy","guys","whitebox","blackbox"]
2021-07-02T14:46:19-05:00 DBG skipping ignorefile error="open .gitignore: no such file or directory" file=.gitignore
2021-07-02T14:46:19-05:00 DBG skipping ignorefile error="open .wokeignore: no such file or directory" file=.wokeignore
2021-07-02T14:46:19-05:00 DBG finished compiling ignores durationMS=0.10426
2021-07-02T14:46:19-05:00 DBG created new printer printer=text
2021-07-02T14:46:19-05:00 DBG process files path=master.txt type=parallel
2021-07-02T14:46:19-05:00 DBG skipping content file=master.txt reason="file is empty"
2021-07-02T14:46:19-05:00 DBG finished processing violations durationMS=0.133699 file=master.txt
master.txt:1:1-1: Filename violation: `master` may be insensitive, use `main`, `original`, `source`, `primary`, `coordinator` instead (error)
2021-07-02T14:46:19-05:00 DBG woke completed durationMS=0.662836
๏…ผ ๏ผ ~/Documents/projects ยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยทยท
โฏ woke --debug mastertest.txt 
2021-07-02T14:46:28-05:00 DBG woke version 0.9.1 built from 0dc3fe3 on 2021-06-20T17:59:32Z
2021-07-02T14:46:28-05:00 DBG loaded config file config=/home/cognitivegears/.woke.yaml
2021-07-02T14:46:28-05:00 DBG rules enabled rules=["master","slave","whitelist","blacklist","master-slave","grandfathered","man-hours","sanity","dummy","guys","whitebox","blackbox"]
2021-07-02T14:46:28-05:00 DBG skipping ignorefile error="open .gitignore: no such file or directory" file=.gitignore
2021-07-02T14:46:28-05:00 DBG skipping ignorefile error="open .wokeignore: no such file or directory" file=.wokeignore
2021-07-02T14:46:28-05:00 DBG finished compiling ignores durationMS=0.11655
2021-07-02T14:46:28-05:00 DBG created new printer printer=text
2021-07-02T14:46:28-05:00 DBG process files path=mastertest.txt type=parallel
2021-07-02T14:46:28-05:00 DBG skipping content file=mastertest.txt reason="file is empty"
2021-07-02T14:46:28-05:00 DBG finished processing violations durationMS=0.071979 file=mastertest.txt
mastertest.txt:1:1-1: Filename violation: `mastertest` may be insensitive, use `main`, `original`, `source`, `primary`, `coordinator` instead (error)
2021-07-02T14:46:28-05:00 DBG woke completed durationMS=0.688194

Support defining and merging multiple configs

Is your feature request related to a problem? Please describe.

Woke only lets you define a single config file. It should support defining and merging multiple config, especially now that there is support for defining remote configs.

Describe the solution you'd like
woke -c https://example.com/config1.yaml -c https://example.com/config2.yaml -c local.yaml where all three configs are merged

Describe alternatives you've considered

Additional context
This will open up a lot of options for community-driven rule sets and allowing users to pick and choose which rules they want easily by choosing from an array of different configs. This will also enhance the "exclude category" feature even further #121 (comment)

SonarQube output format startColumn needs to be zero based

Thank you for creating the issue!

  • [x ] Yes, I've searched similar issues on GitHub and didn't find any.
  • [x ] Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of woke

0.15.0, 0.15.1, 0.16.1

Config file

default config

Go environment
$ go version && go env
# paste output here
Verbose output of running

Woke generated an issue report that has the same value of 'startColumn' and 'endColumn' (both with a value of 1) when there is only one column (ie. file name, java package name)

{
"issues":[
{
"engineId":"woke",
"ruleId":"dummy",
"primaryLocation":{
"message":"Filename finding: dummy may be insensitive, use placeholder, sample instead",
"filePath":"src/main/java/com/testco/pocproject/dummy",
"textRange":{
"startLine":1,
"startColumn":1,
"endColumn":1
}
},
"type":"CODE_SMELL",
"severity":"MAJOR"
},

......

]
}

SonarQube throws the following runtime error when trying to import the above issue format:

ERROR: Error during SonarScanner execution
java.lang.IllegalArgumentException: Start pointer [line=1, lineOffset=1] should be before end pointer [line=1, lineOffset=1]

SonarQube documentation shows the startColumn field as zero based https://docs.sonarqube.org/latest/analysis/generic-issue/

The Hadolint project has had a similar issue eg. hadolint/hadolint#658

Are you using woke? Let us know!!!

Is your organization using woke? Is your open source project using it to ensure inclusive language from contributors? If so, we'd love to know!

As more and more companies and projects commit to inclusive language, the effect of this public commitment turns viral, which means inclusivity will expand further and further. That's the goal!

We'd love to know if you're using woke. Either comment on this ticket and we'll add you to our list in https://docs.getwoke.tech/about/#who-uses-woke, or open a PR yourself (https://github.com/get-woke/woke/blob/main/docs/about.md)!

`--no-ignore` does not include inline ignored violations

--no-ignore should report inline ignored violations in addition to violations in ignored files.

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of woke
$ woke --version
0.5.0
Config file

N/A; this bug is reproducible using default rules.

Go environment

N/A; this bug is reproducible in any environment.

Verbose output of running
$ cat foo
Hey, check out this whitelist! // wokeignore:rule=whitelist
$ woke --debug --no-ignore
2021-03-04T19:24:22-08:00 DBG woke version 0.5.0 built from 8917e8e on 2021-02-10T02:07:06Z
2021-03-04T19:24:22-08:00 DBG rules enabled rules=["blackbox","blacklist","dummy","grandfathered","guys","man-hours","master-slave","sanity","slave","whitebox","whitelist"]
2021-03-04T19:24:22-08:00 DBG created new printer printer=text
2021-03-04T19:24:22-08:00 DBG process files path=. type=parallel
2021-03-04T19:24:22-08:00 DBG skipping file=. reason="file is a directory"
2021-03-04T19:24:22-08:00 DBG ignoring via in-line file=foo line=1 rule=whitelist
2021-03-04T19:24:22-08:00 DBG finished processing violations durationMS=0.38887 file=foo
No violations found. Stay woke โœŠ
2021-03-04T19:24:22-08:00 DBG woke completed durationMS=1.493173
$ woke --debug
2021-03-04T19:24:29-08:00 DBG woke version 0.5.0 built from 8917e8e on 2021-02-10T02:07:06Z
2021-03-04T19:24:29-08:00 DBG rules enabled rules=["blackbox","blacklist","dummy","grandfathered","guys","man-hours","master-slave","sanity","slave","whitebox","whitelist"]
2021-03-04T19:24:29-08:00 DBG skipping ignorefile error="open .gitignore: no such file or directory" file=.gitignore
2021-03-04T19:24:29-08:00 DBG skipping ignorefile error="open .wokeignore: no such file or directory" file=.wokeignore
2021-03-04T19:24:29-08:00 DBG finished compiling ignores durationMS=0.080036
2021-03-04T19:24:29-08:00 DBG created new printer printer=text
2021-03-04T19:24:29-08:00 DBG process files path=. type=parallel
2021-03-04T19:24:29-08:00 DBG skipping file=. reason="file is a directory"
2021-03-04T19:24:29-08:00 DBG ignoring via in-line file=foo line=1 rule=whitelist
2021-03-04T19:24:29-08:00 DBG finished processing violations durationMS=0.174957 file=foo
No violations found. Stay woke โœŠ
2021-03-04T19:24:29-08:00 DBG woke completed durationMS=1.112633

Woke rules are applied to wokeignore comments

wokeignore:rule=master-slave causes the slave rule to fail. This can be worked around by using wokeignore:rule=master-slave,slave instead, but I don't think that should be necessary.

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of woke
$ woke --version
# woke version 0.4.0
Config file
$ cat .woke.yml
# cat: .woke.yml: No such file or directory
Go environment
$ go version && go env
# go: command not found
Verbose output of running
$ woke --debug README.md
2020-11-10T12:54:08-05:00 DBG woke version 0.4.0 built from 038d4dd on 2020-10-29T02:30:44Z
2020-11-10T12:54:08-05:00 DBG tried default config file error="stat .woke.yaml: no such file or directory" cfg=.woke.yaml
2020-11-10T12:54:08-05:00 DBG tried default config file error="stat .woke.yml: no such file or directory" cfg=.woke.yml
2020-11-10T12:54:08-05:00 DBG rules enabled rules=["blackbox","blacklist","dummy","grandfathered","guys","man-hours","master-slave","sanity","slave","whitebox","whitelist"]
2020-11-10T12:54:08-05:00 DBG adding ignorefile file=.gitignore
2020-11-10T12:54:08-05:00 DBG skipping ignorefile error="open .wokeignore: no such file or directory" file=.wokeignore
2020-11-10T12:54:08-05:00 DBG finished compiling ignores durationMS=0.778501
2020-11-10T12:54:08-05:00 DBG created new printer printer=text
2020-11-10T12:54:08-05:00 DBG process files path=README.md type=parallel
2020-11-10T12:54:08-05:00 DBG ignoring via in-line file=README.md line=349 rule=master-slave
2020-11-10T12:54:08-05:00 DBG finished generateFileViolations durationMS=5.644912 file=README.md
README.md:349:114-119: `slave` may be insensitive, use `follower`, `replica`, `standby` instead (error)
master <!-- wokeignore:rule=master-slave -->
                                                                                                                  ^
2020-11-10T12:54:08-05:00 DBG woke completed durationMS=8.229421

Use dynamic OS-detected path separator in place of literal OS-specific separator

Link to original issue on forked repo: inclusive-dev-tools#11

Problem Statement

In the C:\_wrk\inclusive-dev-tools\woke\pkg\ignore\ignore_test.go file, run-time detection of the host OS is used to permit the tests to run/pass cross-platform as shown in the following excerpt:

	assert.False(t, i.Match("not/foo"))
	assert.True(t, i.Match("my/files/file1"))
	assert.False(t, i.Match("my/files"))

	if runtime.GOOS == "windows" {
		assert.False(t, i.Match(`not\foo`))
		assert.True(t, i.Match(`my\files\file1`))
		assert.False(t, i.Match(`my\files`))
	}

Long-term maintainability of the test could be improved by expressing the test paths not as string-literals differing only by their path-separator character but instead leveraging os.PathSeparator (from the os package) and filepath (from the path/filepath package). See https://stackoverflow.com/questions/9371031/how-do-i-create-crossplatform-file-paths-in-go for guidance.

Acceptance Criteria

  • ignore_test.go updated to use the dynamically-interpreted path-separator character in lieu of explicit "/" or "\"

Don't match word appearing as substring in a SHA digest

By chance a SHA digest in a package-lock.json contains GUys:

"integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",

This causes:

package-lock.json:14330:73-77: `GUys` may be insensitive, use `folks`, `people`, `you all`, `y'all`, `yinz` instead (error)

Probably safe to ignore package-lock.json since it's machine generated, but I wanted to open an issue because I think more broadly any SHA digest should be ignored.


  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Please include the following information:

Version of woke
$ woke --version
woke version 0.6.0
Config file

None.

Go environment
$ go version && go env
go version go1.12.4 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/dave/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/dave/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.4/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/5v/r0rk_88d79d875w1f0hm79vw0000gn/T/go-build642673482=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
$ woke --debug package-lock.json 
2021-03-08T13:31:37-07:00 DBG woke version 0.6.0 built from e33a005 on 2021-03-06T17:55:41Z
2021-03-08T13:31:37-07:00 DBG rules enabled rules=["blackbox","blacklist","dummy","grandfathered","guys","man-hours","master-slave","sanity","slave","whitebox","whitelist"]
2021-03-08T13:31:37-07:00 DBG adding ignorefile file=.gitignore
2021-03-08T13:31:37-07:00 DBG skipping ignorefile error="open .wokeignore: no such file or directory" file=.wokeignore
2021-03-08T13:31:37-07:00 DBG finished compiling ignores durationMS=0.511466
2021-03-08T13:31:37-07:00 DBG created new printer printer=text
2021-03-08T13:31:37-07:00 DBG process files path=package-lock.json type=parallel
2021-03-08T13:31:37-07:00 DBG finished processing violations durationMS=356.550554 file=package-lock.json
package-lock.json:14330:73-77: `GUys` may be insensitive, use `folks`, `people`, `you all`, `y'all`, `yinz` instead (error)
      "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",
                                                                         ^
2021-03-08T13:31:37-07:00 DBG woke completed durationMS=357.904338

Fix replacement suggestions for blacklist / whitelist

It is apparent that this project has fallen under an inconsiderate paradigm in regards to the replacement of "blacklist" / "whitelist" terminology. Replacements such as "allowlist" are not viable unfortunately.

This is not the only organization, of course, so no blame is on the developers. I am part of a group of people seeking to spread awareness on this :)

For more information, see:

Thank you in advance for your time.

v0.10.0/1 is case sensitive

Thank you for creating the issue!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

woke misses a significant amount of matches in the current version due to it now being case sensitive. I believe the change from (?i)(%s) to (%s) in 2812f30 is to blame.

$ cat blah.txt
MASTER-SLAVE
$ ./woke blah.txt
No findings found.

Please include the following information:

Version of woke
$ go run main.go --version
woke version main (it's v0.10.1)
Config file

Default

Go environment
$ go version && go env
go version go1.16.5 darwin/amd64
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/nkrichevsky/Library/Caches/go-build"
GOENV="/Users/nkrichevsky/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/nkrichevsky/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/nkrichevsky/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.16.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.16.5/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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/gj/6g23qq697ddc5mx6ry8ypdy80000gp/T/go-build2259988605=/tmp/go-build -gno-record-gcc-switches -fno-common"
Verbose output of running
./woke --debug blah.txt
2021-07-21T13:14:30-04:00 DBG woke version main built from 000000 on today
2021-07-21T13:14:30-04:00 DBG rules enabled rules=["whitelist","blacklist","master-slave","slave","grandfathered","man-hours","sanity","dummy","guys","whitebox","blackbox"]
2021-07-21T13:14:30-04:00 DBG adding ignorefile file=.gitignore
2021-07-21T13:14:30-04:00 DBG adding ignorefile file=.wokeignore
2021-07-21T13:14:30-04:00 DBG adding ignorefile file=.git/info/exclude
2021-07-21T13:14:30-04:00 DBG finished compiling ignores durationMS=1.544947
2021-07-21T13:14:30-04:00 DBG created new printer printer=text
2021-07-21T13:14:30-04:00 DBG process files path=blah.txt type=parallel
2021-07-21T13:14:30-04:00 DBG finished processing findings durationMS=0.14475 file=blah.txt
No findings found.
2021-07-21T13:14:30-04:00 DBG woke completed durationMS=2.35715

Installer script doesn't understand `linux/arm64`

Thank you for creating the issue!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).

Inside an Alpine Linux Docker container running on my M1-based Mac, I am trying to install Woke. From my Dockerfile:

RUN curl -sSLf https://git.io/getwoke | bash -s -- -b /usr/local/bin

I receive the following error during docker build:

get-woke/woke crit platform linux/arm64 is not supported. Make sure this script is up-to-date and file request at https://github.com/get-woke/woke/issues/new

Looks like the installer script doesn't understand linux/arm64, even though you publish the packages in the releases.

Feature Request: Woke understanding projects / .wokeignore etc

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

When trying to scan complex or multiple projects, it would be nice to be able to specify ignored files at a subdirectory level rather than just at the root directory. Also, it isn't possible to run woke from a subdirectory and still use the project .wokeignore. i.e. if you change directory into a subdirectory, then run "woke .." it runs for the parent directory but uses the .wokeignore from the subdirectory (or none if the subdirectory doesn't have it)

Describe the solution you'd like
A clear and concise description of what you want to happen.

Woke should have the idea of a "project", using the SCM files (.git, etc) similar to how other similar text tools operate (ripgrep, the_silver_surfer/ag, etc.) This could then be used to pull project level .wokeignore files regardless of the current working directory. .wokeignore files for subdirectories should also be supported for complex projects or when running at a higher directory level for multiple projects at once.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

As an alternative, the project could just utilize .wokeignore for each current working directory, without the idea of a project. However, this would still limit executing from a subdirectory taking into account project level .wokeignore items, though it would likely be faster to implement.

Additional context
Add any other context or screenshots about the feature request here.

I'm trying to use woke against multiple projects at the same time. The workflow is more convenient to just run against the whole set and fix one a time rather than keep track of each project individually. Unfortunately, when I run at the higher level the project .wokeignore files are ignored. On the other hand, when I go into each project to fix something, I'd like to run woke in that directory to verify the fix, however it then ignores the higher level .wokeignore at the project level as well. I believe the proposal above would make that type of workflow easier and faster.

Thanks for the consideration!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.