Configuring the action to perform on encountering a warn-condition #3

wants to merge 5 commits into


None yet
1 participant

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 some commits Mar 18, 2012

Robert J. Macomber Config file framework and per-check disabling
It should be pretty trivial to enhance this to become "choose whether
you want an error or warning".
Robert J. Macomber Make errors warnings on a per-check basis d531759
Robert J. Macomber Allow setting default action 89c2db9
Robert J. Macomber Document the properties file. dd94cde
Robert J. Macomber Refactor warning-case detection out
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) && ... =>

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 OlegYch pushed a commit to OlegYch/linter that referenced this pull request Jul 1, 2013

@HairyFotr HairyFotr Inferred Any/Nothing (Closes #3), better unused var value detector 2a8ad77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment