Skip to content

Commit

Permalink
Merge branch 'direct_access_to_state_defect' of https://github.com/po…
Browse files Browse the repository at this point in the history
…lystat/odin into direct_access_to_state_defect
  • Loading branch information
Leosimetti committed Apr 4, 2022
2 parents e0663ea + 9fe9bb1 commit 9f6d0a2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ object EOOdinAnalyzer {

final case class Ok(override val ruleId: String) extends OdinAnalysisResult

final case class DefectDetected(
final case class DefectsDetected(
override val ruleId: String,
messages: NonEmptyList[String],
) extends OdinAnalysisResult
Expand All @@ -44,7 +44,7 @@ object EOOdinAnalyzer {
analyzer: String
)(errors: List[String]): OdinAnalysisResult =
errors match {
case e :: es => DefectDetected(analyzer, NonEmptyList(e, es))
case e :: es => DefectsDetected(analyzer, NonEmptyList(e, es))
case Nil => Ok(analyzer)
}

Expand Down Expand Up @@ -103,13 +103,7 @@ object EOOdinAnalyzer {
stream
.compile
.toList
.map {
case Nil => OdinAnalysisResult.Ok(name)
case e :: es => OdinAnalysisResult.DefectDetected(
name,
NonEmptyList(e, es)
)
}
.map(OdinAnalysisResult.fromErrors(name))
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
package org.polystat.odin.analysis.stateaccess

import cats.data.EitherNel
import org.polystat.odin.analysis.inlining.{
Abstract,
BndItself,
Inliner,
MethodInfo,
ObjectInfo,
ParentInfo
}
import org.polystat.odin.core.ast.{
EOAnyNameBnd,
EOBndExpr,
EOCopy,
EODot,
EONamedBnd,
EOSimpleAppWithLocator,
LazyName
}
import org.polystat.odin.analysis.inlining._
import org.polystat.odin.core.ast._
import org.polystat.odin.parser.eo.Parser

object DetectStateAccess {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DetectStateAccessTests extends AnyWordSpec {
)
.flatMap {
case Ok(_) => IO.pure(List.empty)
case DefectDetected(_, errors) => IO.pure(errors.toList)
case DefectsDetected(_, errors) => IO.pure(errors.toList)
case AnalyzerFailure(_, e) => IO.raiseError(e)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object OdinAnalysisResultInterop {
java.util.Optional.empty,
)
)
case DefectDetected(rule, messages) =>
case DefectsDetected(rule, messages) =>
List(
new OdinAnalysisResultInterop(
rule,
Expand Down

0 comments on commit 9f6d0a2

Please sign in to comment.