diff options
author | 2014-10-09 15:35:19 -0400 | |
---|---|---|
committer | 2014-10-09 15:46:05 -0400 | |
commit | f3d197128322981d58677ba165f7d33158e07940 (patch) | |
tree | d73f043118c4b50313fc8475222df6245eac2beb /Command | |
parent | cfc51c5e4ec04f9d5088c42922217cf90b63c903 (diff) |
hlint
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Add.hs | 4 | ||||
-rw-r--r-- | Command/GCryptSetup.hs | 2 | ||||
-rw-r--r-- | Command/Import.hs | 2 | ||||
-rw-r--r-- | Command/Info.hs | 4 | ||||
-rw-r--r-- | Command/InitRemote.hs | 2 | ||||
-rw-r--r-- | Command/Mirror.hs | 2 | ||||
-rw-r--r-- | Command/Move.hs | 4 | ||||
-rw-r--r-- | Command/NotifyChanges.hs | 2 | ||||
-rw-r--r-- | Command/NumCopies.hs | 23 | ||||
-rw-r--r-- | Command/PreCommit.hs | 2 | ||||
-rw-r--r-- | Command/Repair.hs | 2 | ||||
-rw-r--r-- | Command/ResolveMerge.hs | 2 |
12 files changed, 25 insertions, 26 deletions
diff --git a/Command/Add.hs b/Command/Add.hs index 1bc20d819..286324c42 100644 --- a/Command/Add.hs +++ b/Command/Add.hs @@ -177,14 +177,14 @@ ingest (Just source) = withTSDelta $ \delta -> do (undo (keyFilename source) key) maybe noop (genMetaData key (keyFilename source)) ms liftIO $ nukeFile $ keyFilename source - return $ (Just key, mcache) + return (Just key, mcache) goindirect _ _ _ = failure "failed to generate a key" godirect (Just (key, _)) (Just cache) ms = do addInodeCache key cache maybe noop (genMetaData key (keyFilename source)) ms finishIngestDirect key source - return $ (Just key, Just cache) + return (Just key, Just cache) godirect _ _ _ = failure "failed to generate a key" failure msg = do diff --git a/Command/GCryptSetup.hs b/Command/GCryptSetup.hs index 2448467fd..ae3dd29bd 100644 --- a/Command/GCryptSetup.hs +++ b/Command/GCryptSetup.hs @@ -30,7 +30,7 @@ start gcryptid = next $ next $ do g <- gitRepo gu <- Remote.GCrypt.getGCryptUUID True g let newgu = genUUIDInNameSpace gCryptNameSpace gcryptid - if gu == Nothing || gu == Just newgu + if isNothing gu || gu == Just newgu then if Git.repoIsLocalBare g then do void $ Remote.GCrypt.setupRepo gcryptid g diff --git a/Command/Import.hs b/Command/Import.hs index 02f44a598..c8acbee04 100644 --- a/Command/Import.hs +++ b/Command/Import.hs @@ -96,7 +96,7 @@ start mode (srcfile, destfile) = handleexisting Nothing = noop handleexisting (Just s) | isDirectory s = notoverwriting "(is a directory)" - | otherwise = ifM (Annex.getState Annex.force) $ + | otherwise = ifM (Annex.getState Annex.force) ( liftIO $ nukeFile destfile , notoverwriting "(use --force to override)" ) diff --git a/Command/Info.hs b/Command/Info.hs index 1bea17ab4..5d3c86ce6 100644 --- a/Command/Info.hs +++ b/Command/Info.hs @@ -264,7 +264,7 @@ backend_usage = stat "backend usage" $ nojson $ where calc x y = multiLine $ map (\(n, b) -> b ++ ": " ++ show n) $ - reverse $ sort $ map swap $ M.toList $ + sortBy (flip compare) $ map swap $ M.toList $ M.unionWith (+) x y numcopies_stats :: Stat @@ -273,7 +273,7 @@ numcopies_stats = stat "numcopies stats" $ nojson $ where calc = multiLine . map (\(variance, count) -> show variance ++ ": " ++ show count) - . reverse . sortBy (comparing snd) . M.toList + . sortBy (flip (comparing snd)) . M.toList cachedPresentData :: StatState KeyData cachedPresentData = do diff --git a/Command/InitRemote.hs b/Command/InitRemote.hs index dc54023cc..2112c52f9 100644 --- a/Command/InitRemote.hs +++ b/Command/InitRemote.hs @@ -63,7 +63,7 @@ findExisting name = do return $ headMaybe matches newConfig :: String -> R.RemoteConfig -newConfig name = M.singleton nameKey name +newConfig = M.singleton nameKey findByName :: String -> M.Map UUID R.RemoteConfig -> [(UUID, R.RemoteConfig)] findByName n = filter (matching . snd) . M.toList diff --git a/Command/Mirror.hs b/Command/Mirror.hs index 4e9a85009..a3bd85975 100644 --- a/Command/Mirror.hs +++ b/Command/Mirror.hs @@ -32,7 +32,7 @@ seek ps = do ps start :: Maybe Remote -> Maybe Remote -> FilePath -> Key -> CommandStart -start to from file key = startKey to from (Just file) key +start to from file = startKey to from (Just file) startKey :: Maybe Remote -> Maybe Remote -> Maybe FilePath -> Key -> CommandStart startKey to from afile key = do diff --git a/Command/Move.hs b/Command/Move.hs index c3d641edd..118f3b3a7 100644 --- a/Command/Move.hs +++ b/Command/Move.hs @@ -34,7 +34,7 @@ seek ps = do ps start :: Maybe Remote -> Maybe Remote -> Bool -> FilePath -> Key -> CommandStart -start to from move file key = start' to from move (Just file) key +start to from move = start' to from move . Just startKey :: Maybe Remote -> Maybe Remote -> Bool -> Key -> CommandStart startKey to from move = start' to from move Nothing @@ -91,7 +91,7 @@ expectedPresent dest key = do return $ dest `elem` remotes toPerform :: Remote -> Bool -> Key -> AssociatedFile -> Bool -> Either String Bool -> CommandPerform -toPerform dest move key afile fastcheck isthere = do +toPerform dest move key afile fastcheck isthere = case isthere of Left err -> do showNote err diff --git a/Command/NotifyChanges.hs b/Command/NotifyChanges.hs index d0df05551..8ec988832 100644 --- a/Command/NotifyChanges.hs +++ b/Command/NotifyChanges.hs @@ -51,7 +51,7 @@ start = do -- No messages need to be received from the caller, -- but when it closes the connection, notice and terminate. - let receiver = forever $ void $ getLine + let receiver = forever $ void getLine void $ liftIO $ concurrently sender receiver stop diff --git a/Command/NumCopies.hs b/Command/NumCopies.hs index b7323ae35..52eb9dcc6 100644 --- a/Command/NumCopies.hs +++ b/Command/NumCopies.hs @@ -22,16 +22,15 @@ seek = withWords start start :: [String] -> CommandStart start [] = startGet -start [s] = do - case readish s of - Nothing -> error $ "Bad number: " ++ s - Just n - | n > 0 -> startSet n - | n == 0 -> ifM (Annex.getState Annex.force) - ( startSet n - , error "Setting numcopies to 0 is very unsafe. You will lose data! If you really want to do that, specify --force." - ) - | otherwise -> error "Number cannot be negative!" +start [s] = case readish s of + Nothing -> error $ "Bad number: " ++ s + Just n + | n > 0 -> startSet n + | n == 0 -> ifM (Annex.getState Annex.force) + ( startSet n + , error "Setting numcopies to 0 is very unsafe. You will lose data! If you really want to do that, specify --force." + ) + | otherwise -> error "Number cannot be negative!" start _ = error "Specify a single number." startGet :: CommandStart @@ -39,9 +38,9 @@ startGet = next $ next $ do Annex.setOutput QuietOutput v <- getGlobalNumCopies case v of - Just n -> liftIO $ putStrLn $ show $ fromNumCopies n + Just n -> liftIO $ print $ fromNumCopies n Nothing -> do - liftIO $ putStrLn $ "global numcopies is not set" + liftIO $ putStrLn "global numcopies is not set" old <- deprecatedNumCopies case old of Nothing -> liftIO $ putStrLn "(default is 1)" diff --git a/Command/PreCommit.hs b/Command/PreCommit.hs index 355e2766e..9a07115cf 100644 --- a/Command/PreCommit.hs +++ b/Command/PreCommit.hs @@ -59,7 +59,7 @@ startIndirect f = next $ do next $ return True startDirect :: [String] -> CommandStart -startDirect _ = next $ next $ preCommitDirect +startDirect _ = next $ next preCommitDirect addViewMetaData :: View -> ViewedFile -> Key -> CommandStart addViewMetaData v f k = do diff --git a/Command/Repair.hs b/Command/Repair.hs index 56925d83d..3d70ca9cb 100644 --- a/Command/Repair.hs +++ b/Command/Repair.hs @@ -68,7 +68,7 @@ repairAnnexBranch modifiedbranches ) ) where - okindex = Annex.Branch.withIndex $ inRepo $ Git.Repair.checkIndex + okindex = Annex.Branch.withIndex $ inRepo Git.Repair.checkIndex commitindex = do Annex.Branch.forceCommit "committing index after git repository repair" liftIO $ putStrLn "Successfully recovered the git-annex branch using .git/annex/index" diff --git a/Command/ResolveMerge.hs b/Command/ResolveMerge.hs index a50e2aa9d..4425ffe46 100644 --- a/Command/ResolveMerge.hs +++ b/Command/ResolveMerge.hs @@ -19,7 +19,7 @@ def = [command "resolvemerge" paramNothing seek SectionPlumbing "resolve merge conflicts"] seek :: CommandSeek -seek ps = withNothing start ps +seek = withNothing start start :: CommandStart start = do |