summaryrefslogtreecommitdiffstats
path: root/.luacheckrc
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:55:53 +0000
commit3d0386f27ca66379acf50199e1d1298386eeeeb8 (patch)
treef87bd4a126b3a843858eb447e8fd5893c3ee3882 /.luacheckrc
parentInitial commit. (diff)
downloadknot-resolver-3d0386f27ca66379acf50199e1d1298386eeeeb8.tar.xz
knot-resolver-3d0386f27ca66379acf50199e1d1298386eeeeb8.zip
Adding upstream version 3.2.1.upstream/3.2.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--.luacheckrc83
1 files changed, 83 insertions, 0 deletions
diff --git a/.luacheckrc b/.luacheckrc
new file mode 100644
index 0000000..992011f
--- /dev/null
+++ b/.luacheckrc
@@ -0,0 +1,83 @@
+std = 'luajit'
+new_read_globals = {
+ 'help',
+ 'quit',
+ 'hostname',
+ 'package_version',
+ 'moduledir',
+ 'user',
+ 'verbose',
+ 'resolve',
+ 'tojson',
+ 'todname',
+ 'map',
+ 'net',
+ 'cache',
+ 'modules',
+ 'trust_anchors',
+ 'worker',
+ 'event',
+ '_hint_root_file',
+ -- Sandbox declarations
+ 'kB',
+ 'MB',
+ 'GB',
+ 'sec',
+ 'second',
+ 'minute',
+ 'min',
+ 'hour',
+ 'day',
+ 'panic',
+ 'warn',
+ 'log',
+ 'mode',
+ 'trust_anchors',
+ 'reorder_RR',
+ 'option',
+ 'env',
+ 'kres',
+ 'trustanchor',
+ 'libknot_SONAME',
+ 'libzscanner_SONAME',
+ 'table_print',
+ '__engine',
+ '_ENV',
+ '_SANDBOX',
+}
+
+new_globals = {
+ -- Modules are allowed to be set and accessed from global namespace
+ 'policy',
+ 'view',
+ 'stats',
+ 'http',
+ 'trust_anchors',
+ 'bogus_log',
+}
+
+-- Luacheck < 0.18 doesn't support new_read_globals
+for _, v in ipairs(new_read_globals) do
+ table.insert(new_globals, v)
+end
+
+-- Ignore test files
+exclude_files = {
+ 'modules/policy/lua-aho-corasick', -- Vendored
+ 'tests/config/tapered',
+}
+
+-- Ignore some pedantic checks
+ignore = {
+ '4.1/err', -- Shadowing err
+ '4.1/.', -- Shadowing one letter variables
+}
+
+-- Sandbox can set global variables
+files['daemon/lua'].ignore = {'111', '121', '122'}
+files['daemon/lua/kres-gen.lua'].ignore = {'631'} -- Allow overly long lines
+-- Tests and scripts can use global variables
+files['scripts'].ignore = {'111', '112', '113'}
+files['tests'].ignore = {'111', '112', '113'}
+files['modules/**/*.test.lua'].ignore = {'111', '112', '113', '121', '122'}
+files['daemon/**/*.test.lua'].ignore = {'111', '112', '113', '121', '122'}