Attempt at fixing Codacy's complaints

This commit is contained in:
Martin Duhem 2016-02-04 13:24:22 +01:00
parent b7b1f2453d
commit 34d2aabfa9
2 changed files with 10 additions and 5 deletions

View File

@ -25,7 +25,9 @@ object APIUtil {
} }
private[this] class HasPackageObject extends Visit { private[this] class HasPackageObject extends Visit {
var hasPackageObject = false private var _hasPackageObject = false
def hasPackageObject = _hasPackageObject
private def isPackageObject(c: ClassLike): Boolean = { private def isPackageObject(c: ClassLike): Boolean = {
import xsbti.api.DefinitionType.{ Module, PackageModule } import xsbti.api.DefinitionType.{ Module, PackageModule }
@ -33,7 +35,7 @@ object APIUtil {
} }
override def visitClass0(c: ClassLike): Unit = { override def visitClass0(c: ClassLike): Unit = {
hasPackageObject ||= isPackageObject(c) _hasPackageObject ||= isPackageObject(c)
} }
} }
@ -45,7 +47,9 @@ object APIUtil {
} }
private[this] class HasMacro extends Visit { private[this] class HasMacro extends Visit {
var hasMacro = false private var _hasMacro = false
def hasMacro = _hasMacro
// Don't visit inherited definitions since we consider that a class // Don't visit inherited definitions since we consider that a class
// that inherits a macro does not have a macro. // that inherits a macro does not have a macro.
@ -55,7 +59,7 @@ object APIUtil {
} }
override def visitModifiers(m: Modifiers): Unit = { override def visitModifiers(m: Modifiers): Unit = {
hasMacro ||= m.isMacro _hasMacro ||= m.isMacro
super.visitModifiers(m) super.visitModifiers(m)
} }
} }

View File

@ -221,10 +221,11 @@ private final class AnalysisCallback(internalMap: File => Option[File], external
case (a, (src, api)) => case (a, (src, api)) =>
val stamp = current.internalSource(src) val stamp = current.internalSource(src)
val hash = stamp match { case h: Hash => h.value; case _ => new Array[Byte](0) } val hash = stamp match { case h: Hash => h.value; case _ => new Array[Byte](0) }
val nameHashes = publicNameHashes(src)
// TODO store this in Relations, rather than Source. // TODO store this in Relations, rather than Source.
val hasMacro: Boolean = macroSources.contains(src) val hasMacro: Boolean = macroSources.contains(src)
val hasPackageObject = packageObjectSources.contains(src) val hasPackageObject = packageObjectSources.contains(src)
val s = new xsbti.api.Source(compilation, hash, api._2, api._1, publicNameHashes(src), hasMacro, hasPackageObject) val s = new xsbti.api.Source(compilation, hash, api._2, api._1, nameHashes, hasMacro, hasPackageObject)
val info = SourceInfos.makeInfo(getOrNil(reporteds, src), getOrNil(unreporteds, src)) val info = SourceInfos.makeInfo(getOrNil(reporteds, src), getOrNil(unreporteds, src))
val binaries = binaryDeps.getOrElse(src, Nil: Iterable[File]) val binaries = binaryDeps.getOrElse(src, Nil: Iterable[File])
val prods = classes.getOrElse(src, Nil: Iterable[(File, String)]) val prods = classes.getOrElse(src, Nil: Iterable[(File, String)])