woke icon indicating copy to clipboard operation
woke copied to clipboard

Allow exclusion of terms in `.woke.yml`

Open jcraigk opened this issue 2 years ago • 6 comments

There does not appear to be a way to exclude terms that a project may use heavily due to the content it serves. For example, a codebase that deals with historical subject matter may include the term "slave" in direct reference to slavery itself, in a respectful way. Or another example: a project that includes references to works of art with sensitive terms in the art/music titles. It would be nice to have a way of specifically ignoring all mentions of these terms without having to add inline comments or ignore entire files/paths in .wokeignore. I do not see a way of doing that in .woke.yml either. Adding a directive like allowed_terms in .woke.yml would be useful.

jcraigk avatar Nov 06 '22 05:11 jcraigk

You can also create a custom set of rules and leave out the words you think are acceptable.

nicorikken avatar Feb 17 '23 06:02 nicorikken

You can also create a custom set of rules and leave out the words you think are acceptable.

How do you do that? How can I create a rule e.g. to reject "master" but allow "ControlMaster"?

richm avatar Feb 17 '23 14:02 richm

@richm by setting word_boundary_start: true https://docs.getwoke.tech/rules/

nicorikken avatar Feb 19 '23 09:02 nicorikken

@jcraigk With reference to the main question, the answer is already present in the documentation: https://docs.getwoke.tech/rules/#disabling-default-rules.

All the default rules can be found in https://github.com/get-woke/woke/blob/main/pkg/rule/default.yaml

You can either:

  1. disable some default rules (See https://docs.getwoke.tech/rules/#disabling-default-rules) or
  2. disable all default rules and create your own yaml file with custom rules Example: woke hello.txt --disable-default-rules --config example.yaml Reference: a. https://docs.getwoke.tech/rules/#disable-all-default-rules b. https://github.com/get-woke/woke/blob/main/example.yaml

Puneethgr avatar Feb 21 '23 06:02 Puneethgr

@Puneethgr thanks for the more elaborate writeup. The word_boundary_start: true option actually does work for the distinction between "master" and "ControlMaster" as the latter doesn't have a word boundary before "Master". If you for example would encounter "MasterController", then it would match and trigger an error.

nicorikken avatar Feb 21 '23 17:02 nicorikken

@nicorikken Oh yes, correct. My answer was for jcraigk's main question.

How can I create a rule e.g. to reject "master" but allow "ControlMaster"?

Your answer was for richm's comment question. I didn't see that.

Cool. Updated my older comment.

Puneethgr avatar Feb 22 '23 09:02 Puneethgr