mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-07 11:13:15 +08:00
Added a json interface
This commit is contained in:
6
Makefile
6
Makefile
@@ -1,10 +1,14 @@
|
|||||||
all: shellcheck .tests
|
all: shellcheck jsoncheck .tests
|
||||||
: Done
|
: Done
|
||||||
|
|
||||||
shellcheck: regardless
|
shellcheck: regardless
|
||||||
: Conditionally compiling shellcheck
|
: Conditionally compiling shellcheck
|
||||||
ghc --make shellcheck
|
ghc --make shellcheck
|
||||||
|
|
||||||
|
jsoncheck: regardless
|
||||||
|
: Conditionally compiling shellcheck
|
||||||
|
ghc --make jsoncheck
|
||||||
|
|
||||||
.tests: *.hs */*.hs
|
.tests: *.hs */*.hs
|
||||||
: Running unit tests
|
: Running unit tests
|
||||||
./test/runQuack && touch .tests
|
./test/runQuack && touch .tests
|
||||||
|
15
jsoncheck.hs
Normal file
15
jsoncheck.hs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import ShellCheck.Simple
|
||||||
|
import Text.JSON
|
||||||
|
|
||||||
|
instance JSON ShellCheckComment where
|
||||||
|
showJSON c = makeObj [
|
||||||
|
("line", showJSON $ scLine c),
|
||||||
|
("column", showJSON $ scColumn c),
|
||||||
|
("level", showJSON $ scSeverity c),
|
||||||
|
("message", showJSON $ scMessage c)
|
||||||
|
]
|
||||||
|
readJSON = undefined
|
||||||
|
|
||||||
|
main = do
|
||||||
|
script <- getContents
|
||||||
|
putStrLn $ encodeStrict $ shellCheck script
|
Reference in New Issue
Block a user