Skip to content

Commit

Permalink
Merge pull request #573 from paulo-ferraz-oliveira/feature/minor-main…
Browse files Browse the repository at this point in the history
…tenance-updates

Maintenance updates
  • Loading branch information
elbrujohalcon committed Aug 8, 2023
2 parents e07bd78 + 4f957d8 commit 39f27fe
Show file tree
Hide file tree
Showing 20 changed files with 471 additions and 1,035 deletions.
58 changes: 29 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
---
name: build
on:
push:
branches:
- master
pull_request:
branches:
- master
on: [push, pull_request]
jobs:
ci:
name: Run checks and tests over ${{matrix.otp_vsn}} and ${{matrix.os}}
runs-on: ${{matrix.os}}
name: Run checks and tests over ${{matrix.otp_vsn}}
runs-on: ubuntu-22.04
strategy:
matrix:
otp_vsn: [23, 24, 25]
os: [ubuntu-20.04]
otp_vsn: ['24', '25', '26']
rebar3_vsn: ['3.22']
steps:
- name: Install Git 2.18
shell: bash
run: |
sudo apt-get update
sudo apt-get -y install tcl tcl-dev gettext libcurl4-openssl-dev
cd /usr/src/
sudo wget https://github.com/git/git/archive/v2.18.0.tar.gz -O git.tar.gz
sudo tar -xf git.tar.gz
cd git-*
sudo make prefix=/usr/local all
sudo make prefix=/usr/local install
cd $HOME
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
id: setup-beam
with:
otp-version: ${{matrix.otp_vsn}}
rebar3-version: '3.20'
- shell: bash
run: rebar3 dialyzer
- shell: bash
run: rebar3 ct --suite=git_SUITE
rebar3-version: ${{matrix.rebar3_vsn}}
- name: Restore _build
uses: actions/cache@v3
with:
path: _build
key: "_build-cache-for\
-os-${{runner.os}}\
-otp-${{steps.setup-beam.outputs.otp-version}}\
-rebar3-${{steps.setup-beam.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- name: Restore rebar3's cache
uses: actions/cache@v3
with:
path: ~/.cache/rebar3
key: "rebar3-cache-for\
-os-${{runner.os}}\
-otp-${{steps.setup-beam.outputs.otp-version}}\
-rebar3-${{steps.setup-beam.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- name: Format check
run: rebar3 format --verify
- shell: bash
run: rebar3 cover
run: rebar3 test
- shell: bash
run: rebar3 escriptize && _build/default/bin/elvis rock
- shell: bash
run: rebar3 as test test
18 changes: 4 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
_build/
.erlang.mk/
elvis_shell.d
.eunit
.rebar
deps
ebin
*.o
*.beam
*.plt
_*
erl_crash.dump
log*/
.erlang.mk.packages.*
rebar3.crashdump
doc
compile_commands.json
.rebar3
doc/
logs

# Ignore elvis escript
elvis
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ The following is a checklist you can follow when implementing a new Elvis rule:

## Questions?

If you have any questions or general comments regarding how to contribute, please use our public [hipchat room](http://inaka.net/hipchat).
If you have any questions or general comments regarding how to contribute, please use our public
Erlanger Slack channel: [#elvis](https://erlanger.slack.com/archives/C01073W0E15).
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
https://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

Expand Down Expand Up @@ -192,7 +192,7 @@ Apache License
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# elvis [![Build Status](https://github.com/inaka/elvis/workflows/build/badge.svg)](https://github.com/inaka/elvis)

![Elvis Presley dancing](http://www.reactiongifs.com/wp-content/uploads/2013/01/elvis-dance.gif)
![Elvis Presley dancing](https://www.reactiongifs.com/wp-content/uploads/2013/01/elvis-dance.gif)

Command-line interface for Elvis, the Erlang style reviewer.

Expand Down Expand Up @@ -61,7 +61,7 @@ added to `elvis`'s [configuration](#configuration) and also the credentials used
must be from an admin of the repo or someone with permissions for requesting changes
on PRs.

The `webhook/1` function takes a map containing the keys `headers` and `body`,
The `elvis_webhook:event/1` function takes a map containing the keys `headers` and `body`,
whose values should be the map of headers and the body from the GitHub's event
request.

Expand Down Expand Up @@ -165,8 +165,7 @@ You can use four different rulesets `erl_files`, `makefiles`, `rebar_config` or

## Implemented Rules

A reference of all rules implemented in Elvis can be found in this wiki page:
[Rules](https://github.com/inaka/elvis_core/wiki/Rules).
A reference of all rules implemented in Elvis can be found in this `elvis_core`'s [RULES.md](https://github.com/inaka/elvis_core/blob/main/RULES.md).

## User Defined Rules

Expand All @@ -184,17 +183,14 @@ elvis rock -p deps/elvis_rules/ebin -c elvis.config

## Dependencies

- Erlang/OTP 18+
- Erlang/OTP 24+
- git

## References

Inspired on [HoundCI][houndci]

[houndci]: https://houndci.com/
[erlang]: http://www.erlang.org/download_release/24
[make]: http://www.gnu.org/software/make/
[git]: http://git-scm.com/
[pre-commit]: http://git-scm.com/book/en/Customizing-Git-Git-Hooks#Client-Side-Hooks
[config]: http://www.erlang.org/doc/man/config.html
[pre-commit]: https://git-scm.com/book/en/Customizing-Git-Git-Hooks#Client-Side-Hooks
[config]: https://www.erlang.org/doc/man/config.html
[webhooks]: https://developer.github.com/v3/repos/hooks/
33 changes: 11 additions & 22 deletions elvis.config
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
[
{
elvis,
[
{config,
[#{dirs => ["src", "test"],
filter => "*.erl",
ruleset => erl_files
},
#{dirs => ["."],
filter => "rebar.config",
ruleset => rebar_config
},
#{dirs => ["."],
filter => "elvis.config",
ruleset => elvis_config
}
]
}
]
}
].
[{elvis,
[{config,
[#{dirs => ["src", "test"],
filter => "*.erl",
ruleset => erl_files},
#{dirs => ["."],
filter => "rebar.config",
ruleset => rebar_config},
#{dirs => ["."],
filter => "elvis.config",
ruleset => elvis_config}]}]}].
135 changes: 54 additions & 81 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,84 +1,57 @@
%% -*- mode: erlang;erlang-indent-level: 2;indent-tabs-mode: nil -*-
%% ex: ts=4 sw=4 ft=erlang et

