mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-08 18:25:17 +08:00
Add a newSystemInterface to go with the rest of the new* constructors
This commit is contained in:
@@ -39,11 +39,12 @@ module ShellCheck.Interface
|
||||
, ColorOption(ColorAuto, ColorAlways, ColorNever)
|
||||
, TokenComment(tcId, tcComment, tcFix)
|
||||
, emptyCheckResult
|
||||
, newParseResult
|
||||
, newAnalysisSpec
|
||||
, newAnalysisResult
|
||||
, newAnalysisSpec
|
||||
, newFormatterOptions
|
||||
, newParseResult
|
||||
, newPosition
|
||||
, newSystemInterface
|
||||
, newTokenComment
|
||||
, mockedSystemInterface
|
||||
, mockRcFile
|
||||
@@ -135,6 +136,14 @@ newParseSpec = ParseSpec {
|
||||
psShellTypeOverride = Nothing
|
||||
}
|
||||
|
||||
newSystemInterface :: Monad m => SystemInterface m
|
||||
newSystemInterface =
|
||||
SystemInterface {
|
||||
siReadFile = \_ _ -> return $ Left "Not implemented",
|
||||
siFindSource = \_ _ _ name -> return name,
|
||||
siGetConfig = \_ -> return Nothing
|
||||
}
|
||||
|
||||
-- Parser input and output
|
||||
data ParseSpec = ParseSpec {
|
||||
psFilename :: String,
|
||||
@@ -311,7 +320,7 @@ data ColorOption =
|
||||
|
||||
-- For testing
|
||||
mockedSystemInterface :: [(String, String)] -> SystemInterface Identity
|
||||
mockedSystemInterface files = SystemInterface {
|
||||
mockedSystemInterface files = (newSystemInterface :: SystemInterface Identity) {
|
||||
siReadFile = rf,
|
||||
siFindSource = fs,
|
||||
siGetConfig = const $ return Nothing
|
||||
|
Reference in New Issue
Block a user