Skip to content

Commit 687fbc9

Browse files
committed
Update docs for glob-based option overrides
1 parent 00b4d99 commit 687fbc9

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

docsrc/config.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,27 +89,27 @@ Additionally, custom sets can be given names by mutating global ``stds`` variabl
8989
Per-file and per-path overrides
9090
-------------------------------
9191

92-
The environment in which ``luacheck`` loads the config contains a special global ``files``. When checking a file ``<path>``, ``luacheck`` will override options from the main config with entries from ``files[<path>]`` and ``files[<parent_path>]``, applying entries for shorter paths first. For example, the following config re-enables detection of unused arguments only for files in ``src/dir``, but not for ``src/dir/myfile.lua``, and allows using `Busted <http://olivinelabs.com/busted/>`_ globals within ``spec/``:
92+
The environment in which ``luacheck`` loads the config contains a special global ``files``. When checking a file ``<path>``, ``luacheck`` will override options from the main config with entries from ``files[<glob>]`` if ``<glob>`` matches ``<path>``, applying entries for more general globs first. For example, the following config re-enables detection of unused arguments only for files in ``src/dir``, but not for files ending with ``_special.lua``, and allows using `Busted <http://olivinelabs.com/busted/>`_ globals within ``spec/``:
9393

9494
.. code-block:: lua
9595
:linenos:
9696
9797
std = "min"
9898
ignore = {"212"}
9999
files["src/dir"] = {enable = {"212"}}
100-
files["src/dir/myfile.lua"] = {ignore = {"212"}}
100+
files["src/dir/**/*_special.lua"] = {ignore = {"212"}}
101101
files["spec"] = {std = "+busted"}
102102
103103
Note that ``files`` table supports autovivification, so that
104104

105105
.. code-block:: lua
106106
107-
files["myfile.lua"].ignore = {"212"}
107+
files["src/dir"].enable = {"212"}
108108
109109
and
110110

111111
.. code-block:: lua
112112
113-
files["myfile.lua"] = {ignore = {"212"}}
113+
files["src/dir"] = {enable = {"212"}}
114114
115115
are equivalent.

0 commit comments

Comments
 (0)