diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index e3267d91..2c95aecb 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -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 diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index f2cd5094..1693d29a 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -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.) diff --git a/.github/ISSUE_TEMPLATE/new-rule.md b/.github/ISSUE_TEMPLATE/new-rule.md index 1fb4c96e..3201efea 100644 --- a/.github/ISSUE_TEMPLATE/new-rule.md +++ b/.github/ISSUE_TEMPLATE/new-rule.md @@ -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) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..4d1e94e4 --- /dev/null +++ b/.github/workflows/lint.yml @@ -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 diff --git a/.markdownlint.yml b/.markdownlint.yml new file mode 100644 index 00000000..77ddc062 --- /dev/null +++ b/.markdownlint.yml @@ -0,0 +1,3 @@ +default: true +MD013: + line_length: 100 diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 00000000..d0e5475c --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,5 @@ +extends: default +rules: + line-length: + max: 100 + truthy: disable diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 085fa123..16377bc9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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). diff --git a/LICENSE b/LICENSE index 6f300a5a..48cc4e9d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,5 @@ +# LICENSE + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -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. - diff --git a/README.md b/README.md index 7749e20e..ad039ebf 100644 --- a/README.md +++ b/README.md @@ -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 `:::`: + ```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. ``` + The default value for the `output_format` option is `colors`. diff --git a/RULES.md b/RULES.md index 76d432ca..b759a0c3 100644 --- a/RULES.md +++ b/RULES.md @@ -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) + - [No ](doc_rules/elvis_style/no_dollar_space.md) + - [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) @@ -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 diff --git a/doc_rules/elvis_style/max_module_length.md b/doc_rules/elvis_style/max_module_length.md index 76fcdda0..02875434 100644 --- a/doc_rules/elvis_style/max_module_length.md +++ b/doc_rules/elvis_style/max_module_length.md @@ -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) diff --git a/doc_rules/elvis_style/no_call.md b/doc_rules/elvis_style/no_call.md index 4d1fb3e7..f7ef14f2 100644 --- a/doc_rules/elvis_style/no_call.md +++ b/doc_rules/elvis_style/no_call.md @@ -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! diff --git a/doc_rules/elvis_style/no_common_caveats_call.md b/doc_rules/elvis_style/no_common_caveats_call.md index 3b075e67..2e17db46 100644 --- a/doc_rules/elvis_style/no_common_caveats_call.md +++ b/doc_rules/elvis_style/no_common_caveats_call.md @@ -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 diff --git a/doc_rules/elvis_style/no_dollar_space.md b/doc_rules/elvis_style/no_dollar_space.md index dbd51961..e4927b58 100644 --- a/doc_rules/elvis_style/no_dollar_space.md +++ b/doc_rules/elvis_style/no_dollar_space.md @@ -1,3 +1,4 @@ + # No (since [1.5.0](https://github.com/inaka/elvis_core/releases/tag/1.5.0)) diff --git a/doc_rules/elvis_style/no_successive_maps.md b/doc_rules/elvis_style/no_successive_maps.md index 4755472b..8a2115f5 100644 --- a/doc_rules/elvis_style/no_successive_maps.md +++ b/doc_rules/elvis_style/no_successive_maps.md @@ -2,7 +2,8 @@ (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 @@ -10,7 +11,8 @@ Basically, the warning is emitted if a developer _forgets a comma_ and writes so #{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! diff --git a/doc_rules/elvis_text_style/line_length.md b/doc_rules/elvis_text_style/line_length.md index a0c92de2..ea62a3e3 100644 --- a/doc_rules/elvis_text_style/line_length.md +++ b/doc_rules/elvis_text_style/line_length.md @@ -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