Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to ignore some directory? #89

Closed
azzamsa opened this issue Jun 25, 2023 · 14 comments
Closed

How to ignore some directory? #89

azzamsa opened this issue Jun 25, 2023 · 14 comments

Comments

@azzamsa
Copy link

azzamsa commented Jun 25, 2023

Hi.

I want to ignore some directories because I tend to run kondo $HOME.

~ took 20s
❯ kondo $(\ls --ignore=opt/nodebin)
/var/home/azzamsa/opt/nodebin Node project (5 minutes ago)
  └─ node_modules (177.8MiB)
  delete above artifact directories? ([y]es, [n]o, [a]ll, [q]uit): ^C
  
❯ kondo $(exa --ignore-glob ~/opt/nodebin)
/var/home/azzamsa/opt/nodebin Node project (6 minutes ago)
  └─ node_modules (177.8MiB)
  delete above artifact directories? ([y]es, [n]o, [a]ll, [q]uit): n
Projects cleaned: 0, Bytes deleted: 0.0B

Nothing works.

Any suggestions?

Thanks! ❤️

@tbillington
Copy link
Owner

I haven't put much thought into ignoring directories.

Is opt/nodebin part of your gitignore? It would be possible to modify kondo so that it respects gitignore when searching.

@tbillington
Copy link
Owner

Kondo will search recursively down each directory you provide it, so if opt is shown even if opt/nodebin is excluded, it will be found through opt, hope that makes sense.

@azzamsa
Copy link
Author

azzamsa commented Jun 25, 2023

It means no mechanism to tell kondo what directory to ignore?

@tbillington
Copy link
Owner

Not yet, but it could be added. Do you usually exclude directories by their exact path, or by glob?

How many directories do you exclude on average when you run kondo?

@azzamsa
Copy link
Author

azzamsa commented Jun 26, 2023

How many directories do you exclude on average when you run kondo?

one, it contains all language server installed through npm.

Not yet, but it could be added. Do you usually exclude directories by their exact path, or by glob?

So far, it is path.

@tbillington
Copy link
Owner

It would be possible to add an ignore argument, would something like this work? Then you wouldn't need to manually list the directories via ls/exa.

kondo --ignore-dir opt/nodebin

Just curious, do you often do any other kind of filtering/preprocessing before passing the directory list to kondo?

@azzamsa
Copy link
Author

azzamsa commented Jun 27, 2023

Just curious, do you often do any other kind of filtering/preprocessing before passing the directory list to Kondo?

I run Kondo once a week, and the only directory in kondo $HOME that I want to ignore is just one. So, previously, I just answer n to the interactive prompt.

@tbillington
Copy link
Owner

Do you also use the date filter?

@tbillington
Copy link
Owner

tbillington commented Jul 3, 2023

@azzamsa could you try this branch (https://github.com/tbillington/kondo/tree/ignore-dirs) and see if it handles your use-case ? thank you :)

#90

@Aziks0
Copy link

Aziks0 commented Jul 4, 2023

I had the same suggestion, and #90 works perfectly! @tbillington

@tbillington
Copy link
Owner

Okay, thanks @Aziks0 , I'll merge it. Let me know if you have any issue :)

@tbillington
Copy link
Owner

I'll close this issue for now.

@azzamsa
Copy link
Author

azzamsa commented Jul 5, 2023

kondo . --ignored-dirs opt/nodebin/ works like a charm! 🎉

@tbillington
Copy link
Owner

Thanks for confirming @azzamsa :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants