Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Prolog/Programming/CodeAnalysis/Other/RedundantCode.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ toProblem = Problem . displaySuggestion
]
displaySuggestion (DropGoal (n, a, g) goal) =
vsep
[ text $ pack "One goal"
[ text $ pack "One literal"
, indent 2 $ text $ pack $ prettifyTerm goal
, text $ pack "in clause"
, text $ pack "in the body of clause"
, indent 2 $ text $ pack $ prettifyClause $ Clause n a g
, text $ pack "seems redundant and can be removed."
]
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ toProblem msg clause =
Problem {
problemDisplay =
vsep
[ string "The last goal in (an execution trace for) your clause"
[ string "The last literal in (an execution trace for) your clause"
, indent 2 $ string $ pack $ prettifyClause clause
, string "doesn't seem to be a recursive call despite one being used in it."
, maybe empty (string . pack) msg
Expand Down
2 changes: 1 addition & 1 deletion src/Prolog/Programming/CodeAnalysis/Rules/Inlining.hs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ toProblem originalClause equality fixedClause =
, indent 2 $ string $ pack $ prettifyClause originalClause
, string $ pack "uses the unification"
, indent 2 $ string $ pack $ prettifyTerm equality
, string $ pack "as a goal that can also directly be applied to the clause."
, string $ pack "as a literal in the body that can also directly be applied to the clause."
, string $ pack "Doing that would result in:"
, indent 2 $ string $ pack $ prettifyClause fixedClause
]
Expand Down
4 changes: 2 additions & 2 deletions src/Prolog/Programming/CodeAnalysis/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ data CodeAnalysisConfig = CodeAnalysisConfig {
, recursion :: RecursionConfig
-- | Configuration for forbiddenPredicates rule
, forbiddenPredicates :: ForbiddenPredicatesConfig
-- | Configuration for detecting recursive calls before the last goal
-- | Configuration for detecting recursive calls before the last literal in a clause body
, earlyRecursion :: EarlyRecursionConfig
-- | Configuration for inlining rule
, inlining :: InliningConfig
-- | Configuration for symbolOverload rule
, symbolOverload :: SymbolOverloadConfig
-- | Configuration for redundant clause / goal checks
-- | Configuration for redundant clause / literal checks
, redundantCode :: RedundantCodeConfig
}
deriving (Data, Generic, Show, Reader, ToDoc)
Expand Down
2 changes: 1 addition & 1 deletion src/Prolog/Programming/ExampleConfig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ codeAnalysis:
# what to do concerning usage of a symbol both as predicate and as data constructor
status: hint
redundantCode:
# what to do concerning redundant clauses or goals being present
# what to do concerning redundant clauses or literals being present
status: hint
# divisor for timeouts during redundancy check (not used during rigorous validation)
# timeoutDivisor: 2
Expand Down
2 changes: 1 addition & 1 deletion test/CodeAnalysis/MutationSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ check([X|Xs],[Y|Ys]) :- Y is X * 2, length(Xs,A), length(Ys,B), A =:= B, check(X

report <- evaluateCheck config code

report `shouldSatisfy` any (\p -> "The goal" `isInfixOf` p && "A =:= B" `isInfixOf` p)
report `shouldSatisfy` any (\p -> "One literal" `isInfixOf` p && "A =:= B" `isInfixOf` p)
it "detects redundant length([],0) clause" $ do
let code =
[RS.r|
Expand Down
2 changes: 1 addition & 1 deletion test/CodeAnalysis/Rules/InliningSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ detects cases =
caConfig
( map
( \fixedClause display ->
isInfixOf "as a goal that can also directly be applied to the clause." display
isInfixOf "as a literal in the body that can also directly be applied to the clause." display
&& isInfixOf fixedClause display
)
expectedFixedClauses
Expand Down
Loading