diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49f6d5f..24545dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ jobs: - uses: purescript-contrib/setup-purescript@main with: purescript: "unstable" + purs-tidy: "latest" - uses: actions/setup-node@v3 with: @@ -33,3 +34,8 @@ jobs: run: | bower install npm run-script test --if-present + + - name: Check formatting + run: | + purs-tidy check src test + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a1e9b1..86ecef1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ Bugfixes: Other improvements: - Bumped CI's node version to `lts/*` (#41 by @JordanMartinez) - Updated CI `actions/checkout` and `actions/setup-nodee` to `v3` (#41 by @JordanMartinez) +- Format codebase & enforce formatting in CI via purs-tidy (#42 by @JordanMartinez) ## [v9.0.0](https://github.com/purescript-node/purescript-node-child-process/releases/tag/v9.0.0) - 2022-04-29 diff --git a/src/Node/ChildProcess.purs b/src/Node/ChildProcess.purs index 310d838..632e531 100644 --- a/src/Node/ChildProcess.purs +++ b/src/Node/ChildProcess.purs @@ -88,7 +88,7 @@ type ChildProcessRec = , pid :: Pid , connected :: Boolean , kill :: String -> Unit - , send :: forall r. Fn2 { | r} Handle Boolean + , send :: forall r. Fn2 { | r } Handle Boolean , disconnect :: Effect Unit } @@ -110,8 +110,8 @@ stderr = unsafeFromNullable (missingStream "stderr") <<< _.stderr <<< runChildPr missingStream :: String -> String missingStream str = "Node.ChildProcess: stream not available: " <> str <> "\nThis is probably " - <> "because you passed something other than Pipe to the stdio option when " - <> "you spawned it." + <> "because you passed something other than Pipe to the stdio option when " + <> "you spawned it." foreign import unsafeFromNullable :: forall a. String -> Nullable a -> a @@ -491,7 +491,7 @@ data StdIOBehaviour -- | Create pipes for each of the three standard IO streams. pipe :: Array (Maybe StdIOBehaviour) -pipe = map Just [Pipe, Pipe, Pipe] +pipe = map Just [ Pipe, Pipe, Pipe ] -- | Share `stdin` with `stdin`, `stdout` with `stdout`, -- | and `stderr` with `stderr`. @@ -506,8 +506,7 @@ foreign import process :: forall props. { | props } -- | Ignore all streams. ignore :: Array (Maybe StdIOBehaviour) -ignore = map Just [Ignore, Ignore, Ignore] - +ignore = map Just [ Ignore, Ignore, Ignore ] -- Helpers diff --git a/test/Main.purs b/test/Main.purs index 8c34b5d..e8941c5 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -22,7 +22,7 @@ main = do log "nonexistent executable: all good." log "doesn't perform effects too early" - spawn "ls" ["-la"] defaultSpawnOptions >>= \ls -> do + spawn "ls" [ "-la" ] defaultSpawnOptions >>= \ls -> do let _ = kill SIGTERM ls onExit ls \exit -> case exit of @@ -32,7 +32,7 @@ main = do log ("Bad exit: expected `Normally 0`, got: " <> show exit) log "kills processes" - spawn "ls" ["-la"] defaultSpawnOptions >>= \ls -> do + spawn "ls" [ "-la" ] defaultSpawnOptions >>= \ls -> do _ <- kill SIGTERM ls onExit ls \exit -> case exit of @@ -46,9 +46,9 @@ main = do spawnLs :: Effect Unit spawnLs = do - ls <- spawn "ls" ["-la"] defaultSpawnOptions + ls <- spawn "ls" [ "-la" ] defaultSpawnOptions onExit ls \exit -> - log $ "ls exited: " <> show exit + log $ "ls exited: " <> show exit onData (stdout ls) (Buffer.toString UTF8 >=> log) nonExistentExecutable :: Effect Unit -> Effect Unit @@ -65,6 +65,6 @@ execLs = do execSyncEcho :: String -> Effect Unit execSyncEcho str = do - resBuf <- execSync "cat" (defaultExecSyncOptions {input = Just str}) + resBuf <- execSync "cat" (defaultExecSyncOptions { input = Just str }) res <- Buffer.toString NE.UTF8 resBuf log res