aboutsummaryrefslogtreecommitdiffstats
path: root/.luacheckrc
blob: 1ca0d0df15bf3056e8962573f83e8c4d574bfccd (plain)
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
cache = true
unused_secondaries = false
codes = true
ignore = { "411/err", "421/err", "411/ok", "421/ok", "211/_ENV", "431/log", "143/table", "113/unpack" }

max_line_length = 150

read_globals = {
	"prosody",
	"import",
};
files["prosody"] = {
	allow_defined_top = true;
	module = true;
}
files["prosodyctl"] = {
	allow_defined_top = true;
	module = true;
};
files["core/"] = {
	globals = {
		"prosody.hosts.?",
	};
}
files["util/"] = {
	-- Ignore unwrapped license text
	max_comment_line_length = false;
}
files["plugins/"] = {
	module = true;
	allow_defined_top = true;
	read_globals = {
		-- Module instance
		"module.name",
		"module.host",
		"module._log",
		"module.log",
		"module.event_handlers",
		"module.reloading",
		"module.saved_state",
		"module.global",
		"module.path",

		-- Module API
		"module.add_extension",
		"module.add_feature",
		"module.add_identity",
		"module.add_item",
		"module.add_timer",
		"module.broadcast",
		"module.context",
		"module.depends",
		"module.fire_event",
		"module.get_directory",
		"module.get_host",
		"module.get_host_items",
		"module.get_host_type",
		"module.get_name",
		"module.get_option",
		"module.get_option_array",
		"module.get_option_boolean",
		"module.get_option_inherited_set",
		"module.get_option_number",
		"module.get_option_path",
		"module.get_option_scalar",
		"module.get_option_set",
		"module.get_option_string",
		"module.handle_items",
		"module.hook",
		"module.hook_global",
		"module.hook_object_event",
		"module.hook_tag",
		"module.load_resource",
		"module.measure",
		"module.measure_event",
		"module.measure_global_event",
		"module.measure_object_event",
		"module.open_store",
		"module.provides",
		"module.remove_item",
		"module.require",
		"module.send",
		"module.set_global",
		"module.shared",
		"module.unhook",
		"module.unhook_object_event",
		"module.wrap_event",
		"module.wrap_global",
		"module.wrap_object_event",

		-- mod_http API
		"module.http_url",
	};
	globals = {
		-- Methods that can be set on module API
		"module.unload",
		"module.add_host",
		"module.load",
		"module.add_host",
		"module.save",
		"module.restore",
		"module.command",
		"module.environment",
	};
}
files["spec/"] = {
	std = "+busted";
	globals = { "randomize" };
}
files["prosody.cfg.lua"] = {
	ignore = { "131" };
	globals = {
		"Host",
		"host",
		"VirtualHost",
		"Component",
		"component",
		"Include",
		"include",
		"RunScript"
	};
}

if os.getenv("PROSODY_STRICT_LINT") ~= "1" then
	-- These files have not yet been brought up to standard
	-- Do not add more files here, but do help us fix these!
	local exclude_files = {
	"doc/net.server.lua";

	"fallbacks/bit.lua";
	"fallbacks/lxp.lua";

	"net/adns.lua";
	"net/cqueues.lua";
	"net/dns.lua";
	"net/server_select.lua";

	"plugins/mod_admin_adhoc.lua";
	"plugins/mod_admin_telnet.lua";
	"plugins/mod_http_files.lua";
	"plugins/mod_net_multiplex.lua";
	"plugins/mod_privacy.lua";
	"plugins/mod_s2s/mod_s2s.lua";
	"plugins/mod_s2s/s2sout.lib.lua";
	"plugins/mod_storage_sql1.lua";
	"plugins/mod_storage_sql.lua";
	"plugins/mod_websocket.lua";

	"spec/core_configmanager_spec.lua";
	"spec/core_moduleapi_spec.lua";
	"spec/net_http_parser_spec.lua";
	"spec/util_events_spec.lua";
	"spec/util_http_spec.lua";
	"spec/util_ip_spec.lua";
	"spec/util_multitable_spec.lua";
	"spec/util_rfc6724_spec.lua";
	"spec/util_throttle_spec.lua";
	"spec/util_xmppstream_spec.lua";

	"tools/ejabberd2prosody.lua";
	"tools/ejabberdsql2prosody.lua";
	"tools/erlparse.lua";
	"tools/jabberd14sql2prosody.lua";
	"tools/migration/migrator.cfg.lua";
	"tools/migration/migrator/jabberd14.lua";
	"tools/migration/migrator/mtools.lua";
	"tools/migration/migrator/prosody_files.lua";
	"tools/migration/migrator/prosody_sql.lua";
	"tools/migration/prosody-migrator.lua";
	"tools/openfire2prosody.lua";
	"tools/xep227toprosody.lua";

	"util/sasl/digest-md5.lua";
	}
	for _, file in ipairs(exclude_files) do
		files[file] = { only = {} }
	end
end