mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-27 03:33:00 +03:00
Ignore fixes for the README
This commit is contained in:
parent
fc42febf39
commit
8d0108a682
@ -1,4 +1,4 @@
|
||||
module Review.Error exposing (InternalError, ReviewError(..), error, withFixes)
|
||||
module Review.Error exposing (InternalError, ReviewError(..), Target(..), error, withFixes)
|
||||
|
||||
import Elm.Syntax.Range exposing (Range)
|
||||
import Review.Fix exposing (Fix)
|
||||
@ -8,6 +8,13 @@ type ReviewError
|
||||
= ReviewError InternalError
|
||||
|
||||
|
||||
type Target
|
||||
= Module
|
||||
| ElmJson
|
||||
| Readme
|
||||
| Global
|
||||
|
||||
|
||||
type alias InternalError =
|
||||
{ message : String
|
||||
, ruleName : String
|
||||
@ -15,6 +22,7 @@ type alias InternalError =
|
||||
, details : List String
|
||||
, range : Range
|
||||
, fixes : Maybe (List Fix)
|
||||
, target : Target
|
||||
}
|
||||
|
||||
|
||||
@ -27,6 +35,7 @@ error { message, details } range =
|
||||
, details = details
|
||||
, range = range
|
||||
, fixes = Nothing
|
||||
, target = Module
|
||||
}
|
||||
|
||||
|
||||
|
@ -378,6 +378,7 @@ review rules project =
|
||||
]
|
||||
, range = { start = { row = 0, column = 0 }, end = { row = 0, column = 0 } }
|
||||
, fixes = Nothing
|
||||
, target = Review.Error.Global
|
||||
}
|
||||
]
|
||||
, rules
|
||||
@ -403,6 +404,7 @@ review rules project =
|
||||
]
|
||||
, range = { start = { row = 0, column = 0 }, end = { row = 0, column = 0 } }
|
||||
, fixes = Nothing
|
||||
, target = Review.Error.Global
|
||||
}
|
||||
]
|
||||
, rules
|
||||
@ -2515,6 +2517,7 @@ error { message, details } range =
|
||||
, details = details
|
||||
, range = range
|
||||
, fixes = Nothing
|
||||
, target = Review.Error.Module
|
||||
}
|
||||
|
||||
|
||||
@ -2546,6 +2549,7 @@ errorForModule (ModuleKey path) { message, details } range =
|
||||
, range = range
|
||||
, filePath = path
|
||||
, fixes = Nothing
|
||||
, target = Review.Error.Module
|
||||
}
|
||||
|
||||
|
||||
@ -2590,6 +2594,7 @@ errorForElmJson (ElmJsonKey { path, raw }) getErrorInfo =
|
||||
, range = errorInfo.range
|
||||
, filePath = path
|
||||
, fixes = Nothing
|
||||
, target = Review.Error.ElmJson
|
||||
}
|
||||
|
||||
|
||||
@ -2624,6 +2629,7 @@ errorForReadme (ReadmeKey { path }) { message, details } range =
|
||||
, details = details
|
||||
, range = range
|
||||
, fixes = Nothing
|
||||
, target = Review.Error.Readme
|
||||
}
|
||||
|
||||
|
||||
@ -2640,6 +2646,7 @@ parsingError rawFile =
|
||||
]
|
||||
, range = { start = { row = 0, column = 0 }, end = { row = 0, column = 0 } }
|
||||
, fixes = Nothing
|
||||
, target = Review.Error.Module
|
||||
}
|
||||
|
||||
|
||||
@ -2674,7 +2681,7 @@ withFixes fixes error_ =
|
||||
-- TODO Make this impossible?
|
||||
mapInternalError
|
||||
(\err ->
|
||||
if List.isEmpty fixes || String.endsWith ".json" err.filePath then
|
||||
if List.isEmpty fixes || err.target /= Review.Error.Module then
|
||||
{ err | fixes = Nothing }
|
||||
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user