Linters.Common

linters-common-0.1.0.0: Common library for GHC linting scripts

Safe Haskell | Safe-Inferred
Language | Haskell2010

Linters.Common

Synopsis

- data LintMsg = LintMsg !LintLvl !Int !Text !Text
- data LintLvl
  - = LintLvlWarn
  - | LintLvlErr
- type GitRef = Text
- type Sh = IO
- silently :: a -> a
- runGit :: FilePath -> Text -> [Text] -> Sh Text
- runGitStdin :: FilePath -> Text -> [Text] -> Text -> Sh Text
- withUtf8 :: Sh a -> Sh a
- gitCatCommit :: FilePath -> GitRef -> Sh (Text, Text)
- gitCatBlob :: FilePath -> GitRef -> Sh Text
- gitNormCid :: FilePath -> GitRef -> Sh GitRef
- gitBranchesContain :: FilePath -> GitRef -> Sh [Text]
- getModules :: FilePath -> GitRef -> Sh [(Text, (Text, Text))]
- gitDiffTree :: FilePath -> GitRef -> Sh (Text, [([(GitType, Text, Char)], (GitType, Text), Text)])
- gitDiffTreePatch :: FilePath -> GitRef -> Text -> Sh Text
- z40 :: GitRef
- data GitType
  - = GitTypeVoid
  - | GitTypeRegFile
  - | GitTypeExeFile
  - | GitTypeTree
  - | GitTypeSymLink
  - | GitTypeGitLink
- cvtMode :: Text -> GitType
- tshow :: Show a => a -> Text

# Documentation

data LintMsg Source #

Constructors

LintMsg !LintLvl !Int !Text !Text |

#### Instances

Instances details

Show LintMsg Source # |
Instance details Defined in Linters.Common Methods showsPrec :: Int -> LintMsg -> ShowS Source # show :: LintMsg -> String Source # showList :: [LintMsg] -> ShowS Source #

data LintLvl Source #

Constructors

LintLvlWarn |
LintLvlErr |

#### Instances

Instances details

Show LintLvl Source # |
Instance details Defined in Linters.Common Methods showsPrec :: Int -> LintLvl -> ShowS Source # show :: LintLvl -> String Source # showList :: [LintLvl] -> ShowS Source #
Eq LintLvl Source # |
Instance details Defined in Linters.Common Methods (==) :: LintLvl -> LintLvl -> Bool # (/=) :: LintLvl -> LintLvl -> Bool #
Ord LintLvl Source # |
Instance details Defined in Linters.Common Methods compare :: LintLvl -> LintLvl -> Ordering # (<) :: LintLvl -> LintLvl -> Bool # (<=) :: LintLvl -> LintLvl -> Bool # (>) :: LintLvl -> LintLvl -> Bool # (>=) :: LintLvl -> LintLvl -> Bool # max :: LintLvl -> LintLvl -> LintLvl # min :: LintLvl -> LintLvl -> LintLvl #

type GitRef = Text Source #

type Sh = IO Source #

silently :: a -> a Source #

runGit :: FilePath -> Text -> [Text] -> Sh Text Source #

runGitStdin :: FilePath -> Text -> [Text] -> Text -> Sh Text Source #

Run `git` operation

withUtf8 :: Sh a -> Sh a Source #

WARNING: non-reentrant Hack!

gitCatCommit :: FilePath -> GitRef -> Sh (Text, Text) Source #

wrapper around `git cat-file commit`

Returns (commit-header, commit-body)

gitCatBlob :: FilePath -> GitRef -> Sh Text Source #

wrapper around `git cat-file commit`

gitNormCid :: FilePath -> GitRef -> Sh GitRef Source #

Wrapper around `git rev-parse --verify`

Normalise git ref to commit sha1

gitBranchesContain :: FilePath -> GitRef -> Sh [Text] Source #

wrapper around `git branch --contains`

getModules :: FilePath -> GitRef -> Sh [(Text, (Text, Text))] Source #

returns `[(path, (url, key))]`

may throw exception

gitDiffTree :: FilePath -> GitRef -> Sh (Text, [([(GitType, Text, Char)], (GitType, Text), Text)]) Source #

Possible meanings of the `Char` value:

- Added (A),
- Copied (C),
- Deleted (D),
- Modified (M),
- Renamed (R),
- have their type (i.e. regular file, symlink, submodule, ...) changed (T),
- are Unmerged (U),
- are Unknown (X),
- or have had their pairing Broken (B).

gitDiffTreePatch :: FilePath -> GitRef -> Text -> Sh Text Source #

z40 :: GitRef Source #

data GitType Source #

Constructors

GitTypeVoid |
GitTypeRegFile |
GitTypeExeFile |
GitTypeTree |
GitTypeSymLink |
GitTypeGitLink |

#### Instances

Instances details

Enum GitType Source # |
Instance details Defined in Linters.Common Methods succ :: GitType -> GitType Source # pred :: GitType -> GitType Source # toEnum :: Int -> GitType Source # fromEnum :: GitType -> Int Source # enumFrom :: GitType -> [GitType] Source # enumFromThen :: GitType -> GitType -> [GitType] Source # enumFromTo :: GitType -> GitType -> [GitType] Source # enumFromThenTo :: GitType -> GitType -> GitType -> [GitType] Source #
Show GitType Source # |
Instance details Defined in Linters.Common Methods showsPrec :: Int -> GitType -> ShowS Source # show :: GitType -> String Source # showList :: [GitType] -> ShowS Source #
NFData GitType Source # |
Instance details Defined in Linters.Common Methods rnf :: GitType -> () Source #
Eq GitType Source # |
Instance details Defined in Linters.Common Methods (==) :: GitType -> GitType -> Bool # (/=) :: GitType -> GitType -> Bool #
Ord GitType Source # |
Instance details Defined in Linters.Common Methods compare :: GitType -> GitType -> Ordering # (<) :: GitType -> GitType -> Bool # (<=) :: GitType -> GitType -> Bool # (>) :: GitType -> GitType -> Bool # (>=) :: GitType -> GitType -> Bool # max :: GitType -> GitType -> GitType # min :: GitType -> GitType -> GitType #

cvtMode :: Text -> GitType Source #

tshow :: Show a => a -> Text Source #