0

I have a project like this (in fact, there are more files and dirs):

.
├── src
│   ├── main.lua
│   └── smth.lua
└── tests
    ├── others
    │   ├── others_1.lua
    │   ├── others_2.lua
    │   └── others_3.lua
    ├── speed_tests
    │   ├── test1.lua
    │   └── test2.lua
    └── sql
        ├── join.lua
        └── select.lua

and I have such .luacheckrc:

include_files = {
    "**/*.lua"
}

exclude_files = {
    "tests/**/*.lua",
}

I want luacheck utility to check files in tests/sql directory, but not to touch other directories in tests/. Of course, I can explicitly write:

exclude_files = {
    "tests/others/*.lua",
    "tests/speed_tests/*.lua"
}

, but in real project there're 15+ dirs and it doesn't look good to do that.

How can I reach a goal elegantly?

A.Starshov
  • 39
  • 6
  • so you want to exclude a specific folder but you don't want to explicitly name it? how is luacheck supposed to know it then? – Piglet Oct 15 '20 at 11:13
  • no, if you are talking about `include_file { "tests/sql/*.lua}`, it will not work because files from this folder will match the pattern "tests/**/*.lua" in `exclude_file` – A.Starshov Oct 18 '20 at 14:52

1 Answers1

0

Don't use exclude then, only include dirs you wish to traverse.

include_files = {
    "src/*.lua",
    "tests/sql/*.lua"
}
Doyousketch2
  • 2,060
  • 1
  • 11
  • 11