From 8caec686dcd695b99faaa5dc761af2ddf86729ef Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Sat, 1 Jul 2023 02:29:06 +0100 Subject: [PATCH 01/10] Remove default erl_opts and fix strict_validation It's actually strong_validation We'd seen this already with https://github.com/2Latinos/nuntius/pull/6#discussion_r841968524 --- rebar.config | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/rebar.config b/rebar.config index f8b43479..68a91f68 100644 --- a/rebar.config +++ b/rebar.config @@ -5,21 +5,11 @@ %% 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, + [debug_info, + strong_validation, warn_export_vars, - warn_exported_vars, warn_missing_spec, - warn_untyped_record, - debug_info, + warn_unused_import, {feature, maybe_expr, enable}]}. {profiles, From 9d026d1d480a962f8e91cc3afb569656feaaa910 Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Sat, 1 Jul 2023 02:29:54 +0100 Subject: [PATCH 02/10] Don't force features on consumers --- .github/workflows/ci.yml | 8 -------- rebar.config | 7 +------ test/examples/fail_used_ignored_variable.erl | 2 ++ 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c6ca79d..40a9bc02 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,21 +41,13 @@ jobs: -rebar3-${{steps.setup-beam.outputs.rebar3-version}}\ -hash-${{hashFiles('rebar.lock')}}" - name: Compile - env: - ERL_FLAGS: "-enable-feature all" run: rebar3 compile - name: Format check if: ${{ matrix.os == 'ubuntu-20.04' }} - env: - ERL_FLAGS: "-enable-feature all" run: rebar3 format --verify - name: Run test - env: - ERL_FLAGS: "-enable-feature all" run: rebar3 test - name: Run elvis on elvis - env: - ERL_FLAGS: "-enable-feature all" run: | rebar3 escriptize _build/default/bin/elvis_core diff --git a/rebar.config b/rebar.config index 68a91f68..2fc3c149 100644 --- a/rebar.config +++ b/rebar.config @@ -5,12 +5,7 @@ %% Erlang compiler options {erl_opts, - [debug_info, - strong_validation, - warn_export_vars, - warn_missing_spec, - warn_unused_import, - {feature, maybe_expr, enable}]}. + [debug_info, strong_validation, warn_export_vars, warn_missing_spec, warn_unused_import]}. {profiles, [{test, diff --git a/test/examples/fail_used_ignored_variable.erl b/test/examples/fail_used_ignored_variable.erl index f7b30771..c8c0c81d 100644 --- a/test/examples/fail_used_ignored_variable.erl +++ b/test/examples/fail_used_ignored_variable.erl @@ -10,6 +10,8 @@ -if(?OTP_RELEASE >= 25). +-feature(maybe_expr, enable). + -export([no_used_ignored_vars_in_maybe/2]). no_used_ignored_vars_in_maybe(One, _Two) -> From 8e2de59320570829ca1a20a01c3208801be31ff3 Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Sat, 1 Jul 2023 02:30:19 +0100 Subject: [PATCH 03/10] Fix a spec. (as per rebar3_lint consumption issues) --- src/elvis_core.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/elvis_core.erl b/src/elvis_core.erl index f2937620..85876fe5 100644 --- a/src/elvis_core.erl +++ b/src/elvis_core.erl @@ -83,7 +83,8 @@ rock_this(Path, Config) -> %% @private -spec do_parallel_rock(elvis_config:config()) -> - ok | {fail, [elvis_result:file() | elvis_result:rule()]}. + ok | + {fail, [{throw, term()} | elvis_result:file() | elvis_result:rule()]}. do_parallel_rock(Config0) -> Parallel = elvis_config:from_application_or_config(parallel, 1), Config = elvis_config:resolve_files(Config0), From 9e7fe06152bff3ba77ae475f660471202e874d8e Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Sat, 1 Jul 2023 02:38:33 +0100 Subject: [PATCH 04/10] Don't force CI to move forward This is a developer choice If my calculations are correct, since OTP 26 came out on May 16 and rebar3 3.21.0 is May 18, the last version to support 23+ should be 3.20, as proposed --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40a9bc02..c166bfa3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: id: setup-beam with: otp-version: ${{matrix.otp_vsn}} - rebar3-version: '3' + rebar3-version: '3.20' - name: Restore _build uses: actions/cache@v3 with: From 818f8801889d1d4e414beec2391d03e0dc8422d3 Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Sat, 1 Jul 2023 02:51:27 +0100 Subject: [PATCH 05/10] Adapt as per CI --- test/examples/fail_used_ignored_variable.erl | 8 ++++++-- test/style_SUITE.erl | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/examples/fail_used_ignored_variable.erl b/test/examples/fail_used_ignored_variable.erl index c8c0c81d..d5dabb0a 100644 --- a/test/examples/fail_used_ignored_variable.erl +++ b/test/examples/fail_used_ignored_variable.erl @@ -1,5 +1,11 @@ -module(fail_used_ignored_variable). +-if(?OTP_RELEASE >= 25). + +-feature(maybe_expr, enable). + +-endif. + -export([ use_ignored_var/2 , use_ignored_var_in_fun/2 , no_used_ignored_vars_here/2, handle_call/3 @@ -10,8 +16,6 @@ -if(?OTP_RELEASE >= 25). --feature(maybe_expr, enable). - -export([no_used_ignored_vars_in_maybe/2]). no_used_ignored_vars_in_maybe(One, _Two) -> diff --git a/test/style_SUITE.erl b/test/style_SUITE.erl index e89b3021..d93ebd6f 100644 --- a/test/style_SUITE.erl +++ b/test/style_SUITE.erl @@ -629,7 +629,7 @@ verify_used_ignored_variable(Config) -> [#{line_num := _}, #{line_num := _}, #{line_num := _}, #{line_num := _}] = elvis_core_apply_rule(Config, elvis_style, used_ignored_variable, #{}, Path); erl_files -> - [#{line_num := 25}, #{line_num := 28}, #{line_num := 32}, #{line_num := 32}] = + [#{line_num := 31}, #{line_num := 34}, #{line_num := 38}, #{line_num := 38}] = elvis_core_apply_rule(Config, elvis_style, used_ignored_variable, #{}, Path) end, [] = From 415de692d0c2e78d0c4e459b4fd573d6aee9bd85 Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Sat, 1 Jul 2023 03:12:20 +0100 Subject: [PATCH 06/10] Reverse fix for strong_validation It makes rebar3 ct execute 0 tests It makes rebar3 escriptize generate an invalid escript ... at least --- rebar.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rebar.config b/rebar.config index 2fc3c149..bf36ef59 100644 --- a/rebar.config +++ b/rebar.config @@ -5,7 +5,7 @@ %% Erlang compiler options {erl_opts, - [debug_info, strong_validation, warn_export_vars, warn_missing_spec, warn_unused_import]}. + [debug_info, warn_export_vars, warn_missing_spec, warn_unused_import]}. {profiles, [{test, From 55c6605760707d801321bb0c88028ffd2253c947 Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Sat, 1 Jul 2023 03:15:22 +0100 Subject: [PATCH 07/10] Act on CI results --- rebar.config | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rebar.config b/rebar.config index bf36ef59..0997f581 100644 --- a/rebar.config +++ b/rebar.config @@ -4,8 +4,7 @@ %% == Erlang Compiler == %% Erlang compiler options -{erl_opts, - [debug_info, warn_export_vars, warn_missing_spec, warn_unused_import]}. +{erl_opts, [debug_info, warn_export_vars, warn_missing_spec, warn_unused_import]}. {profiles, [{test, From 0fe0f6dc312b61edd8716ad4d2010f2fd614b6ca Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Sat, 1 Jul 2023 03:17:06 +0100 Subject: [PATCH 08/10] Be more condensed --- .github/workflows/lint.yml | 11 +++++------ .markdownlint.yml | 1 + .yamllint.yml | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 4d1e94e4..0c7ecd0c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,16 +16,15 @@ jobs: with: globs: | LICENSE - CONTRIBUTING.md - MIGRATION.md - README.md - RULES.md + *.md doc_rules/**/*.md - .github/ISSUE_TEMPLATE/*.md + .github/**/*.md - name: yamllint uses: ibiqlik/action-yamllint@v3 with: - file_or_dir: .github/workflows/*.yml + file_or_dir: | + .github/**/*.yml + .*.yml strict: true config_file: .yamllint.yml diff --git a/.markdownlint.yml b/.markdownlint.yml index 77ddc062..90b8143a 100644 --- a/.markdownlint.yml +++ b/.markdownlint.yml @@ -1,3 +1,4 @@ +--- default: true MD013: line_length: 100 diff --git a/.yamllint.yml b/.yamllint.yml index d0e5475c..26633db0 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -1,3 +1,4 @@ +--- extends: default rules: line-length: From b35289706dbf83a8d08c784eebdc17931dd0f6a6 Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Sat, 1 Jul 2023 03:19:48 +0100 Subject: [PATCH 09/10] Act on CI --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 773fbfaa..0e9709f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ + # Changelog +For more recent releases check the [Releases](../../releases) page. + ## [1.3.1](https://github.com/inaka/elvis_core/tree/1.3.1) (2021-10-18) [Full Changelog](https://github.com/inaka/elvis_core/compare/1.3.0...1.3.1) @@ -436,6 +439,4 @@ - Copy in the elvis files [\#2](https://github.com/inaka/elvis_core/pull/2) ([Licenser](https://github.com/Licenser)) - Update LICENSE [\#1](https://github.com/inaka/elvis_core/pull/1) ([elbrujohalcon](https://github.com/elbrujohalcon)) - - \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* From ccf2cd109a42be195a25a2a28945251effe0eac8 Mon Sep 17 00:00:00 2001 From: "Paulo F. Oliveira" Date: Mon, 3 Jul 2023 12:16:12 +0100 Subject: [PATCH 10/10] Bump katana to prevent enabling feature maybe_expr --- rebar.config | 2 +- rebar.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rebar.config b/rebar.config index 0997f581..7edcc8c8 100644 --- a/rebar.config +++ b/rebar.config @@ -23,7 +23,7 @@ %% == Dependencies == -{deps, [{zipper, "1.0.1"}, {katana_code, "~> 2.0.1"}]}. +{deps, [{zipper, "1.0.1"}, {katana_code, "~> 2.0.2"}]}. %% == Dialyzer == diff --git a/rebar.lock b/rebar.lock index 1b01df08..0333726e 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,11 +1,11 @@ {"1.2.0", -[{<<"katana_code">>,{pkg,<<"katana_code">>,<<"2.0.1">>},0}, +[{<<"katana_code">>,{pkg,<<"katana_code">>,<<"2.0.2">>},0}, {<<"zipper">>,{pkg,<<"zipper">>,<<"1.0.1">>},0}]}. [ {pkg_hash,[ - {<<"katana_code">>, <<"E29D82DBCF410FD29665B3FD2C9D9C445F1E8FAC4B01488294ECAA84CCB8400C">>}, + {<<"katana_code">>, <<"FAC8F2ABFB2ED54304EE44EEEEC30275BD026550533D094265A51927D7D9470D">>}, {<<"zipper">>, <<"3CCB4F14B97C06B2749B93D8B6C204A1ECB6FAFC6050CACC3B93B9870C05952A">>}]}, {pkg_hash_ext,[ - {<<"katana_code">>, <<"D02F757C8DDE643614D508474A97FC24D9015FE375477E34DE26450BF21CAC16">>}, + {<<"katana_code">>, <<"3E57FED635E0B16A5FBDACCDC872EC53DEB21ED9FC6E7EB9B6415FF199B7B138">>}, {<<"zipper">>, <<"6A1FD3E1F0CC1D1DF5642C9A0CE2178036411B0A5C9642851D1DA276BD737C2D">>}]} ].