Integrate elm-review in CI (#2555)
* Run elm-review from CI Signed-off-by: Andrey Kuzmin <unsoundscapes@gmail.com> * Use the jfmengels/elm-review-simplify rule Signed-off-by: Andrey Kuzmin <unsoundscapes@gmail.com> * Make assets Signed-off-by: Andrey Kuzmin <unsoundscapes@gmail.com>
This commit is contained in:
parent
87915dc652
commit
194f1cfd7c
File diff suppressed because one or more lines are too long
|
@ -7,6 +7,7 @@ ENV PATH=$PATH:/home/node/.npm-global/bin
|
|||
|
||||
RUN mkdir -p $NPM_CONFIG_PREFIX; yarn global add \
|
||||
elm@0.19.1 \
|
||||
elm-format@0.8.4 \
|
||||
elm-format@0.8.5 \
|
||||
elm-test@0.19.1-revision6 \
|
||||
uglify-js@3.4.7
|
||||
uglify-js@3.13.4 \
|
||||
elm-review@2.5.0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
dist/
|
||||
elm-stuff/
|
||||
script.js
|
||||
0.19.0
|
||||
.elm
|
||||
|
|
|
@ -3,12 +3,7 @@
|
|||
ELM_FILES = $(shell find src -iname *.elm)
|
||||
DOCKER_IMG := elm-env
|
||||
DOCKER_RUN_CURRENT_USER := docker run --user=$(shell id -u $(USER)):$(shell id -g $(USER))
|
||||
DOCKER_CMD := $(DOCKER_RUN_CURRENT_USER) --rm -t -v $(PWD):/app -w /app -e "ELM_HOME=/app" $(DOCKER_IMG)
|
||||
# macOS requires mktemp template to be at the end of the filename.
|
||||
TEMPFILE := $(shell mktemp ./elm-XXXXXXXXXX)
|
||||
# --output flag for elm make must end in .js or .html.
|
||||
TEMPFILE_JS := "$(TEMPFILE).js"
|
||||
TEMPOPENAPI := $(shell mktemp -d ./openapi-XXXXXXXXXX)
|
||||
DOCKER_CMD := $(DOCKER_RUN_CURRENT_USER) --rm -t -v $(PWD):/app -w /app -e "ELM_HOME=/app/.elm" $(DOCKER_IMG)
|
||||
# If JUNIT_DIR is set, the tests are executed with the JUnit reporter and the result is stored in the given directory.
|
||||
JUNIT_DIR ?=
|
||||
|
||||
|
@ -28,9 +23,13 @@ format: elm-env $(ELM_FILES)
|
|||
@echo ">> format front-end code"
|
||||
@$(DOCKER_CMD) elm-format --yes $(ELM_FILES)
|
||||
|
||||
review: src/Data elm-env
|
||||
@$(DOCKER_CMD) elm-review --fix
|
||||
|
||||
test: src/Data elm-env
|
||||
@$(DOCKER_CMD) rm -rf elm-stuff/generated-code
|
||||
@$(DOCKER_CMD) elm-format $(ELM_FILES) --validate
|
||||
@$(DOCKER_CMD) elm-review
|
||||
ifneq ($(JUNIT_DIR),)
|
||||
mkdir -p $(JUNIT_DIR)
|
||||
@$(DOCKER_CMD) elm-test --report=junit | tee $(JUNIT_DIR)/junit.xml
|
||||
|
@ -41,14 +40,19 @@ endif
|
|||
dev-server:
|
||||
elm reactor
|
||||
|
||||
# macOS requires mktemp template to be at the end of the filename,
|
||||
# however --output flag for elm make must end in .js or .html.
|
||||
script.js: export TEMPFILE := "$(shell mktemp ./elm-XXXXXXXXXX)"
|
||||
script.js: export TEMPFILE_JS := "$(TEMPFILE).js"
|
||||
script.js: src/Data elm-env format $(ELM_FILES)
|
||||
@echo ">> building script.js"
|
||||
@$(DOCKER_CMD) rm -rf elm-stuff
|
||||
@$(DOCKER_CMD) elm make src/Main.elm --optimize --output $(TEMPFILE_JS)
|
||||
@$(DOCKER_CMD) uglifyjs $(TEMPFILE_JS) --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' --mangle --output=$(@)
|
||||
@$(DOCKER_CMD) uglifyjs $(TEMPFILE_JS) --compress 'pure_funcs="F2,F3,F4,F5,F6,F7,F8,F9,A2,A3,A4,A5,A6,A7,A8,A9",pure_getters,keep_fargs=false,unsafe_comps,unsafe' --mangle --output $(@)
|
||||
@rm -rf $(TEMPFILE_JS)
|
||||
@rm -rf $(TEMPFILE)
|
||||
|
||||
src/Data: export TEMPOPENAPI := $(shell mktemp -d ./openapi-XXXXXXXXXX)
|
||||
src/Data: ../../api/v2/openapi.yaml
|
||||
-rm -r src/Data
|
||||
$(DOCKER_RUN_CURRENT_USER) --rm -v ${PWD}/../..:/local openapitools/openapi-generator-cli:v3.3.4 generate \
|
||||
|
|
|
@ -9,8 +9,9 @@
|
|||
"elm/core": "1.0.5",
|
||||
"elm/json": "1.1.3",
|
||||
"elm/project-metadata-utils": "1.0.1",
|
||||
"jfmengels/elm-review": "2.3.11",
|
||||
"jfmengels/elm-review-unused": "1.1.6",
|
||||
"jfmengels/elm-review": "2.4.1",
|
||||
"jfmengels/elm-review-simplify": "1.0.1",
|
||||
"jfmengels/elm-review-unused": "1.1.9",
|
||||
"stil4m/elm-syntax": "7.2.2"
|
||||
},
|
||||
"indirect": {
|
||||
|
|
|
@ -19,6 +19,7 @@ import NoUnused.Modules
|
|||
import NoUnused.Parameters
|
||||
import NoUnused.Patterns
|
||||
import NoUnused.Variables
|
||||
import Simplify
|
||||
import Review.Rule exposing (Rule)
|
||||
|
||||
|
||||
|
@ -34,4 +35,5 @@ config =
|
|||
, NoUnused.Parameters.rule
|
||||
, NoUnused.Patterns.rule
|
||||
, NoUnused.Variables.rule
|
||||
, Simplify.rule
|
||||
]
|
||||
|
|
|
@ -31,7 +31,7 @@ urlParser url =
|
|||
( h, Nothing )
|
||||
|
||||
h :: rest ->
|
||||
( h, Just (String.join "" rest) )
|
||||
( h, Just (String.concat rest) )
|
||||
in
|
||||
case parse routeParser { url | query = query, fragment = Nothing, path = path } of
|
||||
Just route ->
|
||||
|
|
|
@ -22,7 +22,7 @@ view labels maybeActiveId alert =
|
|||
|> Dict.toList
|
||||
|> List.filter ((\b a -> List.member a b) labels >> not)
|
||||
|> List.partition (Tuple.first >> (==) "alertname")
|
||||
|> (\( a, b ) -> (++) a b)
|
||||
|> (\( a, b ) -> a ++ b)
|
||||
in
|
||||
li
|
||||
[ -- speedup rendering in Chrome, because list-group-item className
|
||||
|
|
|
@ -17,7 +17,7 @@ view activeAlertId alert =
|
|||
alert.labels
|
||||
|> Dict.toList
|
||||
|> List.partition (Tuple.first >> (==) "alertname")
|
||||
|> (\( a, b ) -> (++) a b)
|
||||
|> (\( a, b ) -> a ++ b)
|
||||
|> List.map (\( a, b ) -> String.join "=" [ a, b ])
|
||||
in
|
||||
div
|
||||
|
|
|
@ -52,44 +52,43 @@ view maybeId silenceFormGetParams defaultCreator { form, filterBar, filterBarVal
|
|||
|
||||
dateTimePickerDialog : SilenceForm -> Html SilenceFormMsg
|
||||
dateTimePickerDialog form =
|
||||
case form.viewDateTimePicker of
|
||||
True ->
|
||||
div []
|
||||
[ div [ class "modal fade show", style "display" "block" ]
|
||||
[ div [ class "modal-dialog modal-dialog-centered" ]
|
||||
[ div [ class "modal-content" ]
|
||||
[ div [ class "modal-header" ]
|
||||
[ button
|
||||
[ class "close ml-auto"
|
||||
, onClick (CloseDateTimePicker |> UpdateField)
|
||||
]
|
||||
[ text "x" ]
|
||||
if form.viewDateTimePicker then
|
||||
div []
|
||||
[ div [ class "modal fade show", style "display" "block" ]
|
||||
[ div [ class "modal-dialog modal-dialog-centered" ]
|
||||
[ div [ class "modal-content" ]
|
||||
[ div [ class "modal-header" ]
|
||||
[ button
|
||||
[ class "close ml-auto"
|
||||
, onClick (CloseDateTimePicker |> UpdateField)
|
||||
]
|
||||
, div [ class "modal-body" ]
|
||||
[ viewDateTimePicker form.dateTimePicker |> Html.map UpdateDateTimePicker ]
|
||||
, div [ class "modal-footer" ]
|
||||
[ button
|
||||
[ class "ml-2 btn btn-outline-success mr-auto"
|
||||
, onClick (CloseDateTimePicker |> UpdateField)
|
||||
]
|
||||
[ text "Cancel" ]
|
||||
, button
|
||||
[ class "ml-2 btn btn-primary"
|
||||
, onClick (UpdateTimesFromPicker |> UpdateField)
|
||||
]
|
||||
[ text "Set Date/Time" ]
|
||||
[ text "x" ]
|
||||
]
|
||||
, div [ class "modal-body" ]
|
||||
[ viewDateTimePicker form.dateTimePicker |> Html.map UpdateDateTimePicker ]
|
||||
, div [ class "modal-footer" ]
|
||||
[ button
|
||||
[ class "ml-2 btn btn-outline-success mr-auto"
|
||||
, onClick (CloseDateTimePicker |> UpdateField)
|
||||
]
|
||||
[ text "Cancel" ]
|
||||
, button
|
||||
[ class "ml-2 btn btn-primary"
|
||||
, onClick (UpdateTimesFromPicker |> UpdateField)
|
||||
]
|
||||
[ text "Set Date/Time" ]
|
||||
]
|
||||
]
|
||||
]
|
||||
, div [ class "modal-backdrop fade show" ] []
|
||||
]
|
||||
, div [ class "modal-backdrop fade show" ] []
|
||||
]
|
||||
|
||||
False ->
|
||||
div [ style "clip" "rect(0,0,0,0)", style "position" "fixed" ]
|
||||
[ div [ class "modal fade" ] []
|
||||
, div [ class "modal-backdrop fade" ] []
|
||||
]
|
||||
else
|
||||
div [ style "clip" "rect(0,0,0,0)", style "position" "fixed" ]
|
||||
[ div [ class "modal fade" ] []
|
||||
, div [ class "modal-backdrop fade" ] []
|
||||
]
|
||||
|
||||
|
||||
inputSectionPadding : String
|
||||
|
|
|
@ -21,12 +21,12 @@ parseMatcher =
|
|||
if List.map isNotEmptyTrimmedAlphabetWord [ key, value ] /= [ True, True ] then
|
||||
Expect.equal
|
||||
Nothing
|
||||
(Utils.Filter.parseMatcher <| String.join "" [ key, "=", value ])
|
||||
(Utils.Filter.parseMatcher <| String.concat [ key, "=", value ])
|
||||
|
||||
else
|
||||
Expect.equal
|
||||
(Just (Matcher key Eq value))
|
||||
(Utils.Filter.parseMatcher <| String.join "" [ key, "=", "\"", value, "\"" ])
|
||||
(Utils.Filter.parseMatcher <| String.concat [ key, "=", "\"", value, "\"" ])
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue