Skip to content

Commit

Permalink
README.md: Add some example code
Browse files Browse the repository at this point in the history
  • Loading branch information
xtian committed Aug 10, 2019
1 parent 9f427fc commit f159829
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,31 @@ defmodule Foo do
end
```

---

#### `CredoContrib.Check.EmptyDocString`

Disallows `@doc` strings that do not contain any text.

```elixir
## GOOD

@doc """
This is a function
"""
def bar do
:ok
end

## BAD

@doc """
"""
def bar do
:ok
end
```

---

#### `CredoContrib.Check.EmptyTestBlock`
Expand All @@ -110,6 +131,21 @@ Disallows usage of [ExUnit.Case.test/3][test-3] with an empty body.

For unimplemented tests, use [ExUnit.Case.test/1][test-1] and set `ExUnit.start(except: [:not_implemented])`

```elixir
## GOOD

test "something not implemented"

test "something implemented" do
assert 1 + 1 == 2
end

## BAD

test "something not implemented" do
end
```

[test-1]: https://hexdocs.pm/ex_unit/ExUnit.Case.html#test/1
[test-3]: https://hexdocs.pm/ex_unit/ExUnit.Case.html#test/3

Expand Down

0 comments on commit f159829

Please sign in to comment.