Verites/verigraph

View on GitHub

Showing 188 of 188 total issues

Reduce duplication
Open

      Map.keys values `shouldBe` ["g"]
Severity: Minor
Found in tests/GrLang/CompilerSpec.hs by hlint

Found

Map.keys values `shouldBe` ["g"]
let VGraph g = Ann.drop $ values Map.! "g"
g `shouldBe`
  fromNodesAndEdges tgraph [(Node 0 "n1", 1), (Node 1 "n2", 1)]
    [(Edge 0 0 1 "e1", 1), (Edge 1 0 1 "e2", 1)]

Perhaps

Combine with tests/GrLang/CompilerSpec.hs:182:7

Use $>
Open

  <|> (reserved "EF" *> pure (E . F))
Severity: Minor
Found in src/library/Logic/Ctl/Parser.hs by hlint

Found

reserved "EF" *> pure (E . F)

Perhaps

reserved "EF" Data.Functor.$> (E . F)

Redundant bracket
Open

          (\(e,src,tgt) b ->
            (createEdgeOnDomain e src tgt (edgeTypesInA e) e
              (createNodeOnDomain tgt (nodeTypesInA tgt) tgt
                (createNodeOnDomain src (nodeTypesInA src) src b)
              )

Found

\ (e, src, tgt) b ->
  (createEdgeOnDomain e src tgt (edgeTypesInA e) e
     (createNodeOnDomain tgt (nodeTypesInA tgt) tgt
        (createNodeOnDomain src (nodeTypesInA src) src b)))

Perhaps

\ (e, src, tgt) b ->
  createEdgeOnDomain e src tgt (edgeTypesInA e) e
    (createNodeOnDomain tgt (nodeTypesInA tgt) tgt
       (createNodeOnDomain src (nodeTypesInA src) src b))

Move guards forward
Open

            edgesFromA = [(edgeId e, u, v) |
                           e <- orphanTypedEdges m,
                           u <- nodeIds (domain edgesL'),
                           v <- nodeIds (domain edgesL'),
                           sourceId e == applyNodeIdUnsafe edgesL' u,

Found

[(edgeId e, u, v) | e <- orphanTypedEdges m,
 u <- nodeIds (domain edgesL'), v <- nodeIds (domain edgesL'),
 sourceId e == applyNodeIdUnsafe edgesL' u,
 targetId e == applyNodeIdUnsafe edgesL' v]

Perhaps

[(edgeId e, u, v) | e <- orphanTypedEdges m,
 u <- nodeIds (domain edgesL'),
 sourceId e == applyNodeIdUnsafe edgesL' u,
 v <- nodeIds (domain edgesL'),
 targetId e == applyNodeIdUnsafe edgesL' v]

Replace case with fromMaybe
Open

    getNode id = case lookup id nodes of
      Nothing -> error $ "edgeInContext: malformed graph, lookup of edge " ++ show id ++ " failed"
      Just n  -> n
Severity: Minor
Found in src/library/Data/Graphs.hs by hlint

Found

case lookup id nodes of
    Nothing -> error $
                 "edgeInContext: malformed graph, lookup of edge " ++
                   show id ++ " failed"
    Just n -> n

Perhaps

fromMaybe
  (error $
     "edgeInContext: malformed graph, lookup of edge " ++
       show id ++ " failed")
  (lookup id nodes)

Use $>
Open

  <|> (reserved "AG" *> pure (A . G))
Severity: Minor
Found in src/library/Logic/Ctl/Parser.hs by hlint

Found

reserved "AG" *> pure (A . G)

Perhaps

reserved "AG" Data.Functor.$> (A . G)

Use infix
Open

    (_,edges) = L.partition (\((_,_,label),_) -> L.isPrefixOf "type:" label) types

Found

L.isPrefixOf "type:" label

Perhaps

"type:" `isPrefixOf` label

Use fmap
Open

    , ("toString", haskellFn1 globalState $ \idx ->
          show . pretty <$> lookupGrLangValue idx
Severity: Minor
Found in src/repl/GrLang.hs by hlint

Found

\ idx -> show . pretty <$> lookupGrLangValue idx

Perhaps

(fmap (show . pretty) . lookupGrLangValue)

Redundant bracket
Open

    injEdges = filter (\x -> (all (\e' -> TGM.applyEdgeIdUnsafe n e' /= x) (TG.edgeIds $ TGM.domainGraph n))) (TG.edgeIds $ TGM.codomainGraph n)

Found

\ x ->
  (all (\ e' -> TGM.applyEdgeIdUnsafe n e' /= x)
     (TG.edgeIds $ TGM.domainGraph n))

Perhaps

\ x ->
  all (\ e' -> TGM.applyEdgeIdUnsafe n e' /= x)
    (TG.edgeIds $ TGM.domainGraph n)

Reduce duplication
Open

      assertBool "rhs morphism is monic" (isMonic $ rightMorphism r)
Severity: Minor
Found in tests/GrLang/CompilerSpec.hs by hlint

Found

assertBool "rhs morphism is monic" (isMonic $ rightMorphism r)
assertBool "rhs morphism is not iso"
  (not . isIsomorphism $ rightMorphism r)
assertEqual "NACs" [] (nacs r)

Perhaps

Combine with tests/GrLang/CompilerSpec.hs:400:7

Reduce duplication
Open

      Map.keys values `shouldBe` ["r"]
Severity: Minor
Found in tests/GrLang/CompilerSpec.hs by hlint

Found

Map.keys values `shouldBe` ["r"]
let VRule r = Ann.drop $ values Map.! "r"
assertValidRule r
assertEqual "LHS"
  (fromNodesAndEdges tgraph
     [(Node 0 "r1", 1), (Node 1 "r2", 1), (Node 2 "d1", 2),
      (Node 3 "d2", 2)]
     [(Edge 0 0 2 "r1", 1), (Edge 1 1 3 "r2", 1)])
  (leftObject r)

Perhaps

Combine with tests/GrLang/CompilerSpec.hs:325:7

Use $>
Open

  <|> (reserved "EX" *> pure (E . X))
Severity: Minor
Found in src/library/Logic/Ctl/Parser.hs by hlint

Found

reserved "EX" *> pure (E . X)

Perhaps

reserved "EX" Data.Functor.$> (E . X)

Move guards forward
Open

          edgesFromA = [(edgeId e, u, v) |
                         e <- orphanTypedEdges m,
                         u <- nodeIdsFromDomain edgesL',
                         v <- nodeIdsFromDomain edgesL',
                         sourceId e == applyNodeIdUnsafe edgesL' u,

Found

[(edgeId e, u, v) | e <- orphanTypedEdges m,
 u <- nodeIdsFromDomain edgesL', v <- nodeIdsFromDomain edgesL',
 sourceId e == applyNodeIdUnsafe edgesL' u,
 targetId e == applyNodeIdUnsafe edgesL' v]

Perhaps

[(edgeId e, u, v) | e <- orphanTypedEdges m,
 u <- nodeIdsFromDomain edgesL',
 sourceId e == applyNodeIdUnsafe edgesL' u,
 v <- nodeIdsFromDomain edgesL',
 targetId e == applyNodeIdUnsafe edgesL' v]

Use infix
Open

    nacNames = filter (\(x,_) -> isPrefixOf "NAC" x) names
Severity: Minor
Found in src/library/XML/GGXWriter.hs by hlint

Found

isPrefixOf "NAC" x

Perhaps

"NAC" `isPrefixOf` x

Reduce duplication
Open

      Map.keys values `shouldBe` ["g"]
Severity: Minor
Found in tests/GrLang/CompilerSpec.hs by hlint

Found

Map.keys values `shouldBe` ["g"]
let VGraph g = Ann.drop $ values Map.! "g"
g `shouldBe`
  fromNodesAndEdges tgraph [(Node 0 "n1", 1), (Node 1 "n2", 1)]
    [(Edge 0 0 1 "e1", 1), (Edge 1 0 1 "e2", 1)]

Perhaps

Combine with tests/GrLang/CompilerSpec.hs:192:7

Reduce duplication
Open

      Map.keys values `shouldBe` ["commit"]
Severity: Minor
Found in tests/GrLang/CompilerSpec.hs by hlint

Found

Map.keys values `shouldBe` ["commit"]
let VRule r = Ann.drop $ values Map.! "commit"
assertValidRule r
assertEqual "LHS"
  (fromNodesAndEdges tgraph [(Node 0 "r1", 1), (Node 1 "d1", 2)]
     [(Edge 0 0 1 . Just $ Metadata Nothing Nothing, 1)])
  (leftObject r)

Perhaps

Combine with tests/GrLang/CompilerSpec.hs:377:7

Use camelCase
Open

class Category morph => E'PairCofinitary morph where

  -- | Check if the given pair of morphisms \(X \overset{f}{\to} Z
  -- \overset{g}{\leftarrow} Y\) belongs to the class \(\mathcal{E}'\) of joint
  -- surjections. The behaviour is undefined if the given morphisms have

Found

class Category morph => E'PairCofinitary morph where
  isJointSurjection :: (morph, morph) -> Bool
  findJointSurjections ::
    (MorphismClass morph, Obj morph)
    -> (MorphismClass morph, Obj morph) -> [(morph, morph)]
  default findJointSurjections ::
            (ECofinitary morph, Cocomplete morph) =>
            (MorphismClass morph, Obj morph)
            -> (MorphismClass morph, Obj morph) -> [(morph, morph)]
  findJointSurjections (c1, x) (c2, y)
    = let (jx, jy) = calculateCoproduct x y
      in
        [(f, g) |
           e <- findAllQuotientsOf (codomain jx),
           let (f, g) = (e <&> jx, e <&> jy),
           f `belongsToClass` c1,
           g `belongsToClass` c2]
  findJointSurjectionSquares ::
    (MorphismClass morph, morph)
    -> (MorphismClass morph, morph) -> [(morph, morph)]
  findJointSurjectionSquares (cf, f) (cg, g)
    = [(f', g') |
         (g', f') <- findJointSurjections (cf, codomain f) (cg, codomain g),
         g' <&> f == f' <&> g]

Perhaps

class Category morph => EPairCofinitary morph where
  isJointSurjection :: (morph, morph) -> Bool
  findJointSurjections ::
    (MorphismClass morph, Obj morph)
    -> (MorphismClass morph, Obj morph) -> [(morph, morph)]
  default findJointSurjections ::
            (ECofinitary morph, Cocomplete morph) =>
            (MorphismClass morph, Obj morph)
            -> (MorphismClass morph, Obj morph) -> [(morph, morph)]
  findJointSurjections (c1, x) (c2, y)
    = let (jx, jy) = calculateCoproduct x y
      in
        [(f, g) |
           e <- findAllQuotientsOf (codomain jx),
           let (f, g) = (e `<&>` jx, e `<&>` jy),
           f `belongsToClass` c1,
           g `belongsToClass` c2]
  findJointSurjectionSquares ::
    (MorphismClass morph, morph)
    -> (MorphismClass morph, morph) -> [(morph, morph)]
  findJointSurjectionSquares (cf, f) (cg, g)
    = [(f', g') |
         (g', f') <- findJointSurjections (cf, codomain f) (cg, codomain g),
         g' `<&>` f `==` f' `<&>` g]

Reduce duplication
Open

      (fL, fR) = (mappingLeft f, mappingRight f)

Found

(fL, fR) = (mappingLeft f, mappingRight f)
(gL, gR) = (mappingLeft g, mappingRight g)
cls = toFstOrderMorphismClass cls'

Perhaps

Combine with src/library/Category/TypedGraphRule/FindMorphism.hs:44:7

Use $>
Open

      reserved "U" *> pure U
Severity: Minor
Found in src/library/Logic/Ctl/Parser.hs by hlint

Found

reserved "U" *> pure U

Perhaps

(reserved "U" Data.Functor.$> U)

Redundant bracket
Open

    injNodes = filter (\x -> (all (\n' -> TGM.applyNodeIdUnsafe n n' /= x) (TG.nodeIds $ TGM.domainGraph n))) (TG.nodeIds $ TGM.codomainGraph n)

Found

\ x ->
  (all (\ n' -> TGM.applyNodeIdUnsafe n n' /= x)
     (TG.nodeIds $ TGM.domainGraph n))

Perhaps

\ x ->
  all (\ n' -> TGM.applyNodeIdUnsafe n n' /= x)
    (TG.nodeIds $ TGM.domainGraph n)
Severity
Category
Status
Source
Language