-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major refactor for maintainability (#565)
* Refactoring hadolint to use as single pass check The single pass is provided by the foldl library * Fixing some bugs intruced after the refactor * performance tweaks and code simplification * minor tweaks for clarity * bumping version to 2.0 as the refactor is a pretty major API change * documentation and applying hlint suggestions
- Loading branch information
Showing
72 changed files
with
3,049 additions
and
2,239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,44 @@ | ||
module Hadolint | ||
( module Hadolint.Lint, | ||
module Hadolint.Rules, | ||
module Hadolint.Process, | ||
module Hadolint.Config, | ||
Result (..) | ||
Result (..), | ||
OutputFormat (..), | ||
shallSkipErrorStatus, | ||
printResults, | ||
) | ||
where | ||
|
||
import Data.Text (Text) | ||
import Hadolint.Config | ||
import Hadolint.Lint | ||
import Hadolint.Rules | ||
import qualified Hadolint.Formatter.Checkstyle | ||
import qualified Hadolint.Formatter.Codacy | ||
import qualified Hadolint.Formatter.Codeclimate | ||
import Hadolint.Formatter.Format (Result (..)) | ||
import qualified Hadolint.Formatter.Json | ||
import qualified Hadolint.Formatter.TTY | ||
import Hadolint.Lint | ||
import Hadolint.Process | ||
import Language.Docker.Parser (DockerfileError) | ||
|
||
data OutputFormat | ||
= Json | ||
| TTY | ||
| CodeclimateJson | ||
| GitlabCodeclimateJson | ||
| Checkstyle | ||
| Codacy | ||
deriving (Show, Eq) | ||
|
||
shallSkipErrorStatus :: OutputFormat -> Bool | ||
shallSkipErrorStatus format = format `elem` [CodeclimateJson, Codacy] | ||
|
||
printResults :: Foldable f => OutputFormat -> Bool -> f (Result Text DockerfileError) -> IO () | ||
printResults format nocolor allResults = | ||
case format of | ||
TTY -> Hadolint.Formatter.TTY.printResults allResults nocolor | ||
Json -> Hadolint.Formatter.Json.printResults allResults | ||
Checkstyle -> Hadolint.Formatter.Checkstyle.printResults allResults | ||
CodeclimateJson -> Hadolint.Formatter.Codeclimate.printResults allResults | ||
GitlabCodeclimateJson -> Hadolint.Formatter.Codeclimate.printGitlabResults allResults | ||
Codacy -> Hadolint.Formatter.Codacy.printResults allResults |
Oops, something went wrong.