CFLint icon indicating copy to clipboard operation
CFLint copied to clipboard

Implement scanning exclude mechanism on folder level

Open TheRealAgentK opened this issue 6 years ago • 15 comments

.cflintrc can block out linting on certain dirs by not including any rules.

But there should be a mechanism to block CFLint from even going into certain directories. An example would be huge asset structures with 1000s of files or subdirectories. No need to scan all those files for the supported extensions if the user already knows this is a waste of time and CPU resources.

TheRealAgentK avatar Jan 02 '18 23:01 TheRealAgentK

Can we have a discussion if this is useful and how we'd support it, @KamasamaK @ryaneberly ?

TheRealAgentK avatar Jan 02 '18 23:01 TheRealAgentK

Agreed. Could we simply ignore all 'hidden' folders by default (folders that start with a period)?

ryaneberly avatar Jan 03 '18 00:01 ryaneberly

Yeah, I think that's even better than my solution with .git, .hg and .svn. CFLint has no business in those kind of folders.

TheRealAgentK avatar Jan 03 '18 00:01 TheRealAgentK

What about something in the vein of .gitignore, .eslintignore, .tslintignore, etc. that allows ignoring globs?

KamasamaK avatar Jan 03 '18 01:01 KamasamaK

Basically the file would (have to) live in your "scanning root" ?

TheRealAgentK avatar Jan 03 '18 01:01 TheRealAgentK

Yes, that would be the idea. I suppose it could also be a command line argument if you wanted to use one from another location.

KamasamaK avatar Jan 03 '18 01:01 KamasamaK

I'd be fine with a single file in the scanning root. What I wouldn't want to have to support (I think git/hg can do that) at this stage is nested .cflintignore files and building a precedence chain and complications around that.

TheRealAgentK avatar Jan 03 '18 01:01 TheRealAgentK

That seems fine. .eslintignore is handled that way.

KamasamaK avatar Jan 03 '18 01:01 KamasamaK

eslint uses the parameter --no-ignore to disable the ignore. For simpilicity we could hardcode out all .folders and support that parm. .cflintignore could be a future enhancement

ryaneberly avatar Jan 03 '18 02:01 ryaneberly

I would go along the lines of @KamasamaK that if there is a .gitignore read it and ignore its patterns, almost all the time this file dictates code that is not in your source control (dependencies, libraries, etc). This is a big start. The next one is a configuration param in the current .cflintrc Why not include another key for folder/file patterns to ignore.

lmajano avatar Feb 15 '18 20:02 lmajano

This would be great. VS Code crawls every time i do a box install as it scans everything again :(

gpickin avatar May 17 '18 18:05 gpickin

@TheRealAgentK I think I have a prototype working. Borrowed the .gitignore parser from jgit.
https://github.com/cflint/CFLint/commit/073a4b92284bca49181cb42b2b5f7e4a8ae009f0

ryaneberly avatar Sep 14 '19 01:09 ryaneberly

moving to 1.6.0

ryaneberly avatar Sep 15 '19 04:09 ryaneberly

Having a .cflintingnore file would be awesome! I am trying to find a way to just ignore one file (that has includes that everyone includes so parsing crawls) would be awesome.

cybersonic avatar Jan 23 '20 12:01 cybersonic

@cybersonic If you're using Sublime Text, it's possible to get tricky with the exclude patterns. I did a bit of an exploration to see if I could make SublimeLinter call CFLint only when wanted. https://www.youtube.com/watch?v=rl44og2sblE&t=2s

jlamoree avatar Jan 23 '20 13:01 jlamoree