mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +03:00
cleanup hlint warnings
This commit is contained in:
parent
956f821a13
commit
0b664ef68e
2
HLint.hs
2
HLint.hs
@ -2,6 +2,8 @@ import "hint" HLint.Default
|
||||
import "hint" HLint.Dollar
|
||||
import "hint" HLint.Generalise
|
||||
|
||||
ignore "Use mappend"
|
||||
error "generalize ++" = (++) ==> (<>)
|
||||
-- AMP fallout
|
||||
error "generalize mapM" = mapM ==> traverse
|
||||
error "generalize mapM_" = mapM_ ==> traverse_
|
||||
|
@ -133,11 +133,11 @@ alignChildren getRange (first:rest) headRanges
|
||||
| ~(l, r) <- splitThese first
|
||||
= case intersectionsWithHeadRanges first of
|
||||
-- It intersects on both sides, so we can just take the first line whole.
|
||||
(True, True) -> ((++) <$> toTerms first <*> firstRemaining, restRemaining)
|
||||
(True, True) -> ((<>) <$> toTerms first <*> firstRemaining, restRemaining)
|
||||
-- It only intersects on the left, so split it up.
|
||||
(True, False) -> ((++) <$> toTerms (fromJust l) <*> firstRemaining, maybe identity (:) r restRemaining)
|
||||
(True, False) -> ((<>) <$> toTerms (fromJust l) <*> firstRemaining, maybe identity (:) r restRemaining)
|
||||
-- It only intersects on the right, so split it up.
|
||||
(False, True) -> ((++) <$> toTerms (fromJust r) <*> firstRemaining, maybe identity (:) l restRemaining)
|
||||
(False, True) -> ((<>) <$> toTerms (fromJust r) <*> firstRemaining, maybe identity (:) l restRemaining)
|
||||
-- It doesn’t intersect at all, so skip it and move along.
|
||||
(False, False) -> (firstRemaining, first:restRemaining)
|
||||
| otherwise = alignChildren getRange rest headRanges
|
||||
|
@ -42,7 +42,7 @@ termConstructor source info = cofree . construct
|
||||
where
|
||||
withDefaultInfo syntax = (info :< syntax)
|
||||
construct :: [Term Text Info] -> CofreeF (S.Syntax Text) Info (Term Text Info)
|
||||
construct [] = withDefaultInfo $ S.Leaf . pack . toString $ slice (characterRange info) source
|
||||
construct [] = withDefaultInfo . S.Leaf . pack . toString $ slice (characterRange info) source
|
||||
construct children | Assignment == category info = case children of
|
||||
(identifier:value:[]) -> withDefaultInfo $ S.Assignment identifier value
|
||||
construct children | MathAssignment == category info = case children of
|
||||
|
@ -35,7 +35,7 @@ rangesAndWordsFrom startIndex string = fromMaybe [] $ take isWord <|> take isPun
|
||||
endFor parsed = startIndex + length parsed
|
||||
parse transform predicate = case span predicate string of
|
||||
([], _) -> Nothing
|
||||
(parsed, rest) -> Just $ maybe identity (:) (transform parsed) $ rangesAndWordsFrom (endFor parsed) rest
|
||||
(parsed, rest) -> Just . maybe identity (:) (transform parsed) $ rangesAndWordsFrom (endFor parsed) rest
|
||||
-- | Is this a word character?
|
||||
-- | Word characters are defined as in [Ruby’s `\p{Word}` syntax](http://ruby-doc.org/core-2.1.1/Regexp.html#class-Regexp-label-Character+Properties), i.e.:
|
||||
-- | > A member of one of the following Unicode general category _Letter_, _Mark_, _Number_, _Connector_Punctuation_
|
||||
|
@ -80,7 +80,7 @@ split diff blobs = TL.toStrict . renderHtml
|
||||
. docTypeHtml
|
||||
. ((head $ link ! A.rel "stylesheet" ! A.href "style.css") <>)
|
||||
. body
|
||||
. (table ! A.class_ (stringValue "diff")) $
|
||||
. (table ! A.class_ (stringValue "diff")) .
|
||||
((colgroup $ (col ! A.width (stringValue . show $ columnWidth)) <> col <> (col ! A.width (stringValue . show $ columnWidth)) <> col) <>)
|
||||
. mconcat $ numberedLinesToMarkup <$> numbered
|
||||
where
|
||||
@ -158,7 +158,7 @@ instance ToMarkup (Renderable (Source Char, Term a Info)) where
|
||||
toMarkup (Renderable (source, term)) = Prologue.fst $ cata (\ (info :< syntax) -> (toMarkup $ Renderable (source, info, syntax), characterRange info)) term
|
||||
|
||||
instance ToMarkup (Renderable (Source Char, SplitDiff a Info)) where
|
||||
toMarkup (Renderable (source, diff)) = Prologue.fst $ iter (\ (info :< syntax) -> (toMarkup $ Renderable (source, info, syntax), characterRange info)) $ toMarkupAndRange <$> diff
|
||||
toMarkup (Renderable (source, diff)) = Prologue.fst . iter (\ (info :< syntax) -> (toMarkup $ Renderable (source, info, syntax), characterRange info)) $ toMarkupAndRange <$> diff
|
||||
where toMarkupAndRange :: SplitPatch (Term a Info) -> (Markup, Range)
|
||||
toMarkupAndRange patch = let term@(info :< _) = runCofree $ getSplitTerm patch in
|
||||
((div ! A.class_ (splitPatchToClassName patch) ! A.data_ (stringValue (show (unSize (size info))))) . toMarkup $ Renderable (source, cofree term), characterRange info)
|
||||
|
Loading…
Reference in New Issue
Block a user