Skip to content

Commit cb28221

Browse files
Merge pull request #51 from paulo-ferraz-oliveira/feature/minor-maintenance-updates
Maintenance updates
2 parents 41ea782 + f0cf691 commit cb28221

16 files changed

Lines changed: 648 additions & 744 deletions

.github/workflows/erlang.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: Erlang CI
3+
4+
"on": [push, pull_request]
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-22.04
9+
10+
strategy:
11+
matrix:
12+
otp: ['24', '25', '26']
13+
rebar: ['3.22']
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: erlef/setup-beam@v1
18+
id: setup-beam
19+
with:
20+
otp-version: ${{matrix.otp}}
21+
rebar3-version: ${{matrix.rebar}}
22+
- name: Restore _build
23+
uses: actions/cache@v3
24+
with:
25+
path: _build
26+
key: "_build-cache-for\
27+
-os-${{runner.os}}\
28+
-otp-${{steps.setup-beam.outputs.otp-version}}\
29+
-rebar3-${{steps.setup-beam.outputs.rebar3-version}}\
30+
-hash-${{hashFiles('rebar.lock')}}"
31+
- name: Restore rebar3's cache
32+
uses: actions/cache@v3
33+
with:
34+
path: ~/.cache/rebar3
35+
key: "rebar3-cache-for\
36+
-os-${{runner.os}}\
37+
-otp-${{steps.setup-beam.outputs.otp-version}}\
38+
-rebar3-${{steps.setup-beam.outputs.rebar3-version}}\
39+
-hash-${{hashFiles('rebar.lock')}}"
40+
- name: Compile
41+
run: rebar3 compile
42+
- name: Format check
43+
run: rebar3 format --verify
44+
- name: Run tests and verifications
45+
run: rebar3 test
46+
- name: Run meta verifications
47+
run: rebar3 as test test

.github/workflows/lint.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Lint
3+
4+
"on": [push, pull_request]
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-22.04
9+
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
# uses .markdownlint-cli2.yaml for configuration
14+
- name: markdownlint
15+
uses: DavidAnson/markdownlint-cli2-action@v11
16+
with:
17+
globs: |
18+
*.md
19+
LICENSE
20+
!CHANGELOG.md
21+
22+
- name: yamllint
23+
uses: ibiqlik/action-yamllint@v3
24+
with:
25+
file_or_dir: |
26+
.github/**/erlang.yml
27+
.*.yml
28+
strict: true
29+
config_file: .yamllint.yml

.gitignore

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
doc/
2-
.erlang.mk/
3-
zipper.d
4-
.eunit
5-
deps
6-
*.o
7-
*.beam
8-
*.plt
92
erl_crash.dump
10-
ebin
11-
.erlang.mk.*
12-
log*/
13-
_build/
3+
rebar3.crashdump
4+
.rebar3
5+
_*
6+
logs

.markdownlint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
default: true
3+
MD013:
4+
line_length: 100

.yamllint.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
extends: default
3+
rules:
4+
line-length:
5+
max: 100

LICENSE

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
Apache License
1+
# Apache License
2+
23
Version 2.0, January 2004
3-
http://www.apache.org/licenses/
4+
https://www.apache.org/licenses/
45

56
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
67

@@ -192,7 +193,7 @@ Apache License
192193
you may not use this file except in compliance with the License.
193194
You may obtain a copy of the License at
194195

195-
http://www.apache.org/licenses/LICENSE-2.0
196+
https://www.apache.org/licenses/LICENSE-2.0
196197

197198
Unless required by applicable law or agreed to in writing, software
198199
distributed under the License is distributed on an "AS IS" BASIS,

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1+
# Zipper [![GitHub Actions CI](https://github.com/inaka/zipper/workflows/build/badge.svg)](https://github.com/inaka/zipper)
2+
13
Generic zipper implementation in Erlang.
24

35
## Zippers: what are they good for?
46

57
Zippers let you traverse immutable data structures with ease and flexibility.
68

