get-woke / woke

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

Add flag to disable nested ignores #257

Open jeremydelacruz opened 1 year ago

jeremydelacruz commented 1 year ago

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...) Feature

What is the current behavior? Nested ignores are currently enabled by default, which has the potential to cause performance issues in very large repositories (even when they have no nested ignores). See issue #239 for more on this.

What is the new behavior (if this is a feature change)? As this is related to an already released feature, the safest bet is to add the following flag to opt-out: --disable-nested-ignores. This should match the original behavior of only checking for top-level ignore-files (i.e. nested ignore-files should no longer be considered when using this flag).

Does this PR introduce a breaking change? (What changes might users need to make due to this PR?) No

Other information: Another PR should follow this one, attempting to address the performance issues with nested ignores turned on.

Let me know your thoughts on this!

jeremydelacruz commented 1 year ago

Running the ignore benchmark with nested ignores enabled vs. disabled (with an increased scale for emphasis) gave me the following comparison: image

codecov[bot] commented 1 year ago

Codecov Report

Merging #257 (495c36a) into main (b92e612) will decrease coverage by 0.31%. The diff coverage is 78.57%.

@@            Coverage Diff             @@
##             main     #257      +/-   ##
==========================================
- Coverage   93.76%   93.45%   -0.32%     
==========================================
  Files          23       23              
  Lines         818      840      +22     
==========================================
+ Hits          767      785      +18     
- Misses         30       33       +3     
- Partials       21       22       +1     
Impacted Files Coverage Δ
pkg/ignore/ignore.go 84.37% <76.92%> (-1.68%) :arrow_down:
cmd/root.go 82.27% <100.00%> (+0.22%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.