ilib-lint 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +231 -0
- package/docs/AnsiConsoleFormatter.html +467 -0
- package/docs/Formatter.html +577 -0
- package/docs/Formatter.js.html +135 -0
- package/docs/FormatterFactory.html +191 -0
- package/docs/FormatterFactory.js.html +109 -0
- package/docs/Parser.html +483 -0
- package/docs/Parser.js.html +122 -0
- package/docs/ParserFactory.js.html +109 -0
- package/docs/Plugin.html +847 -0
- package/docs/Plugin.js.html +168 -0
- package/docs/PluginManager.html +541 -0
- package/docs/PluginManager.js.html +125 -0
- package/docs/ResourceICUPlurals.html +278 -0
- package/docs/ResourceQuoteStyle.html +278 -0
- package/docs/ResourceRegExpChecker.html +295 -0
- package/docs/ResourceUniqueKeys.html +278 -0
- package/docs/Result.html +263 -0
- package/docs/Result.js.html +130 -0
- package/docs/Rule.html +774 -0
- package/docs/Rule.js.html +230 -0
- package/docs/RuleSet.html +760 -0
- package/docs/RuleSet.js.html +153 -0
- package/docs/SourceFile.html +826 -0
- package/docs/SourceFile.js.html +232 -0
- package/docs/XliffParser.html +396 -0
- package/docs/XliffPlugin.html +472 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/formatters_AnsiConsoleFormatter.js.html +147 -0
- package/docs/global.html +448 -0
- package/docs/ilibLint.md +1013 -0
- package/docs/index.html +81 -0
- package/docs/plugins_XliffParser.js.html +129 -0
- package/docs/plugins_XliffPlugin.js.html +129 -0
- package/docs/rules_ResourceICUPlurals.js.html +297 -0
- package/docs/rules_ResourceQuoteStyle.js.html +238 -0
- package/docs/rules_ResourceRegExpChecker.js.html +248 -0
- package/docs/rules_ResourceUniqueKeys.js.html +144 -0
- package/docs/scripts/collapse.js +20 -0
- package/docs/scripts/linenumber.js +25 -0
- package/docs/scripts/nav.js +12 -0
- package/docs/scripts/polyfill.js +4 -0
- package/docs/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/docs/scripts/prettify/lang-css.js +2 -0
- package/docs/scripts/prettify/prettify.js +28 -0
- package/docs/scripts/search.js +83 -0
- package/docs/styles/jsdoc.css +765 -0
- package/docs/styles/prettify.css +79 -0
- package/docs/walk.js.html +214 -0
- package/log4js.json +21 -0
- package/package.json +83 -0
- package/src/Formatter.js +66 -0
- package/src/FormatterFactory.js +41 -0
- package/src/Parser.js +53 -0
- package/src/ParserFactory.js +41 -0
- package/src/Plugin.js +99 -0
- package/src/PluginManager.js +56 -0
- package/src/Result.js +62 -0
- package/src/Rule.js +162 -0
- package/src/RuleSet.js +84 -0
- package/src/SourceFile.js +163 -0
- package/src/formatters/AnsiConsoleFormatter.js +78 -0
- package/src/index.js +213 -0
- package/src/plugins/XliffParser.js +60 -0
- package/src/plugins/XliffPlugin.js +60 -0
- package/src/rules/ResourceICUPlurals.js +229 -0
- package/src/rules/ResourceQuoteStyle.js +170 -0
- package/src/rules/ResourceRegExpChecker.js +179 -0
- package/src/rules/ResourceUniqueKeys.js +76 -0
- package/src/rules/utils.js +78 -0
- package/src/walk.js +146 -0
package/docs/Rule.html
ADDED
|
@@ -0,0 +1,774 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>Rule - Documentation</title>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<script src="scripts/prettify/prettify.js"></script>
|
|
10
|
+
<script src="scripts/prettify/lang-css.js"></script>
|
|
11
|
+
<!--[if lt IE 9]>
|
|
12
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
13
|
+
<![endif]-->
|
|
14
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
15
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
16
|
+
<script src="scripts/nav.js" defer></script>
|
|
17
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
18
|
+
</head>
|
|
19
|
+
<body>
|
|
20
|
+
|
|
21
|
+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
22
|
+
<label for="nav-trigger" class="navicon-button x">
|
|
23
|
+
<div class="navicon"></div>
|
|
24
|
+
</label>
|
|
25
|
+
|
|
26
|
+
<label for="nav-trigger" class="overlay"></label>
|
|
27
|
+
|
|
28
|
+
<nav >
|
|
29
|
+
|
|
30
|
+
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AnsiConsoleFormatter.html">AnsiConsoleFormatter</a><ul class='methods'><li data-type='method'><a href="AnsiConsoleFormatter.html#format">format</a></li><li data-type='method'><a href="AnsiConsoleFormatter.html#getDescription">getDescription</a></li></ul></li><li><a href="Formatter.html">Formatter</a><ul class='methods'><li data-type='method'><a href="Formatter.html#format">format</a></li><li data-type='method'><a href="Formatter.html#getDescription">getDescription</a></li><li data-type='method'><a href="Formatter.html#getName">getName</a></li></ul></li><li><a href="FormatterFactory.html">FormatterFactory</a></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#getResources">getResources</a></li><li data-type='method'><a href="Parser.html#init">init</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li></ul></li><li><a href="Plugin.html">Plugin</a><ul class='methods'><li data-type='method'><a href="Plugin.html#getExtensions">getExtensions</a></li><li data-type='method'><a href="Plugin.html#getFormatters">getFormatters</a></li><li data-type='method'><a href="Plugin.html#getParsers">getParsers</a></li><li data-type='method'><a href="Plugin.html#getRules">getRules</a></li><li data-type='method'><a href="Plugin.html#getType">getType</a></li><li data-type='method'><a href="Plugin.html#init">init</a></li></ul></li><li><a href="PluginManager.html">PluginManager</a><ul class='methods'><li data-type='method'><a href="PluginManager.html#getHandlers">getHandlers</a></li><li data-type='method'><a href="PluginManager.html#load">load</a></li></ul></li><li><a href="ResourceICUPlurals.html">ResourceICUPlurals</a><ul class='methods'><li data-type='method'><a href="ResourceICUPlurals.html#match">match</a></li></ul></li><li><a href="ResourceQuoteStyle.html">ResourceQuoteStyle</a><ul class='methods'><li data-type='method'><a href="ResourceQuoteStyle.html#match">match</a></li></ul></li><li><a href="ResourceRegExpChecker.html">ResourceRegExpChecker</a><ul class='methods'><li data-type='method'><a href="ResourceRegExpChecker.html#match">match</a></li></ul></li><li><a href="ResourceUniqueKeys.html">ResourceUniqueKeys</a><ul class='methods'><li data-type='method'><a href="ResourceUniqueKeys.html#match">match</a></li></ul></li><li><a href="Result.html">Result</a></li><li><a href="Rule.html">Rule</a><ul class='methods'><li data-type='method'><a href="Rule.html#getDescription">getDescription</a></li><li data-type='method'><a href="Rule.html#getName">getName</a></li><li data-type='method'><a href="Rule.html#getRuleType">getRuleType</a></li><li data-type='method'><a href="Rule.html#match">match</a></li></ul></li><li><a href="RuleSet.html">RuleSet</a><ul class='methods'><li data-type='method'><a href="RuleSet.html#addRule">addRule</a></li><li data-type='method'><a href="RuleSet.html#getRule">getRule</a></li><li data-type='method'><a href="RuleSet.html#getRules">getRules</a></li><li data-type='method'><a href="RuleSet.html#getSize">getSize</a></li></ul></li><li><a href="SourceFile.html">SourceFile</a><ul class='methods'><li data-type='method'><a href="SourceFile.html#findIssues">findIssues</a></li><li data-type='method'><a href="SourceFile.html#getFilePath">getFilePath</a></li><li data-type='method'><a href="SourceFile.html#getLocaleFromPath">getLocaleFromPath</a></li><li data-type='method'><a href="SourceFile.html#getType">getType</a></li><li data-type='method'><a href="SourceFile.html#parse">parse</a></li></ul></li><li><a href="XliffParser.html">XliffParser</a><ul class='methods'><li data-type='method'><a href="XliffParser.html#getResources">getResources</a></li><li data-type='method'><a href="XliffParser.html#parse">parse</a></li></ul></li><li><a href="XliffPlugin.html">XliffPlugin</a><ul class='methods'><li data-type='method'><a href="XliffPlugin.html#getExtensions">getExtensions</a></li><li data-type='method'><a href="XliffPlugin.html#getParsers">getParsers</a></li><li data-type='method'><a href="XliffPlugin.html#getType">getType</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#ParserFactory">ParserFactory</a></li><li><a href="global.html#walk">walk</a></li></ul>
|
|
31
|
+
</nav>
|
|
32
|
+
|
|
33
|
+
<div id="main">
|
|
34
|
+
|
|
35
|
+
<h1 class="page-title">Rule</h1>
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
<section>
|
|
44
|
+
|
|
45
|
+
<header>
|
|
46
|
+
|
|
47
|
+
<h2>
|
|
48
|
+
Rule
|
|
49
|
+
</h2>
|
|
50
|
+
|
|
51
|
+
<div class="class-description usertext">Represent an ilib-lint rule.</div>
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
</header>
|
|
55
|
+
|
|
56
|
+
<article>
|
|
57
|
+
|
|
58
|
+
<div class="container-overview">
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
<h2>Constructor</h2>
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
<h4 class="name" id="Rule"><span class="type-signature">(abstract) </span>new Rule<span class="signature">()</span><span class="type-signature"></span></h4>
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
<dl class="details">
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
<dt class="tag-source">Source:</dt>
|
|
77
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
78
|
+
<a href="Rule.js.html">Rule.js</a>, <a href="Rule.js.html#line24">line 24</a>
|
|
79
|
+
</li></ul></dd>
|
|
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
|
+
</dl>
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
<div class="description usertext">
|
|
118
|
+
Construct an ilib-lint rule. Rules in plugins should implement this
|
|
119
|
+
abstract class.
|
|
120
|
+
</div>
|
|
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
|
+
</div>
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
<h3 class="subsection-title">Methods</h3>
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
<h4 class="name" id="getDescription"><span class="type-signature"></span>getDescription<span class="signature">()</span><span class="type-signature"> → {String}</span></h4>
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
<dl class="details">
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
<dt class="tag-source">Source:</dt>
|
|
186
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
187
|
+
<a href="Rule.js.html">Rule.js</a>, <a href="Rule.js.html#line58">line 58</a>
|
|
188
|
+
</li></ul></dd>
|
|
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
|
+
</dl>
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
<div class="description usertext">
|
|
227
|
+
Return a general description of the type of problems that this rule is
|
|
228
|
+
testing for. This description is not related to particular matches, so
|
|
229
|
+
it cannot be more specific. Examples:
|
|
230
|
+
|
|
231
|
+
"translation should use the appropriate quote style"
|
|
232
|
+
"parameters to the translation wrapper function must not be concatenated"
|
|
233
|
+
"translation should match the whitespace of the source string"
|
|
234
|
+
</div>
|
|
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
|
+
<h5>Returns:</h5>
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
<div class="param-desc">
|
|
264
|
+
a general description of the type of problems that this rule is
|
|
265
|
+
testing for
|
|
266
|
+
</div>
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
<dl class="param-type">
|
|
271
|
+
<dt>
|
|
272
|
+
Type
|
|
273
|
+
</dt>
|
|
274
|
+
<dd>
|
|
275
|
+
|
|
276
|
+
<span class="param-type">String</span>
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
</dd>
|
|
280
|
+
</dl>
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
<h4 class="name" id="getName"><span class="type-signature"></span>getName<span class="signature">()</span><span class="type-signature"> → {String}</span></h4>
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
<dl class="details">
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
<dt class="tag-source">Source:</dt>
|
|
302
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
303
|
+
<a href="Rule.js.html">Rule.js</a>, <a href="Rule.js.html#line41">line 41</a>
|
|
304
|
+
</li></ul></dd>
|
|
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
|
+
</dl>
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
<div class="description usertext">
|
|
343
|
+
Get the name of the rule. This should be a string with a dash-separated
|
|
344
|
+
set of words (kebab or dash case). Example: "resource-match-whitespace"
|
|
345
|
+
</div>
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
<h5>Returns:</h5>
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
<div class="param-desc">
|
|
375
|
+
the name of this rule
|
|
376
|
+
</div>
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
<dl class="param-type">
|
|
381
|
+
<dt>
|
|
382
|
+
Type
|
|
383
|
+
</dt>
|
|
384
|
+
<dd>
|
|
385
|
+
|
|
386
|
+
<span class="param-type">String</span>
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
</dd>
|
|
390
|
+
</dl>
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
<h4 class="name" id="getRuleType"><span class="type-signature"></span>getRuleType<span class="signature">()</span><span class="type-signature"> → {String}</span></h4>
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
<dl class="details">
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
<dt class="tag-source">Source:</dt>
|
|
412
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
413
|
+
<a href="Rule.js.html">Rule.js</a>, <a href="Rule.js.html#line83">line 83</a>
|
|
414
|
+
</li></ul></dd>
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
</dl>
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
<div class="description usertext">
|
|
453
|
+
Return the type of this rule. Rules can be organized into the following
|
|
454
|
+
types:
|
|
455
|
+
|
|
456
|
+
- A resource rule. This checks a translated resource with a source string
|
|
457
|
+
and a translation to a given locale. eg. a rule that checks that
|
|
458
|
+
substitution parameters that exist in the source string also are
|
|
459
|
+
given in the target string.
|
|
460
|
+
- A line rule. This rule checks single lines of a file. eg. a rule to
|
|
461
|
+
check the parameters to a function call.
|
|
462
|
+
- A multiline rule. This rule checks multiple lines at once to find
|
|
463
|
+
problems that may span multiple lines. For example, a rule to enforce
|
|
464
|
+
a policy that all translatable strings in a source file have an appropriate
|
|
465
|
+
translator's comment on them.
|
|
466
|
+
- A multifile rule. This rule checks problems across multiple files. eg.
|
|
467
|
+
a rule to check that ids for translatable strings are unique across all
|
|
468
|
+
files.
|
|
469
|
+
</div>
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
<h5>Returns:</h5>
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
<div class="param-desc">
|
|
499
|
+
a string with either "resource", "line", "multiline", or
|
|
500
|
+
"multifile".
|
|
501
|
+
</div>
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
<dl class="param-type">
|
|
506
|
+
<dt>
|
|
507
|
+
Type
|
|
508
|
+
</dt>
|
|
509
|
+
<dd>
|
|
510
|
+
|
|
511
|
+
<span class="param-type">String</span>
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
</dd>
|
|
515
|
+
</dl>
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
<h4 class="name" id="match"><span class="type-signature"></span>match<span class="signature">(options)</span><span class="type-signature"> → {Object|Array.<Object>|undefined}</span></h4>
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
<dl class="details">
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
<dt class="tag-source">Source:</dt>
|
|
537
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
538
|
+
<a href="Rule.js.html">Rule.js</a>, <a href="Rule.js.html#line157">line 157</a>
|
|
539
|
+
</li></ul></dd>
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
</dl>
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
<div class="description usertext">
|
|
578
|
+
Return whether or not this rule matches the input. The options object can
|
|
579
|
+
contain any of the following properties:
|
|
580
|
+
|
|
581
|
+
<ul>
|
|
582
|
+
<li>locale - the locale against which this rule should be checked. Some rules
|
|
583
|
+
are locale-sensitive, others not.
|
|
584
|
+
<li>resource - the resource to test this rule against. For resource rules, this
|
|
585
|
+
is a required property.
|
|
586
|
+
<li>line - a single line of a file to test this rule against (for line rules)
|
|
587
|
+
<li>lines - all the lines of a file to test this rule against (for multiline rules
|
|
588
|
+
and multifile rules)
|
|
589
|
+
<li>pathName - the name of the current file being matched in multifile rules.
|
|
590
|
+
<li>parameters - (optional) parameters for this rule from the configuration file
|
|
591
|
+
</ul>
|
|
592
|
+
|
|
593
|
+
The return value from this method when a rule matches is an object with the
|
|
594
|
+
following properties:
|
|
595
|
+
|
|
596
|
+
<ul>
|
|
597
|
+
<li>severity - the severity of this match. This can be one of the following:
|
|
598
|
+
<ul>
|
|
599
|
+
<li>suggestion - a suggestion of a better way to do things. The current way is
|
|
600
|
+
not incorrect, but probably not optimal
|
|
601
|
+
<li>warning - a problem that should be fixed, but which does not prevent
|
|
602
|
+
your app from operating internationally. This is more severe than a suggestion.
|
|
603
|
+
<li>error - a problem that must be fixed. This type of problem will prevent
|
|
604
|
+
your app from operating properly internationally and could possibly even
|
|
605
|
+
crash your app in some cases.
|
|
606
|
+
</ul>
|
|
607
|
+
<li>description - a description of the problem to display to the user. In order
|
|
608
|
+
to make the ilib-lint output useful, this description should attempt to make the
|
|
609
|
+
following things clear:
|
|
610
|
+
<ul>
|
|
611
|
+
<li>What part is wrong
|
|
612
|
+
<li>Why it is wrong
|
|
613
|
+
<li>Suggestions on how to fix it
|
|
614
|
+
</ul>
|
|
615
|
+
<li>lineNumber - the line number where the match occurred in multiline rules
|
|
616
|
+
<li>highlight - the line where the problem occurred, highlighted with XML syntax
|
|
617
|
+
(see below)
|
|
618
|
+
</ul>
|
|
619
|
+
|
|
620
|
+
For the `highlight` property, the line that has a problem is reproduced with
|
|
621
|
+
XML tags around the problem part, if it is known. The tags are of the form
|
|
622
|
+
<eX> where X is a digit starting with 0 and progressing to 9 for each
|
|
623
|
+
subsequent problem. If the file type is XML already, the rest of the line will
|
|
624
|
+
be XML-escaped first.<p>
|
|
625
|
+
|
|
626
|
+
Example:<p>
|
|
627
|
+
|
|
628
|
+
"const str = rb.getString(<e0>id</e0>);"<p>
|
|
629
|
+
|
|
630
|
+
In this rule, `getString()` must be called with a static string in order for the
|
|
631
|
+
loctool to be able to extract that string. The line above calls `getString()`
|
|
632
|
+
with a variable named "id" as a parameter. The variable is highlighted with the
|
|
633
|
+
e0 tag. Callers can then translate the open and close tags appropriately for
|
|
634
|
+
the output device, such as ASCII escapes for a regular terminal, or HTML tags
|
|
635
|
+
for a web-based device.
|
|
636
|
+
</div>
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
<h5>Parameters:</h5>
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
<table class="params">
|
|
652
|
+
<thead>
|
|
653
|
+
<tr>
|
|
654
|
+
|
|
655
|
+
<th>Name</th>
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
<th>Type</th>
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
<th class="last">Description</th>
|
|
665
|
+
</tr>
|
|
666
|
+
</thead>
|
|
667
|
+
|
|
668
|
+
<tbody>
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
<tr>
|
|
672
|
+
|
|
673
|
+
<td class="name"><code>options</code></td>
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
<td class="type">
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
<span class="param-type">Object</span>
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
</td>
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
<td class="description last">The options object as per the description above</td>
|
|
690
|
+
</tr>
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
</tbody>
|
|
694
|
+
</table>
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
<h5>Returns:</h5>
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
<div class="param-desc">
|
|
715
|
+
an object describing the problem if the rule
|
|
716
|
+
does match for this locale, or an array of such Objects if there are multiple
|
|
717
|
+
problems with the same input, or undefined if the rule does not match
|
|
718
|
+
</div>
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
<dl class="param-type">
|
|
723
|
+
<dt>
|
|
724
|
+
Type
|
|
725
|
+
</dt>
|
|
726
|
+
<dd>
|
|
727
|
+
|
|
728
|
+
<span class="param-type">Object</span>
|
|
729
|
+
|
|
|
730
|
+
|
|
731
|
+
<span class="param-type">Array.<Object></span>
|
|
732
|
+
|
|
|
733
|
+
|
|
734
|
+
<span class="param-type">undefined</span>
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
</dd>
|
|
738
|
+
</dl>
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
</article>
|
|
751
|
+
|
|
752
|
+
</section>
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
</div>
|
|
760
|
+
|
|
761
|
+
<br class="clear">
|
|
762
|
+
|
|
763
|
+
<footer>
|
|
764
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.11</a> on Mon Dec 19 2022 15:00:46 GMT-0800 (Pacific Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
765
|
+
</footer>
|
|
766
|
+
|
|
767
|
+
<script>prettyPrint();</script>
|
|
768
|
+
<script src="scripts/polyfill.js"></script>
|
|
769
|
+
<script src="scripts/linenumber.js"></script>
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
</body>
|
|
774
|
+
</html>
|