mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-09-11 16:16:09 +03:00
Add Review.Rule.errorFixFailure
This commit is contained in:
parent
ed59b64dae
commit
9902fcad00
@ -20,7 +20,7 @@ module Review.Rule exposing
|
|||||||
, Metadata, withMetadata, moduleNameFromMetadata, moduleNameNodeFromMetadata, isInSourceDirectories
|
, Metadata, withMetadata, moduleNameFromMetadata, moduleNameNodeFromMetadata, isInSourceDirectories
|
||||||
, Error, error, errorWithFix, ModuleKey, errorForModule, errorForModuleWithFix, ElmJsonKey, errorForElmJson, errorForElmJsonWithFix, ReadmeKey, errorForReadme, errorForReadmeWithFix
|
, Error, error, errorWithFix, ModuleKey, errorForModule, errorForModuleWithFix, ElmJsonKey, errorForElmJson, errorForElmJsonWithFix, ReadmeKey, errorForReadme, errorForReadmeWithFix
|
||||||
, globalError, configurationError
|
, globalError, configurationError
|
||||||
, ReviewError, errorRuleName, errorMessage, errorDetails, errorRange, errorFixes, errorFilePath, errorTarget
|
, ReviewError, errorRuleName, errorMessage, errorDetails, errorRange, errorFilePath, errorTarget, errorFixes, errorFixFailure
|
||||||
, ignoreErrorsForDirectories, ignoreErrorsForFiles, filterErrorsForFiles
|
, ignoreErrorsForDirectories, ignoreErrorsForFiles, filterErrorsForFiles
|
||||||
, withDataExtractor, preventExtract
|
, withDataExtractor, preventExtract
|
||||||
, reviewV3, reviewV2, review, ProjectData, ruleName, ruleProvidesFixes, ruleKnowsAboutIgnoredFiles, withRuleId, getConfigurationError
|
, reviewV3, reviewV2, review, ProjectData, ruleName, ruleProvidesFixes, ruleKnowsAboutIgnoredFiles, withRuleId, getConfigurationError
|
||||||
@ -244,7 +244,7 @@ first, as they are in practice a simpler version of project rules.
|
|||||||
|
|
||||||
@docs Error, error, errorWithFix, ModuleKey, errorForModule, errorForModuleWithFix, ElmJsonKey, errorForElmJson, errorForElmJsonWithFix, ReadmeKey, errorForReadme, errorForReadmeWithFix
|
@docs Error, error, errorWithFix, ModuleKey, errorForModule, errorForModuleWithFix, ElmJsonKey, errorForElmJson, errorForElmJsonWithFix, ReadmeKey, errorForReadme, errorForReadmeWithFix
|
||||||
@docs globalError, configurationError
|
@docs globalError, configurationError
|
||||||
@docs ReviewError, errorRuleName, errorMessage, errorDetails, errorRange, errorFixes, errorFilePath, errorTarget
|
@docs ReviewError, errorRuleName, errorMessage, errorDetails, errorRange, errorFilePath, errorTarget, errorFixes, errorFixFailure
|
||||||
|
|
||||||
|
|
||||||
## Configuring exceptions
|
## Configuring exceptions
|
||||||
@ -3862,6 +3862,33 @@ errorFixes (Review.Error.ReviewError err) =
|
|||||||
Just fixes
|
Just fixes
|
||||||
|
|
||||||
|
|
||||||
|
{-| Get the reason why the fix for an error failed when its available automatic fix was attempted and deemed incorrect.
|
||||||
|
|
||||||
|
Note that if the review process was not run in fix mode previously, then this will return `Nothing`.
|
||||||
|
|
||||||
|
-}
|
||||||
|
errorFixFailure : ReviewError -> Maybe Fix.Problem
|
||||||
|
errorFixFailure (Review.Error.ReviewError err) =
|
||||||
|
case err.fixes of
|
||||||
|
Review.Error.Available _ ->
|
||||||
|
Nothing
|
||||||
|
|
||||||
|
Review.Error.NoFixes ->
|
||||||
|
Nothing
|
||||||
|
|
||||||
|
Review.Error.FailedToApply _ problem ->
|
||||||
|
Just <|
|
||||||
|
case problem of
|
||||||
|
Review.Error.Unchanged ->
|
||||||
|
Fix.Unchanged
|
||||||
|
|
||||||
|
Review.Error.SourceCodeIsNotValid string ->
|
||||||
|
Fix.SourceCodeIsNotValid string
|
||||||
|
|
||||||
|
Review.Error.HasCollisionsInFixRanges ->
|
||||||
|
Fix.HasCollisionsInFixRanges
|
||||||
|
|
||||||
|
|
||||||
{-| Get the file path of an [`Error`](#Error).
|
{-| Get the file path of an [`Error`](#Error).
|
||||||
-}
|
-}
|
||||||
errorFilePath : ReviewError -> String
|
errorFilePath : ReviewError -> String
|
||||||
|
Loading…
Reference in New Issue
Block a user