Verites/verigraph

View on GitHub

Showing 188 of 188 total issues

Function check_module has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def check_module(self, module, verbose=False):
        if self.__should_check_module(module.name):
            if verbose: print('Checking module', module.name, '...', end=' ')

            no_errors = True
Severity: Minor
Found in scripts/check-architecture.py - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Unused LANGUAGE pragma
Open

{-# LANGUAGE TupleSections #-}
Severity: Minor
Found in src/CLI/CriticalPairAnalysis.hs by hlint

Found

{-# LANGUAGE TupleSections #-}

Perhaps

Avoid restricted qualification
Open

import           Data.Graphs          as G
Severity: Minor
Found in src/library/Category/Graph.hs by hlint

Found

import Data.Graphs as G

Perhaps

import Data.Graphs as Graph

Applying this change:

  • may break the code

Use .
Open

  describe "updateNodePayload" $
    prop "payload changed" $ \graph f ->
      not (Prelude.null $ nodes graph) ==>
      (`all` nodeIds graph) $ \nodeId ->
        let
Severity: Minor
Found in tests/Data/GraphsSpec.hs by hlint

Found

describe "updateNodePayload" $
  prop "payload changed" $
    \ graph f ->
      not (Prelude.null $ nodes graph) ==>
        (`all` nodeIds graph) $
          \ nodeId ->
            let graph'
                  = updateNodePayload nodeId graph (apply f) :: Graph Int Int
              in
              (nodeInfo <$> lookupNode nodeId graph') ==
                (apply f . nodeInfo <$> lookupNode nodeId graph)

Perhaps

describe "updateNodePayload" . prop "payload changed" $
  (\ graph f ->
     not (Prelude.null $ nodes graph) ==>
       (`all` nodeIds graph) $
         \ nodeId ->
           let graph'
                 = updateNodePayload nodeId graph (apply f) :: Graph Int Int
             in
             (nodeInfo <$> lookupNode nodeId graph') ==
               (apply f . nodeInfo <$> lookupNode nodeId graph))

Use .
Open

      "AG foo" `shouldParseTo` (Temporal$A$G$ Atom "foo")
Severity: Minor
Found in tests/Logic/Ctl/ParserSpec.hs by hlint

Found

A $ G $ Atom "foo"

Perhaps

(A . G $ Atom "foo")

Use .
Open

      "EF foo" `shouldParseTo` (Temporal$E$F$ Atom "foo")
Severity: Minor
Found in tests/Logic/Ctl/ParserSpec.hs by hlint

Found

E $ F $ Atom "foo"

Perhaps

(E . F $ Atom "foo")

Use .
Open

    then Just $ buildTypedGraphMorphism d c $ GM.updateNodes n1 n2 m

Found

Just $ buildTypedGraphMorphism d c $ GM.updateNodes n1 n2 m

Perhaps

Just . buildTypedGraphMorphism d c $ GM.updateNodes n1 n2 m

Avoid restricted qualification
Open

import qualified Data.Graphs as G

Found

import qualified Data.Graphs as G

Perhaps

import qualified Data.Graphs as Graph

Applying this change:

  • may break the code

Use .
Open

      "AF foo" `shouldParseTo` (Temporal$A$F$ Atom "foo")
Severity: Minor
Found in tests/Logic/Ctl/ParserSpec.hs by hlint

Found

A $ F $ Atom "foo"

Perhaps

(A . F $ Atom "foo")

Use .
Open

                              (Temporal$E$G$ Not q))
Severity: Minor
Found in src/library/Logic/Ctl/Semantics.hs by hlint

Found

Temporal $ E $ G $ Not q

Perhaps

Temporal . E $ (G $ Not q)

Use .
Open

      it "produce-dangling" $
        testCase findAllProduceDangling rules $
          "( 0 0 0 0 0 0 0 0 )\n"++
          "( 0 0 0 0 0 0 0 0 )\n"++
          "( 0 0 0 0 1 0 0 0 )\n"++
Severity: Minor
Found in tests/Analysis/CriticalPairsSpec.hs by hlint

Found

it "produce-dangling" $
  testCase findAllProduceDangling rules $
    "( 0 0 0 0 0 0 0 0 )\n" ++
      "( 0 0 0 0 0 0 0 0 )\n" ++
        "( 0 0 0 0 1 0 0 0 )\n" ++
          "( 0 0 0 0 0 0 0 0 )\n" ++
            "( 0 0 0 0 0 0 0 0 )\n" ++
              "( 0 0 0 0 0 0 0 0 )\n" ++
                "( 0 0 0 0 0 0 0 0 )\n" ++ "( 0 0 0 0 0 0 0 0 )\n"

Perhaps

it "produce-dangling" . testCase findAllProduceDangling rules $
  ("( 0 0 0 0 0 0 0 0 )\n" ++
     "( 0 0 0 0 0 0 0 0 )\n" ++
       "( 0 0 0 0 1 0 0 0 )\n" ++
         "( 0 0 0 0 0 0 0 0 )\n" ++
           "( 0 0 0 0 0 0 0 0 )\n" ++
             "( 0 0 0 0 0 0 0 0 )\n" ++
               "( 0 0 0 0 0 0 0 0 )\n" ++ "( 0 0 0 0 0 0 0 0 )\n")

Use .
Open

      it "produce-dangling" $
        testCase findAllProduceDangling rules $
            "( 0 0 0 0 0 )\n"++
            "( 0 0 0 0 0 )\n"++
            "( 0 0 0 0 0 )\n"++
Severity: Minor
Found in tests/Analysis/CriticalPairsSpec.hs by hlint

Found

it "produce-dangling" $
  testCase findAllProduceDangling rules $
    "( 0 0 0 0 0 )\n" ++
      "( 0 0 0 0 0 )\n" ++
        "( 0 0 0 0 0 )\n" ++ "( 0 0 0 0 0 )\n" ++ "( 0 0 0 0 0 )\n"

Perhaps

it "produce-dangling" . testCase findAllProduceDangling rules $
  ("( 0 0 0 0 0 )\n" ++
     "( 0 0 0 0 0 )\n" ++
       "( 0 0 0 0 0 )\n" ++ "( 0 0 0 0 0 )\n" ++ "( 0 0 0 0 0 )\n")

Use .
Open

  describe "fromNodesAndEdges" $
    prop "is always valid" $ \nodes edges ->
      isValid (fromNodesAndEdges nodes edges :: Graph Int Int)
Severity: Minor
Found in tests/Data/GraphsSpec.hs by hlint

Found

describe "fromNodesAndEdges" $
  prop "is always valid" $
    \ nodes edges ->
      isValid (fromNodesAndEdges nodes edges :: Graph Int Int)

Perhaps

describe "fromNodesAndEdges" . prop "is always valid" $
  (\ nodes edges ->
     isValid (fromNodesAndEdges nodes edges :: Graph Int Int))

Use .
Open

      "~AX~foo" `shouldParseTo` (Not$ Temporal$A$X$ Not$ Atom "foo")
Severity: Minor
Found in tests/Logic/Ctl/ParserSpec.hs by hlint

Found

Not $ Temporal $ A $ X $ Not $ Atom "foo"

Perhaps

Not . Temporal $ (A $ X $ Not $ Atom "foo")

Use .
Open

      "~AX~foo" `shouldParseTo` (Not$ Temporal$A$X$ Not$ Atom "foo")
Severity: Minor
Found in tests/Logic/Ctl/ParserSpec.hs by hlint

Found

X $ Not $ Atom "foo"

Perhaps

(X . Not $ Atom "foo")

Use .
Open

                  ++ fromJust (errorMessages $ validate $ initialGraph completeOgg)
Severity: Minor
Found in src/CLI/Processes.hs by hlint

Found

errorMessages $ validate $ initialGraph completeOgg

Perhaps

errorMessages . validate $ initialGraph completeOgg

Avoid restricted qualification
Open

import qualified Data.Graphs                  as G

Found

import qualified Data.Graphs as G

Perhaps

import qualified Data.Graphs as Graph

Applying this change:

  • may break the code

Use .
Open

  satisfyExpr' model (Not$ Temporal$E$F$ Not p)
Severity: Minor
Found in src/library/Logic/Ctl/Semantics.hs by hlint

Found

Temporal $ E $ F $ Not p

Perhaps

(Temporal . E $ (F $ Not p))

Unused LANGUAGE pragma
Open

{-# LANGUAGE TypeSynonymInstances #-}
Severity: Minor
Found in src/library/Category/TypedGraph.hs by hlint

Found

{-# LANGUAGE TypeSynonymInstances #-}

Perhaps

Applying this change:

  • Extension TypeSynonymInstances is implied by FlexibleInstances

Use .
Open

  satisfyExpr' model (Not$ Temporal$E$F$ Not p)
Severity: Minor
Found in src/library/Logic/Ctl/Semantics.hs by hlint

Found

E $ F $ Not p

Perhaps

(E . F $ Not p)
Severity
Category
Status
Source
Language