diff --git a/.github/workflows/restyled.yml b/.github/workflows/restyled.yml new file mode 100644 index 0000000..72720ab --- /dev/null +++ b/.github/workflows/restyled.yml @@ -0,0 +1,22 @@ +name: Restyled + +on: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + pull-requests: write + +jobs: + restyled: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: restyled-io/actions/setup@v4 + - uses: restyled-io/actions/run@v4 + with: + suggestions: true diff --git a/.restyled.yaml b/.restyled.yaml index 20a1cec..c25b270 100644 --- a/.restyled.yaml +++ b/.restyled.yaml @@ -4,7 +4,7 @@ restylers: enabled: false - fourmolu: image: - tag: v0.14.1.0 + tag: v0.17.0.0 - stylish-haskell: enabled: false - prettier-markdown: diff --git a/app/Main.hs b/app/Main.hs index cecba33..3c4b678 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -11,8 +11,8 @@ main :: IO () main = runSubcommand $ subcommand Commands.cat - <> subcommand Commands.capture - <> subcommand Commands.changes - <> subcommand Commands.deploy - <> subcommand Commands.list - <> subcommand Commands.version + <> subcommand Commands.capture + <> subcommand Commands.changes + <> subcommand Commands.deploy + <> subcommand Commands.list + <> subcommand Commands.version diff --git a/fourmolu.yaml b/fourmolu.yaml index 9211e93..292304b 100644 --- a/fourmolu.yaml +++ b/fourmolu.yaml @@ -1,15 +1,30 @@ indentation: 2 -column-limit: 80 # ignored until v12 / ghc-9.6 +column-limit: 80 # needs v0.12 function-arrows: leading comma-style: leading # default import-export-style: leading +import-grouping: # needs v0.17 + - name: "Preludes" + rules: + - glob: Prelude + - glob: "**.Prelude" + - glob: RIO + - glob: Stackctl.Test.App + - name: "Everything else" + rules: + - match: all + priority: 100 indent-wheres: false # default record-brace-space: true newlines-between-decls: 1 # default haddock-style: single-line let-style: mixed in-style: left-align -single-constraint-parens: never # ignored until v12 / ghc-9.6 +single-constraint-parens: never # needs v0.12 +sort-constraints: false # default +sort-derived-classes: false # default +sort-derived-clauses: false # default +trailing-section-operators: false # needs v0.17 unicode: never # default respectful: true # default diff --git a/src/Stackctl/AWS/CloudFormation.hs b/src/Stackctl/AWS/CloudFormation.hs index 0e21dc0..728b52b 100644 --- a/src/Stackctl/AWS/CloudFormation.hs +++ b/src/Stackctl/AWS/CloudFormation.hs @@ -194,7 +194,7 @@ awsCloudFormationDescribeStackMaybe stackName = handling_ _ValidationError (pure Nothing) $ awsSilently -- don't log said 400 $ Just - <$> awsCloudFormationDescribeStack stackName + <$> awsCloudFormationDescribeStack stackName awsCloudFormationDescribeStackOutputs :: (MonadIO m, MonadAWS m) @@ -218,10 +218,10 @@ awsCloudFormationDescribeStackEvents stackName mLastId = do runConduit $ AWS.paginate req - .| mapC (fromMaybe [] . (^. describeStackEventsResponse_stackEvents)) - .| concatC - .| takeWhileC (\e -> Just (e ^. stackEvent_eventId) /= mLastId) - .| sinkList + .| mapC (fromMaybe [] . (^. describeStackEventsResponse_stackEvents)) + .| concatC + .| takeWhileC (\e -> Just (e ^. stackEvent_eventId) /= mLastId) + .| sinkList awsCloudFormationGetStackNamesMatching :: (MonadIO m, MonadAWS m) @@ -232,12 +232,12 @@ awsCloudFormationGetStackNamesMatching p = do runConduit $ AWS.paginate req - .| concatMapC (^. listStacksResponse_stackSummaries) - .| concatC - .| mapC (^. stackSummary_stackName) - .| filterC ((p `match`) . unpack) - .| mapC StackName - .| sinkList + .| concatMapC (^. listStacksResponse_stackSummaries) + .| concatC + .| mapC (^. stackSummary_stackName) + .| filterC ((p `match`) . unpack) + .| mapC StackName + .| sinkList awsCloudFormationGetMostRecentStackEventId :: (MonadIO m, MonadAWS m) @@ -258,9 +258,9 @@ awsCloudFormationGetMostRecentStackEventId stackName = do AWS.simple req $ pure - . getFirstEventId - . fromMaybe [] - . (^. describeStackEventsResponse_stackEvents) + . getFirstEventId + . fromMaybe [] + . (^. describeStackEventsResponse_stackEvents) awsCloudFormationDeleteStack :: (MonadIO m, MonadLogger m, MonadAWS m) @@ -314,7 +314,7 @@ awaitStack awaitStack waiter stackName = AWS.await waiter $ newDescribeStacks - & describeStacks_stackName ?~ unStackName stackName + & describeStacks_stackName ?~ unStackName stackName makeParameter :: Text -> Maybe Text -> Parameter makeParameter k v = @@ -424,7 +424,7 @@ awsCloudFormationCreateChangeSet stackName mStackDescription stackTemplate param logInfo $ "Creating changeset..." - :# ["name" .= name, "type" .= changeSetType] + :# ["name" .= name, "type" .= changeSetType] csId <- AWS.simple req (^. createChangeSetResponse_id) logDebug "Awaiting CREATE_COMPLETE" @@ -471,16 +471,16 @@ awsCloudFormationDeleteAllChangeSets stackName = do logInfo "Deleting all changesets" runConduit $ AWS.paginate (newListChangeSets $ unStackName stackName) - .| concatMapC - ( \resp -> fromMaybe [] $ do - ss <- resp ^. listChangeSetsResponse_summaries - pure $ mapMaybe Summary.changeSetId ss - ) - .| mapM_C - ( \csId -> do - logInfo $ "Enqueing delete" :# ["changeSetId" .= csId] - void $ AWS.send $ newDeleteChangeSet csId - ) + .| concatMapC + ( \resp -> fromMaybe [] $ do + ss <- resp ^. listChangeSetsResponse_summaries + pure $ mapMaybe Summary.changeSetId ss + ) + .| mapM_C + ( \csId -> do + logInfo $ "Enqueing delete" :# ["changeSetId" .= csId] + void $ AWS.send $ newDeleteChangeSet csId + ) -- | Did we abandoned this Stack's first ever ChangeSet? -- diff --git a/src/Stackctl/AWS/Core.hs b/src/Stackctl/AWS/Core.hs index dba4001..b0db1f1 100644 --- a/src/Stackctl/AWS/Core.hs +++ b/src/Stackctl/AWS/Core.hs @@ -160,10 +160,10 @@ handlingServiceError = handling _ServiceError $ \e -> do logError $ "Exiting due to AWS Service error" - :# [ "code" .= toText (e ^. serviceError_code) - , "message" .= fmap toText (e ^. serviceError_message) - , "requestId" .= fmap toText (e ^. serviceError_requestId) - ] + :# [ "code" .= toText (e ^. serviceError_code) + , "message" .= fmap toText (e ^. serviceError_message) + , "requestId" .= fmap toText (e ^. serviceError_requestId) + ] exitFailure formatServiceError :: ServiceError -> Text diff --git a/src/Stackctl/AWS/Lambda.hs b/src/Stackctl/AWS/Lambda.hs index 61684ae..c0c9fba 100644 --- a/src/Stackctl/AWS/Lambda.hs +++ b/src/Stackctl/AWS/Lambda.hs @@ -93,11 +93,11 @@ awsLambdaInvoke name payload = do logDebug $ "Function result" - :# [ "name" .= name - , "status" .= status - , "error" .= mError - , "functionError" .= mFunctionError - ] + :# [ "name" .= name + , "status" .= status + , "error" .= mError + , "functionError" .= mFunctionError + ] pure $ if diff --git a/src/Stackctl/AWS/Scope.hs b/src/Stackctl/AWS/Scope.hs index 3d3f72e..909ec8d 100644 --- a/src/Stackctl/AWS/Scope.hs +++ b/src/Stackctl/AWS/Scope.hs @@ -26,20 +26,14 @@ awsScopeSpecPatterns :: AwsScope -> [Pattern] awsScopeSpecPatterns AwsScope {..} = [ compile $ "stacks" - unpack (unAccountId awsAccountId) - <> ".*" - unpack (fromRegion awsRegion) - <> "**" - "*" - <.> "yaml" + unpack (unAccountId awsAccountId) <> ".*" + unpack (fromRegion awsRegion) <> "**" + "*" <.> "yaml" , compile $ "stacks" - "*." - <> unpack (unAccountId awsAccountId) - unpack (fromRegion awsRegion) - <> "**" - "*" - <.> "yaml" + "*." <> unpack (unAccountId awsAccountId) + unpack (fromRegion awsRegion) <> "**" + "*" <.> "yaml" ] awsScopeSpecStackName :: AwsScope -> FilePath -> Maybe StackName @@ -50,13 +44,13 @@ awsScopeSpecStackName scope path = do -- pretty fast and loose with the "parsing" step pure $ path -- stacks/account/region/x/y.yaml - & splitPath -- [stacks/, account/, region/, x/, y.yaml] - & drop 3 -- [x, y.yaml] - & joinPath -- x/y.yaml - & dropExtension -- x/y - & pack - & T.replace "/" "-" -- x-y - & StackName + & splitPath -- [stacks/, account/, region/, x/, y.yaml] + & drop 3 -- [x, y.yaml] + & joinPath -- x/y.yaml + & dropExtension -- x/y + & pack + & T.replace "/" "-" -- x-y + & StackName class HasAwsScope env where awsScopeL :: Lens' env AwsScope diff --git a/src/Stackctl/Action.hs b/src/Stackctl/Action.hs index ffc496a..ed05c0a 100644 --- a/src/Stackctl/Action.hs +++ b/src/Stackctl/Action.hs @@ -128,10 +128,10 @@ runAction stackName Action {on, run} = do Nothing -> do logError $ "Output not found" - :# [ "stackName" .= stackName - , "desiredOutput" .= outputName - , "availableOutputs" .= map (^. output_outputKey) outputs - ] + :# [ "stackName" .= stackName + , "desiredOutput" .= outputName + , "availableOutputs" .= map (^. output_outputKey) outputs + ] throwIO NoSuchOutput Just name -> invoke name InvokeLambdaByName name -> invoke name diff --git a/src/Stackctl/Config.hs b/src/Stackctl/Config.hs index 9cf2148..2092179 100644 --- a/src/Stackctl/Config.hs +++ b/src/Stackctl/Config.hs @@ -75,9 +75,10 @@ loadConfigOrExit = either die pure =<< loadConfig loadConfig :: MonadIO m => m (Either ConfigError Config) loadConfig = - runExceptT $ getConfigFile >>= \case - Nothing -> pure emptyConfig - Just cf -> loadConfigFrom cf + runExceptT + $ getConfigFile >>= \case + Nothing -> pure emptyConfig + Just cf -> loadConfigFrom cf loadConfigFrom :: (MonadIO m, MonadError ConfigError m) => FilePath -> m Config loadConfigFrom path = loadConfigFromBytes =<< liftIO (readFileBinary path) diff --git a/src/Stackctl/Config/RequiredVersion.hs b/src/Stackctl/Config/RequiredVersion.hs index 56e119e..842f2f3 100644 --- a/src/Stackctl/Config/RequiredVersion.hs +++ b/src/Stackctl/Config/RequiredVersion.hs @@ -54,7 +54,7 @@ requiredVersionFromText = fromWords . T.words ws -> Left $ show (unpack $ T.unwords ws) - <> " did not parse as optional operator and version string" + <> " did not parse as optional operator and version string" parseRequiredVersion :: Text -> Text -> Either String RequiredVersion parseRequiredVersion op w = RequiredVersion <$> parseOp op <*> parseVersion w @@ -71,8 +71,8 @@ requiredVersionFromText = fromWords . T.words op -> Left $ "Invalid comparison operator (" - <> unpack op - <> "), may only be =, <, <=, >, >=, or =~" + <> unpack op + <> "), may only be =, <, <=, >, >=, or =~" parseVersion :: Text -> Either String Version parseVersion t = diff --git a/src/Stackctl/FilterOption.hs b/src/Stackctl/FilterOption.hs index 0310e50..90ae154 100644 --- a/src/Stackctl/FilterOption.hs +++ b/src/Stackctl/FilterOption.hs @@ -44,8 +44,8 @@ envFilterOption items = var "FILTERS" <|> var "FILTER" Env.var (first Env.UnreadError . readFilterOption) name $ Env.help $ "Filter " - <> items - <> " by patterns" + <> items + <> " by patterns" filterOption :: String -> Parser FilterOption filterOption items = diff --git a/src/Stackctl/Options.hs b/src/Stackctl/Options.hs index ba3f927..6f472bc 100644 --- a/src/Stackctl/Options.hs +++ b/src/Stackctl/Options.hs @@ -55,11 +55,11 @@ envParser :: Env.Parser Env.Error Options envParser = Env.prefixed "STACKCTL_" $ Options - <$> optional envDirectoryOption - <*> optional (envFilterOption "specifications") - <*> pure mempty -- use LOG_COLOR - <*> pure mempty -- use LOG_LEVEL - <*> optional envAutoSSOOption + <$> optional envDirectoryOption + <*> optional (envFilterOption "specifications") + <*> pure mempty -- use LOG_COLOR + <*> pure mempty -- use LOG_LEVEL + <*> optional envAutoSSOOption -- brittany-disable-next-binding diff --git a/src/Stackctl/Spec/Capture.hs b/src/Stackctl/Spec/Capture.hs index 2332edd..d71d790 100644 --- a/src/Stackctl/Spec/Capture.hs +++ b/src/Stackctl/Spec/Capture.hs @@ -132,9 +132,8 @@ runCapture CaptureOptions {..} = do case results of [] -> do logError - $ "No Active Stacks match " - <> pack (decompile scoStackName) - :# [] + $ "No Active Stacks match " <> pack (decompile scoStackName) + :# [] exitFailure [stackName] -> do stack <- awsCloudFormationDescribeStack stackName diff --git a/src/Stackctl/Spec/Cat.hs b/src/Stackctl/Spec/Cat.hs index bf62dd3..3ef1ffa 100644 --- a/src/Stackctl/Spec/Cat.hs +++ b/src/Stackctl/Spec/Cat.hs @@ -138,11 +138,11 @@ prettyPrintStackSpecYaml Colors {..} name StackSpecYaml {..} = kvs <- f <$> mA pure $ [cyan label <> ":"] - <> map - ( \(k, mV) -> - " " <> cyan k <> ":" <> maybe "" (\v -> " " <> green v) mV - ) - kvs + <> map + ( \(k, mV) -> + " " <> cyan k <> ":" <> maybe "" (\v -> " " <> green v) mV + ) + kvs ppList :: Text -> (a -> [Text]) -> Maybe a -> [Text] ppList label f = maybe [] (((cyan label <> ":") :) . f) @@ -186,8 +186,8 @@ prettyPrintTemplate Colors {..} val = displayObjectProperty = displayPropertyWith @(HashMap Text Value) $ map ((" - " <>) . green) - . sort - . HashMap.keys + . sort + . HashMap.keys displayPropertyWith :: (FromJSON a, ToJSON a) => (a -> [Text]) -> Text -> [Text] diff --git a/src/Stackctl/Spec/Changes/Format.hs b/src/Stackctl/Spec/Changes/Format.hs index ddb5291..359a27c 100644 --- a/src/Stackctl/Spec/Changes/Format.hs +++ b/src/Stackctl/Spec/Changes/Format.hs @@ -76,10 +76,11 @@ formatTTY colors@Colors {..} name mChangeSet = case (mChangeSet, rChanges) of (Nothing, _) -> "No changes for " <> name (_, Nothing) -> "Metadata only changes (e.g. Tags or Outputs)" (_, Just rcs) -> - ("\n" <>) $ (<> "\n") $ mconcat $ ("Changes for " <> cyan name <> ":") - : map - (("\n " <>) . formatResourceChange) - (NE.toList rcs) + ("\n" <>) + $ (<> "\n") + $ mconcat + $ ("Changes for " <> cyan name <> ":") + : map (("\n " <>) . formatResourceChange) (NE.toList rcs) where rChanges = do cs <- mChangeSet @@ -149,20 +150,20 @@ commentBody omitFull cs rcs = , "\n| Action | Logical Id | Physical Id | Type | Replacement | Scope | Details |" , "\n| --- | --- | --- | --- | --- | --- | --- |" ] - <> map commentTableRow (NE.toList rcs) - <> case omitFull of - OmitFull -> [] - IncludeFull -> - [ "\n" - , "\n
" - , "\nFull changes" - , "\n" - , "\n```json" - , "\n" <> changeSetJSON cs - , "\n```" - , "\n" - , "\n
" - ] + <> map commentTableRow (NE.toList rcs) + <> case omitFull of + OmitFull -> [] + IncludeFull -> + [ "\n" + , "\n
" + , "\nFull changes" + , "\n" + , "\n```json" + , "\n" <> changeSetJSON cs + , "\n```" + , "\n" + , "\n
" + ] commentTableRow :: ResourceChange -> Text commentTableRow ResourceChange' {..} = @@ -194,10 +195,10 @@ formatDetail Colors {..} ResourceChangeDetail' {..} = do pure $ toText c - <> maybe "" ((" in " <>) . toText) attr - <> maybe "" (\x -> " (" <> magenta (toText x) <> ")") n - <> maybe "" ((", recreation " <>) . formatRR) rr - <> maybe "" ((", caused by " <>) . toText) causingEntity + <> maybe "" ((" in " <>) . toText) attr + <> maybe "" (\x -> " (" <> magenta (toText x) <> ")") n + <> maybe "" ((", recreation " <>) . formatRR) rr + <> maybe "" ((", caused by " <>) . toText) causingEntity where formatRR = \case x@RequiresRecreation_Always -> red (toText x) diff --git a/src/Stackctl/Spec/Deploy.hs b/src/Stackctl/Spec/Deploy.hs index 08295b6..d8c2913 100644 --- a/src/Stackctl/Spec/Deploy.hs +++ b/src/Stackctl/Spec/Deploy.hs @@ -266,8 +266,7 @@ formatStackEvent Colors {..} e = do timestamp <- liftIO $ formatTime defaultTimeLocale "%F %T %Z" - <$> utcToLocalZonedTime - (e ^. stackEvent_timestamp) + <$> utcToLocalZonedTime (e ^. stackEvent_timestamp) pure $ mconcat @@ -276,8 +275,7 @@ formatStackEvent Colors {..} e = do , maybe "" colorStatus $ e ^. stackEvent_resourceStatus , maybe "" (magenta . (" " <>)) $ e ^. stackEvent_logicalResourceId , maybe "" ((\x -> " (" <> x <> ")") . T.strip) - $ e - ^. stackEvent_resourceStatusReason + $ e ^. stackEvent_resourceStatusReason ] where colorStatus = \case diff --git a/src/Stackctl/Spec/Discover.hs b/src/Stackctl/Spec/Discover.hs index a0b6e2a..bcec218 100644 --- a/src/Stackctl/Spec/Discover.hs +++ b/src/Stackctl/Spec/Discover.hs @@ -105,9 +105,9 @@ checkForDuplicateStackNames = logError $ "Multiple specifications produced the same Stack name" - :# [ "name" .= stackSpecPathStackName (NE.head specPaths) - , "paths" .= collidingPaths - ] + :# [ "name" .= stackSpecPathStackName (NE.head specPaths) + , "paths" .= collidingPaths + ] exitFailure @@ -130,18 +130,17 @@ checkForUnknownDepends known spec = for_ depends $ \depend -> do let (nearest, _distance) = NE.minimumBy1 (comparing snd) - $ (id &&& getDistance depend) - <$> known + $ (id &&& getDistance depend) <$> known logWarn $ "Stack lists dependency that does not exist" - :# [ "dependency" - .= ( unStackName (stackSpecStackName spec) - <> " -> " - <> unStackName depend - ) - , "hint" .= ("Did you mean " <> unStackName nearest <> "?") - ] + :# [ "dependency" + .= ( unStackName (stackSpecStackName spec) + <> " -> " + <> unStackName depend + ) + , "hint" .= ("Did you mean " <> unStackName nearest <> "?") + ] getDistance = levenshtein `on` unStackName diff --git a/src/Stackctl/Spec/List.hs b/src/Stackctl/Spec/List.hs index 90aecac..097717a 100644 --- a/src/Stackctl/Spec/List.hs +++ b/src/Stackctl/Spec/List.hs @@ -79,7 +79,7 @@ runList ListOptions {..} = do when loLegend $ pushLoggerLn $ "\nLegend:\n " - <> T.intercalate ", " (map legendItem [minBound .. maxBound]) + <> T.intercalate ", " (map legendItem [minBound .. maxBound]) data Indicator = Deployed diff --git a/src/Stackctl/StackSpec.hs b/src/Stackctl/StackSpec.hs index 1ea2f17..e2e0300 100644 --- a/src/Stackctl/StackSpec.hs +++ b/src/Stackctl/StackSpec.hs @@ -81,8 +81,7 @@ stackSpecTemplate :: StackSpec -> StackTemplate stackSpecTemplate spec = StackTemplate $ FilePath.normalise - $ ssSpecRoot spec - stackSpecTemplateFile spec + $ ssSpecRoot spec stackSpecTemplateFile spec stackSpecParameters :: StackSpec -> [Parameter] stackSpecParameters = @@ -197,8 +196,7 @@ createChangeSet spec parameters tags = (stackSpecStackName spec) (stackSpecStackDescription spec) (stackSpecTemplate spec) - ( nubOrdOn (^. parameter_parameterKey) $ parameters <> stackSpecParameters spec - ) + (nubOrdOn (^. parameter_parameterKey) $ parameters <> stackSpecParameters spec) (stackSpecCapabilities spec) (nubOrdOn (^. tag_key) $ tags <> stackSpecTags spec) diff --git a/src/Stackctl/StackSpecPath.hs b/src/Stackctl/StackSpecPath.hs index a5ce673..8500b61 100644 --- a/src/Stackctl/StackSpecPath.hs +++ b/src/Stackctl/StackSpecPath.hs @@ -83,16 +83,16 @@ stackSpecPathFromFilePath awsScope@AwsScope {..} path = unless (pathAccountId == awsAccountId) $ Left $ "Unexpected account: " - <> unpack (unAccountId pathAccountId) - <> " != " - <> unpack (unAccountId awsAccountId) + <> unpack (unAccountId pathAccountId) + <> " != " + <> unpack (unAccountId awsAccountId) unless (unpack (fromRegion awsRegion) == pathRegion) $ Left $ "Unexpected region: " - <> pathRegion - <> " != " - <> unpack (fromRegion awsRegion) + <> pathRegion + <> " != " + <> unpack (fromRegion awsRegion) stackName <- maybe (Left "Must end in .yaml") (Right . StackName) @@ -117,6 +117,6 @@ parseAccountPath path = case second (T.drop 1) $ T.breakOn "." $ pack path of _ -> Left $ "Path matches neither {account-id}.{account-name}, nor {account-name}.{account-id}: " - <> path + <> path where isAccountId x = T.length x == 12 && T.all isDigit x diff --git a/src/Stackctl/StackSpecYaml.hs b/src/Stackctl/StackSpecYaml.hs index 7ae052c..7cb0e60 100644 --- a/src/Stackctl/StackSpecYaml.hs +++ b/src/Stackctl/StackSpecYaml.hs @@ -85,8 +85,7 @@ instance Semigroup ParametersYaml where $ KeyMap.toList $ KeyMap.fromListWith (<>) $ map (pyKey &&& pyValue) - $ bs -- flipped to make sure Last-wins - <> as + $ bs <> as -- flipped to make sure Last-wins instance FromJSON ParametersYaml where parseJSON = \case @@ -215,8 +214,7 @@ instance Semigroup TagsYaml where $ HashMap.toList $ HashMap.fromList $ map (toPair . unTagYaml) - $ as - <> bs + $ as <> bs where toPair :: Tag -> (Text, Text) toPair = (^. tag_key) &&& (^. tag_value) diff --git a/src/Stackctl/Version.hs b/src/Stackctl/Version.hs index b768081..f1871df 100644 --- a/src/Stackctl/Version.hs +++ b/src/Stackctl/Version.hs @@ -3,10 +3,10 @@ module Stackctl.Version ) where import Stackctl.Prelude +import Prelude (putStrLn) import Data.Version import qualified Paths_stackctl as Pkg -import Prelude (putStrLn) logVersion :: MonadIO m => m () logVersion = liftIO $ putStrLn $ ("Stackctl v" <>) $ showVersion Pkg.version diff --git a/test/Stackctl/AWS/EC2Spec.hs b/test/Stackctl/AWS/EC2Spec.hs index df71979..4f1d8a0 100644 --- a/test/Stackctl/AWS/EC2Spec.hs +++ b/test/Stackctl/AWS/EC2Spec.hs @@ -23,7 +23,7 @@ spec = do $ Right $ newDescribeAvailabilityZonesResponse 200 & describeAvailabilityZonesResponse_availabilityZones - ?~ zones + ?~ zones withMatcher matcher awsEc2DescribeFirstAvailabilityZoneRegionName `shouldReturn` "us-east-1" diff --git a/test/Stackctl/AWS/LambdaSpec.hs b/test/Stackctl/AWS/LambdaSpec.hs index bfb3b92..6226718 100644 --- a/test/Stackctl/AWS/LambdaSpec.hs +++ b/test/Stackctl/AWS/LambdaSpec.hs @@ -33,18 +33,16 @@ spec = do [ SendMatcher (isInvocation "lambda-1") $ Right $ newInvokeResponse 200 - & invokeResponse_payload - ?~ "" + & invokeResponse_payload ?~ "" , SendMatcher (isInvocation "lambda-2") $ Right $ newInvokeResponse 200 - & invokeResponse_payload - ?~ BSL.toStrict (encode lambdaError) + & invokeResponse_payload ?~ BSL.toStrict (encode lambdaError) , SendMatcher (isInvocation "lambda-3") $ Right $ newInvokeResponse 500 & (invokeResponse_payload ?~ "") - . (invokeResponse_functionError ?~ "") + . (invokeResponse_functionError ?~ "") ] withMatchers matchers $ do diff --git a/test/Stackctl/ConfigSpec.hs b/test/Stackctl/ConfigSpec.hs index 971c25b..3d25d07 100644 --- a/test/Stackctl/ConfigSpec.hs +++ b/test/Stackctl/ConfigSpec.hs @@ -32,8 +32,7 @@ spec = do case result of Left err -> do expectationFailure - $ "Expected to load a Config, got error: " - <> show err + $ "Expected to load a Config, got error: " <> show err Right config -> do configParameters config `shouldBe` Just (toParametersYaml [("Some", Just "Parameter")]) @@ -56,9 +55,9 @@ spec = do Right config = loadConfigFromBytes $ "defaults:" - <> "\n tags:" - <> "\n From: Defaults" - <> "\n Keep: \"You?\"" + <> "\n tags:" + <> "\n From: Defaults" + <> "\n Keep: \"You?\"" Just tags = ssyTags (applyConfig config specYaml) diff --git a/test/Stackctl/Test/App.hs b/test/Stackctl/Test/App.hs index afa45c9..3e4f436 100644 --- a/test/Stackctl/Test/App.hs +++ b/test/Stackctl/Test/App.hs @@ -92,5 +92,4 @@ testAppStackFilePath base = "stacks" "0123456789.test" "us-east-1" - unpack base - <.> "yaml" + unpack base <.> "yaml"