Configuring the action to perform on encountering a warn-condition#3
Open
rjmac wants to merge 5 commits intojorgeortiz85:masterfrom
rjmac:configuration
Open
Configuring the action to perform on encountering a warn-condition#3rjmac wants to merge 5 commits intojorgeortiz85:masterfrom rjmac:configuration
rjmac wants to merge 5 commits intojorgeortiz85:masterfrom
rjmac:configuration
Conversation
added 5 commits
March 18, 2012 10:19
It should be pretty trivial to enhance this to become "choose whether you want an error or warning".
Presumably this plugin will end up with many more warnings. This will
prevent LinterPlugin.scala from getting unweildly huge. Also it removes
some boilerplate of the form
case ... if warningEnable(Warnings.ThisWarning) && ... =>
onWarn(Warnings.ThisWarning)...
That double "Warnings.ThisWarning" was setting my teeth on edge.
Unfortunately, it introduces a pair of typecasts! I cannot convince scalac
that my references to a Global are all references to the *same* Global.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I've added an option to pass in a properties file that allows the plugin's user to define the action to take on encountering a construct that it wants to warn about. The action (one of "no_action", "warn", or "error") is configurable both globally and on a per-warning-type basis. The last commit in this series breaks the individual checks out into their own classes to serve as a base for growing the set of checks without bloating LinterPlugin.scala itself without bound.
I'm not super happy with the tests. They're pretty comprehensive, but in order to keep the amount of repetitive code down, I've made each individual test use a helper that invokes the actual test code multiple times with various options for testing each codepath. It ends up being memory intensive (many differently-configured Scala compilers instantiated!), not very fast, and honestly not very unit-testy. Still, it works.