@yegor256/dogent 0.7.3 → 0.7.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/package.json +1 -1
- package/src/rules/atomic.js +4 -2
- package/src/rules/passive.js +1 -1
- package/src/rules/simple.js +1 -1
package/package.json
CHANGED
package/src/rules/atomic.js
CHANGED
|
@@ -37,8 +37,10 @@ class Atomic {
|
|
|
37
37
|
}
|
|
38
38
|
judge(text, line, uri) {
|
|
39
39
|
const clean = text.replace(/^\s*(?:[-*+]|\d+\.)\s+/u, '').trimEnd();
|
|
40
|
-
const
|
|
41
|
-
|
|
40
|
+
const weld = /(?<!,)\s(?:and|then)\s+(?<verb>[a-z]+)\s+\S/u.exec(clean);
|
|
41
|
+
const welded = weld !== null &&
|
|
42
|
+
!/(?:ly|al|ial|ous|ive|less|ic|ary|ory|able|ible)$/u.test(weld.groups.verb);
|
|
43
|
+
if (!/[.!?]\s+\S/u.test(clean) && !/;/u.test(clean) && !welded) {
|
|
42
44
|
return [];
|
|
43
45
|
}
|
|
44
46
|
return [new Violation(
|
package/src/rules/passive.js
CHANGED
|
@@ -35,7 +35,7 @@ class Passive {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
scan(text, line, uri) {
|
|
38
|
-
const regex = /\b(?:is|are|was|were|be|been|being)\b\s+(?:\w+ly\s+)?(?:\w+ed|written|done|made|built|kept|sent|shown|seen|taken|given|held|found|run|read|set)\b/iu;
|
|
38
|
+
const regex = /\b(?:is|are|was|were|be|been|being)\b\s+(?:\w+ly\s+)?(?:\w+ed|written|done|made|built|kept|sent|shown|seen|taken|given|held|found|run|read|set)\b(?=\s*$|\s*[.,;:!?)]|\s+(?:by|in|into|onto|to|from|with|within|without|for|on|at|as|through|against|over|under|after|before|during|upon|per|about)\b)/iu;
|
|
39
39
|
if (!regex.test(text)) {
|
|
40
40
|
return [];
|
|
41
41
|
}
|
package/src/rules/simple.js
CHANGED
|
@@ -37,7 +37,7 @@ class Simple {
|
|
|
37
37
|
const commas = text.match(/,/gu);
|
|
38
38
|
const commaCount = commas === null ? 0 : commas.length;
|
|
39
39
|
const hasConjunction = /\b(?:if|when|unless|because|although|while)\b/iu.test(text);
|
|
40
|
-
const tangled = hasConjunction && commaCount >= 2
|
|
40
|
+
const tangled = hasConjunction && commaCount >= 2;
|
|
41
41
|
if (!tangled) {
|
|
42
42
|
return [];
|
|
43
43
|
}
|