-
Notifications
You must be signed in to change notification settings - Fork 186
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 support for linters #291
Merged
Merged
Commits on Aug 18, 2017
-
Replace sourcecode.Name with scalafix.rewrite.RewriteName.
RewriteName is a wrapper around a non-empty list of strings instead of being a single string. Original names are preserved when composing multiple RewriteNames.
Configuration menu - View commit details
-
Copy full SHA for a9ff6a0 - Browse repository at this point
Copy the full SHA a9ff6a0View commit details -
Add infrastructure for linters, towards scalacenter#92.
New package scalafix.lint with data structures for emitting messages from linters: - LintID: uniquely identifies a certain kind of linter message, owned by a rewrite. A LintID is attached to a default warning/error severity but can be configured to another category with `lint.ignore/warning/error = [ LintID ]` - LintMessage: an instance of LintID with a customized message at a particular position. A LintMessage can be created wit LintID.at(String/Position). - A LintMessage can be turned into a Patch with ctx.lint(LintMessage). LintMessages don't report to the console until Rewrite.apply is called. To accommodate linter development, scalafix-testkit now enforces that expected warnings/errors are documented in the input sources with a trailing `// scalafix: error/warning` comment. scalafix-cli returns a non-zero exit code of kind "LinterError" when a linter reports an error.
Configuration menu - View commit details
-
Copy full SHA for ecab461 - Browse repository at this point
Copy the full SHA ecab461View commit details -
Configuration menu - View commit details
-
Copy full SHA for a014ff4 - Browse repository at this point
Copy the full SHA a014ff4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6e5b915 - Browse repository at this point
Copy the full SHA 6e5b915View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9f11786 - Browse repository at this point
Copy the full SHA 9f11786View commit details -
Configuration menu - View commit details
-
Copy full SHA for 33ec950 - Browse repository at this point
Copy the full SHA 33ec950View commit details -
- RewriteName is a list of RewriteIdentifier. - RewriteIdentifier is a name + optional deprecation warning. This makes it possible to rename a rewrite without breaking peoples config. - Rewrite.empty has name RewriteName.empty, which is an empty list of RewriteIdentifier.
Configuration menu - View commit details
-
Copy full SHA for c95f1b2 - Browse repository at this point
Copy the full SHA c95f1b2View commit details -
Emit deprecation warnings when referencing a rewrite by old name.
This change allows rewrites to change their names without breaking compatibility. Users using the old name will receive deprecation warnings and have opportunity to switch to the new name.
Configuration menu - View commit details
-
Copy full SHA for 9aec7a0 - Browse repository at this point
Copy the full SHA 9aec7a0View commit details -
Move cli/test to unit/testOnly *cli*.
unit/test has fixtures to build SemanticCtx, which will come in handy to test the cli.
Configuration menu - View commit details
-
Copy full SHA for dcacac5 - Browse repository at this point
Copy the full SHA dcacac5View commit details -
Rewrite CliTest with StringFS.
The cli tests have in need for a rewrite for a long time. This commits creates a helper method to easily construct a fixture and run assertions against the expected output.
Configuration menu - View commit details
-
Copy full SHA for 6433616 - Browse repository at this point
Copy the full SHA 6433616View commit details -
Instead of using LintID.owner, the RewriteCtx.printMessages takes an `owner: RewriteName` argument. This results in a simpler LintID data structure.
Configuration menu - View commit details
-
Copy full SHA for e43b4b0 - Browse repository at this point
Copy the full SHA e43b4b0View commit details -
Configuration menu - View commit details
-
Copy full SHA for c0bd9f4 - Browse repository at this point
Copy the full SHA c0bd9f4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 275bdf0 - Browse repository at this point
Copy the full SHA 275bdf0View commit details -
LintCategory is more suitable since it is a category of LintMessages.
Configuration menu - View commit details
-
Copy full SHA for 5d38cf6 - Browse repository at this point
Copy the full SHA 5d38cf6View commit details -
Add test for deprecated names, VolatileLazyVal => DottyVolatileLazyVal.
I've been meaning to rename this rewrite for a while but wasn't satisfied that this would break people's configuraiton. I wanted to solve this potentially common problem in the future more elegantly. Now that rewrites can have multiple names and names can have deprecation warnings, this commits tests that it indeed works as expected.
Configuration menu - View commit details
-
Copy full SHA for 6de3ac8 - Browse repository at this point
Copy the full SHA 6de3ac8View commit details -
- doc polish - Require `// scalafix: Rewrite.LintCategory` assertions instead of warning/error. This is more robust. - Rename VolatileLazyVal to DottyVolatileLazyVal in tests, I noticed because of deprecation warnings getting printed out. - Don't print out lint messages in scalafix-testkit by default, if you have a lot of assertions then the console gets flooded with too many messages.
Configuration menu - View commit details
-
Copy full SHA for 0bbaf08 - Browse repository at this point
Copy the full SHA 0bbaf08View commit details -
- remove unused imports with scalafix (hurray!) - refactor build.sbt a bit - polish new doc entries - Remove unused Patch.applyInternal
Configuration menu - View commit details
-
Copy full SHA for 9798839 - Browse repository at this point
Copy the full SHA 9798839View commit details -
Configuration menu - View commit details
-
Copy full SHA for b8e85db - Browse repository at this point
Copy the full SHA b8e85dbView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.