.luacheckrc 1.46 KB
Newer Older
1 2
std = 'luajit'
new_read_globals = {
3 4
	'cache',
	'event',
5
	'help',
6
	'_hint_root_file',
7 8 9
	'hostname',
	'map',
	'modules',
10 11 12 13
	'net',
	'package_version',
	'quit',
	'resolve',
14
	'ta_update',
15 16 17 18
	'todname',
	'tojson',
	'user',
	'verbose',
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
	'worker',
	-- Sandbox declarations
	'kB',
	'MB',
	'GB',
	'sec',
	'second',
	'minute',
	'min',
	'hour',
	'day',
	'panic',
	'warn',
	'log',
	'mode',
	'reorder_RR',
	'option',
	'env',
	'kres',
	'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',
52
	'trust_anchors',
53
	'bogus_log',
54 55 56 57 58 59 60 61 62 63
}

-- 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
64
	'tests/config/tapered',
65 66 67 68 69 70 71 72 73
}

-- Ignore some pedantic checks
ignore = {
	'4.1/err', -- Shadowing err
	'4.1/.',   -- Shadowing one letter variables
}

-- Sandbox can set global variables
Tomas Krizek's avatar
Tomas Krizek committed
74 75
files['**/daemon/lua'].ignore = {'111', '121', '122'}
files['**/daemon/lua/kres-gen.lua'].ignore = {'631'} -- Allow overly long lines
76 77
-- Tests and scripts can use global variables
files['scripts'].ignore = {'111', '112', '113'}
78
files['tests'].ignore = {'111', '112', '113'}
Tomas Krizek's avatar
Tomas Krizek committed
79 80
files['**/modules/**/*.test.lua'].ignore = {'111', '112', '113', '121', '122'}
files['**/daemon/**/*.test.lua'].ignore = {'111', '112', '113', '121', '122'}