get-woke / woke

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

Question: Is there a way to allow "ansible-test sanity" but disallow "sanity"? #234

Open richm opened 2 years ago

richm commented 2 years ago

The ansible-test sanity command is used in some places in our code. I would like to configure woke to allow the string ansible-test sanity, but have an error anywhere else the string sanity is used.

github-actions[bot] commented 2 years ago

👋 Thanks for submitting your first issue!

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

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

richm commented 2 years ago

Another question - Can woke scan for filenames? I don't mean the contents of files, I mean the names of files and directories? For example, ansible-test sanity requires the project to have a directory named tests/sanity/. I would like to be able to scan for problematic file/directory names, and have rules to allow certain ones (like tests/sanity/).

richm commented 2 years ago

The ansible-test sanity command is used in some places in our code. I would like to configure woke to allow the string ansible-test sanity, but have an error anywhere else the string sanity is used.

It doesn't look like woke supports this. In our case, I think we can use # wokeignore:rule=sanity judiciously.

caitlinelfring commented 2 years ago

Woke doesn't support if word == "sanity" then true; except if word == "ansible-test sanity"; then false, but there's an open PR to allow full customization via regex - https://github.com/get-woke/woke/pull/133, if you could figure out a way to get regex to work for your use-case, then maybe. But otherwise, ignoring is the way to go

Yes, woke does scan filenames and shows it as a finding at line/start column/end column of 1