Skip to content

Commit

Permalink
Merge pull request #122 from codeclimate/pr/109
Browse files Browse the repository at this point in the history
Code cleanup
  • Loading branch information
pbrisbin committed Aug 17, 2016
2 parents 40884b0 + 893db11 commit a508779
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .eslintrc
@@ -1,8 +1,10 @@
{
"env": {
"node": true
"node": true,
"mocha": true
},
"rules": {
"block-spacing": 2,
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
"comma-dangle": [2, "never"],
"comma-style": [2, "first", { exceptions: {ArrayExpression: true, ObjectExpression: true} }],
Expand Down
10 changes: 6 additions & 4 deletions bin/eslint.js
Expand Up @@ -44,6 +44,8 @@ function buildIssueJson(message, path) {
if(message.fatal) {
checkName = "fatal";
}
var line = message.line || 1;
var column = message.column || 1;

var issue = {
type: "issue",
Expand All @@ -57,12 +59,12 @@ function buildIssueJson(message, path) {
path: path,
positions: {
begin: {
line: message.line || 1,
column: message.column || 1
line: line,
column: column
},
end: {
line: message.line || 1,
column: message.column || 1
line: line,
column: column
}
}
},
Expand Down
7 changes: 3 additions & 4 deletions test/checks_test.js
Expand Up @@ -13,6 +13,9 @@ describe("checks module", function() {
});

describe(".remediationPoints()", function() {
var eslintConfig = function(rulesConfig) {
return { rules: rulesConfig };
};
it("returns the default of 50,000 for a non-complexity issue", function() {
var issue = { ruleId: "eqeqeq", message: "always use ==="};
expect(checks.remediationPoints(issue.ruleId, issue, null)).to.eq(50000);
Expand Down Expand Up @@ -41,9 +44,5 @@ describe("checks module", function() {
, config = eslintConfig({ "complexity": [2, 10] });
expect(checks.remediationPoints(issue.ruleId, issue, config)).to.eq(1000000);
});

var eslintConfig = function(rulesConfig) {
return { rules: rulesConfig };
};
});
});
6 changes: 3 additions & 3 deletions test/validate_config_test.js
Expand Up @@ -13,7 +13,7 @@ describe("validateConfig", function() {

it("returns false if no files exist", function(done) {
temp.mkdir("no-config", function(err, directory) {
if (err) throw err;
if (err) { throw err; }

process.chdir(directory);

Expand All @@ -24,7 +24,7 @@ describe("validateConfig", function() {

it("returns true if an eslintrc exists", function(done) {
temp.mkdir("config", function(err, directory) {
if (err) throw err;
if (err) { throw err; }

process.chdir(directory);

Expand All @@ -36,7 +36,7 @@ describe("validateConfig", function() {
};

fs.writeFile(configPath, JSON.stringify(config), function(err) {
if (err) throw err;
if (err) { throw err; }

expect(validateConfig(null)).to.eq(true);
done();
Expand Down

0 comments on commit a508779

Please sign in to comment.