@yegor256/dogent 0.7.3 → 0.7.5

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 CHANGED
@@ -40,7 +40,7 @@
40
40
  "lint": "eslint .",
41
41
  "test": "mocha 'test/**/*.js' --timeout 60000"
42
42
  },
43
- "version": "0.7.3",
43
+ "version": "0.7.5",
44
44
  "dependencies": {
45
45
  "minimist": "^1.2.8"
46
46
  }
@@ -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 welded = /;|\s(?:and|then)\s+[a-z]+\s+\S/u;
41
- if (!/[.!?]\s+\S/u.test(clean) && !welded.test(clean)) {
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|ate)$/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(
@@ -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
  }
@@ -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 || commaCount >= 3;
40
+ const tangled = hasConjunction && commaCount >= 2;
41
41
  if (!tangled) {
42
42
  return [];
43
43
  }