fix all hlint suggestions

This commit is contained in:
Ryan Mulligan 2019-05-04 15:37:46 -07:00
parent cc2eba66fb
commit 281ede1e25
5 changed files with 23 additions and 20 deletions

View File

@ -93,7 +93,7 @@ checkReport (BinaryCheck p _ _) =
result :: MonadIO m => UpdateEnv -> Text -> m Text
result updateEnv resultPath =
let shellyResultPath = fromText $ resultPath
let shellyResultPath = fromText resultPath
in Shell.ourShell (options updateEnv) $ do
let expectedVersion = newVersion updateEnv
home <- get_env_text "HOME"
@ -153,7 +153,7 @@ result updateEnv resultPath =
(\p ->
((expectedVersion `T.isInfixOf` toTextIgnore p) &&) <$>
test_f p)
(shellyResultPath)) $
shellyResultPath) $
addToReport $
"- found " <> expectedVersion <> " in filename of file in " <>
toTextIgnore shellyResultPath)

View File

@ -149,8 +149,8 @@ openAutoUpdatePR updateEnv oprs = oprs & (V.find isThisPkg >>> isJust)
titleHasNewVersion = newVersion updateEnv `T.isSuffixOf` title
in titleHasName && titleHasNewVersion
checkExistingUpdatePR :: MonadIO m => UpdateEnv -> ExceptT Text m ()
checkExistingUpdatePR ue = do
checkExistingUpdatePR :: MonadIO m => UpdateEnv -> Text -> ExceptT Text m ()
checkExistingUpdatePR ue attrPath = do
searchResult <-
ExceptT $
liftIO $
@ -162,11 +162,7 @@ checkExistingUpdatePR ue = do
(anyOpen searchResult)
(throwE "There is already an open PR for this update")
where
pn = packageName ue
ov = oldVersion ue
nv = newVersion ue
search = [interpolate|repo:nixos/nixpkgs $pn $ov -> $nv |]
title = prTitle ue attrPath
search = [interpolate|repo:nixos/nixpkgs $title |]
anyOpen searchResult =
any
(\issue -> isNothing (issueClosedAt issue))
(searchResultResults searchResult)
any (issueClosedAt >>> isNothing) (searchResultResults searchResult)

View File

@ -118,9 +118,9 @@ headHash = readProcessInterleavedNoIndexIssue_ "git rev-parse HEAD"
deleteBranchEverywhere :: MonadIO m => Text -> ExceptT Text m ()
deleteBranchEverywhere bName = do
(runProcessNoIndexIssue_ $ delete bName) <|>
runProcessNoIndexIssue_ (delete bName) <|>
liftIO (T.putStrLn ("Couldn't delete " <> bName))
(runProcessNoIndexIssue_ $ deleteOrigin bName) <|>
runProcessNoIndexIssue_ (deleteOrigin bName) <|>
liftIO (T.putStrLn ("Couldn't delete " <> bName <> " on origin"))
runProcessNoIndexIssue_ ::

View File

@ -33,6 +33,7 @@ import Utils
, Version
, branchName
, parseUpdates
, prTitle
, runtimeDir
, tRead
)
@ -112,9 +113,9 @@ updatePackage log updateEnv mergeBaseOutpathsContext =
Nix.assertNewerVersion updateEnv
Git.fetchIfStale <|> liftIO (T.putStrLn "Failed to fetch.")
Git.checkAutoUpdateBranchDoesntExist (packageName updateEnv)
GH.checkExistingUpdatePR updateEnv
Git.cleanAndResetTo "master"
attrPath <- Nix.lookupAttrPath updateEnv
GH.checkExistingUpdatePR updateEnv attrPath
Blacklist.attrPath attrPath
Version.assertCompatibleWithPathPin updateEnv attrPath
srcUrls <- Nix.getSrcUrls attrPath
@ -229,11 +230,10 @@ repologyUrl updateEnv =
commitMessage :: UpdateEnv -> Text -> Text
commitMessage updateEnv attrPath =
let oV = oldVersion updateEnv
nV = newVersion updateEnv
let title = prTitle updateEnv attrPath
repologyLink = repologyUrl updateEnv
in [interpolate|
$attrPath: $oV -> $nV
$title
Semi-automatic update generated by
https://github.com/ryantm/nixpkgs-update tools. This update was made
@ -261,11 +261,10 @@ prMessage ::
-> Text
prMessage updateEnv isBroken metaDescription releaseUrlMessage compareUrlMessage resultCheckReport commitHash attrPath maintainersCc resultPath opReport =
let brokenMsg = brokenWarning isBroken
oV = oldVersion updateEnv
nV = newVersion updateEnv
title = prTitle updateEnv attrPath
repologyLink = repologyUrl updateEnv
in [interpolate|
$attrPath: $oV -> $nV
$title
Semi-automatic update generated by https://github.com/ryantm/nixpkgs-update tools. This update was made based on information from $repologyLink.
$brokenMsg

View File

@ -1,5 +1,6 @@
{-# LANGUAGE ExtendedDefaultRules #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# OPTIONS_GHC -fno-warn-type-defaults #-}
module Utils
@ -13,6 +14,7 @@ module Utils
, branchName
, runtimeDir
, srcOrMain
, prTitle
) where
import OurPrelude
@ -51,6 +53,12 @@ data UpdateEnv = UpdateEnv
, options :: Options
}
prTitle :: UpdateEnv -> Text -> Text
prTitle updateEnv attrPath =
let oV = oldVersion updateEnv
nV = newVersion updateEnv
in [interpolate| $attrPath: $oV -> $nV |]
regDirMode :: FileMode
regDirMode =
directoryMode .|. ownerModes .|. groupModes .|. otherReadMode .|.