Skip to content
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 plugin option for global filters #14

Merged
merged 3 commits into from
Aug 13, 2018
Merged

Add plugin option for global filters #14

merged 3 commits into from
Aug 13, 2018

Conversation

cchantep
Copy link

@cchantep cchantep commented Aug 7, 2018

Support minimal global filter as plugin option -P:silencer:globalFilters=[semi-colon separated message patterns]

See example

cchantep added 2 commits August 7, 2018 16:47
@@ -0,0 +1,10 @@
package testdata

object globallyFiltered {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please write this test so that there's one warning suppressed and one similar warning unsuppressed (e.g. one that doesn't match the regex). This way we test if silencer only suppresses exactly what we want it to suppress and we also avoid changing the multiple files compilation test.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

private lazy val reporter =
new SuppressingReporter(global.reporter, globalFilters)

override def processOptions(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use single-line formatting and remove procedure syntax, e.g.

override def processOptions(options: List[STring], error: String => Unit): Unit = {

import scala.reflect.internal.util.{Position, SourceFile}
import scala.tools.nsc.reporters.Reporter

class SuppressingReporter(original: Reporter) extends Reporter {
class SuppressingReporter(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the parameters in a single line.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such line would exceed 80cols

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have such limit in silencer project, currently I have formatting enforced by IntelliJ and it limits lines to 120 columns which for me is more sensible. You can also move extends Reporter { to next line but leave parameters in a single line.

@ghik ghik merged commit dd5a5b7 into ghik:master Aug 13, 2018
@ghik
Copy link
Owner

ghik commented Aug 13, 2018

Good job, thanks a lot!

@cchantep cchantep deleted the feature/global-filters branch August 13, 2018 11:57
@SethTisue
Copy link
Contributor

looks useful — would like to try it out in a release

@SethTisue
Copy link
Contributor

should this PR have included README changes?

@ghik
Copy link
Owner

ghik commented Aug 15, 2018

I'll try to update README and do a release until the end of this week.

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.

3 participants