-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add max-file-line-count rule #842
Add max-file-line-count rule #842
Conversation
@@ -0,0 +1,27 @@ | |||
# Max File Line Count | |||
|
|||
Rule `max-file-line-count` will enforce that a files length doesn't exceed a certain number of lines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo - file's
length: 300 | ||
}, | ||
'detect': function (ast, parser) { | ||
var result = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be simplified as all we need is the end.line
of the stylesheet
node (ast
), which will always be ast.end.line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...
'detect': function (ast, parser) {
var result = [];
if (ast.end.line > parser.options.length) {
result = helpers.addUnique(result, {
'ruleId': parser.rule.name,
'line': ast.end.line,
'column': 0,
'message': 'This file has ' + ast.end.line + ' lines, which exceeds the maximum of ' + parser.options.length + ' lines allowed.',
'severity': parser.severity
});
}
return result;
}
...
04764e4
to
8167ede
Compare
Adds the rule
max-file-line-count
to enforce the length of a fileIf a file exceeds the default / user specified line count the following message will be provided:
This file has 301 lines, which exceeds the maximum of 300 lines allowed.
closes #841
<DCO 1.1 Signed-off-by: Dan Purdy [email protected]>