Showing 188 of 188 total issues
Function check_module
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
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
- Read upRead up
- Create a ticketCreate a ticket
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
Open
{-# LANGUAGE TupleSections #-}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
{-# LANGUAGE TupleSections #-}
Perhaps
Avoid restricted qualification Open
Open
import Data.Graphs as G
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
import Data.Graphs as G
Perhaps
import Data.Graphs as Graph
Applying this change:
- may break the code
Use . Open
Open
describe "updateNodePayload" $
prop "payload changed" $ \graph f ->
not (Prelude.null $ nodes graph) ==>
(`all` nodeIds graph) $ \nodeId ->
let
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Open
"AG foo" `shouldParseTo` (Temporal$A$G$ Atom "foo")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
A $ G $ Atom "foo"
Perhaps
(A . G $ Atom "foo")
Use . Open
Open
"EF foo" `shouldParseTo` (Temporal$E$F$ Atom "foo")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
E $ F $ Atom "foo"
Perhaps
(E . F $ Atom "foo")
Use . Open
Open
then Just $ buildTypedGraphMorphism d c $ GM.updateNodes n1 n2 m
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
Just $ buildTypedGraphMorphism d c $ GM.updateNodes n1 n2 m
Perhaps
Just . buildTypedGraphMorphism d c $ GM.updateNodes n1 n2 m
Avoid restricted qualification Open
Open
import qualified Data.Graphs as G
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
import qualified Data.Graphs as G
Perhaps
import qualified Data.Graphs as Graph
Applying this change:
- may break the code
Use . Open
Open
"AF foo" `shouldParseTo` (Temporal$A$F$ Atom "foo")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
A $ F $ Atom "foo"
Perhaps
(A . F $ Atom "foo")
Use . Open
Open
(Temporal$E$G$ Not q))
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
Temporal $ E $ G $ Not q
Perhaps
Temporal . E $ (G $ Not q)
Use . Open
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"++
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
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"++
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Open
describe "fromNodesAndEdges" $
prop "is always valid" $ \nodes edges ->
isValid (fromNodesAndEdges nodes edges :: Graph Int Int)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
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
Open
"~AX~foo" `shouldParseTo` (Not$ Temporal$A$X$ Not$ Atom "foo")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
Not $ Temporal $ A $ X $ Not $ Atom "foo"
Perhaps
Not . Temporal $ (A $ X $ Not $ Atom "foo")
Use . Open
Open
"~AX~foo" `shouldParseTo` (Not$ Temporal$A$X$ Not$ Atom "foo")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
X $ Not $ Atom "foo"
Perhaps
(X . Not $ Atom "foo")
Use . Open
Open
++ fromJust (errorMessages $ validate $ initialGraph completeOgg)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
errorMessages $ validate $ initialGraph completeOgg
Perhaps
errorMessages . validate $ initialGraph completeOgg
Avoid restricted qualification Open
Open
import qualified Data.Graphs as G
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
import qualified Data.Graphs as G
Perhaps
import qualified Data.Graphs as Graph
Applying this change:
- may break the code
Use . Open
Open
satisfyExpr' model (Not$ Temporal$E$F$ Not p)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
Temporal $ E $ F $ Not p
Perhaps
(Temporal . E $ (F $ Not p))
Unused LANGUAGE pragma Open
Open
{-# LANGUAGE TypeSynonymInstances #-}
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
{-# LANGUAGE TypeSynonymInstances #-}
Perhaps
Applying this change:
- Extension TypeSynonymInstances is implied by FlexibleInstances
Use . Open
Open
satisfyExpr' model (Not$ Temporal$E$F$ Not p)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Found
E $ F $ Not p
Perhaps
(E . F $ Not p)