Skip to content

Commit 237fc8e

Browse files
committed
[chore] appease hlint
1 parent fc5d08c commit 237fc8e

File tree

22 files changed

+61
-77
lines changed

22 files changed

+61
-77
lines changed

integration/test/Testlib/App.hs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module Testlib.App where
33
import Control.Monad.Reader
44
import Control.Retry qualified as Retry
55
import Data.Aeson hiding ((.=))
6-
import Data.Functor ((<&>))
76
import Data.IORef
87
import Data.Text qualified as T
98
import Data.Yaml qualified as Yaml
@@ -44,9 +43,13 @@ readServiceConfig = readServiceConfig' . configName
4443
readServiceConfig' :: String -> App Value
4544
readServiceConfig' srvName = do
4645
cfgFile <-
47-
asks (.servicesCwdBase) <&> \case
48-
Nothing -> "/etc/wire" </> srvName </> "conf" </> (srvName <> ".yaml")
49-
Just p -> p </> srvName </> (srvName <> ".integration.yaml")
46+
asks
47+
( ( \case
48+
Nothing -> "/etc/wire" </> srvName </> "conf" </> (srvName <> ".yaml")
49+
Just p -> p </> srvName </> (srvName <> ".integration.yaml")
50+
)
51+
. (.servicesCwdBase)
52+
)
5053

5154
eith <- liftIO (Yaml.decodeFileEither cfgFile)
5255
case eith of

integration/test/Testlib/HTTP.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import Data.ByteString.Char8 qualified as C8
99
import Data.ByteString.Lazy qualified as L
1010
import Data.CaseInsensitive qualified as CI
1111
import Data.Function
12-
import Data.Functor ((<&>))
1312
import Data.List
1413
import Data.List.Split (splitOn)
1514
import Data.Maybe
@@ -173,7 +172,7 @@ locationHeaderHost :: Response -> String
173172
locationHeaderHost resp =
174173
let location = C8.unpack . snd . fromJust $ locationHeader resp
175174
locationURI = fromJust $ parseURI location
176-
locationHost = fromJust $ locationURI & uriAuthority <&> uriRegName
175+
locationHost = uriRegName (fromJust (locationURI & uriAuthority))
177176
in locationHost
178177

179178
locationHeader :: Response -> Maybe (HTTP.HeaderName, ByteString)

integration/test/Testlib/JSON.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ printJSON = prettyJSON >=> liftIO . putStrLn
287287

288288
prettyJSON :: MakesValue a => a -> App String
289289
prettyJSON x =
290-
make x <&> Aeson.encodePretty <&> LC8.unpack
290+
make x <&> LC8.unpack . Aeson.encodePretty
291291

292292
jsonType :: Value -> String
293293
jsonType (Object _) = "Object"

integration/test/Testlib/ModService.hs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,14 @@ startProcess' domain execName config = do
397397
tempFile <- liftIO $ writeTempFile "/tmp" (execName <> "-" <> domain <> "-" <> ".yaml") (cs $ Yaml.encode config)
398398

399399
(cwd, exe) <-
400-
asks (.servicesCwdBase) <&> \case
401-
Nothing -> (Nothing, execName)
402-
Just dir ->
403-
(Just (dir </> execName), "../../dist" </> execName)
400+
asks
401+
( ( \case
402+
Nothing -> (Nothing, execName)
403+
Just dir ->
404+
(Just (dir </> execName), "../../dist" </> execName)
405+
)
406+
. (.servicesCwdBase)
407+
)
404408

405409
(_, Just stdoutHdl, Just stderrHdl, ph) <- liftIO $ createProcess (proc exe ["-c", tempFile]) {cwd = cwd, std_out = CreatePipe, std_err = CreatePipe}
406410
let prefix = "[" <> execName <> "@" <> domain <> "] "

integration/test/Testlib/Run.hs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,13 @@ createGlobalEnv cfg = do
113113
config <- readServiceConfig Galley
114114
relPath <- config %. "settings.mlsPrivateKeyPaths.removal.ed25519" & asString
115115
path <-
116-
asks (.servicesCwdBase) <&> \case
117-
Nothing -> relPath
118-
Just dir -> dir </> "galley" </> relPath
116+
asks
117+
( ( \case
118+
Nothing -> relPath
119+
Just dir -> dir </> "galley" </> relPath
120+
)
121+
. ((.servicesCwdBase))
122+
)
119123
bs <- liftIO $ B.readFile path
120124
pems <- case pemParseBS bs of
121125
Left err -> assertFailure $ "Could not parse removal key PEM: " <> err

