Skip to content

Allow ignoring warnings from configuration. #144

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

Merged
Merged
Show file tree
Hide file tree
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
19 changes: 19 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Contributing

## Testing Changes
Changes made to the engine can be tested locally.

1. Install [the CodeClimate CLI](https://github.com/codeclimate/codeclimate).
1. Create the image (customizing the `IMAGE_NAME` as needed):
```bash
IMAGE_NAME=codeclimate/codeclimate-eslint-test make image
```
1. Add the engine to your test `.codeclimate.yml`:
```bash
eslint-test:
enabled: true
```
1. Run analyze via the CLI:
```bash
codeclimate analyze --dev
```
8 changes: 8 additions & 0 deletions bin/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ var glob = require("glob");
var options = { extensions: [".js"], ignore: true, reset: false, useEslintrc: true };
var cli; // instantiation delayed until after options are (potentially) modified
var debug = false;
var ignoreWarnings = false;
var ESLINT_WARNING_SEVERITY = 1;
var checks = require("../lib/checks");
var validateConfig = require("../lib/validate_config");
var computeFingerprint = require("../lib/compute_fingerprint");
Expand Down Expand Up @@ -174,6 +176,10 @@ runWithTiming("engineConfig", function () {
options.ignorePath = userConfig.ignore_path;
}

if (userConfig.ignore_warnings) {
ignoreWarnings = true;
}

if (userConfig.debug) {
debug = true;
}
Expand Down Expand Up @@ -209,6 +215,8 @@ function analyzeFiles() {
var path = result.filePath.replace(/^\/code\//, "");

result.messages.forEach(function(message) {
if (ignoreWarnings && message.severity === ESLINT_WARNING_SEVERITY) { return; }

var issueJson = buildIssueJson(message, path);
process.stdout.write(issueJson + "\u0000\n");
});
Expand Down