Report configuration error

This commit is contained in:
Jeroen Engels 2024-02-23 23:14:09 +01:00
parent 5d64d1073e
commit 9f34b4cba7
2 changed files with 14 additions and 6 deletions

View File

@ -1327,10 +1327,15 @@ fromProjectRuleSchema (ProjectRuleSchema schema) =
)
}
Err _ ->
Err faultyGlobs ->
configurationError schema.name
{ message = "Invalid globs provided"
, details = [ "Globs bad" ]
{ message = "Invalid globs provided when requesting extra files"
, details =
[ "This rule requested additional files, but did so by specifying globs that I could not make sense of:"
, faultyGlobs
|> List.indexedMap (\index glob -> " " ++ String.fromInt (index + 1) ++ ". " ++ glob)
|> String.join "\n"
]
}

View File

@ -90,12 +90,15 @@ a = 1
\() ->
createRule
(Rule.withExtraFilesModuleVisitor
[ " ** " ]
[ "** " ]
(reportsFileNames "A")
)
|> Review.Test.expectConfigurationError
{ message = "err"
, details = [ "details" ]
{ message = "Invalid globs provided when requesting extra files"
, details =
[ "This rule requested additional files, but did so by specifying globs that I could not make sense of:"
, " 1. ** "
]
}
]