libs/types-common/src/Data/Misc.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ instance ToSchema (Fingerprint Rsa) where
329329
p :: Chars.Parser (Fingerprint Rsa)
330330
p = do
331331
bs <- parser
332-
either fail pure (Fingerprint <$> B64.decode bs)
332+
either fail (pure . Fingerprint) (B64.decode bs)
333333

334334
instance Cql (Fingerprint a) where
335335
ctype = Tagged BlobColumn

services/brig/src/Brig/API/Connection.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ createConnectionToLocalUser self conn target = do
146146

147147
accept :: UserConnection -> UserConnection -> ExceptT ConnectionError (AppT r) (ResponseForExistedCreated UserConnection)
148148
accept s2o o2s = do
149-
when (ucStatus s2o `notElem` [Sent, Accepted]) $
149+
unless (ucStatus s2o `elem` [Sent, Accepted]) $
150150
checkLimit self
151151
lift . Log.info $
152152
logLocalConnection (tUnqualified self) (qUnqualified (ucTo s2o))
@@ -168,7 +168,7 @@ createConnectionToLocalUser self conn target = do
168168

169169
resend :: UserConnection -> UserConnection -> ExceptT ConnectionError (AppT r) (ResponseForExistedCreated UserConnection)
170170
resend s2o o2s = do
171-
when (ucStatus s2o `notElem` [Sent, Accepted]) $
171+
unless (ucStatus s2o `elem` [Sent, Accepted]) $
172172
checkLimit self
173173
lift . Log.info $
174174
logLocalConnection (tUnqualified self) (qUnqualified (ucTo s2o))

services/brig/src/Brig/AWS.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,7 @@ mkEnv lgr opts emailOpts mgr = do
123123
mkAwsEnv g ses dyn sqs = do
124124
baseEnv <-
125125
AWS.newEnv AWS.discover
126-
<&> maybe id AWS.configureService ses
127-
<&> maybe id AWS.configureService dyn
128-
<&> AWS.configureService sqs
126+
<&> AWS.configureService sqs . maybe id AWS.configureService dyn . maybe id AWS.configureService ses
129127
pure $
130128
baseEnv
131129
{ AWS.logger = awsLogger g,

services/brig/src/Brig/Run.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,18 @@ pendingActivationCleanup = do
197197
)
198198

199199
API.deleteUsersNoVerify $
200-
catMaybes
201-
( uids <&> \(isExpired, isPendingInvitation, uid) ->
200+
mapMaybe
201+
( \(isExpired, isPendingInvitation, uid) ->
202202
if isExpired && isPendingInvitation then Just uid else Nothing
203203
)
204+
uids
204205

205206
liftSem . UsersPendingActivationStore.removeMultiple $
206-
catMaybes
207-
( uids <&> \(isExpired, _isPendingInvitation, uid) ->
207+
mapMaybe
208+
( \(isExpired, _isPendingInvitation, uid) ->
208209
if isExpired then Just uid else Nothing
209210
)
211+
uids
210212

211213
threadDelayRandom
212214
where

services/brig/src/Brig/Team/Util.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ ensurePermissions u t perms = do
4949
throwStd insufficientTeamPermissions
5050
where
5151
check :: Maybe TeamMember -> Bool
52-
check (Just m) = and $ hasPermission m <$> perms
52+
check (Just m) = all (hasPermission m) perms
5353
check Nothing = False
5454

5555
-- | Privilege escalation detection (make sure no `RoleMember` user creates a `RoleOwner`).
@@ -64,5 +64,5 @@ ensurePermissionToAddUser u t inviteePerms = do
6464
check :: Maybe TeamMember -> Bool
6565
check (Just inviter) =
6666
hasPermission inviter AddTeamMember
67-
&& and (mayGrantPermission inviter <$> Set.toList (inviteePerms ^. self))
67+
&& all (mayGrantPermission inviter) (Set.toList (inviteePerms ^. self))
6868
check Nothing = False

0 commit comments

Comments
 (0)