-
Notifications
You must be signed in to change notification settings - Fork 2
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
Multiple targets in lint runner #40
Conversation
this.lintRegister = lintRegister; | ||
|
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.
Moved most of this logic to getAllFiles
. Failing to create an instance because one of the paths is wrong is not very good. Also constructors should not have complicated logic.
files.addAll(FileUtils.listFiles(file, null, true)); | ||
} else { | ||
// TODO: Add proper logging | ||
Logger.getGlobal().warning(basePath + " is not a valid file path"); |
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.
Would love feedback here. We don't want to fail the runner because one of the provided paths was wrong. But it should be more conspicuous than a log. Is it possible to include this failure as a part of the report?
for (LintRule lintRule : lintRegister.getLintRules()) { | ||
try { | ||
if (lintRule.getLevel() != LintLevel.IGNORE) { | ||
Map<JSONFile, List<String>> lintReports = lintRule.lint(filesToLint.toArray(new JSONFile[filesToLint.size()])); | ||
Map<JSONFile, List<String>> lintReports = lintRule.lint(filesToLint.toArray(new JSONFile[0])); |
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.
Better for performance. No change in semantics.
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.
Minor changes
1d87422
to
307aeb5
Compare
- Added Unit test - Make LintRunner not fail on creation if path doesn't contain valid JSON files
307aeb5
to
dfa0ee8
Compare
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Feature
What is the current behavior? (You can also link to an open issue here)
Only one path can be provided to the LintRunner for linting. This could either be the path to a single file or a directory. But to lint multiple files/directory with the same rules, multiple instances of LintRunner would need to be created.
What is the new behavior (if this is a feature change)?
Multiple files or folders (or a combination) can be linted with a common set of rules by a single LintRunner.
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
Completely backward compatible
Other information: