Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add count_by #40

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/erlang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Erlang CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:

build:

runs-on: ubuntu-latest

container:
image: erlang:24

steps:
- uses: actions/checkout@v2
- name: Compile
run: rebar3 compile
- name: Run tests
run: rebar3 do eunit, ct
190 changes: 115 additions & 75 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,73 +1,99 @@
%% -*- mode: erlang;erlang-indent-level: 2;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et

%% == Erlang Compiler ==

{erl_opts, [
warn_unused_vars,
warnings_as_errors,
ewarn_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
]}.
{
erl_opts,
[
warn_unused_vars,
warnings_as_errors,
ewarn_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
]
}.

%% == Dependencies ==

{deps, [
{sumo_db, "0.7.2"},
{riakc, "2.5.3"},
{iso8601, "1.1.2", {pkg, inaka_iso8601}}
]}.
{
deps,
[
{
datetime,
{git, "https://github.com/jagguli/date_util.git", {branch, "master"}}
},
{
sumo_db,
{git, "https://github.com/jagguli/sumo_db.git", {branch, "master"}}
},
{
riakc,
{
git,
"git://github.com/basho/riak-erlang-client.git",
{branch, "develop-3.0"}
}
},
{iso8601, "1.1.2", {pkg, inaka_iso8601}}
]
}.

%% == Overrides ==

{overrides, []}.

%% == Profiles ==

{profiles, [
{test, [
{deps, [
{katana_test, "0.1.1"},
{mixer, "0.1.5", {pkg, inaka_mixer}}
]}
]}
]}.
{
profiles,
[
{
test,
[
{
deps,
[katana_test, {mixer, "1.2.0", {pkg, inaka_mixer}}, {elvis, "1.0.1"}]
}
]
}
]
}.

%% == Common Test ==

{ct_compile_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
]}.

{ct_opts, [
{sys_config, ["test/test.config"]}
]}.
{
ct_compile_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
]
}.

{ct_opts, [{sys_config, ["test/test.config"]}]}.

%% == Cover ==

Expand All @@ -77,32 +103,46 @@

%% == EDoc ==

{edoc_opts, [
{report_missing_types, true},
{source_path, ["src"]},
{report_missing_types, true},
{todo, true},
{packages, false},
{subpackages, false}
]}.
{
edoc_opts,
[
{report_missing_types, true},
{source_path, ["src"]},
{report_missing_types, true},
{todo, true},
{packages, false},
{subpackages, false}
]
}.

%% == Dialyzer ==

{dialyzer, [
{warnings, [
race_conditions,
no_return,
unmatched_returns,
error_handling
]},
{plt_apps, top_level_deps},
{plt_extra_apps, []},
{plt_location, local},
{plt_prefix, "sumo_db_riak"},
{base_plt_location, ".plt"},
{base_plt_prefix, "sumo_db_riak"}
]}.
{
dialyzer,
[
{warnings, [race_conditions, no_return, unmatched_returns, error_handling]},
{plt_apps, top_level_deps},
{plt_extra_apps, []},
{plt_location, local},
{plt_prefix, "sumo_db_riak"},
{base_plt_location, ".plt"},
{base_plt_prefix, "sumo_db_riak"}
]
}.

%% == Shell ==

{shell, [{apps, [sumo_db_riak]}]}.

%% == Plugins ==

{plugins, [steamroller]}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is an inaka project, on principle, we should use rebar3_format instead of steamroller.
In any case, you can either…

  • Fork the project and use steamroller on your fork.
  • Use rebar3_format with a profile for you that uses the sr_formatter formatter (that one formats the code with steamroller).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware of rebar3_format, let me check it out, Thanks

Copy link
Member

@elbrujohalcon elbrujohalcon Sep 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is totally off-topic, but it's something that I always wonder about…
As a maintainer of multiple open-source tools for the Erlang community (and a blog), I'm always trying to reach as many Erlang devs as possible with the news.
So, 100% out of curiosity and not as a criticism: If you didn't know about rebar3_format but you knew about steamroller… How do you get your news about Erlang and its ecosystem? What communication channel am I missing?
I mean… as far as I know, @dtip published steamroller in exactly the same places I published rebar3_format (sometimes even I was the one publishing his work). So… If you don't mind… What did I miss? How can I improve the broadcasting of news about the tools I create/maintain?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be because I searched for "opinionated code formatter for erlang"
coming from python as a python dev, I discovered the comfort of black for python
wanted the same for Erlang

Mostly I'm searching for concepts parallel to python

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opinionated formatters are the right choice 😉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:trollface:


