Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .ormolu
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
infixr 10 .=
infix 4 ===
infix 4 =/=
infixr 3 !!!
infixr 3 <!!
1 change: 1 addition & 0 deletions libs/api-bot/.ormolu
3 changes: 2 additions & 1 deletion libs/api-bot/src/Network/Wire/Bot/Crypto.hs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ instance Serialize SymmetricKeys where

randomSymmetricKeys :: MonadIO m => BotClient -> m SymmetricKeys
randomSymmetricKeys clt =
SymmetricKeys <$> randomBytes (botClientBox clt) 32
SymmetricKeys
<$> randomBytes (botClientBox clt) 32
<*> randomBytes (botClientBox clt) 32

encryptSymmetric :: MonadIO m => BotClient -> SymmetricKeys -> Plaintext -> m Ciphertext
Expand Down
3 changes: 2 additions & 1 deletion libs/api-bot/src/Network/Wire/Bot/Email.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ data MailboxSettings = MailboxSettings

instance FromJSON MailboxSettings where
parseJSON = withObject "mailbox-settings" $ \o ->
MailboxSettings <$> o .: "host"
MailboxSettings
<$> o .: "host"
<*> o .: "user"
<*> o .: "pass"
<*> o .: "conn"
Expand Down
31 changes: 17 additions & 14 deletions libs/api-bot/src/Network/Wire/Bot/Monad.hs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ newBotNetEnv manager logger o = do
serverSSL = setBotNetApiSSL o,
serverManager = manager
}
pure
$! BotNetEnv
pure $!
BotNetEnv
{ botNetGen = gen,
botNetMailboxes = mbx,
botNetSender = setBotNetSender o,
Expand All @@ -195,16 +195,16 @@ initMetrics = do
pure m
where
counters =
Metrics.assertionsTotal :
Metrics.assertionsFailed :
Metrics.exceptionsTotal :
Metrics.botsCreatedNew :
Metrics.botsCreatedCached :
Metrics.eventsTotalRcvd :
Metrics.eventsTotalAckd :
Metrics.eventsTotalIgnd :
Metrics.eventsTotalMssd :
concatMap etc [(minBound :: EventType) ..]
Metrics.assertionsTotal
: Metrics.assertionsFailed
: Metrics.exceptionsTotal
: Metrics.botsCreatedNew
: Metrics.botsCreatedCached
: Metrics.eventsTotalRcvd
: Metrics.eventsTotalAckd
: Metrics.eventsTotalIgnd
: Metrics.eventsTotalMssd
: concatMap etc [(minBound :: EventType) ..]
etc t =
[ Metrics.eventTypeRcvd t,
Metrics.eventTypeAckd t,
Expand Down Expand Up @@ -592,7 +592,9 @@ assertFailure :: (HasCallStack, MonadBotNet m) => Text -> m ()
assertFailure m = whenAsserts $ do
incrAssertFailed
log Error . msg $
val "Assertion failed: " +++ m +++ val "\n"
val "Assertion failed: "
+++ m
+++ val "\n"
+++ prettyCallStack callStack

-- | Place an assertion on a 'Bot', expecting a matching 'Event' to arrive
Expand Down Expand Up @@ -771,7 +773,8 @@ heartbeat bot e = forever $ do
for_ out $ liftIO . atomically . flip tryPutTMVar Nothing
botLog l bot Warn $
msg $
"Assertion Timeout: " <> eventTypeText typ
"Assertion Timeout: "
<> eventTypeText typ
<> "\nAssertion was created at: "
<> pack (prettyCallStack stack)
-- Re-establish the push connection, if it died
Expand Down
12 changes: 9 additions & 3 deletions libs/api-bot/src/Network/Wire/Bot/Report/Text.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,15 @@ formatReport ::
Lazy.Text
formatReport pretty r =
toLazyText $
"\n" <> title <> "\n"
"\n"
<> title
<> "\n"
<> foldMap section (reportSections r)
where
pp x = if pretty then x else mempty
title =
pp underline <> pp bold
pp underline
<> pp bold
<> fromText (reportTitle r)
<> " Report\n\n"
<> pp clear
Expand All @@ -57,7 +60,10 @@ formatReport pretty r =
<> pp clear
<> "\n"
section s =
pp bold <> fromText (sectionName s) <> "\n" <> pp clear
pp bold
<> fromText (sectionName s)
<> "\n"
<> pp clear
<> foldMap metric (sectionMetrics s)
<> "\n"
metric (Counter l p) = single l . fromString . show $ reportCounter r p
Expand Down
1 change: 1 addition & 0 deletions libs/api-client/.ormolu
3 changes: 2 additions & 1 deletion libs/api-client/src/Network/Wire/Client/API/Push.hs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ instance FromJSON Notification where

instance FromJSON a => FromJSON (ConvEvent a) where
parseJSON = withObject "conversation-event" $ \o ->
ConvEvent <$> o .: "conversation"
ConvEvent
<$> o .: "conversation"
<*> o .: "from"
<*> o .: "time"
<*> o .: "data"
Expand Down
6 changes: 4 additions & 2 deletions libs/api-client/src/Network/Wire/Client/HTTP.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ data Error = Error

instance FromJSON Error where
parseJSON = withObject "error" $ \o ->
Error <$> o .: "code"
Error
<$> o .: "code"
<*> o .: "label"
<*> o .: "message"

Expand Down Expand Up @@ -89,7 +90,8 @@ clientRequest rq expected f = do
exec = do
s <- getServer
let rq' =
rq & setServer s
rq
& setServer s
& header hUserAgent "api-client"
Log.debug $ Log.msg (show rq')
runInIO <- askRunInIO
Expand Down
1 change: 1 addition & 0 deletions libs/bilge/.ormolu
4 changes: 2 additions & 2 deletions libs/bilge/src/Bilge/Assert.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ io <!! aa = do
let failures = filter (isJust . snd) $ zip [1 ..] results
unless (null failures) $
error . concat $
title "Assertions failed:\n" :
intersperse "\n" (map msg failures)
title "Assertions failed:\n"
: intersperse "\n" (map msg failures)
++ ["\n\nResponse was:\n\n" ++ show r]
pure r
where
Expand Down
4 changes: 2 additions & 2 deletions libs/bilge/src/Bilge/Request.hs
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ expectStatus property r = r {Rq.checkResponse = check}
check _ res
| property (HTTP.statusCode (Rq.responseStatus res)) = pure ()
| otherwise = do
some <- Lazy.toStrict <$> brReadSome (Rq.responseBody res) 1024
throwHttp $ Rq.StatusCodeException (void res) some
some <- Lazy.toStrict <$> brReadSome (Rq.responseBody res) 1024
throwHttp $ Rq.StatusCodeException (void res) some

checkStatus :: (Status -> ResponseHeaders -> CookieJar -> Maybe SomeException) -> Request -> Request
checkStatus f r = r {Rq.checkResponse = check}
Expand Down
1 change: 1 addition & 0 deletions libs/brig-types/.ormolu
3 changes: 2 additions & 1 deletion libs/brig-types/src/Brig/Types/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ instance FromJSON PhonePrefix where
Just p -> pure p
Nothing ->
fail $
"Invalid phone number prefix: [" ++ show s
"Invalid phone number prefix: ["
++ show s
++ "]. Expected format similar to E.164 (with 1-15 digits after the +)."

instance FromByteString PhonePrefix where
Expand Down
22 changes: 11 additions & 11 deletions libs/brig-types/src/Brig/Types/Team/LegalHold.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ data LegalHoldService = LegalHoldService

instance ToJSON LegalHoldService where
toJSON s =
object $
"team_id" .= legalHoldServiceTeam s
# "base_url" .= legalHoldServiceUrl s
# "fingerprint" .= legalHoldServiceFingerprint s
# "auth_token" .= legalHoldServiceToken s
# "public_key" .= legalHoldServiceKey s
# []
object
$ "team_id" .= legalHoldServiceTeam s
# "base_url" .= legalHoldServiceUrl s
# "fingerprint" .= legalHoldServiceFingerprint s
# "auth_token" .= legalHoldServiceToken s
# "public_key" .= legalHoldServiceKey s
# []

instance FromJSON LegalHoldService where
parseJSON = withObject "LegalHoldService" $ \o ->
Expand Down Expand Up @@ -85,7 +85,7 @@ instance FromJSON LegalHoldClientRequest where

instance ToJSON LegalHoldClientRequest where
toJSON (LegalHoldClientRequest requester lastPrekey') =
object $
"requester" .= requester
# "last_prekey" .= lastPrekey'
# []
object
$ "requester" .= requester
# "last_prekey" .= lastPrekey'
# []
3 changes: 2 additions & 1 deletion libs/brig-types/src/Brig/Types/User/Auth.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ instance ToJSON SsoLogin where

instance FromJSON LegalHoldLogin where
parseJSON = withObject "LegalHoldLogin" $ \o ->
LegalHoldLogin <$> o .: "user"
LegalHoldLogin
<$> o .: "user"
<*> o .:? "password"
<*> o .:? "label"

Expand Down
1 change: 1 addition & 0 deletions libs/cargohold-types/.ormolu
1 change: 1 addition & 0 deletions libs/cassandra-util/.ormolu
12 changes: 7 additions & 5 deletions libs/cassandra-util/src/Cassandra/Schema.hs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ createKeyspace (Keyspace k) rs = void $ schema (cql rs) (params All ())
where
cql (SimpleStrategy (ReplicationFactor n)) =
QueryString . toLazyText $
fromText "create keyspace if not exists " <> fromText k
fromText "create keyspace if not exists "
<> fromText k
<> fromText " with replication = { "
<> fromText " 'class': 'SimpleStrategy' "
<> fromText " , 'replication_factor': '"
Expand All @@ -146,7 +147,8 @@ createKeyspace (Keyspace k) rs = void $ schema (cql rs) (params All ())
<> fromText "};"
cql (NetworkTopologyStrategy (ReplicationMap dcs)) =
QueryString . toLazyText $
fromText "create keyspace if not exists " <> fromText k
fromText "create keyspace if not exists "
<> fromText k
<> fromText " with replication = { "
<> fromText " 'class': 'NetworkTopologyStrategy' "
<> fromText " , "
Expand All @@ -165,8 +167,8 @@ migrateSchema :: Log.Logger -> MigrationOpts -> [Migration] -> IO ()
migrateSchema l o ms = do
hosts <- initialContactsPlain $ pack (migHost o)
p <-
CQL.init $
setLogger (CT.mkLogger l)
CQL.init
$ setLogger (CT.mkLogger l)
. setContacts (NonEmpty.head hosts) (NonEmpty.tail hosts)
. setPortNumber (fromIntegral $ migPort o)
. setMaxConnections 1
Expand All @@ -183,7 +185,7 @@ migrateSchema l o ms = do
. setSendTimeout 20
. setResponseTimeout 50
. setProtocolVersion V4
$ defSettings
$ defSettings
runClient p $ do
let keyspace = Keyspace . migKeyspace $ o
when (migReset o) $ do
Expand Down
6 changes: 3 additions & 3 deletions libs/cassandra-util/src/Cassandra/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ writeTimeToUTC = posixSecondsToUTCTime . fromIntegral . (`div` 1000000)

defInitCassandra :: Text -> Text -> Word16 -> Log.Logger -> IO ClientState
defInitCassandra ks h p lg =
init $
setLogger (CT.mkLogger lg)
init
$ setLogger (CT.mkLogger lg)
. setPortNumber (fromIntegral p)
. setContacts (unpack h) []
. setKeyspace (Keyspace ks)
$ defSettings
$ defSettings
1 change: 1 addition & 0 deletions libs/deriving-swagger2/.ormolu
1 change: 1 addition & 0 deletions libs/dns-util/.ormolu
1 change: 1 addition & 0 deletions libs/extended/.ormolu
1 change: 1 addition & 0 deletions libs/galley-types/.ormolu
6 changes: 4 additions & 2 deletions libs/galley-types/src/Galley/Types/Bot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ addBot = AddBot

instance FromJSON AddBot where
parseJSON = withObject "AddBot" $ \o ->
AddBot <$> o .: "service"
AddBot
<$> o .: "service"
<*> o .: "conversation"
<*> o .: "bot"
<*> o .: "client"
Expand Down Expand Up @@ -82,7 +83,8 @@ removeBot = RemoveBot

instance FromJSON RemoveBot where
parseJSON = withObject "RemoveBot" $ \o ->
RemoveBot <$> o .: "conversation"
RemoveBot
<$> o .: "conversation"
<*> o .: "bot"

instance ToJSON RemoveBot where
Expand Down
3 changes: 2 additions & 1 deletion libs/galley-types/src/Galley/Types/Bot/Service.hs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ newService ref url tok fps = Service ref url tok fps True

instance FromJSON Service where
parseJSON = withObject "Service" $ \o ->
Service <$> o .: "ref"
Service
<$> o .: "ref"
<*> o .: "base_url"
<*> o .: "auth_token"
<*> o .: "fingerprints"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ one2OneConvId a b = case compareDomains a b of
]
x = hash c
result =
U.toUUID . U.mk @U.V5
U.toUUID
. U.mk @U.V5
. fromMaybe UUID.nil
-- fromByteString only returns 'Nothing' when the input is not
-- exactly 16 bytes long, here this should not be a case since
Expand Down
3 changes: 2 additions & 1 deletion libs/galley-types/src/Galley/Types/Teams/Intra.hs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ data TeamStatusUpdate = TeamStatusUpdate

instance FromJSON TeamStatusUpdate where
parseJSON = withObject "team-status-update" $ \o ->
TeamStatusUpdate <$> o .: "status"
TeamStatusUpdate
<$> o .: "status"
<*> o .:? "currency"

instance ToJSON TeamStatusUpdate where
Expand Down
1 change: 1 addition & 0 deletions libs/gundeck-types/.ormolu
9 changes: 6 additions & 3 deletions libs/gundeck-types/src/Gundeck/Types/Push/V2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ recipient u r = Recipient u r RecipientClientsAll

instance FromJSON Recipient where
parseJSON = withObject "Recipient" $ \p ->
Recipient <$> p .: "user_id"
Recipient
<$> p .: "user_id"
<*> p .: "route"
<*> p .:? "clients" .!= RecipientClientsAll

Expand Down Expand Up @@ -216,7 +217,8 @@ instance ToJSON ApsData where

instance FromJSON ApsData where
parseJSON = withObject "ApsData" $ \o ->
ApsData <$> o .: "loc_key"
ApsData
<$> o .: "loc_key"
<*> o .:? "loc_args" .!= []
<*> o .:? "sound"
<*> o .:? "preference"
Expand Down Expand Up @@ -291,7 +293,8 @@ singletonPayload = List1.singleton . toJSONObject

instance FromJSON Push where
parseJSON = withObject "Push" $ \p ->
Push <$> p .: "recipients"
Push
<$> p .: "recipients"
<*> p .:? "origin"
<*> p .:? "connections" .!= Set.empty
<*> p .:? "origin_connection"
Expand Down
1 change: 1 addition & 0 deletions libs/hscim/.ormolu
Loading