ls-lint icon indicating copy to clipboard operation
ls-lint copied to clipboard

Add glob support to ignores

Open hanneskaeufler opened this issue 3 years ago • 5 comments

As is on the v2 wishlist and was mentioned in https://github.com/loeffel-io/ls-lint/issues/35 and https://github.com/loeffel-io/ls-lint/issues/56#issuecomment-909418833, globbing is currently not allowed for the ignore key.

This is a first try at implementing this.

  • [x] Performance implications?
  • [ ] Documentation?
  • [ ] Haven't found a changelog

Performance

All measurements done on an 2020 M1 MacBook Air with 8GB of ram. Using hyperfine, I ran hyperfine './ls-lint' with the current local build of ls-lint as well as with master. I did a couple variations, based on the example config:

build config result
this branch with node_modules in ignore Time (mean ± σ): 16.0 ms ± 0.8 ms [User: 7.4 ms, System: 8.7 ms]
this branch with '**/node_modules' in ignore Time (mean ± σ): 282.4 ms ± 21.8 ms [User: 71.7 ms, System: 210.1 ms]
master with node_module in ignore Time (mean ± σ): 15.9 ms ± 0.7 ms [User: 7.3 ms, System: 8.7 ms]

This kind of confirms what makes some sense: If you use a glob in ignores, depending on the size of your project, you pay a significant penalty in performance. If you don't use any globs, you don't pay measurably.

hanneskaeufler avatar May 28 '22 16:05 hanneskaeufler

Codecov Report

Merging #76 (901d6e1) into master (3d00746) will increase coverage by 1.05%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #76      +/-   ##
==========================================
+ Coverage   66.89%   67.94%   +1.05%     
==========================================
  Files          13       13              
  Lines         441      443       +2     
==========================================
+ Hits          295      301       +6     
+ Misses        129      127       -2     
+ Partials       17       15       -2     
Impacted Files Coverage Δ
config.go 76.19% <100.00%> (+2.38%) :arrow_up:
linter.go 74.10% <100.00%> (+2.28%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3d00746...901d6e1. Read the comment docs.

codecov-commenter avatar May 28 '22 16:05 codecov-commenter

Great! Thanks for the PR! I am currently on vacation and get back to you asap

loeffel-io avatar May 29 '22 16:05 loeffel-io

Gentle ping @loeffel-io, just wanted to make sure that you didn't forget about this PR 😅

RaisinTen avatar Jul 14 '22 13:07 RaisinTen

What's the status on this? Feels very high priority.

MagnusHJensen avatar Aug 01 '22 10:08 MagnusHJensen

@loeffel-io friendly ping :) Anything I can do to move this along? Thanks!

hanneskaeufler avatar Sep 03 '22 20:09 hanneskaeufler

Would be great to get this merged and published. There doesn't seem to be a good way to ignore certain folder names in arbitrary locations in a repo. I have a monorepo with multiple tests folders that I would like to ignore.

GeorgeTaveras1231 avatar Oct 07 '22 14:10 GeorgeTaveras1231

Hey folks,

sorry that this takes so long - the support will come! This will come together with https://github.com/github/super-linter/issues/2505#issuecomment-1263886322 as soon i have enough mind capacity

loeffel-io avatar Oct 07 '22 16:10 loeffel-io

@loeffel-io Is there anything we can do to help get this merged? Seems like it has been stale for a bit.

ProjectBarks avatar Dec 27 '22 20:12 ProjectBarks

ping from here as well; I need glob support in the ignore section for my monorepo 🙏🏻

dror-weiss avatar Mar 18 '23 07:03 dror-weiss

no support for ignore globs is a show-stopper for me.

gbrandt1 avatar Apr 23 '23 10:04 gbrandt1

Very happy to announce that v2.0.0-beta.0 is now available: https://github.com/loeffel-io/ls-lint/releases/tag/v2.0.0-beta.0 Please see the changelog for any additional info: https://ls-lint.org/2.0/prologue/changelog.html#v2-0-0-beta

This feature (add glob support to ignores) is planned for v2.1 I will close this PR for now (there will be a new one)

loeffel-io avatar May 21 '23 23:05 loeffel-io

This is now supported with v2.1.0-beta.0 🎉 feel free to test it! more infos: https://github.com/loeffel-io/ls-lint/pull/119

loeffel-io avatar Jul 09 '23 20:07 loeffel-io