Skip to content

Commit

Permalink
fix(core): deprecate nlp rules
Browse files Browse the repository at this point in the history
closed #54
  • Loading branch information
marionebl committed Nov 2, 2017
1 parent 504bca2 commit bbab1d8
Show file tree
Hide file tree
Showing 17 changed files with 103 additions and 831 deletions.
4 changes: 0 additions & 4 deletions @commitlint/config-angular/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
module.exports = {
rules: {
'body-leading-blank': [1, 'always'],
'body-tense': [1, 'always', ['present-imperative']],
'footer-leading-blank': [1, 'always'],
'footer-tense': [1, 'always', ['present-imperative']],
'header-max-length': [2, 'always', 72],
lang: [1, 'always', 'eng'],
'scope-case': [2, 'always', 'lowerCase'],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'subject-tense': [1, 'always', ['present-imperative']],
'type-case': [2, 'always', 'lowerCase'],
'type-empty': [2, 'never'],
'type-enum': [
Expand Down
2 changes: 0 additions & 2 deletions @commitlint/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,8 @@
"conventional-commits-parser": "^1.3.0",
"cosmiconfig": "^3.0.1",
"find-up": "^2.1.0",
"franc": "^2.0.0",
"lodash": "^4.17.4",
"path-exists": "^3.0.0",
"pos": "^0.4.2",
"resolve-from": "^3.0.0",
"semver": "^5.3.0"
}
Expand Down
18 changes: 0 additions & 18 deletions @commitlint/core/src/library/ensure-language.js

This file was deleted.

63 changes: 0 additions & 63 deletions @commitlint/core/src/library/ensure-language.test.js

This file was deleted.

68 changes: 0 additions & 68 deletions @commitlint/core/src/library/ensure-tense.js

This file was deleted.

59 changes: 0 additions & 59 deletions @commitlint/core/src/library/ensure-tense.test.js

This file was deleted.

8 changes: 4 additions & 4 deletions @commitlint/core/src/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ export default async (message, rules = {}, opts = {}) => {
})
.filter(Boolean);

const errors = results.filter(result => result.level > 1 && !result.valid);

const warnings = results.filter(result => result.level < 2 && !result.valid);
const errors = results.filter(result => result.level === 2 && !result.valid);
const warnings = results.filter(
result => result.level === 1 && !result.valid
);

const valid = errors.length === 0;

Expand All @@ -55,4 +56,3 @@ export default async (message, rules = {}, opts = {}) => {
warnings
};
};

21 changes: 2 additions & 19 deletions @commitlint/core/src/rules/body-tense.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
import ensureTense from '../library/ensure-tense';
import message from '../library/message';

export default (parsed, when, value) => {
const tenses = Array.isArray(value) ? value : value.allowed || [];
const ignoreConfig = Array.isArray(value) ? [] : value.ignored || [];

const negated = when === 'never';
const ignored = [...ignoreConfig, ...parsed.notes.map(note => note.title)];
const {matches, offending} = ensureTense(parsed.body, tenses, {ignored});
const offenders = offending
.map(item => [item.lemma, item.tense].join(' - '))
.join(',');

return [
negated ? !matches : matches,
message([
`tense of body must`,
negated ? `not` : null,
`be ${value}. Verbs in other tenses: ${offenders}`
])
false,
`rules.body-tense is deprecated. Received [${when}, [${value.join(', ')}]]`
];
};
Loading

0 comments on commit bbab1d8

Please sign in to comment.