Skip to content

Commit

Permalink
[Fix #40] Update dependencies; Update erlang.mk; Add ruleset to elvis…
Browse files Browse the repository at this point in the history
….config; Add rebar.config file
  • Loading branch information
harenson committed Mar 11, 2016
1 parent cdbcc3e commit 54839b9
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 89 deletions.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
PROJECT = lasse

SHELL_DEPS = sync
TEST_DEPS = cowboy shotgun meck katana mixer
TEST_DEPS = cowboy shotgun meck katana_test mixer
BUILD_DEPS = inaka_mk hexer_mk
LOCAL_DEPS = common_test

dep_meck = hex 0.8.4
dep_cowboy = git https://github.com/extend/cowboy.git 1.0.4
dep_shotgun = hex 0.1.15
dep_katana = hex 0.2.18
dep_mixer = git https://github.com/inaka/mixer.git 0.1.4
dep_inaka_mk = git https://github.com/inaka/inaka.mk.git 1.0.0
dep_hexer_mk = git https://github.com/inaka/hexer.mk.git 1.0.1
dep_meck = hex 0.8.4
dep_cowboy = git https://github.com/ninenines/cowboy.git 1.0.4
dep_shotgun = hex 0.2.3
dep_katana_test = git https://github.com/inaka/katana-test.git 0.0.3
dep_mixer = git https://github.com/inaka/mixer.git 0.1.5
dep_inaka_mk = git https://github.com/inaka/inaka.mk.git 1.0.0
dep_hexer_mk = git https://github.com/inaka/hexer.mk.git 1.1.0

DEP_PLUGINS = inaka_mk hexer_mk

Expand Down
78 changes: 14 additions & 64 deletions elvis.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,29 @@
{config,
[#{dirs => ["src", "examples/ping_pong/src"],
filter => "*.erl",
rules => [{elvis_style, line_length, #{limit => 80,
skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace},
{elvis_style, macro_names},
{elvis_style, macro_module_names},
{elvis_style, operator_spaces, #{rules => [{right, ","},
{right, "++"},
{left, "++"}]}},
{elvis_style, nesting_level, #{level => 3}},
{elvis_style, god_modules, #{limit => 30}},
{elvis_style, no_if_expression},
{elvis_style, invalid_dynamic_call},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{
elvis_style,
module_naming_convention,
#{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$",
ignore => []}
},
{
elvis_style,
function_naming_convention,
#{regex => "^([a-z][a-z0-9]*_?)*$"}
},
{elvis_style, state_record_and_type},
{elvis_style, no_spec_with_records},
{elvis_style, dont_repeat_yourself, #{min_complexity => 10}},
{elvis_style, no_debug_call}
]
rules => [{elvis_style, god_modules, #{limit => 30}}],
ruleset => erl_files
},
#{dirs => ["test"],
filter => "*.erl",
rules => [{elvis_style, line_length, #{limit => 80,
skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace},
{elvis_style, macro_names},
{elvis_style, macro_module_names},
{elvis_style, operator_spaces, #{rules => [{right, ","},
{right, "++"},
{left, "++"}]}},
{elvis_style, nesting_level, #{level => 3}},
{elvis_style, god_modules, #{limit => 30}},
{elvis_style, no_if_expression},
{elvis_style, invalid_dynamic_call},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{
elvis_style,
module_naming_convention,
#{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$",
ignore => []}
},
{
elvis_style,
function_naming_convention,
#{regex => "^([a-z][a-z0-9]*_?)*$"}
},
{elvis_style, state_record_and_type},
{elvis_style, no_spec_with_records},
{elvis_style, dont_repeat_yourself, #{min_complexity => 10}}
]
rules => [{elvis_style, god_modules, #{limit => 30}},
{elvis_style, no_debug_call, disable}],
ruleset => erl_files
},
#{dirs => ["."],
filter => "Makefile",
rules => [{elvis_project, no_deps_master_erlang_mk},
{elvis_project, protocol_for_deps_erlang_mk, #{regex => "(https://.*|[0-9]+([.][0-9]+)*)"}}]
rules => [{elvis_project,
protocol_for_deps_erlang_mk,
#{regex => "(https://.*|[0-9]+([.][0-9]+)*)"}}],
ruleset => makefiles
},
#{dirs => ["."],
filter => "rebar.config",
ruleset => rebar_config
},
#{dirs => ["."],
filter => "elvis.config",
rules => [{elvis_project, old_configuration_format}]
ruleset => elvis_config
}
]
}
Expand Down
76 changes: 60 additions & 16 deletions erlang.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

ERLANG_MK_FILENAME := $(realpath $(lastword $(MAKEFILE_LIST)))

ERLANG_MK_VERSION = 2.0.0-pre.2-72-g86ddfb5
ERLANG_MK_VERSION = 2.0.0-pre.2-88-g865bc1f

# Core configuration.

Expand Down Expand Up @@ -1843,6 +1843,14 @@ pkg_gen_unix_fetch = git
pkg_gen_unix_repo = https://github.com/msantos/gen_unix
pkg_gen_unix_commit = master

PACKAGES += geode
pkg_geode_name = geode
pkg_geode_description = geohash/proximity lookup in pure, uncut erlang.
pkg_geode_homepage = https://github.com/bradfordw/geode
pkg_geode_fetch = git
pkg_geode_repo = https://github.com/bradfordw/geode
pkg_geode_commit = master

PACKAGES += getopt
pkg_getopt_name = getopt
pkg_getopt_description = Module to parse command line arguments using the GNU getopt syntax
Expand Down Expand Up @@ -2070,9 +2078,9 @@ pkg_jerg_commit = master
PACKAGES += jesse
pkg_jesse_name = jesse
pkg_jesse_description = jesse (JSon Schema Erlang) is an implementation of a json schema validator for Erlang.
pkg_jesse_homepage = https://github.com/klarna/jesse
pkg_jesse_homepage = https://github.com/for-GET/jesse
pkg_jesse_fetch = git
pkg_jesse_repo = https://github.com/klarna/jesse
pkg_jesse_repo = https://github.com/for-GET/jesse
pkg_jesse_commit = master

PACKAGES += jiffy
Expand Down Expand Up @@ -2123,6 +2131,14 @@ pkg_json_rec_fetch = git
pkg_json_rec_repo = https://github.com/justinkirby/json_rec
pkg_json_rec_commit = master

PACKAGES += jsone
pkg_jsone_name = jsone
pkg_jsone_description = An Erlang library for encoding, decoding JSON data.
pkg_jsone_homepage = https://github.com/sile/jsone.git
pkg_jsone_fetch = git
pkg_jsone_repo = https://github.com/sile/jsone.git
pkg_jsone_commit = master

PACKAGES += jsonerl
pkg_jsonerl_name = jsonerl
pkg_jsonerl_description = yet another but slightly different erlang <-> json encoder/decoder
Expand Down Expand Up @@ -2163,6 +2179,14 @@ pkg_kafka_fetch = git
pkg_kafka_repo = https://github.com/wooga/kafka-erlang
pkg_kafka_commit = master

PACKAGES += kafka_protocol
pkg_kafka_protocol_name = kafka_protocol
pkg_kafka_protocol_description = Kafka protocol Erlang library
pkg_kafka_protocol_homepage = https://github.com/klarna/kafka_protocol
pkg_kafka_protocol_fetch = git
pkg_kafka_protocol_repo = https://github.com/klarna/kafka_protocol.git
pkg_kafka_protocol_commit = master

PACKAGES += kai
pkg_kai_name = kai
pkg_kai_description = DHT storage by Takeshi Inoue
Expand Down Expand Up @@ -3435,6 +3459,14 @@ pkg_skel_fetch = git
pkg_skel_repo = https://github.com/ParaPhrase/skel
pkg_skel_commit = master

PACKAGES += slack
pkg_slack_name = slack
pkg_slack_description = Minimal slack notification OTP library.
pkg_slack_homepage = https://github.com/DonBranson/slack
pkg_slack_fetch = git
pkg_slack_repo = https://github.com/DonBranson/slack.git
pkg_slack_commit = 1.0.0

PACKAGES += smother
pkg_smother_name = smother
pkg_smother_description = Extended code coverage metrics for Erlang.
Expand Down Expand Up @@ -4346,9 +4378,9 @@ define dep_autopatch_rebar.erl
[] -> ok;
_ ->
Write("\npre-app::\n\t$$\(MAKE) -f c_src/Makefile.erlang.mk\n"),
PortSpecWrite(io_lib:format("ERL_CFLAGS = -finline-functions -Wall -fPIC -I ~s/erts-~s/include -I ~s\n",
PortSpecWrite(io_lib:format("ERL_CFLAGS = -finline-functions -Wall -fPIC -I \\"~s/erts-~s/include\\" -I \\"~s\\"\n",
[code:root_dir(), erlang:system_info(version), code:lib_dir(erl_interface, include)])),
PortSpecWrite(io_lib:format("ERL_LDFLAGS = -L ~s -lerl_interface -lei\n",
PortSpecWrite(io_lib:format("ERL_LDFLAGS = -L \\"~s\\" -lerl_interface -lei\n",
[code:lib_dir(erl_interface, lib)])),
[PortSpecWrite(["\n", E, "\n"]) || E <- OsEnv],
FilterEnv = fun(Env) ->
Expand Down Expand Up @@ -5095,12 +5127,16 @@ $(if $(filter-out -Werror,$1),\
endef

define compat_erlc_opts_to_list
[$(call comma_list,$(foreach o,$(call compat_prepare_erlc_opts,$1),$(call compat_convert_erlc_opts,$o)))]
[$(call comma_list,$(foreach o,$(call compat_prepare_erlc_opts,$1),$(call compat_convert_erlc_opts,$o)))]
endef

define compat_rebar_config
{deps, [$(call comma_list,$(foreach d,$(DEPS),\
{$(call dep_name,$d),".*",{git,"$(call dep_repo,$d)","$(call dep_commit,$d)"}}))]}.
{deps, [
$(call comma_list,$(foreach d,$(DEPS),\
$(if $(filter hex,$(call dep_fetch,$d)),\
{$(call dep_name,$d)$(comma)"$(call dep_repo,$d)"},\
{$(call dep_name,$d)$(comma)".*"$(comma){git,"$(call dep_repo,$d)"$(comma)"$(call dep_commit,$d)"}})))
]}.
{erl_opts, $(call compat_erlc_opts_to_list,$(ERLC_OPTS))}.
endef

Expand Down Expand Up @@ -5170,8 +5206,8 @@ help::
" bootstrap Generate a skeleton of an OTP application" \
" bootstrap-lib Generate a skeleton of an OTP library" \
" bootstrap-rel Generate the files needed to build a release" \
" new-app n=NAME Create a new local OTP application NAME" \
" new-lib n=NAME Create a new local OTP library NAME" \
" new-app in=NAME Create a new local OTP application NAME" \
" new-lib in=NAME Create a new local OTP library NAME" \
" new t=TPL n=NAME Generate a module NAME based on the template TPL" \
" new t=T n=N in=APP Generate a module NAME based on the template TPL in APP" \
" list-templates List available templates"
Expand Down Expand Up @@ -5645,6 +5681,7 @@ ifeq ($(PLATFORM),msys2)
# We hardcode the compiler used on MSYS2. The default CC=cc does
# not produce working code. The "gcc" MSYS2 package also doesn't.
CC = /mingw64/bin/gcc
export CC
CFLAGS ?= -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes
CXXFLAGS ?= -O3 -finline-functions -Wall
else ifeq ($(PLATFORM),darwin)
Expand Down Expand Up @@ -5955,12 +5992,18 @@ ct: $(if $(IS_APP),,apps-ct)
else
ct: test-build $(if $(IS_APP),,apps-ct)
$(verbose) mkdir -p $(CURDIR)/logs/
$(gen_verbose) $(CT_RUN) -suite $(addsuffix _SUITE,$(CT_SUITES)) $(CT_OPTS)
$(gen_verbose) $(CT_RUN) -sname ct_$(PROJECT) -suite $(addsuffix _SUITE,$(CT_SUITES)) $(CT_OPTS)
endif

ifneq ($(ALL_APPS_DIRS),)
apps-ct:
$(verbose) for app in $(ALL_APPS_DIRS); do $(MAKE) -C $$app ct IS_APP=1; done
define ct_app_target
apps-ct-$1:
$(MAKE) -C $1 ct IS_APP=1
endef

$(foreach app,$(ALL_APPS_DIRS),$(eval $(call ct_app_target,$(app))))

apps-ct: $(addprefix apps-ct-,$(ALL_APPS_DIRS))
endif

ifndef t
Expand All @@ -5977,7 +6020,7 @@ endif
define ct_suite_target
ct-$(1): test-build
$(verbose) mkdir -p $(CURDIR)/logs/
$(gen_verbose) $(CT_RUN) -suite $(addsuffix _SUITE,$(1)) $(CT_EXTRA) $(CT_OPTS)
$(gen_verbose) $(CT_RUN) -sname ct_$(PROJECT) -suite $(addsuffix _SUITE,$(1)) $(CT_EXTRA) $(CT_OPTS)
endef

$(foreach test,$(CT_SUITES),$(eval $(call ct_suite_target,$(test))))
Expand Down Expand Up @@ -6184,8 +6227,9 @@ eunit: test-build
$(gen_verbose) $(call erlang,$(call eunit.erl,fun $(t)/0),$(EUNIT_ERL_OPTS))
endif
else
EUNIT_EBIN_MODS = $(notdir $(basename $(call core_find,ebin/,*.beam)))
EUNIT_TEST_MODS = $(notdir $(basename $(call core_find,$(TEST_DIR)/,*.beam)))
EUNIT_EBIN_MODS = $(notdir $(basename $(ERL_FILES) $(BEAM_FILES)))
EUNIT_TEST_MODS = $(notdir $(basename $(call core_find,$(TEST_DIR)/,*.erl)))

EUNIT_MODS = $(foreach mod,$(EUNIT_EBIN_MODS) $(filter-out \
$(patsubst %,%_tests,$(EUNIT_EBIN_MODS)),$(EUNIT_TEST_MODS)),'$(mod)')

Expand Down
18 changes: 18 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{erl_opts,
[
warn_unused_vars,
warn_export_all,
warn_shadow_vars,
warn_unused_import,
warn_unused_function,
warn_bif_clash,
warn_unused_record,
warn_deprecated_function,
warn_obsolete_guard,
strict_validation,
warn_export_vars,
warn_exported_vars,
warn_missing_spec,
warn_untyped_record, debug_info
]
}.
2 changes: 1 addition & 1 deletion src/lasse.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
{"Example", "https://github.com/inaka/lasse/tree/master/examples/ping_pong"},
{"SSE Spec", "https://html.spec.whatwg.org/multipage/comms.html#server-sent-events"}
]},
{build_tools,["make"]}
{build_tools,["erlang.mk", "rebar"]}
]
}.

0 comments on commit 54839b9

Please sign in to comment.