Filter zinc compilation warnings at the Reporter level

Review Request #2656 - Created Aug. 18, 2015 and submitted

Information
Stu Hood
pants
d525e8a...
Reviewers
pants-reviews
benjyw, fkorotkov, peiyu, zundel

The existing impl did not include the severity in its match, so it's possible that errors could be filtered.

  • Only filter non-errors
  • Filter zinc compilation at the Reporter level, rather than in the logger
  • Split between message filters and filename filters

Used:

./pants --config-override=pants.ini.isolated publish.jar --no-dryrun --local=~/.m2/repository --named-snapshot=$USER-`date +%s` src/scala/org/pantsbuild/zinc::

...to do a local publish, then tested that:

./pants --config-override=pants.ini.isolated compile testprojects/src/java/org/pantsbuild/testproject/dummies::

properly applied both -msg-filter and -file-filter.


Can add a pants integration test once this release goes out.

Issues

  • 1
  • 3
  • 1
  • 5
Description From Last Updated
I'd prefer use Position#sourcePath and something like because it's easier to read: private final def matches(filters: Seq[Regex], text: String): Boolean ... Fedor Korotkov Fedor Korotkov
Eric Ayers
Andy Reitz
Stu Hood
Review request changed

Status: Closed (submitted)

Change Summary:

Merged as 085bcace513f88d90cf5455736536ba52cb35079

Fedor Korotkov

LGTM

I think in the rest of zinc sources there are no spaces within {}

src/scala/org/pantsbuild/zinc/logging/Reporters.scala (Diff revision 1)
 
 
 
 
 
 
 
 
 
 

I'd prefer use Position#sourcePath and something like because it's easier to read:

private final def matches(filters: Seq[Regex], text: String): Boolean =
filters.exists(_.findFirstIn(text).isDefined)

private val isFiltered: (Position, String, Severity) => Boolean = {
case (, , Severity.Error) => false
case (, msg, ) if matches(msgFilters, msg) => true
case (pos, , ) if pos.sourcePath.isDefined && matches(fileFilters, pos.sourcePath.get) => true
case _ => false
}

Loading...