From f569c3e63589b53e954c0c807f0c6a07a810b39e Mon Sep 17 00:00:00 2001 From: nimec01 <24428341+nimec01@users.noreply.github.com> Date: Fri, 27 Nov 2026 13:15:38 +0100 Subject: [PATCH] don't use "goal" in feedback --- src/Prolog/Programming/CodeAnalysis/Other/RedundantCode.hs | 4 ++-- src/Prolog/Programming/CodeAnalysis/Rules/EarlyRecursion.hs | 2 +- src/Prolog/Programming/CodeAnalysis/Rules/Inlining.hs | 2 +- src/Prolog/Programming/CodeAnalysis/Types.hs | 4 ++-- src/Prolog/Programming/ExampleConfig.hs | 2 +- test/CodeAnalysis/MutationSpec.hs | 2 +- test/CodeAnalysis/Rules/InliningSpec.hs | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Prolog/Programming/CodeAnalysis/Other/RedundantCode.hs b/src/Prolog/Programming/CodeAnalysis/Other/RedundantCode.hs index 0eba0c02..531e0095 100644 --- a/src/Prolog/Programming/CodeAnalysis/Other/RedundantCode.hs +++ b/src/Prolog/Programming/CodeAnalysis/Other/RedundantCode.hs @@ -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." ] diff --git a/src/Prolog/Programming/CodeAnalysis/Rules/EarlyRecursion.hs b/src/Prolog/Programming/CodeAnalysis/Rules/EarlyRecursion.hs index 7cd1b807..be6900a5 100644 --- a/src/Prolog/Programming/CodeAnalysis/Rules/EarlyRecursion.hs +++ b/src/Prolog/Programming/CodeAnalysis/Rules/EarlyRecursion.hs @@ -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 diff --git a/src/Prolog/Programming/CodeAnalysis/Rules/Inlining.hs b/src/Prolog/Programming/CodeAnalysis/Rules/Inlining.hs index 18a3808f..7fd01b2f 100644 --- a/src/Prolog/Programming/CodeAnalysis/Rules/Inlining.hs +++ b/src/Prolog/Programming/CodeAnalysis/Rules/Inlining.hs @@ -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 ] diff --git a/src/Prolog/Programming/CodeAnalysis/Types.hs b/src/Prolog/Programming/CodeAnalysis/Types.hs index 66dc7d2f..9115cd03 100644 --- a/src/Prolog/Programming/CodeAnalysis/Types.hs +++ b/src/Prolog/Programming/CodeAnalysis/Types.hs @@ -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) diff --git a/src/Prolog/Programming/ExampleConfig.hs b/src/Prolog/Programming/ExampleConfig.hs index e5bfc9ca..0f730917 100644 --- a/src/Prolog/Programming/ExampleConfig.hs +++ b/src/Prolog/Programming/ExampleConfig.hs @@ -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 diff --git a/test/CodeAnalysis/MutationSpec.hs b/test/CodeAnalysis/MutationSpec.hs index 43940f65..05512db7 100644 --- a/test/CodeAnalysis/MutationSpec.hs +++ b/test/CodeAnalysis/MutationSpec.hs @@ -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| diff --git a/test/CodeAnalysis/Rules/InliningSpec.hs b/test/CodeAnalysis/Rules/InliningSpec.hs index 569e8953..bcb06063 100644 --- a/test/CodeAnalysis/Rules/InliningSpec.hs +++ b/test/CodeAnalysis/Rules/InliningSpec.hs @@ -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