Skip to content

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#3
rjmac wants to merge 5 commits intojorgeortiz85:masterfrom
rjmac:configuration

Conversation

@rjmac
Copy link

@rjmac rjmac commented Mar 20, 2012

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.

Robert J. Macomber 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.
OlegYch pushed a commit to OlegYch/linter that referenced this pull request Jul 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant