Skip to content

Commit c768497

Browse files
aj-devAlexej Yaroshevich
authored andcommitted
Misc: make error messages consistent: sentence case and no period
Closes gh-148
1 parent b9da3fc commit c768497

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

lib/rules/validate-jsdoc/check-annotations.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function validateAnnotations(file, errors) {
8484

8585
node.iterate(function(tag) {
8686
if (!(tag.id in tags)) {
87-
errors.add('unavailable tag ' + tag.id, tag.loc);
87+
errors.add('Unavailable tag ' + tag.id, tag.loc);
8888
return;
8989
}
9090

@@ -93,7 +93,7 @@ function validateAnnotations(file, errors) {
9393
switch (tags[tag.id]) {
9494
case false:
9595
if (isFilled) {
96-
errors.add('unexpected data in tag ' + tag.id, tag.loc);
96+
errors.add('Unexpected data in tag ' + tag.id, tag.loc);
9797
}
9898
break;
9999

@@ -103,7 +103,7 @@ function validateAnnotations(file, errors) {
103103

104104
case 'some':
105105
if (!isFilled) {
106-
errors.add('incomplete data in tag ' + tag.id, tag.loc);
106+
errors.add('Incomplete data in tag ' + tag.id, tag.loc);
107107
}
108108
break;
109109

lib/rules/validate-jsdoc/check-types.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function validateTypesInTags(file, errors) {
7979
}
8080
if (!tag.type.valid) {
8181
// throw an error if not valid
82-
errors.add('expects valid type instead of ' + tag.type.value, tag.type.loc);
82+
errors.add('Expects valid type instead of ' + tag.type.value, tag.type.loc);
8383
}
8484
if (strictNativeCase || capitalizedNativeCase) {
8585
tag.type.iterate(function(node) {
@@ -99,7 +99,7 @@ function validateTypesInTags(file, errors) {
9999
var normType = strictNatives[lowerType];
100100
if (strictNativeCase && type !== normType ||
101101
capitalizedNativeCase && type !== (normType[0].toUpperCase() + normType.substr(1))) {
102-
errors.add('invalid case of type `' + type + '`', tag.type.loc);
102+
errors.add('Invalid case of type `' + type + '`', tag.type.loc);
103103
}
104104
});
105105
}

lib/rules/validate-jsdoc/require-description-complete-sentence.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function requireDescriptionCompleteSentence(node, err) {
5959
if (START_DESCRIPTION.test(doc.description)) {
6060
var matches = returnAllMatches(doc.description, START_DESCRIPTION);
6161
matches.map(function(match) {
62-
match.message = 'Description must start with an upper case letter.';
62+
match.message = 'Description must start with an upper case letter';
6363
match.index = match.start;
6464
});
6565
errors = errors.concat(matches);
@@ -68,7 +68,7 @@ function requireDescriptionCompleteSentence(node, err) {
6868
if (RE_NEW_LINE_START_WITH_UPPER_CASE.test(doc.description)) {
6969
var matches1 = returnAllMatches(doc.description, RE_NEW_LINE_START_WITH_UPPER_CASE);
7070
matches1.map(function(match) {
71-
match.message = 'Sentence must start with an upper case letter.';
71+
match.message = 'Sentence must start with an upper case letter';
7272
match.index = match.end - 1;
7373
});
7474
errors = errors.concat(matches1);
@@ -77,7 +77,7 @@ function requireDescriptionCompleteSentence(node, err) {
7777
if (RE_END_WITH_PERIOD.test(doc.description)) {
7878
var matches2 = returnAllMatches(doc.description, RE_END_WITH_PERIOD);
7979
matches2.map(function(match) {
80-
match.message = 'Sentence must end with a period.';
80+
match.message = 'Sentence must end with a period';
8181
match.index = match.start;
8282
});
8383
errors = errors.concat(matches2);
@@ -87,7 +87,7 @@ function requireDescriptionCompleteSentence(node, err) {
8787
var matches3 = returnAllMatches(doc.description, RE_NEW_LINE_UPPERCASE);
8888
matches3.map(function(match) {
8989
match.message = 'You started a new line with an upper case letter but ' +
90-
'previous line does not end with a period.';
90+
'previous line does not end with a period';
9191
match.index = match.end - 1;
9292
});
9393
errors = errors.concat(matches3);

test/lib/rules/validate-jsdoc/check-annotations.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe('lib/rules/validate-jsdoc/check-annotations', function() {
1010
/* jshint ignore:start */
1111
{
1212
it: 'should throw unavailable tag',
13-
errors: {message: 'unavailable tag ppublic'},
13+
errors: {message: 'Unavailable tag ppublic'},
1414
code: function() {
1515
/**
1616
* @ppublic
@@ -35,7 +35,7 @@ describe('lib/rules/validate-jsdoc/check-annotations', function() {
3535
},
3636
{
3737
it: 'should throw @access without data',
38-
errors: {message: 'incomplete data in tag access'},
38+
errors: {message: 'Incomplete data in tag access'},
3939
code: function() {
4040
/** @access */
4141
}
@@ -68,7 +68,7 @@ describe('lib/rules/validate-jsdoc/check-annotations', function() {
6868
},
6969
{
7070
it: 'should throw unavailable @arg',
71-
errors: {message: 'unavailable tag arg'},
71+
errors: {message: 'Unavailable tag arg'},
7272
code: function() {
7373
/**
7474
* @arg

0 commit comments

Comments
 (0)