Skip to content

Commit

Permalink
Merge branch 'main' into fix/max-function-length
Browse files Browse the repository at this point in the history
  • Loading branch information
elbrujohalcon authored Oct 1, 2024
2 parents 590a507 + d1f2eaf commit 86f9a13
Show file tree
Hide file tree
Showing 44 changed files with 687 additions and 81 deletions.
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Description

A brief description of your changes.

Closes #<issue>.

- [ ] I have read and understood the [contributing guidelines](/inaka/elvis_core/blob/main/CONTRIBUTING.md)
10 changes: 4 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ jobs:
runs-on: ${{matrix.os}}
strategy:
matrix:
otp_vsn: ['24', '25', '26', '27']
rebar3_vsn: ['3.23']
os: [ubuntu-22.04, windows-2022]
otp_vsn: ['25', '26', '27']
rebar3_vsn: ['3.24']
os: [ubuntu-24.04, windows-2022]
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
Expand All @@ -42,10 +42,8 @@ jobs:
-otp-${{steps.setup-beam.outputs.otp-version}}\
-rebar3-${{steps.setup-beam.outputs.rebar3-version}}\
-hash-${{hashFiles('rebar.lock')}}"
- name: Compile
run: rebar3 compile
- name: Format check
if: ${{ matrix.os == 'ubuntu-22.04' && matrix.otp_vsn == '26' }}
if: ${{ matrix.os == 'ubuntu-24.04' && matrix.otp_vsn == '26' }}
run: rebar3 format --verify
- name: Run test
run: rebar3 test
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ on:

jobs:
md_and_yml:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4

# uses .markdownlint.yml for configuration
- name: markdownlint
uses: DavidAnson/markdownlint-cli2-action@v16
uses: DavidAnson/markdownlint-cli2-action@v17
with:
globs: |
LICENSE
Expand Down
2 changes: 2 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
default: true
MD013:
line_length: 100
MD024:
siblings_only: true
128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
<[email protected]> or <[email protected]>.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: <https://www.contributor-covenant.org>

For answers to common questions about this code of conduct, see the FAQ at
<https://www.contributor-covenant.org/faq>. Translations are available at
<https://www.contributor-covenant.org/translations>.
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ The following is a checklist you can follow when implementing a new Elvis rule:
and in the [`config/elvis.config`](https://github.com/inaka/elvis/blob/HEAD/config/elvis.config)
file.

## Development

CI for `elvis_core` is pretty simple, but in case you want to replicate it locally before
pushing most issues will be found via `rebar3 do format --verify, test`.

## Questions?

If you have any questions or general comments regarding how to contribute, please use our public
Expand Down
23 changes: 23 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,29 @@ since these are incremental.
This file's format is influenced by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and
[Make a README](https://www.makeareadme.com/).

## Going from `3.x` to `4.x`

### Update

- your `atom_naming_convention`'s options to be the ones defined at
<https://github.com/inaka/elvis_core/blob/3.2.5/doc_rules/elvis_style/atom_naming_convention.md#options>
- your `macro_names`' options to be the ones defined at
<https://github.com/inaka/elvis_core/blob/3.2.5/doc_rules/elvis_style/macro_names.md#options>
- your `operator_spaces` options to be the ones defined at
<https://github.com/inaka/elvis_core/blob/3.2.5/doc_rules/elvis_style/operator_spaces.md#options>
- your `no_space` options to be the ones defined at
<https://github.com/inaka/elvis_core/blob/3.2.5/doc_rules/elvis_style/no_space.md#options>
- your `function_naming_convention` options to be the ones defined at
<https://github.com/inaka/elvis_core/blob/3.2.5/doc_rules/elvis_style/function_naming_convention.md#options>
- your `module_naming_convention` options to be the ones defined at
<https://github.com/inaka/elvis_core/blob/3.2.5/doc_rules/elvis_style/module_naming_convention.md#options>
- your `no_debug_call` options to be the ones defined at
<https://github.com/inaka/elvis_core/blob/3.2.5/doc_rules/elvis_style/no_debug_call.md#options>
- your `no_common_caveats_call` options to be the ones defined at
<https://github.com/inaka/elvis_core/blob/3.2.5/doc_rules/elvis_style/no_common_caveats_call.md#options>

On the other hand you may choose to not implement those changes and merely adapt your code.

## Going from `0.x` to `1.x`

### Update
Expand Down
10 changes: 10 additions & 0 deletions RULES.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ identified with `(since ...)` for convenience purposes.
- [State Record and Type](doc_rules/elvis_style/state_record_and_type.md)
- [Used Ignored Variable](doc_rules/elvis_style/used_ignored_variable.md)
- [Variable Naming Convention](doc_rules/elvis_style/variable_naming_convention.md)
- [Prefer Unquoted Atoms](doc_rules/elvis_text_style/prefer_unquoted_atoms.md)

## `.gitignore` rules

- [`.gitignore` required patterns](doc_rules/elvis_gitignore/required_patterns.md)
- [`.gitignore` forbidden patterns](doc_rules/elvis_gitignore/forbidden_patterns.md)

## Project rules

Expand All @@ -84,6 +90,7 @@ The six pre-defined rulesets are:
- `elvis_config`, for elvis configuration files.
- `erl_files`, for Erlang source files (pre-defined rule set).
- `erl_files_strict`, for Erlang source files (all available rules).
- `gitignore`, for `.gitignore` files.
- `hrl_files`, for Erlang header files.
- `makefiles`, for Makefiles.
- `rebar_config`, for rebar configuration files.
Expand Down Expand Up @@ -201,6 +208,9 @@ line numbers will most surely not correspond with those in the source file.
, filter => "elvis.config"
, ruleset => elvis_config
, rules => [] }
, #{ dirs => ["."]
, filter => ".gitignore"
, ruleset => gitignore }
]}
, {verbose, true}
]}].
Expand Down
34 changes: 34 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Security policy

