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

Maintenance updates #573

Merged
merged 23 commits into from
Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
bebcbc6
Preemptively accept format results
paulo-ferraz-oliveira Aug 4, 2023
cc4e764
Kill it with fire
paulo-ferraz-oliveira Aug 4, 2023
94ec896
Dialyzer it
paulo-ferraz-oliveira Aug 4, 2023
d9d6a88
Handle error
paulo-ferraz-oliveira Aug 5, 2023
2cbe5eb
Accept elvis_core's change
paulo-ferraz-oliveira Aug 5, 2023
5a340ee
Adapt to recent elvis_core changes
paulo-ferraz-oliveira Aug 5, 2023
1d34489
Validate rebar3_ex_doc results
paulo-ferraz-oliveira Aug 6, 2023
edb770f
Fix as per `rebar3 as test test` results
paulo-ferraz-oliveira Aug 6, 2023
7896a1e
Ease maintenance of .gitignore
paulo-ferraz-oliveira Aug 6, 2023
d606bb9
Update go-to place for discussion
paulo-ferraz-oliveira Aug 7, 2023
3059cb0
Move http:// to https://
paulo-ferraz-oliveira Aug 7, 2023
a8013cd
Accept further format results
paulo-ferraz-oliveira Aug 7, 2023
c177f62
Lint README.md and adapt it to ex_doc
paulo-ferraz-oliveira Aug 7, 2023
86d300f
Ease pre-pull request fork CI
paulo-ferraz-oliveira Aug 7, 2023
86d4143
Tweak ci.yml
paulo-ferraz-oliveira Aug 7, 2023
78aa207
Tweak rebar.config
paulo-ferraz-oliveira Aug 7, 2023
345ac83
Move meta CT suites to GitHub CI
paulo-ferraz-oliveira Aug 7, 2023
9e59629
Try with out-of-the-box git
paulo-ferraz-oliveira Aug 7, 2023
af885ca
Act on self-review: make for faster CI by caching _build and ~/.cache…
paulo-ferraz-oliveira Aug 7, 2023
1f322ff
Act on self-review: generate a proper link
paulo-ferraz-oliveira Aug 7, 2023
9c3ee12
Act on review result: remove meaningless test
paulo-ferraz-oliveira Aug 8, 2023
be744d8
Act on review result: make for more readable code in a simple case
paulo-ferraz-oliveira Aug 8, 2023
4f957d8
Act on review result: make for more readable code in a simple case
paulo-ferraz-oliveira Aug 8, 2023
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
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
elbrujohalcon marked this conversation as resolved.
Show resolved Hide resolved
- 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
elbrujohalcon marked this conversation as resolved.
Show resolved Hide resolved
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).
elbrujohalcon marked this conversation as resolved.
Show resolved Hide resolved
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/
elbrujohalcon marked this conversation as resolved.
Show resolved Hide resolved
[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