forked from elonafoobar/elonafoobar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.luacheckrc
364 lines (346 loc) · 11.7 KB
/
.luacheckrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
-------------------------------------------------------------------------------
--[LICENSE]--
-------------------------------------------------------------------------------
-- .luacheckrc
-- This file is free and unencumbered software released into the public domain.
--
-- Anyone is free to copy, modify, publish, use, compile, sell, or
-- distribute this file, either in source code form or as a compiled
-- binary, for any purpose, commercial or non-commercial, and by any
-- means.
--
-- In jurisdictions that recognize copyright laws, the author or authors
-- of this file dedicate any and all copyright interest in the
-- software to the public domain. We make this dedication for the benefit
-- of the public at large and to the detriment of our heirs and
-- successors. We intend this dedication to be an overt act of
-- relinquishment in perpetuity of all present and future rights to this
-- software under copyright law.
--
-- THE FILE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-- IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-- OTHER DEALINGS IN THE SOFTWARE.
--
-- For more information, please refer to <http://unlicense.org/>
-- ]]
-------------------------------------------------------------------------------
--[.luacheckrc]
-------------------------------------------------------------------------------
-- Set up the the standards for this file.
files['.luacheckrc'] = {
std = 'lua52c',
globals = {'files', 'exclude_files', 'not_globals', 'stds', 'std', 'max_line_length', 'ignore', 'quiet', "max_cyclomatic_complexity", "codes"},
max_line_length = false --turn of line length warnings for this file
}
-------------------------------------------------------------------------------
--[Set Defaults]--
-------------------------------------------------------------------------------
local LINE_LENGTH = false
local IGNORE = {'21./%w+_$', '21./^_%w+$', '213/[ijk]', '213/index', '213/key'}
local NOT_GLOBALS = {'coroutine', 'socket', 'dofile', 'loadfile'}
local STD_ELONA = 'lua52c+elona+stdlib'
-------------------------------------------------------------------------------
--[Standards]--
-------------------------------------------------------------------------------
std = STD_ELONA
max_line_length = LINE_LENGTH
not_globals = NOT_GLOBALS
ignore = IGNORE
quiet = 1 -- pass -q option
max_cyclomatic_complexity = 75
codes = true
--List of files and directories to exclude
exclude_files = {
--Ignore special folders
'**/.*/*' --Ignore if path starts with .
}
-------------------------------------------------------------------------------
--[Base]--
-------------------------------------------------------------------------------
files['**/runtime/profile/_/mod'] = {std = STD_ELONA}
files['**/runtime/profile/_/mod/core'] = {std = "+core"}
files['**/runtime/profile/_/user/script/console.lua'] = {std = "+core+console"}
files['src/tests/lua/*.lua'] = {std = "+tests"}
files['src/tests/lua/classes/*.lua'] = {std = "+tests"}
files['src/tests/lua/support'] = {std = "+minctest"}
-------------------------------------------------------------------------------
--[STDS ELONA]--
-------------------------------------------------------------------------------
stds.elona = {
--Set the read only variables
read_globals = {
-- @data@: Data definition table.
data = {
fields = {
raw = {
other_fields = true,
read_only = true
},
by_legacy = {
other_fields = true,
read_only = true
},
types = {
other_fields = true,
read_only = true
},
"add", "add_multi", "define_type"
},
},
-- @Elona@: The core Elona API.
Elona = {
fields = {
"require",
Rand = {
fields = {
"rnd", "one_in", "coinflip"
},
},
Event = {
fields = {
"register", "unregister", "clear", "trigger",
EventKind = {
other_fields = true,
}
},
},
Chara = {
fields = {
"is_alive", "is_player", "is_ally", "player", "create"
},
},
Map = {
fields = {
"width", "height", "valid", "can_access", "bound_within", "random_pos", "set_tile", "set_tile_memory",
},
},
Pos = {
fields = {
"dist"
},
},
World = {
fields = {
"time"
},
},
Magic = {
fields = {
"cast"
},
},
Env = {
fields = {
"LUA_VERSION", "ELONA_VERSION", "ELONA_FOOBAR_VERSION", "MOD_API_VERSION"
},
},
FOV = {
fields = {
"los", "you_see"
},
},
Item = {
fields = {
"create"
},
},
Skill = {
fields = {
"level"
},
},
Trait = {
fields = {
"level", "min", "max", "set", "modify"
},
},
Input = {
fields = {
"yes_no", "prompt", "prompt_number", "prompt_text"
},
},
GUI = {
fields = {
"txt", "txt_color"
},
},
I18N = {
fields = {
"get", "get_optional", "get_enum", "get_enum_property", "get_enum_property_optional"
}
},
Debug = {
fields = {
"log", "dump_characters", "dump_items", "inspect"
}
},
ReadOnly = {
fields = {
"make_read_only"
}
},
Iter = {
fields = {
"rectangle_iter", "rectangle_iter_step"
}
},
Animation = {
fields = {
"play_failure_to_cast", "play_bright_aura", "play_breath", "play_ball_atomic_bomb", "play_ball_magic", "play_bolt", "play_throwing_object", "play_swarm", "play_ranged_attack", "play_melee_attack", "play_gene_engineering", "play_miracle", "play_meteor", "play_ragnarok", "play_breaking"
}
},
Registry = {
fields = {
"on_event",
"register_chara_init",
"register_map_init",
Data = {
read_only = false,
other_fields = true
}
}
},
Defines = {
fields = {
Enums = {},
Events = {
other_fields = true
},
}
},
}
},
-- @Store@: Mod-local data storage.
Store = {
fields = {
map_local = {
read_only = false,
other_fields = true
},
global = {
read_only = false,
other_fields = true
}
}
},
-- @LuaCharacter@
LuaCharacter = { other_fields = true },
LuaItem = { other_fields = true },
LuaPosition = { other_fields = true }
},
}
--(( core ))--
stds.core = {
globals = {
"_IS_TEST", "_LOADED", "pairs", "table",
Elona = {
fields = {
core = {
other_fields = true,
fields = stds.elona.read_globals.Elona.fields
}
}
}
}
}
--(( console ))--
stds.console = {
read_globals = {
"_LAST_RESULT"
}
}
for k, v in pairs(stds.elona.read_globals.Elona.fields) do
if type(v) == "table" then
stds.console.read_globals[k] = v
end
end
--(( stdlib extensions ))--
stds.stdlib = {
read_globals = {
table = {
fields = {
"find", "size"
},
},
},
}
--(( tests ))--
stds.tests = {
read_globals = {
"lrun", "lequal", "lfequal", "lok", "lresults",
Testing = {
fields = {
"start_in_debug_map", "reset_state", "load_translations"
},
}
},
}
--(( minctest ))--
stds.minctest = {
globals = stds.tests.read_globals
}
--[[
"ignore", "std", "globals", "unused_args", "self", "compat", "global", "unused", "redefined",
"unused_secondaries", "allow_defined", "allow_defined_top", "module",
"read_globals", "new_globals", "new_read_globals", "enable", "only", "not_globals",
"max_line_length", "max_code_line_length", "max_string_line_length", "max_comment_line_length",
"max_cyclomatic_complexity"
--]]
-- Warnings list
-- 011 A syntax error.
-- 021 An invalid inline option.
-- 022 An unpaired inline push directive.
-- 023 An unpaired inline pop directive.
-- 111 Setting an undefined global variable.
-- 112 Mutating an undefined global variable.
-- 113 Accessing an undefined global variable.
-- 121 Setting a read-only global variable.
-- 122 Setting a read-only field of a global variable.
-- 131 Unused implicitly defined global variable.
-- 142 Setting an undefined field of a global variable.
-- 143 Accessing an undefined field of a global variable.
-- 211 Unused local variable.
-- 212 Unused argument.
-- 213 Unused loop variable.
-- 221 Local variable is accessed but never set.
-- 231 Local variable is set but never accessed.
-- 232 An argument is set but never accessed.
-- 233 Loop variable is set but never accessed.
-- 241 Local variable is mutated but never accessed.
-- 311 Value assigned to a local variable is unused.
-- 312 Value of an argument is unused.
-- 313 Value of a loop variable is unused.
-- 314 Value of a field in a table literal is unused.
-- 321 Accessing uninitialized local variable.
-- 331 Value assigned to a local variable is mutated but never accessed.
-- 341 Mutating uninitialized local variable.
-- 411 Redefining a local variable.
-- 412 Redefining an argument.
-- 413 Redefining a loop variable.
-- 421 Shadowing a local variable.
-- 422 Shadowing an argument.
-- 423 Shadowing a loop variable.
-- 431 Shadowing an upvalue.
-- 432 Shadowing an upvalue argument.
-- 433 Shadowing an upvalue loop variable.
-- 511 Unreachable code.
-- 512 Loop can be executed at most once.
-- 521 Unused label.
-- 531 Left-hand side of an assignment is too short.
-- 532 Left-hand side of an assignment is too long.
-- 541 An empty do end block.
-- 542 An empty if branch.
-- 551 An empty statement.
-- 611 A line consists of nothing but whitespace.
-- 612 A line contains trailing whitespace.
-- 613 Trailing whitespace in a string.
-- 614 Trailing whitespace in a comment.
-- 621 Inconsistent indentation (SPACE followed by TAB).
-- 631 Line is too long.
-- Local Variables:
-- mode: lua
-- End: