isml-linter 5.39.0 → 5.39.4
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/CHANGELOG.md +1167 -1133
- package/LICENSE +21 -21
- package/README.md +245 -245
- package/bin/isml-linter.js +32 -32
- package/ismllinter.config.js +33 -33
- package/package.json +53 -53
- package/scaffold_files/ismllinter.config.js +47 -47
- package/src/Builder.js +15 -15
- package/src/Constants.js +139 -139
- package/src/IsmlLinter.js +255 -255
- package/src/enums/ParseStatus.js +5 -5
- package/src/enums/SfccTagContainer.js +287 -287
- package/src/isml_tree/ContainerNode.js +38 -38
- package/src/isml_tree/IsmlNode.js +684 -658
- package/src/isml_tree/MaskUtils.js +421 -419
- package/src/isml_tree/ParseUtils.js +514 -434
- package/src/isml_tree/TreeBuilder.js +273 -271
- package/src/publicApi.js +24 -24
- package/src/rules/line_by_line/enforce-isprint.js +53 -53
- package/src/rules/line_by_line/enforce-require.js +35 -35
- package/src/rules/line_by_line/lowercase-filename.js +29 -29
- package/src/rules/line_by_line/max-lines.js +37 -37
- package/src/rules/line_by_line/no-br.js +36 -36
- package/src/rules/line_by_line/no-git-conflict.js +43 -43
- package/src/rules/line_by_line/no-import-package.js +34 -34
- package/src/rules/line_by_line/no-inline-style.js +34 -34
- package/src/rules/line_by_line/no-isscript.js +34 -34
- package/src/rules/line_by_line/no-space-only-lines.js +47 -47
- package/src/rules/line_by_line/no-tabs.js +38 -38
- package/src/rules/line_by_line/no-trailing-spaces.js +52 -52
- package/src/rules/prototypes/RulePrototype.js +79 -79
- package/src/rules/prototypes/SingleLineRulePrototype.js +47 -47
- package/src/rules/prototypes/TreeRulePrototype.js +84 -84
- package/src/rules/tree/align-isset.js +87 -87
- package/src/rules/tree/contextual-attrs.js +105 -105
- package/src/rules/tree/custom-tags.js +54 -54
- package/src/rules/tree/disallow-tags.js +39 -39
- package/src/rules/tree/empty-eof.js +66 -66
- package/src/rules/tree/enforce-security.js +85 -85
- package/src/rules/tree/eslint-to-isscript.js +179 -179
- package/src/rules/tree/indent.js +853 -853
- package/src/rules/tree/leading-iscache.js +39 -43
- package/src/rules/tree/leading-iscontent.js +35 -39
- package/src/rules/tree/max-depth.js +54 -54
- package/src/rules/tree/no-deprecated-attrs.js +67 -67
- package/src/rules/tree/no-embedded-isml.js +17 -17
- package/src/rules/tree/no-hardcode.js +51 -51
- package/src/rules/tree/no-iselse-slash.js +35 -35
- package/src/rules/tree/no-redundant-context.js +134 -134
- package/src/rules/tree/no-require-in-loop.js +63 -63
- package/src/rules/tree/one-element-per-line.js +76 -76
- package/src/util/CommandLineUtils.js +19 -19
- package/src/util/ConfigUtils.js +219 -219
- package/src/util/ConsoleUtils.js +327 -327
- package/src/util/CustomTagContainer.js +45 -45
- package/src/util/ExceptionUtils.js +149 -131
- package/src/util/FileUtils.js +79 -79
- package/src/util/GeneralUtils.js +60 -60
- package/src/util/NativeExtensionUtils.js +6 -6
- package/src/util/RuleUtils.js +295 -295
- package/src/util/TempRuleUtils.js +232 -232
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
-
const ParseUtils = require('../../isml_tree/ParseUtils');
|
|
3
|
-
|
|
4
|
-
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
5
|
-
const description = 'Wrap expression in <isprint> tag';
|
|
6
|
-
|
|
7
|
-
const Rule = Object.create(SingleLineRulePrototype);
|
|
8
|
-
|
|
9
|
-
Rule.init(ruleId, description);
|
|
10
|
-
|
|
11
|
-
Rule.isBroken = function(line) {
|
|
12
|
-
return (line.indexOf('>${') >= 0 ||
|
|
13
|
-
line.indexOf(' ${') >= 0 ||
|
|
14
|
-
line.indexOf('"${') >= 0) &&
|
|
15
|
-
line.indexOf('<isprint value="${') === -1 ||
|
|
16
|
-
line.indexOf('${') === 0;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
Rule.getColumnNumber = function(line) {
|
|
20
|
-
return Math.max(ParseUtils.getNextNonEmptyCharPos(line), 0) + 1;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
Rule.getFirstOccurrence = function(line) {
|
|
24
|
-
|
|
25
|
-
let result = null;
|
|
26
|
-
|
|
27
|
-
if (this.isBroken(line)) {
|
|
28
|
-
|
|
29
|
-
let matchPos = -1;
|
|
30
|
-
|
|
31
|
-
if (line.indexOf('>${') >= 0) {
|
|
32
|
-
matchPos = line.indexOf('>${') + 1;
|
|
33
|
-
} else if (line.indexOf(' ${') >= 0) {
|
|
34
|
-
matchPos = line.indexOf(' ${') + 1;
|
|
35
|
-
} else if (line.indexOf('"${') >= 0 && line.indexOf('<isprint value="${') === -1) {
|
|
36
|
-
matchPos = line.indexOf('"${') + 1;
|
|
37
|
-
} else if (line.indexOf('${') === 0) {
|
|
38
|
-
matchPos = 0;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const temp = line.substring(matchPos);
|
|
42
|
-
|
|
43
|
-
result = {
|
|
44
|
-
globalPos : matchPos,
|
|
45
|
-
columnNumber: 'aa',
|
|
46
|
-
length : temp.indexOf('}') + 1
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return result;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
module.exports = Rule;
|
|
1
|
+
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
+
const ParseUtils = require('../../isml_tree/ParseUtils');
|
|
3
|
+
|
|
4
|
+
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
5
|
+
const description = 'Wrap expression in <isprint> tag';
|
|
6
|
+
|
|
7
|
+
const Rule = Object.create(SingleLineRulePrototype);
|
|
8
|
+
|
|
9
|
+
Rule.init(ruleId, description);
|
|
10
|
+
|
|
11
|
+
Rule.isBroken = function(line) {
|
|
12
|
+
return (line.indexOf('>${') >= 0 ||
|
|
13
|
+
line.indexOf(' ${') >= 0 ||
|
|
14
|
+
line.indexOf('"${') >= 0) &&
|
|
15
|
+
line.indexOf('<isprint value="${') === -1 ||
|
|
16
|
+
line.indexOf('${') === 0;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
Rule.getColumnNumber = function(line) {
|
|
20
|
+
return Math.max(ParseUtils.getNextNonEmptyCharPos(line), 0) + 1;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
Rule.getFirstOccurrence = function(line) {
|
|
24
|
+
|
|
25
|
+
let result = null;
|
|
26
|
+
|
|
27
|
+
if (this.isBroken(line)) {
|
|
28
|
+
|
|
29
|
+
let matchPos = -1;
|
|
30
|
+
|
|
31
|
+
if (line.indexOf('>${') >= 0) {
|
|
32
|
+
matchPos = line.indexOf('>${') + 1;
|
|
33
|
+
} else if (line.indexOf(' ${') >= 0) {
|
|
34
|
+
matchPos = line.indexOf(' ${') + 1;
|
|
35
|
+
} else if (line.indexOf('"${') >= 0 && line.indexOf('<isprint value="${') === -1) {
|
|
36
|
+
matchPos = line.indexOf('"${') + 1;
|
|
37
|
+
} else if (line.indexOf('${') === 0) {
|
|
38
|
+
matchPos = 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const temp = line.substring(matchPos);
|
|
42
|
+
|
|
43
|
+
result = {
|
|
44
|
+
globalPos : matchPos,
|
|
45
|
+
columnNumber: 'aa',
|
|
46
|
+
length : temp.indexOf('}') + 1
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return result;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
module.exports = Rule;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
-
|
|
3
|
-
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
4
|
-
const description = 'Avoid direct call to the "dw" package, use "require()" instead';
|
|
5
|
-
const regex = /dw\.[A-Za-z]+\.[A-Za-z]+(\.|;)/;
|
|
6
|
-
|
|
7
|
-
const Rule = Object.create(SingleLineRulePrototype);
|
|
8
|
-
|
|
9
|
-
Rule.init(ruleId, description);
|
|
10
|
-
|
|
11
|
-
Rule.isBroken = function(line) { return line.match(regex); };
|
|
12
|
-
|
|
13
|
-
Rule.getColumnNumber = function(line) {
|
|
14
|
-
return Math.max(line.indexOf('dw.'), 0) + 1;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
Rule.getFirstOccurrence = function(line) {
|
|
18
|
-
|
|
19
|
-
let result = null;
|
|
20
|
-
|
|
21
|
-
if (this.isBroken(line)) {
|
|
22
|
-
|
|
23
|
-
const temp = regex.exec(line);
|
|
24
|
-
const matchPos = temp.index;
|
|
25
|
-
|
|
26
|
-
result = {
|
|
27
|
-
globalPos : matchPos,
|
|
28
|
-
length : temp[0].length - 1
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
module.exports = Rule;
|
|
1
|
+
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
+
|
|
3
|
+
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
4
|
+
const description = 'Avoid direct call to the "dw" package, use "require()" instead';
|
|
5
|
+
const regex = /dw\.[A-Za-z]+\.[A-Za-z]+(\.|;)/;
|
|
6
|
+
|
|
7
|
+
const Rule = Object.create(SingleLineRulePrototype);
|
|
8
|
+
|
|
9
|
+
Rule.init(ruleId, description);
|
|
10
|
+
|
|
11
|
+
Rule.isBroken = function(line) { return line.match(regex); };
|
|
12
|
+
|
|
13
|
+
Rule.getColumnNumber = function(line) {
|
|
14
|
+
return Math.max(line.indexOf('dw.'), 0) + 1;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
Rule.getFirstOccurrence = function(line) {
|
|
18
|
+
|
|
19
|
+
let result = null;
|
|
20
|
+
|
|
21
|
+
if (this.isBroken(line)) {
|
|
22
|
+
|
|
23
|
+
const temp = regex.exec(line);
|
|
24
|
+
const matchPos = temp.index;
|
|
25
|
+
|
|
26
|
+
result = {
|
|
27
|
+
globalPos : matchPos,
|
|
28
|
+
length : temp[0].length - 1
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
module.exports = Rule;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
-
|
|
3
|
-
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
4
|
-
const description = 'Template file name must be lowercase';
|
|
5
|
-
|
|
6
|
-
const Rule = Object.create(SingleLineRulePrototype);
|
|
7
|
-
|
|
8
|
-
Rule.init(ruleId, description);
|
|
9
|
-
|
|
10
|
-
Rule.isBroken = function(fileName) { return fileName !== fileName.toLowerCase(); };
|
|
11
|
-
|
|
12
|
-
Rule.getColumnNumber = function() {
|
|
13
|
-
return 1;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
Rule.check = function(fileName, templateContent) {
|
|
17
|
-
const result = {
|
|
18
|
-
occurrenceList : []
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
if (this.isBroken(fileName)) {
|
|
22
|
-
const error = this.getError('', 0, -1, 0, templateContent.length);
|
|
23
|
-
result.occurrenceList.push(error);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
module.exports = Rule;
|
|
1
|
+
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
+
|
|
3
|
+
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
4
|
+
const description = 'Template file name must be lowercase';
|
|
5
|
+
|
|
6
|
+
const Rule = Object.create(SingleLineRulePrototype);
|
|
7
|
+
|
|
8
|
+
Rule.init(ruleId, description);
|
|
9
|
+
|
|
10
|
+
Rule.isBroken = function(fileName) { return fileName !== fileName.toLowerCase(); };
|
|
11
|
+
|
|
12
|
+
Rule.getColumnNumber = function() {
|
|
13
|
+
return 1;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
Rule.check = function(fileName, templateContent) {
|
|
17
|
+
const result = {
|
|
18
|
+
occurrenceList : []
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
if (this.isBroken(fileName)) {
|
|
22
|
+
const error = this.getError('', 0, -1, 0, templateContent.length);
|
|
23
|
+
result.occurrenceList.push(error);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
module.exports = Rule;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
-
const Constants = require('../../Constants');
|
|
3
|
-
const GeneralUtils = require('../../util/GeneralUtils');
|
|
4
|
-
|
|
5
|
-
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
6
|
-
const description = 'Template has more lines than allowed';
|
|
7
|
-
|
|
8
|
-
const Rule = Object.create(SingleLineRulePrototype);
|
|
9
|
-
|
|
10
|
-
Rule.getDefaultAttrs = () => {
|
|
11
|
-
return {
|
|
12
|
-
max : 350
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
Rule.init(ruleId, description);
|
|
17
|
-
|
|
18
|
-
Rule.getColumnNumber = function() {
|
|
19
|
-
return 1;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
Rule.check = function(templateContent) {
|
|
23
|
-
|
|
24
|
-
const maxLines = this.getConfigs().max;
|
|
25
|
-
const lineArray = GeneralUtils.toLF(templateContent).split(Constants.EOL);
|
|
26
|
-
const columnNumber = this.getColumnNumber();
|
|
27
|
-
const occurrenceList = [];
|
|
28
|
-
|
|
29
|
-
if (lineArray.length > maxLines) {
|
|
30
|
-
const error = this.getError(lineArray[0], 1, columnNumber, 0, 0);
|
|
31
|
-
occurrenceList.push(error);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return { occurrenceList };
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
module.exports = Rule;
|
|
1
|
+
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
+
const Constants = require('../../Constants');
|
|
3
|
+
const GeneralUtils = require('../../util/GeneralUtils');
|
|
4
|
+
|
|
5
|
+
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
6
|
+
const description = 'Template has more lines than allowed';
|
|
7
|
+
|
|
8
|
+
const Rule = Object.create(SingleLineRulePrototype);
|
|
9
|
+
|
|
10
|
+
Rule.getDefaultAttrs = () => {
|
|
11
|
+
return {
|
|
12
|
+
max : 350
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
Rule.init(ruleId, description);
|
|
17
|
+
|
|
18
|
+
Rule.getColumnNumber = function() {
|
|
19
|
+
return 1;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
Rule.check = function(templateContent) {
|
|
23
|
+
|
|
24
|
+
const maxLines = this.getConfigs().max;
|
|
25
|
+
const lineArray = GeneralUtils.toLF(templateContent).split(Constants.EOL);
|
|
26
|
+
const columnNumber = this.getColumnNumber();
|
|
27
|
+
const occurrenceList = [];
|
|
28
|
+
|
|
29
|
+
if (lineArray.length > maxLines) {
|
|
30
|
+
const error = this.getError(lineArray[0], 1, columnNumber, 0, 0);
|
|
31
|
+
occurrenceList.push(error);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return { occurrenceList };
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
module.exports = Rule;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
-
|
|
3
|
-
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
4
|
-
const description = 'Avoid using <br/> tags, use css instead';
|
|
5
|
-
const occurrenceText = '<br';
|
|
6
|
-
|
|
7
|
-
const Rule = Object.create(SingleLineRulePrototype);
|
|
8
|
-
|
|
9
|
-
Rule.init(ruleId, description);
|
|
10
|
-
|
|
11
|
-
Rule.isBroken = function(line) { return line.indexOf(occurrenceText) >= 0; };
|
|
12
|
-
|
|
13
|
-
Rule.getColumnNumber = function(line) {
|
|
14
|
-
return Math.max(line.indexOf('<br'), 0) + 1;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
Rule.getFirstOccurrence = function(line) {
|
|
18
|
-
|
|
19
|
-
let result = null;
|
|
20
|
-
|
|
21
|
-
if (this.isBroken(line)) {
|
|
22
|
-
|
|
23
|
-
const matchPos = line.indexOf(occurrenceText);
|
|
24
|
-
const temp = line.substring(line.indexOf(occurrenceText));
|
|
25
|
-
const matchLength = temp.indexOf('>') + 1;
|
|
26
|
-
|
|
27
|
-
result = {
|
|
28
|
-
globalPos : matchPos,
|
|
29
|
-
length : matchLength
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
module.exports = Rule;
|
|
1
|
+
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
+
|
|
3
|
+
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
4
|
+
const description = 'Avoid using <br/> tags, use css instead';
|
|
5
|
+
const occurrenceText = '<br';
|
|
6
|
+
|
|
7
|
+
const Rule = Object.create(SingleLineRulePrototype);
|
|
8
|
+
|
|
9
|
+
Rule.init(ruleId, description);
|
|
10
|
+
|
|
11
|
+
Rule.isBroken = function(line) { return line.indexOf(occurrenceText) >= 0; };
|
|
12
|
+
|
|
13
|
+
Rule.getColumnNumber = function(line) {
|
|
14
|
+
return Math.max(line.indexOf('<br'), 0) + 1;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
Rule.getFirstOccurrence = function(line) {
|
|
18
|
+
|
|
19
|
+
let result = null;
|
|
20
|
+
|
|
21
|
+
if (this.isBroken(line)) {
|
|
22
|
+
|
|
23
|
+
const matchPos = line.indexOf(occurrenceText);
|
|
24
|
+
const temp = line.substring(line.indexOf(occurrenceText));
|
|
25
|
+
const matchLength = temp.indexOf('>') + 1;
|
|
26
|
+
|
|
27
|
+
result = {
|
|
28
|
+
globalPos : matchPos,
|
|
29
|
+
length : matchLength
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
module.exports = Rule;
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
-
|
|
3
|
-
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
4
|
-
const description = 'Unresolved Git conflict';
|
|
5
|
-
const occurrenceText1 = '<<<<<<< HEAD';
|
|
6
|
-
const occurrenceText2 = '=======';
|
|
7
|
-
|
|
8
|
-
const Rule = Object.create(SingleLineRulePrototype);
|
|
9
|
-
|
|
10
|
-
Rule.init(ruleId, description);
|
|
11
|
-
|
|
12
|
-
Rule.isBroken = function(line) { return line === occurrenceText1 || line === occurrenceText2; };
|
|
13
|
-
|
|
14
|
-
Rule.getColumnNumber = function() {
|
|
15
|
-
return 1;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
Rule.getFirstOccurrence = function(line) {
|
|
19
|
-
|
|
20
|
-
let result = null;
|
|
21
|
-
|
|
22
|
-
if (this.isBroken(line)) {
|
|
23
|
-
|
|
24
|
-
let occurrenceText = null;
|
|
25
|
-
|
|
26
|
-
if (line === occurrenceText1) {
|
|
27
|
-
occurrenceText = occurrenceText1;
|
|
28
|
-
} else if (line === occurrenceText2) {
|
|
29
|
-
occurrenceText = occurrenceText2;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const matchPos = line.indexOf(occurrenceText);
|
|
33
|
-
|
|
34
|
-
result = {
|
|
35
|
-
globalPos : matchPos,
|
|
36
|
-
length : occurrenceText.length
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return result;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
module.exports = Rule;
|
|
1
|
+
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
+
|
|
3
|
+
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
4
|
+
const description = 'Unresolved Git conflict';
|
|
5
|
+
const occurrenceText1 = '<<<<<<< HEAD';
|
|
6
|
+
const occurrenceText2 = '=======';
|
|
7
|
+
|
|
8
|
+
const Rule = Object.create(SingleLineRulePrototype);
|
|
9
|
+
|
|
10
|
+
Rule.init(ruleId, description);
|
|
11
|
+
|
|
12
|
+
Rule.isBroken = function(line) { return line === occurrenceText1 || line === occurrenceText2; };
|
|
13
|
+
|
|
14
|
+
Rule.getColumnNumber = function() {
|
|
15
|
+
return 1;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
Rule.getFirstOccurrence = function(line) {
|
|
19
|
+
|
|
20
|
+
let result = null;
|
|
21
|
+
|
|
22
|
+
if (this.isBroken(line)) {
|
|
23
|
+
|
|
24
|
+
let occurrenceText = null;
|
|
25
|
+
|
|
26
|
+
if (line === occurrenceText1) {
|
|
27
|
+
occurrenceText = occurrenceText1;
|
|
28
|
+
} else if (line === occurrenceText2) {
|
|
29
|
+
occurrenceText = occurrenceText2;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const matchPos = line.indexOf(occurrenceText);
|
|
33
|
+
|
|
34
|
+
result = {
|
|
35
|
+
globalPos : matchPos,
|
|
36
|
+
length : occurrenceText.length
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
module.exports = Rule;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
-
|
|
3
|
-
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
4
|
-
const description = 'Avoid using importPackage()';
|
|
5
|
-
const occurrenceText = 'importPackage';
|
|
6
|
-
|
|
7
|
-
const Rule = Object.create(SingleLineRulePrototype);
|
|
8
|
-
|
|
9
|
-
Rule.init(ruleId, description);
|
|
10
|
-
|
|
11
|
-
Rule.isBroken = function(line) { return line.indexOf(occurrenceText) >= 0; };
|
|
12
|
-
|
|
13
|
-
Rule.getColumnNumber = function(line) {
|
|
14
|
-
return Math.max(line.indexOf('importPackage('), 0) + 1;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
Rule.getFirstOccurrence = function(line) {
|
|
18
|
-
|
|
19
|
-
let result = null;
|
|
20
|
-
|
|
21
|
-
if (this.isBroken(line)) {
|
|
22
|
-
|
|
23
|
-
const matchPos = line.indexOf(occurrenceText);
|
|
24
|
-
|
|
25
|
-
result = {
|
|
26
|
-
globalPos : matchPos,
|
|
27
|
-
length : occurrenceText.length
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return result;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
module.exports = Rule;
|
|
1
|
+
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
+
|
|
3
|
+
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
4
|
+
const description = 'Avoid using importPackage()';
|
|
5
|
+
const occurrenceText = 'importPackage';
|
|
6
|
+
|
|
7
|
+
const Rule = Object.create(SingleLineRulePrototype);
|
|
8
|
+
|
|
9
|
+
Rule.init(ruleId, description);
|
|
10
|
+
|
|
11
|
+
Rule.isBroken = function(line) { return line.indexOf(occurrenceText) >= 0; };
|
|
12
|
+
|
|
13
|
+
Rule.getColumnNumber = function(line) {
|
|
14
|
+
return Math.max(line.indexOf('importPackage('), 0) + 1;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
Rule.getFirstOccurrence = function(line) {
|
|
18
|
+
|
|
19
|
+
let result = null;
|
|
20
|
+
|
|
21
|
+
if (this.isBroken(line)) {
|
|
22
|
+
|
|
23
|
+
const matchPos = line.indexOf(occurrenceText);
|
|
24
|
+
|
|
25
|
+
result = {
|
|
26
|
+
globalPos : matchPos,
|
|
27
|
+
length : occurrenceText.length
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
module.exports = Rule;
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
-
|
|
3
|
-
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
4
|
-
const description = 'Avoid using inline style';
|
|
5
|
-
const occurrenceText = 'style="';
|
|
6
|
-
|
|
7
|
-
const Rule = Object.create(SingleLineRulePrototype);
|
|
8
|
-
|
|
9
|
-
Rule.init(ruleId, description);
|
|
10
|
-
|
|
11
|
-
Rule.isBroken = function(line) { return line.indexOf('<isprint') === -1 && line.indexOf(occurrenceText) >= 0; };
|
|
12
|
-
|
|
13
|
-
Rule.getColumnNumber = function(line) {
|
|
14
|
-
return Math.max(line.indexOf(occurrenceText), 0) + 1;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
Rule.getFirstOccurrence = function(line) {
|
|
18
|
-
|
|
19
|
-
let result = null;
|
|
20
|
-
|
|
21
|
-
if (this.isBroken(line)) {
|
|
22
|
-
|
|
23
|
-
const matchPos = line.indexOf(occurrenceText);
|
|
24
|
-
|
|
25
|
-
result = {
|
|
26
|
-
globalPos : matchPos,
|
|
27
|
-
length : occurrenceText.length - 2
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return result;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
module.exports = Rule;
|
|
1
|
+
const SingleLineRulePrototype = require('../prototypes/SingleLineRulePrototype');
|
|
2
|
+
|
|
3
|
+
const ruleId = require('path').basename(__filename).slice(0, -3);
|
|
4
|
+
const description = 'Avoid using inline style';
|
|
5
|
+
const occurrenceText = 'style="';
|
|
6
|
+
|
|
7
|
+
const Rule = Object.create(SingleLineRulePrototype);
|
|
8
|
+
|
|
9
|
+
Rule.init(ruleId, description);
|
|
10
|
+
|
|
11
|
+
Rule.isBroken = function(line) { return line.indexOf('<isprint') === -1 && line.indexOf(occurrenceText) >= 0; };
|
|
12
|
+
|
|
13
|
+
Rule.getColumnNumber = function(line) {
|
|
14
|
+
return Math.max(line.indexOf(occurrenceText), 0) + 1;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
Rule.getFirstOccurrence = function(line) {
|
|
18
|
+
|
|
19
|
+
let result = null;
|
|
20
|
+
|
|
21
|
+
if (this.isBroken(line)) {
|
|
22
|
+
|
|
23
|
+
const matchPos = line.indexOf(occurrenceText);
|
|
24
|
+
|
|
25
|
+
result = {
|
|
26
|
+
globalPos : matchPos,
|
|
27
|
+
length : occurrenceText.length - 2
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
module.exports = Rule;
|