Skip to content

Commit

Permalink
Update CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
René Föhring committed Mar 14, 2020
1 parent abaff63 commit 7d656c3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 44 deletions.
89 changes: 47 additions & 42 deletions CHANGELOG.md
@@ -1,5 +1,10 @@
# Changelog

## 1.3.1

- Fix new check (Credo.Check.Readability.StrictModuleLayout)
- Ignore module attributes in UnsafeToAtom

## 1.3.0

- Enable `UnnecessaryAliasExpansion` check by default
Expand All @@ -25,60 +30,60 @@ Of course, we can have the same effect by choosing the pattern less explicitly:

> This deprecates the mandatory use of `@explanation` and `@default_params` module attributes for checks.
Before `v1.3` you had to define module attributes named `@explanation` and `@default_params` before calling
`use Credo.Check`.

Now you can pass `:explanations` (plural) and `:param_defaults` options directly to `use Credo.Check`.

```elixir
defmodule MyCheck do
use Credo.Check,
category: :warning,
base_priority: :high,
param_defaults: [param1: 42, param2: "offline"],
explanations: [
check: "...",
params: [
param1: "Your favorite number",
param2: "Online/Offline mode"
]
Before `v1.3` you had to define module attributes named `@explanation` and `@default_params` before calling
`use Credo.Check`.

Now you can pass `:explanations` (plural) and `:param_defaults` options directly to `use Credo.Check`.

```elixir
defmodule MyCheck do
use Credo.Check,
category: :warning,
base_priority: :high,
param_defaults: [param1: 42, param2: "offline"],
explanations: [
check: "...",
params: [
param1: "Your favorite number",
param2: "Online/Offline mode"
]
]

def run(source_file, params) do
#
end
def run(source_file, params) do
#
end
```
end
```

Please note that these options
are also **just a convenience** to implement the functions specified by the `Credo.Check` behaviour.
You can alternatively implement the respective functions yourself:
Please note that these options
are also **just a convenience** to implement the functions specified by the `Credo.Check` behaviour.
You can alternatively implement the respective functions yourself:

```elixir
defmodule MyCheck do
use Credo.Check
```elixir
defmodule MyCheck do
use Credo.Check

def category, do: :warning
def category, do: :warning

def base_priority, do: :high
def base_priority, do: :high

def explanations do
[
check: "...",
params: [
param1: "Your favorite number",
param2: "Online/Offline mode"
]
def explanations do
[
check: "...",
params: [
param1: "Your favorite number",
param2: "Online/Offline mode"
]
end
]
end

def param_defaults, do: [param1: 42, param2: "offline"]
def param_defaults, do: [param1: 42, param2: "offline"]

def run(source_file, params) do
#
end
def run(source_file, params) do
#
end
```
end
```

### New checks

Expand Down
4 changes: 2 additions & 2 deletions lib/credo/check.ex
Expand Up @@ -66,8 +66,8 @@ defmodule Credo.Check do

@doc """
Returns the base priority for the check.
This can be one of `:higher`, `:high`, `:normal`, `:low` or `:ignore`
This can be one of `:higher`, `:high`, `:normal`, `:low` or `:ignore`
(technically it can also be or an integer, but these are internal representations although that is not recommended).
"""
@callback base_priority() :: :higher | :high | :normal | :low | :ignore | integer
Expand Down

0 comments on commit 7d656c3

Please sign in to comment.