{
steamroller,
[
{line_length, 80},
{indent, 2},
{inputs, ["rebar.config", "{src,test,include}/*.{[he]rl,app.src}"]}
]
}.
49 changes: 31 additions & 18 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
{"1.1.0",
[{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},2},
{<<"hamcrest">>,{pkg,<<"basho_hamcrest">>,<<"0.4.1">>},2},
{<<"iso8601">>,{pkg,<<"inaka_iso8601">>,<<"1.1.2">>},0},
{<<"lager">>,{pkg,<<"lager">>,<<"3.2.4">>},1},
{"1.2.0",
[{<<"iso8601">>,{pkg,<<"inaka_iso8601">>,<<"1.1.2">>},0},
{<<"meck">>,
{git,"https://github.com/eproxus/meck.git",
{ref,"4ecc1ae9089edc6977e8c8c4cd41081513cc5590"}},
3},
{<<"protobuffs">>,
{git,"https://github.com/basho/erlang_protobuffs.git",
{ref,"098efad8f85dfe556d64e2cf6ce31f2075808f67"}},
2},
{<<"quickrand">>,{pkg,<<"quickrand">>,<<"1.5.4">>},2},
{<<"riak_pb">>,{pkg,<<"riak_pb">>,<<"2.3.2">>},1},
{<<"riakc">>,{pkg,<<"riakc">>,<<"2.5.3">>},0},
{<<"sumo_db">>,{pkg,<<"sumo_db">>,<<"0.7.2">>},0},
{<<"uuid">>,{pkg,<<"uuid_erl">>,<<"1.5.4">>},1},
{<<"worker_pool">>,{pkg,<<"worker_pool">>,<<"2.0.1">>},1}]}.
{<<"riak_pb">>,
{git,"https://github.com/basho/riak_pb",
{ref,"b7abca90e4c708073021d2c4e18c896f1a10b838"}},
1},
{<<"riakc">>,
{git,"git://github.com/basho/riak-erlang-client.git",
{ref,"d9fa46335fda4704fda71cbc011ab6a11e50e3f3"}},
0},
{<<"sumo_db">>,
{git,"https://github.com/jagguli/sumo_db.git",
{ref,"372fa1c25de4aabfd3db56944df8ec5157db3c03"}},
0},
{<<"uuid">>,{pkg,<<"uuid_erl">>,<<"1.5.2-rc1">>},1},
{<<"worker_pool">>,{pkg,<<"worker_pool">>,<<"3.1.0">>},1}]}.
[
{pkg_hash,[
{<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>},
{<<"hamcrest">>, <<"FB7B2C92D252A1E9DB936750B86089ADDAEBEB8F87967FB4BBDDA61E8863338E">>},
{<<"iso8601">>, <<"6D84BBA9641FA39802E6B53C57E0B61B2F61BF8E81C112356B57BE8DA31DE771">>},
{<<"lager">>, <<"A6DEB74DAE7927F46BD13255268308EF03EB206EC784A94EAF7C1C0F3B811615">>},
{<<"quickrand">>, <<"47ADD4755CC5F209CBEFFD6F47C84061196CD7FAD99FD8FD12418EB0D06B939D">>},
{<<"riak_pb">>, <<"48FFBF66DBB3F136AB9A7134BAC4E496754BAA5EF58C4F50A61326736D996390">>},
{<<"riakc">>, <<"6132D9E687A0DFD314B2B24C4594302CA8B55568A5D733C491D8FB6CD4004763">>},
{<<"sumo_db">>, <<"B56544DB18826D1EE5296042B5D4461D0805B7F54C998ED8338F1BC59E284749">>},
{<<"uuid">>, <<"06240EFF3EAF013CC22274689B0C1FF6345645EE5D47A9E4ED7545EEB7698B23">>},
{<<"worker_pool">>, <<"B90273074898FA89434317991E00884DBBAFFAB5BFD964A7586317CD16FB18D4">>}]}
{<<"uuid">>, <<"D4022AB3F4F1A28E86EA15D4075CB0C57EC908D8AF1CA2E8AF28AA815EF93C3A">>},
{<<"worker_pool">>, <<"C908627E04057CF29940AD0E79B89AB161DB520EEBC76942EFD08A187BABF93A">>}]},
{pkg_hash_ext,[
{<<"iso8601">>, <<"8964665B3EDBC8C4B390512D9DE429A550CC32FF3FA3583F2E6F14925127D480">>},
{<<"quickrand">>, <<"2657DCA4544BF98EC44328F95F2C94A07ACCECE452195C599E43799A760B28B0">>},
{<<"uuid">>, <<"4297348D9D52A38E2446185F979CB8786FE8784AC053ABE6724C2AF7D7930E38">>},
{<<"worker_pool">>, <<"F809B89F46B2CB5DFD2B731A2C8B234DB2788490FAB88EB0823DA18B64851EE2">>}]}
].
Loading