79
### Contact Us
8-
If you find any **bugs** or have a **problem** while using this library, please [open an issue](https://github.com/inaka/zipper/issues/new) in this repo (or a pull request :)).
910

10-
And you can check all of our open-source projects at [inaka.github.io](http://inaka.github.io)
11+
If you find any **bugs** or have a **problem** while using this library, please
12+
[open an issue](https://github.com/inaka/zipper/issues/new) in this repo (or a pull request :)).
13+
14+
And you can check all of our open-source projects at [inaka.github.io](https://inaka.github.io)
1115

1216
## Usage
1317

@@ -44,6 +48,7 @@ Root = #{type => planet,
4448
```
4549

4650
You can build a zipper by providing three simple functions:
51+
4752
- `IsBranchFun`: takes a node and returns `true` if it is a branch node or
4853
`false` otherwise.
4954
- `ChildrenFun`: takes a node and returns a list of its children.
@@ -85,7 +90,10 @@ io:format("~p", [America]),
8590

8691
## Tests
8792

88-
Circular dependency in test environment ([Katana Test](https://github.com/inaka/katana-test) -> [Elvis Core](https://github.com/inaka/elvis_core) -> [Zipper](https://github.com/inaka/zipper)) is fixed by including Zipper as a dep in the test profile in `rebar.config`
93+
Circular dependency in test environment ([Katana Test](https://github.com/inaka/katana-test) ->
94+
[Elvis Core](https://github.com/inaka/elvis_core) -> [Zipper](https://github.com/inaka/zipper)) is
95+
fixed by including Zipper as a dep in the test profile in `rebar.config`
96+
8997
```erlang
9098
...
9199
{profiles, [
@@ -99,10 +107,12 @@ Circular dependency in test environment ([Katana Test](https://github.com/inaka/
99107
]}.
100108
...
101109
```
110+
102111
but then, we still replace the tag with the current branch. This is done in `rebar.config.script`.
103-
Therefore, it's really important to have the branch updated and pushed to github before running the tests with `rebar3 ct`.
112+
Therefore, it's really important to have the branch updated and pushed to github before running the
113+
tests with `rebar3 ct`.
104114
105115
## References
106116
107117
- [The Zipper, GERARD HUET](https://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/huet-zipper.pdf)
108-
- [clojure.zip](http://clojure.github.io/clojure/clojure.zip-api.html#clojure.zip/zipper)
118+
- [clojure.zip](https://clojure.github.io/clojure/clojure.zip-api.html#clojure.zip/zipper)

elvis.config

Lines changed: 11 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,11 @@
1-
[
2-
{
3-
elvis,
4-
[
5-
{config,
6-
[#{dirs => ["src", "test"],
7-
filter => "*.erl",
8-
rules => [{elvis_style, line_length, #{limit => 80,
9-
skip_comments => false}},
10-
{elvis_style, no_tabs},
11-
{elvis_style, no_trailing_whitespace},
12-
{elvis_style, macro_names},
13-
{elvis_style, macro_module_names},
14-
{elvis_style, operator_spaces, #{rules => [{right, ","},
15-
{right, "++"},
16-
{left, "++"}]}},
17-
{elvis_style, nesting_level, #{level => 3}},
18-
{elvis_style, god_modules, #{limit => 30}},
19-
{elvis_style, no_if_expression},
20-
{elvis_style, invalid_dynamic_call},
21-
{elvis_style, used_ignored_variable},
22-
{elvis_style, no_behavior_info},
23-
{
24-
elvis_style,
25-
module_naming_convention,
26-
#{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$",
27-
ignore => []}
28-
},
29-
{
30-
elvis_style,
31-
function_naming_convention,
32-
#{regex => "^([a-z][a-z0-9]*_?)*$"}
33-
},
34-
{elvis_style, state_record_and_type},
35-
{elvis_style, no_spec_with_records},
36-
{elvis_style, dont_repeat_yourself, #{min_complexity => 18}},
37-
{elvis_style, no_debug_call}
38-
]
39-
},
40-
#{dirs => ["."],
41-
filter => "Makefile",
42-
rules => [{elvis_project, no_deps_master_erlang_mk},
43-
{elvis_project, protocol_for_deps_erlang_mk, #{regex => "(https://.*|[0-9]+([.][0-9]+)*)"}}]
44-
},
45-
#{dirs => ["."],
46-
filter => "rebar.config",
47-
rules => [{elvis_project, no_deps_master_rebar},
48-
{elvis_project, protocol_for_deps_rebar}]
49-
},
50-
#{dirs => ["."],
51-
filter => "elvis.config",
52-
rules => [{elvis_project, old_configuration_format}]
53-
}
54-
]
55-
}
56-
]
57-
}
58-
].
1+
[{elvis,
2+
[{config,
3+
[#{dirs => ["src", "test"],
4+
filter => "*.erl",
5+
ruleset => erl_files},
6+
#{dirs => ["."],
7+
filter => "rebar.config",
8+
ruleset => rebar_config},
9+
#{dirs => ["."],
10+
filter => "elvis.config",
11+
ruleset => elvis_config}]}]}].

rebar.config

Lines changed: 56 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,56 @@
1-
%% -*- mode: erlang;erlang-indent-level: 2;indent-tabs-mode: nil -*-
2-
%% ex: ts=4 sw=4 ft=erlang et
3-
4-
%% == Erlang Compiler ==
5-
6-
%% Erlang compiler options
7-
{erl_opts, [
8-
warn_unused_vars,
9-
warn_export_all,
10-
warn_shadow_vars,
11-
warn_unused_import,
12-
warn_unused_function,
13-
warn_bif_clash,
14-
warn_unused_record,
15-
warn_deprecated_function,
16-
warn_obsolete_guard,
17-
strict_validation,
18-
warn_export_vars,
19-
warn_exported_vars,
20-
warn_missing_spec,
21-
warn_untyped_record, debug_info
22-
]}.
23-
24-
{profiles, [
25-
{test, [
26-
{deps, [
27-
{xref_runner, "1.0.0"}
28-
]}
29-
]},
30-
{shell, [
31-
{deps, [
32-
{sync, {git, "https://github.com/rustyio/sync.git", {ref, "9c78e7b"}}}
33-
]}
34-
]}
35-
]}.
36-
37-
%% == Common Test ==
38-
39-
%% {erl_opts, [...]}, but for CT runs
40-
{ct_compile_opts, [
41-
warn_unused_vars,
42-
warn_export_all,
43-
warn_shadow_vars,
44-
warn_unused_import,
45-
warn_unused_function,
46-
warn_bif_clash,
47-
warn_unused_record,
48-
warn_deprecated_function,
49-
warn_obsolete_guard,
50-
strict_validation,
51-
warn_export_vars,
52-
warn_exported_vars,
53-
warn_missing_spec,
54-
warn_untyped_record, debug_info
55-
]}.
56-
57-
{ct_opts, []}.
58-
59-
%% == Cover ==
60-
61-
{cover_enabled, true}.
62-
63-
{cover_opts, [verbose]}.
64-
65-
%% == Dependencies ==
66-
67-
{deps, []}.
68-
69-
%% == Dialyzer ==
70-
71-
{dialyzer, [
72-
{warnings, [ unmatched_returns
73-
, error_handling
74-
]},
75-
{get_warnings, true},
76-
{plt_apps, top_level_deps},
77-
{plt_extra_apps, []},
78-
{plt_location, local},
79-
{base_plt_apps, [stdlib, kernel]},
80-
{base_plt_location, global}
81-
]}.
82-
83-
%% == Shell ==
84-
85-
{shell, [{apps, [sync]}]}.
1+
%% == Compiler and Profiles ==
2+
3+
{erl_opts,
4+
[warn_unused_import, warn_export_vars, warnings_as_errors, verbose, report, debug_info]}.
5+
6+
{minimum_otp_vsn, "24"}.
7+
8+
{profiles,
9+
[{test,
10+
[{cover_enabled, true},
11+
{cover_opts, [verbose]},
12+
{ct_opts, [{verbose, true}]},
13+
{dialyzer,
14+
[{warnings, [no_return, unmatched_returns, error_handling, unknown]},
15+
{plt_extra_apps, [syntax_tools]}]}]},
16+
{shell, [{deps, [{sync, "0.4.1"}]}, {apps, [sync]}]}]}.
17+
18+
{alias, [{test, [compile, format, hank, lint, xref, dialyzer, ct, cover, ex_doc]}]}.
19+
20+
%% == Dependencies and plugins ==
21+
22+
{project_plugins,
23+
[{rebar3_hank, "~> 1.4.0"},
24+
{rebar3_hex, "~> 7.0.7"},
25+
{rebar3_format, "~> 1.3.0"},
26+
{rebar3_lint, "~> 3.1.0"},
27+
{rebar3_ex_doc, "~> 0.2.20"}]}.
28+
29+
%% == Documentation ==
30+
31+
{ex_doc,
32+
[{source_url, <<"https://github.com/inaka/zipper">>},
33+
{extras, [<<"README.md">>, <<"LICENSE">>]},
34+
{main, <<"README.md">>},
35+
{prefix_ref_vsn_with_v, false}]}.
36+
37+
{hex, [{doc, #{provider => ex_doc}}]}.
38+
39+
%% == Format ==
40+
41+
{format, [{files, ["*.config", "src/*", "test/*"]}]}.
42+
43+
%% == Hank ==
44+
45+
{hank, [{ignore, [{"test/*.erl", unnecessary_function_arguments}]}]}.
46+
47+
%% == Dialyzer + XRef ==
48+
49+
{dialyzer,
50+
[{warnings, [no_return, unmatched_returns, error_handling, unknown]},
51+
{plt_extra_apps, [syntax_tools]}]}.
52+
53+
{xref_checks,
54+
[undefined_function_calls, deprecated_function_calls, deprecated_functions]}.
55+
56+
{xref_extra_paths, ["test/**"]}.

0 commit comments

Comments
 (0)