Merge pull request #13176 from JimMoen/erlfmt-file-name-by-find
build: run erlfmt with files name by `$(FIND)`
This commit is contained in:
commit
f0721bdb97
|
@ -1,12 +1,12 @@
|
|||
%% -*- mode: erlang -*-
|
||||
{application, http_server,
|
||||
[{description, "An HTTP server application"},
|
||||
{application, http_server, [
|
||||
{description, "An HTTP server application"},
|
||||
{vsn, "0.2.0"},
|
||||
{registered, []},
|
||||
% {mod, {http_server_app, []}},
|
||||
{modules, []},
|
||||
{applications,
|
||||
[kernel,
|
||||
{applications, [
|
||||
kernel,
|
||||
stdlib,
|
||||
minirest
|
||||
]},
|
||||
|
|
14
Makefile
14
Makefile
|
@ -317,10 +317,16 @@ $(foreach tt,$(ALL_ELIXIR_TGZS),$(eval $(call gen-elixir-tgz-target,$(tt))))
|
|||
|
||||
.PHONY: fmt
|
||||
fmt: $(REBAR)
|
||||
@$(SCRIPTS)/erlfmt -w 'apps/*/{src,include,priv,test,integration_test}/**/*.{erl,hrl,app.src,eterm}'
|
||||
@$(SCRIPTS)/erlfmt -w 'apps/*/rebar.config' 'apps/emqx/rebar.config.script' '.ci/fvt_tests/http_server/rebar.config'
|
||||
@$(SCRIPTS)/erlfmt -w 'rebar.config' 'rebar.config.erl'
|
||||
@$(SCRIPTS)/erlfmt -w 'scripts/*.escript' 'bin/*.escript' 'bin/nodetool'
|
||||
@$(FIND) . \( -name '*.app.src' -o \
|
||||
-name '*.erl' -o \
|
||||
-name '*.hrl' -o \
|
||||
-name 'rebar.config' -o \
|
||||
-name '*.eterm' -o \
|
||||
-name '*.escript' \) -not -path '*/_build/*' -type f \
|
||||
| xargs $(SCRIPTS)/erlfmt -w
|
||||
@$(SCRIPTS)/erlfmt -w 'apps/emqx/rebar.config.script'
|
||||
@$(SCRIPTS)/erlfmt -w 'elvis.config'
|
||||
@$(SCRIPTS)/erlfmt -w 'bin/nodetool'
|
||||
@mix format
|
||||
|
||||
.PHONY: clean-test-cluster-config
|
||||
|
|
53
elvis.config
53
elvis.config
|
@ -3,60 +3,75 @@
|
|||
{
|
||||
elvis,
|
||||
[
|
||||
{config,
|
||||
[
|
||||
#{dirs => ["src", "apps/**/src"],
|
||||
{config, [
|
||||
#{
|
||||
dirs => ["src", "apps/**/src"],
|
||||
filter => "*.erl",
|
||||
ruleset => erl_files,
|
||||
rules => [
|
||||
{elvis_style, param_pattern_matching, disable},
|
||||
{elvis_style, macro_names, disable},
|
||||
{elvis_style, function_naming_convention, disable},
|
||||
{elvis_style, state_record_and_type, disable},
|
||||
{elvis_style, no_common_caveats_call, #{}},
|
||||
{elvis_style, no_debug_call, #{ debug_functions => [ {ct, pal}
|
||||
, {ct, print}
|
||||
]}},
|
||||
{elvis_style, operator_spaces, #{rules => [{right, "|"},
|
||||
{elvis_style, no_debug_call, #{
|
||||
debug_functions => [
|
||||
{ct, pal},
|
||||
{ct, print}
|
||||
]
|
||||
}},
|
||||
{elvis_style, operator_spaces, #{
|
||||
rules => [
|
||||
{right, "|"},
|
||||
{left, "|"},
|
||||
{right, "||"},
|
||||
{left, "||"}]}},
|
||||
{left, "||"}
|
||||
]
|
||||
}},
|
||||
{elvis_style, dont_repeat_yourself, #{min_complexity => 20}},
|
||||
{elvis_style, god_modules, #{limit => 100}},
|
||||
{elvis_text_style, line_length, #{ limit => 120 % trust erlfmt
|
||||
, skip_comments => false
|
||||
% trust erlfmt
|
||||
{elvis_text_style, line_length, #{
|
||||
limit => 120,
|
||||
skip_comments => false
|
||||
}}
|
||||
]
|
||||
},
|
||||
#{dirs => ["test", "apps/**/test"],
|
||||
#{
|
||||
dirs => ["test", "apps/**/test"],
|
||||
filter => "*.erl",
|
||||
rules => [
|
||||
{elvis_text_style, line_length, #{ limit => 120
|
||||
, skip_comments => false
|
||||
{elvis_text_style, line_length, #{
|
||||
limit => 120,
|
||||
skip_comments => false
|
||||
}},
|
||||
{elvis_style, dont_repeat_yourself, #{min_complexity => 100}},
|
||||
{elvis_style, nesting_level, #{level => 6}}
|
||||
]
|
||||
},
|
||||
#{dirs => ["apps/emqx_rule_engine/src"],
|
||||
#{
|
||||
dirs => ["apps/emqx_rule_engine/src"],
|
||||
filter => "*_rule_funcs.erl",
|
||||
rules => [
|
||||
{elvis_style, god_modules, disable}
|
||||
]
|
||||
},
|
||||
#{dirs => ["."],
|
||||
#{
|
||||
dirs => ["."],
|
||||
filter => "Makefile",
|
||||
ruleset => makefiles
|
||||
},
|
||||
#{dirs => ["."],
|
||||
#{
|
||||
dirs => ["."],
|
||||
filter => "rebar.config",
|
||||
ruleset => rebar_config
|
||||
},
|
||||
#{dirs => ["."],
|
||||
#{
|
||||
dirs => ["."],
|
||||
filter => "elvis.config",
|
||||
ruleset => elvis_config
|
||||
}
|
||||
]
|
||||
}
|
||||
]}
|
||||
]
|
||||
}
|
||||
].
|
||||
|
|
|
@ -39,3 +39,5 @@ a4feb3e6e95c18cb531416112e57520c5ba00d40
|
|||
72eb34658d31fb38130421949cff262efab51139
|
||||
# erlfmt rebar.config files and bin/nodetool
|
||||
5e100f52b8a530f4a952a4b20125ec37b38e2906
|
||||
# erlfmt files in `erlang-mode`
|
||||
336ed1b9223e37adb3336b8edacfd2a9b4238319
|
||||
|
|
Loading…
Reference in New Issue