Skip to content

Commit

Permalink
Lint some more (*.md and *.yml) (#257)
Browse files Browse the repository at this point in the history
* Lint some more

* Fix more stuff locally

* Be more consistent
  • Loading branch information
paulo-ferraz-oliveira authored Sep 13, 2022
1 parent 123e95a commit 0ebed61
Show file tree
Hide file tree
Showing 16 changed files with 89 additions and 22 deletions.
11 changes: 8 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,23 @@ assignees: ''
---

## Bug Description

[//]:# (A clear and concise description of what the bug is.)

## To Reproduce

[//]:# (Steps to reproduce the behavior)

## Expected Behavior

[//]:# (A clear and concise description of what you expected to happen.)

## `rebar3` Logs

[//]:# (If applicable, run `rebar3` with `DIAGNOSTIC=1` and attach all the logs to your report.)

## Additional Context
- OS: [e.g. MacOS]
- Erlang version
- rebar3 version

- OS: [e.g. MacOS]
- Erlang version
- rebar3 version
6 changes: 5 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ assignees: ''

---

## Is your feature request related to a problem? Please describe.
## Is your feature request related to a problem? Please describe

[//]:# (A clear and concise description of what the problem is. Ex. I'm always frustrated when [...])

## Describe the solution you'd like

[//]:# (A clear and concise description of what you want to happen.)

## Describe alternatives you've considered

[//]:# (A clear and concise description of any alternative solutions or features you've considered.)

## Additional Context

[//]:# (Add any other context or screenshots about the feature request here.)
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/new-rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ assignees: ''
---

### Name

[//]:# (Choose a name for your rule)

### Brief Description

[//]:# (What will Elvis try to detect?)

### Reasoning

[//]:# (Why is this an example of a bad practice?)

### Refactoring Proposal

[//]:# (If applicable, describe what users should do when Elvis detects this kind of code)
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: lint

on: [push, pull_request]

jobs:
md_and_yml:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# uses .markdownlint.yml for configuration
- name: markdownlint
uses: DavidAnson/markdownlint-cli2-action@v5
with:
globs: |
LICENSE
CONTRIBUTING.md
MIGRATION.md
README.md
RULES.md
doc_rules/**/*.md
.github/ISSUE_TEMPLATE/*.md
- name: yamllint
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: .github/workflows/*.yml
strict: true
config_file: .yamllint.yml
3 changes: 3 additions & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
default: true
MD013:
line_length: 100
5 changes: 5 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extends: default
rules:
line-length:
max: 100
truthy: disable
26 changes: 16 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,32 @@ Before anything else... Thank you for your time and contributions!
## Issues (New Features, Rules & Bug Reports)

If you have a feature or rule you want to see added to Elvis, please create an
[issue](https://github.com/inaka/elvis/issues) before doing any work, so that we can discuss it and figure
out what to do about it.
[issue](https://github.com/inaka/elvis/issues) before doing any work, so that we can discuss it and
figure out what to do about it.

In the case of rules, keep in mind you can always create your [User Defined Rules](https://github.com/inaka/elvis#user-defined-rules), in order to run them locally.
In the case of rules, keep in mind you can always create your
[User Defined Rules](https://github.com/inaka/elvis#user-defined-rules), in order to run them
locally.

When you find a bug in one of Elvis's rules or the way Elvis itself work, please provide detailed steps
that show how to reproduce the problem.
When you find a bug in one of Elvis's rules or the way Elvis itself work, please provide detailed
steps that show how to reproduce the problem.

## Rules

When an issue is already marked with the `rule` label and you are interested in working on it, first check
there is no existing [branch](https://github.com/inaka/elvis/branches) with the issue's number, If so, you
can go ahead and start working on it.
When an issue is already marked with the `rule` label and you are interested in working on it,
first check there is no existing [branch](https://github.com/inaka/elvis/branches) with the
issue's number. If so, you can go ahead and start working on it.

The following is a checklist you can follow when implementing a new Elvis rule:

- [ ] Write both test cases that fail and that pass the rule.
- [ ] Edit [RULES.md](RULES.md), and add a specific file (same name as rule) to folder `doc_rules`.
- [ ] When the issue has the label `default rule`, add the rule to [Default Rules in Elvis Webhook](https://github.com/inaka/elvis/wiki/Default-Rules-in-Elvis-Webhook) and in the [`config/elvis.config`](https://github.com/inaka/elvis/blob/HEAD/config/elvis.config) file.
- [ ] When the issue has the label `default rule`, add the rule to
[Default Rules in Elvis Webhook](https://github.com/inaka/elvis/wiki/Default-Rules-in-Elvis-Webhook)
and in the [`config/elvis.config`](https://github.com/inaka/elvis/blob/HEAD/config/elvis.config)
file.

## 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
[hipchat room](http://inaka.net/hipchat).
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# LICENSE

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down Expand Up @@ -199,4 +201,3 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,14 @@ Option `output_format` allows you to configure the output format. Possible value
`plain` and `parsable`. The latter could be used for automated parsing and has a format very close
to the one presented by `dialyzer`, like `<file>:<line>:<rule>:<message>`:

<!-- markdownlint-disable MD013 -->
```shell
src/example.erl:1:god_modules:This module has too many functions (56). Consider breaking it into a number of modules.
src/example_a.erl:341:no_debug_call:Remove the debug call to io:format/2 on line 341.
src/example_a.erl:511:used_ignored_variable:Ignored variable is being used on line 511 and column 54.
src/example_a.erl:1252:used_ignored_variable:Ignored variable is being used on line 1252 and column 21.
```
<!-- markdownlint-enable MD013 -->

The default value for the `output_format` option is `colors`.

Expand Down
4 changes: 3 additions & 1 deletion RULES.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ identified with `(since ...)` for convenience purposes.
- [No catch expressions](doc_rules/elvis_style/no_catch_expressions.md)
- [No Common Caveats](doc_rules/elvis_style/no_common_caveats_call.md)
- [No debug call](doc_rules/elvis_style/no_debug_call.md)
<!-- markdownlint-disable MD033 -->
- [No <code>&&nbsp;</code>](doc_rules/elvis_style/no_dollar_space.md)
<!-- markdownlint-enable MD033 -->
- [No If Expression](doc_rules/elvis_style/no_if_expression.md)
- [No Macros](doc_rules/elvis_style/no_macros.md)
- [No Nested try...catch Blocks](doc_rules/elvis_style/no_nested_try_catch.md)
Expand Down Expand Up @@ -104,7 +106,7 @@ expected in `elvis.config`'s `rules` option, e.g.:
-elvis([{elvis_style, no_nested_try_catch}]).
```

**Note**: a single attribute with a list of rules is _the same_ as multiple attributes with a list
**Note**: a single attribute with a list of rules is *the same* as multiple attributes with a list
of rules each - the rules are "merged" - as in:

```erlang
Expand Down
3 changes: 2 additions & 1 deletion doc_rules/elvis_style/max_module_length.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ This specifies an upper bound on module file **line** length. Lines that are com
whitespace can be either included or excluded from the line count.

**Notice**: this rule is not enforced by default. Check the
[example `elvis.config` file](#example-elvisconfig) below to see how you can enforce it.
[example `elvis.config` file](../../README.md#configuration) to see how you can
enforce it.

> Works on `.beam` file? Not really! (it consumes results Ok, but these might be unexpected, since
the files are pre-processed)
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 @@ -9,7 +9,7 @@ to avoid (especially calls to third party libraries, where you can't just deprec
functions).

**Notice**: this rule is not enforced by default. Check the
[example `elvis.config` file](#example-elvisconfig) below to see how you can enforce it.
[example `elvis.config` file](../../README.md#configuration) to see how you can enforce it.

> Works on `.beam` file? Yes!
Expand Down
2 changes: 1 addition & 1 deletion doc_rules/elvis_style/no_common_caveats_call.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ alternatives.
]`.

**Notice**: this rule is not enforced by default. Check the
[example `elvis.config` file](#example-elvisconfig) below to see how you can enforce it.
[example `elvis.config` file](../../README.md#configuration) to see how you can enforce it.

## Example

Expand Down
1 change: 1 addition & 0 deletions doc_rules/elvis_style/no_dollar_space.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- markdownlint-disable MD033 -->
# No <code>&&nbsp;</code>

(since [1.5.0](https://github.com/inaka/elvis_core/releases/tag/1.5.0))
Expand Down
6 changes: 4 additions & 2 deletions doc_rules/elvis_style/no_successive_maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

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

The idea behind this rule comes from [this email](http://erlang.org/pipermail/erlang-questions/2017-April/092112.html) by @kvakvs.
The idea behind this rule comes from
[this email](http://erlang.org/pipermail/erlang-questions/2017-April/092112.html) by @kvakvs.
Basically, the warning is emitted if a developer _forgets a comma_ and writes something like the following:

```erlang
[#{a => 1}
#{b => 2}]
```

It will also warn on things like ``#{a =>1}#{b => 2}``, which is easily rewritable as ``#{a => 1, b => 2}``.
It will also warn on things like ``#{a =>1}#{b => 2}``, which is easily rewritable as
``#{a => 1, b => 2}``.

> Works on `.beam` file? Yes!
Expand Down
2 changes: 1 addition & 1 deletion doc_rules/elvis_text_style/line_length.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ No line should be longer than a given limit. Comments can be skipped.
- default: `false`, means _emit a warning for every line that goes over `Limit`_
- `any` means _don't emit a warning if the part of the line that goes over `Limit` belongs to a
comment_
- `whole_line` means _don't emit a warning if the line that goes over `Limit` is *just* a comment_
- `whole_line` means _don't emit a warning if the line that goes over `Limit` is __just__ a comment_

## Example

Expand Down

0 comments on commit 0ebed61

Please sign in to comment.