Thanks for helping make `elvis_core` safer for everyone.

Find below updated information on our security policy.

## Security

We take the security of this software seriously.

We don't implement a bug bounty program or bounty rewards, but will work with
you to ensure that your findings get the appropriate handling.

## Reporting Security Issues

If you believe you have found a security vulnerability in this repository,
please report it to <[email protected]> or <[email protected]>.

Please do not report security vulnerabilities through public channels, like
GitHub issues, discussions, or pull requests.

Please include as much of the information listed below as you can to help us
better understand and resolve the issue:

- the type of issue (e.g., buffer overflow, SQL injection, or cross-site
scripting)
- full paths of source file(s) related to the manifestation of the issue
- the location of the affected source code (tag/branch/commit or direct URL)
- any special configuration required to reproduce the issue
- step-by-step instructions to reproduce the issue
- proof-of-concept or exploit code (if possible)
- impact of the issue, including how an attacker might exploit the issue

This information will help us triage your report more quickly.
7 changes: 6 additions & 1 deletion config/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,10 @@
ruleset => rebar_config},
#{dirs => ["../../_build/test/lib/elvis_core/test/examples"],
filter => "elvis.config",
ruleset => elvis_config}]},
ruleset => elvis_config},
#{dirs =>
["../../_build/test/lib/elvis_core/test/dirs/apps/app1",
"../../_build/test/lib/elvis_core/test/dirs/apps/app2"],
filter => ".gitignore",
ruleset => gitignore}]},
{output_format, plain}]}].
16 changes: 16 additions & 0 deletions doc_rules/elvis_gitignore/forbidden_patterns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# `.gitignore` forbidden patterns

(since [4.0.0](https://github.com/inaka/elvis_core/releases/tag/4.0.0))

Exclude, from the project's `.gitignore` file, the patterns identified by the rule.

## Options

- `regexes :: [string()]`.
- default: `["^rebar.lock$"]`.

## Example

```erlang
{elvis_gitignore, forbidden_patterns, #{}}
```
22 changes: 22 additions & 0 deletions doc_rules/elvis_gitignore/required_patterns.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# `.gitignore` required patterns

(since [4.0.0](https://github.com/inaka/elvis_core/releases/tag/4.0.0))

Include, in the project's `.gitignore` file, the patterns identified by the rule.

## Options

- `regexes :: [string()]`.
- default: `["^.rebar3/$",
"^_build/$",
"^_checkouts/$",
"^doc/$",
"^/erl_crash.dump$",
"^/rebar3.crashdump$",
"^test/logs/$"]`.

## Example

```erlang
{elvis_gitignore, required_patterns, #{}}
```
2 changes: 1 addition & 1 deletion doc_rules/elvis_style/function_naming_convention.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ All functions should be named according to the regular expression provided.
## Options

- `regex :: string()`.
- default: `"^([a-z][a-z0-9]*_?)*(_SUITE)?$"`.
- default: `"^[a-z](_?[a-z0-9]+)*$"`.

## Example

Expand Down
2 changes: 1 addition & 1 deletion doc_rules/elvis_style/macro_names.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Macro names should only contain upper-case alphanumeric characters.
## Options

- `regex :: string()`. (since [1.0.0](https://github.com/inaka/elvis_core/releases/tag/1.0.0))
- default: `"^([A-Z][A-Z_0-9]+)$"`.
- default: `"^[A-Z](_?[A-Z0-9]+)*$"`.

## Example

Expand Down
2 changes: 1 addition & 1 deletion doc_rules/elvis_style/module_naming_convention.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ All modules should be named according to the regular expression provided.
## Options

- `regex :: string()`.
- default: `"^([a-z][a-z0-9]*_?)*(_SUITE)?$"`.
- default: `"^[a-z](_?[a-z0-9]+)*(_SUITE)?$"`.

## Example

Expand Down
2 changes: 1 addition & 1 deletion doc_rules/elvis_style/no_call.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
(since [0.4.0](https://github.com/inaka/elvis_core/releases/tag/0.4.0))

This rule raise a warning when certain functions are called. It is also used internally to implement
`no_debug_call` and `no_common_caveats` but, on its own, makes no checks on your code (the default
`no_debug_call` and `no_common_caveats_call` but, on its own, makes no checks on your code (the default
`no_call_functions` list is empty). However, it is a convenient place to add your own list of calls
to avoid (especially calls to third party libraries, where you can't just deprecate undesired
functions).
Expand Down
Loading

0 comments on commit 86f9a13

Please sign in to comment.