Skip to content

Commit

Permalink
Add listSep
Browse files Browse the repository at this point in the history
  • Loading branch information
philderbeast committed Nov 25, 2024
1 parent b08b629 commit 93ae2b5
Showing 1 changed file with 29 additions and 36 deletions.
65 changes: 29 additions & 36 deletions Cabal/src/Distribution/PackageDescription/Check/Warning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1316,45 +1316,33 @@ ppExplanation BaseNoUpperBounds =
++ "version. For example if you have tested your package with 'base' "
++ "version 4.5 and 4.6 then use 'build-depends: base >= 4.5 && < 4.7'."
ppExplanation (MissingUpperBounds ct names) =
let separator = "\n - "
in "On "
++ ppCET ct
++ ", "
++ "these packages miss upper bounds:"
++ separator
++ List.intercalate separator names
++ "\n"
++ "Please add them. There is more information at https://pvp.haskell.org/"
"On "
++ ppCET ct
++ ", "
++ "these packages miss upper bounds:"
++ listSep names
++ "Please add them. There is more information at https://pvp.haskell.org/"
ppExplanation (LEQUpperBounds ct names) =
let separator = "\n - "
in "On "
++ ppCET ct
++ ", "
++ "these packages have less than or equals (<=) upper bounds:"
++ separator
++ List.intercalate separator names
++ "\n"
++ "Please use less than (<) for upper bounds."
"On "
++ ppCET ct
++ ", "
++ "these packages have less than or equals (<=) upper bounds:"
++ listSep names
++ "Please use less than (<) for upper bounds."
ppExplanation (TrailingZeroUpperBounds ct names) =
let separator = "\n - "
in "On "
++ ppCET ct
++ ", "
++ "these packages have upper bounds with trailing zeros:"
++ separator
++ List.intercalate separator names
++ "\n"
++ "Please avoid trailing zeros for upper bounds."
"On "
++ ppCET ct
++ ", "
++ "these packages have upper bounds with trailing zeros:"
++ listSep names
++ "Please avoid trailing zeros for upper bounds."
ppExplanation (GTLowerBounds ct names) =
let separator = "\n - "
in "On "
++ ppCET ct
++ ", "
++ "these packages have greater than (>) lower bounds:"
++ separator
++ List.intercalate separator names
++ "\n"
++ "Please use greater than or equals (>=) for lower bounds."
"On "
++ ppCET ct
++ ", "
++ "these packages have greater than (>) lower bounds:"
++ listSep names
++ "Please use greater than or equals (>=) for lower bounds."
ppExplanation (SuspiciousFlagName invalidFlagNames) =
"Suspicious flag names: "
++ unwords invalidFlagNames
Expand Down Expand Up @@ -1516,6 +1504,11 @@ ppExplanation (WrongFieldForExpectedDocFiles extraDocFileSupport field paths) =

-- * Formatting utilities

listSep :: [String] -> String
listSep names =
let separator = "\n - "
in separator ++ List.intercalate separator names ++ "\n"

commaSep :: [String] -> String
commaSep = List.intercalate ", "

Expand Down

0 comments on commit 93ae2b5

Please sign in to comment.