Skip to content

Pass options through to rule verification #695

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cli/common.js
Original file line number Diff line number Diff line change
@@ -140,7 +140,7 @@ function cli(api) {
function processFile(relativeFilePath, options) {
var input = api.readFile(relativeFilePath),
ruleset = filterRules(options),
result = CSSLint.verify(input, gatherRules(options, ruleset)),
result = CSSLint.verify(input, gatherRules(options, ruleset), options),
formatter = CSSLint.getFormatter(options.format || "text"),
messages = result.messages || [],
output,
5 changes: 3 additions & 2 deletions src/core/CSSLint.js
Original file line number Diff line number Diff line change
@@ -169,10 +169,11 @@ var CSSLint = (function() {
* @param {Object} ruleset (Optional) List of rules to apply. If null, then
* all rules are used. If a rule has a value of 1 then it's a warning,
* a value of 2 means it's an error.
* @param {Object} options (Optional) options for processing
* @return {Object} Results of the verification.
* @method verify
*/
api.verify = function(text, ruleset) {
api.verify = function(text, ruleset, options) {

var i = 0,
reporter,
@@ -245,7 +246,7 @@ var CSSLint = (function() {
for (i in ruleset) {
if (ruleset.hasOwnProperty(i) && ruleset[i]) {
if (rules[i]) {
rules[i].init(parser, reporter);
rules[i].init(parser, reporter, options);
}
}
}
2 changes: 1 addition & 1 deletion src/core/Reporter.js
Original file line number Diff line number Diff line change
@@ -133,7 +133,7 @@ Reporter.prototype = {
line : line,
col : col,
message : message,
evidence: this.lines[line-1],
evidence: this.lines[line-1] || "",
rule : rule
});
},