%% == Erlang Compiler ==

%% Erlang compiler options
{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]}.

{project_plugins, [rebar3_hex]}.

{profiles, [
{test, [
{extra_src_dirs, [{"test/examples", [{recursive, true}]}]},
{deps, [ {mixer, "1.2.0", {pkg, inaka_mixer}}
, {meck, "0.9.2"}
, {xref_runner, "1.2.0"}
]}
]}
]}.

%% == 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, ["./config/test.config"]}
, {logdir, "./logs"}
, {verbose, true}
]}.

%% == Cover ==

{cover_enabled, true}.

{cover_opts, [verbose]}.

%% == Dependencies ==

{deps, [ {elvis_core, "3.0.1"}
, {getopt, "1.0.2"}
, {egithub, "0.7.0"}
]}.

%% == Dialyzer ==

{dialyzer, [ {warnings, [ no_return
, unmatched_returns
, error_handling
]}
, {plt_apps, top_level_deps}
, {plt_extra_apps, []}
, {plt_location, local}
, {base_plt_apps, [stdlib, kernel]}
, {base_plt_location, global}]}.
%% == Compiler and Profiles ==

{erl_opts,
[warn_unused_import, warn_export_vars, warnings_as_errors, verbose, report, debug_info]}.

{minimum_otp_vsn, "23"}.

{profiles,
[{test,
[{extra_src_dirs, [{"test/examples", [{recursive, true}]}]},
{deps, [{mixer, "1.2.0", {pkg, inaka_mixer}}, {meck, "0.9.2"}]},
{ct_opts, [{sys_config, ["./config/test.config"]}, {logdir, "./logs"}, {verbose, true}]},
{cover_enabled, true},
{cover_opts, [verbose]},
{dialyzer,
[{warnings, [no_return, unmatched_returns, error_handling, underspecs, unknown]},
{plt_extra_apps, [meck, dialyzer, common_test, compiler]}]}]}]}.

{alias, [{test, [compile, format, hank, xref, dialyzer, ct, cover, ex_doc]}]}.

{escript_main_app, elvis}.

{escript_name, "elvis"}.

%% == Dependencies and plugins ==

{deps, [{elvis_core, "3.1.0"}, {getopt, "1.0.2"}, {egithub, "0.7.0"}]}.

{project_plugins,
[{rebar3_hank, "~> 1.4.0"},
{rebar3_hex, "~> 7.0.7"},
{rebar3_format, "~> 1.3.0"},
{rebar3_ex_doc, "0.2.18"}]}.

%% == Documentation ==

{ex_doc,
[{source_url, <<"https://github.com/inaka/elvis">>},
{extras, [<<"README.md">>, <<"LICENSE">>]},
{main, <<"README.md">>},
{prefix_ref_vsn_with_v, false}]}.

{hex, [{doc, #{provider => ex_doc}}]}.

%% == Format ==

{format, [{files, ["*.config", "src/*", "test/**/*{.erl,.coverspec,.js,.fail}"]}]}.

%% == Dialyzer + XRef ==

{dialyzer,
[{warnings, [no_return, unmatched_returns, error_handling, underspecs, unknown]}]}.

{xref_checks,
[undefined_function_calls, deprecated_function_calls, deprecated_functions]}.

{xref_extra_paths, ["test/**"]}.
Loading

0 comments on commit 39f27fe

Please sign in to comment.