dwyl / dwyl/library

Credo Fails on master 😞

Open
#90 0 comments 0 reactions 0 assignees View on GitHub
bug chore
Dominant language
Elixir
Stars
16
Forks
1
PR merge metrics
No merged PRs in 30d

Description

At present the project has a pre-commit hook which runs `mix credo` setup in https://github.com/dwyl/library/issues/3

The output of running `mix credo` on `master` is: (_failure_)
![image](https://user-images.githubusercontent.com/194400/60322431-594eb880-9977-11e9-827b-fd2a2aaf5d0d.png)

```
Checking 11 source files ...
Error while running Elixir.Credo.Check.Consistency.SpaceAroundOperators

07:35:12.252 [error] Task #PID<0.128.0> started from #PID<0.92.0> terminating
** (MatchError) no match of right hand side value: {:ok, [{:identifier, {1, 1, nil}, :defmodule}, {:alias, {1, 11, nil}, :Library}, {:., {1, 18, nil}}, {:alias, {1, 19, nil}, :BooksTest}, {:do, {1, 29, nil}}, {:eol, {1, 31, 1}}, {:identifier, {2, 3, nil}, :use}, {:alias, {2, 7, nil}, :Library}, {:., {2, 14, nil}}, {:alias, {2, 15, nil}, :DataCase}, {:eol, {2, 23, 2}}, {:identifier, {4, 3, nil}, :alias}, {:alias, {4, 9, nil}, :Library}, {:., {4, 16, nil}}, {:alias, {4, 17, nil}, :Books}, {:eol, {4, 22, 2}}, {:identifier, {6, 3, nil}, :describe}, {:bin_string, {6, 12, nil}, ["books"]}, {:do, {6, 20, nil}}, {:eol, {6, 22, 1}}, {:identifier, {7, 5, nil}, :alias}, {:alias, {7, 11, nil}, :Library}, {:., {7, 18, nil}}, {:alias, {7, 19, nil}, :Books}, {:., {7, 24, nil}}, {:alias, {7, 25, nil}, :Book}, {:eol, {7, 29, 1}}, {:identifier, {8, 5, nil}, :alias}, {:alias, {8, 11, nil}, :Library}, {:., {8, 18, nil}}, {:alias, {8, 19, nil}, :Users}, {:eol, {8, 24, 2}}, {:at_op, {10, 5, nil}, :@}, {:identifier, {10, 6, nil}, :valid_attrs}, {:%{}, {10, 18, nil}}, {:"{", {10, 19, nil}}, {:kw_identifier, {10, 20, nil}, :author_list}, {:"[", {10, 33, nil}}, {:bin_string, {10, 34, nil}, ["some author"]}, {:"]", {10, 47, nil}}, {:",", {10, 48, 1}}, {:kw_identifier, {11, 20, nil}, :category}, {:bin_string, {11, 30, nil}, ["some category"]}, {:",", {11, 45, ...}}, {:kw_identifier, {12, ...}, :date_published}, {:bin_string, {...}, ...}, {:",", ...}, {...}, ...]}
lib/credo/code.ex:104: Credo.Code.to_tokens/1
lib/credo/check/consistency/space_around_operators/collector.ex:10: Credo.Check.Consistency.SpaceAroundOperators.Collector.collect_matches/2
lib/credo/check/consistency/collector.ex:126: anonymous fn/3 in Credo.Check.Consistency.Collector.find_issues/4
(elixir) lib/enum.ex:1327: Enum."-map/2-lists^map/1-0-"/2
lib/credo/check/consistency/collector.ex:125: Credo.Check.Consistency.Collector.find_issues/4
lib/credo/check/consistency/space_around_operators/collector.ex:2: Credo.Check.Consistency.SpaceAroundOperators.Collector.find_and_append_issues/4
lib/credo/check/runner.ex:148: Credo.Check.Runner.run_check/3
(elixir) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
Function: #Function<11.71096419/0 in Credo.Check.Runner.run_checks_that_run_on_all/2>
Args: []
** (EXIT from #PID<0.92.0>) an exception was raised:
** (MatchError) no match of right hand side value: {:ok, [{:identifier, {1, 1, nil}, :defmodule}, {:alias, {1, 11, nil}, :Library}, {:., {1, 18, nil}}, {:alias, {1, 19, nil}, :BooksTest}, {:do, {1, 29, nil}}, {:eol, {1, 31, 1}}, {:identifier, {2, 3, nil}, :use}, {:alias, {2, 7, nil}, :Library}, {:., {2, 14, nil}}, {:alias, {2, 15, nil}, :DataCase}, {:eol, {2, 23, 2}}, {:identifier, {4, 3, nil}, :alias}, {:alias, {4, 9, nil}, :Library}, {:., {4, 16, nil}}, {:alias, {4, 17, nil}, :Books}, {:eol, {4, 22, 2}}, {:identifier, {6, 3, nil}, :describe}, {:bin_string, {6, 12, nil}, ["books"]}, {:do, {6, 20, nil}}, {:eol, {6, 22, 1}}, {:identifier, {7, 5, nil}, :alias}, {:alias, {7, 11, nil}, :Library}, {:., {7, 18, nil}}, {:alias, {7, 19, nil}, :Books}, {:., {7, 24, nil}}, {:alias, {7, 25, nil}, :Book}, {:eol, {7, 29, 1}}, {:identifier, {8, 5, nil}, :alias}, {:alias, {8, 11, nil}, :Library}, {:., {8, 18, nil}}, {:alias, {8, 19, nil}, :Users}, {:eol, {8, 24, 2}}, {:at_op, {10, 5, nil}, :@}, {:identifier, {10, 6, nil}, :valid_attrs}, {:%{}, {10, 18, nil}}, {:"{", {10, 19, nil}}, {:kw_identifier, {10, 20, nil}, :author_list}, {:"[", {10, 33, nil}}, {:bin_string, {10, 34, nil}, ["some author"]}, {:"]", {10, 47, nil}}, {:",", {10, 48, 1}}, {:kw_identifier, {11, 20, nil}, :category}, {:bin_string, {11, 30, nil}, ["some category"]}, {:",", {11, 45, ...}}, {:kw_identifier, {12, ...}, :date_published}, {:bin_string, {...}, ...}, {:",", ...}, {...}, ...]}
lib/credo/code.ex:104: Credo.Code.to_tokens/1
lib/credo/check/consistency/space_around_operators/collector.ex:10: Credo.Check.Consistency.SpaceAroundOperators.Collector.collect_matches/2
lib/credo/check/consistency/collector.ex:126: anonymous fn/3 in Credo.Check.Consistency.Collector.find_issues/4
(elixir) lib/enum.ex:1327: Enum."-map/2-lists^map/1-0-"/2
lib/credo/check/consistency/collector.ex:125: Credo.Check.Consistency.Collector.find_issues/4
lib/credo/check/consistency/space_around_operators/collector.ex:2: Credo.Check.Consistency.SpaceAroundOperators.Collector.find_and_append_issues/4
lib/credo/check/runner.ex:148: Credo.Check.Runner.run_check/3
(elixir) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
```

The output/stacktrace of running the `mix credo` command is _useless_. 😞
It gives zero indication which line(s) in the _project_ is causing the error.

attempting to run `mix credo list` as indicated in the credo docs https://github.com/rrrene/credo/ is no use either ...

![image](https://user-images.githubusercontent.com/194400/60322125-99616b80-9976-11e9-9cf1-33d92fda022a.png)

```sh
Error while running Elixir.Credo.Check.Consistency.SpaceAroundOperators

07:21:18.179 [error] Task #PID<0.128.0> started from #PID<0.92.0> terminating
** (MatchError) no match of right hand side value: {:ok, [{:identifier, {1, 1, nil}, :defmodule}, {:alias, {1, 11, nil}, :Library}, {:., {1, 18, nil}}, {:alias, {1, 19, nil}, :BooksTest}, {:do, {1, 29, nil}}, {:eol, {1, 31, 1}}, {:identifier, {2, 3, nil}, :use}, {:alias, {2, 7, nil}, :Library}, {:., {2, 14, nil}}, {:alias, {2, 15, nil}, :DataCase}, {:eol, {2, 23, 2}}, {:identifier, {4, 3, nil}, :alias}, {:alias, {4, 9, nil}, :Library}, {:., {4, 16, nil}}, {:alias, {4, 17, nil}, :Books}, {:eol, {4, 22, 2}}, {:identifier, {6, 3, nil}, :describe}, {:bin_string, {6, 12, nil}, ["books"]}, {:do, {6, 20, nil}}, {:eol, {6, 22, 1}}, {:identifier, {7, 5, nil}, :alias}, {:alias, {7, 11, nil}, :Library}, {:., {7, 18, nil}}, {:alias, {7, 19, nil}, :Books}, {:., {7, 24, nil}}, {:alias, {7, 25, nil}, :Book}, {:eol, {7, 29, 1}}, {:identifier, {8, 5, nil}, :alias}, {:alias, {8, 11, nil}, :Library}, {:., {8, 18, nil}}, {:alias, {8, 19, nil}, :Users}, {:eol, {8, 24, 2}}, {:at_op, {10, 5, nil}, :@}, {:identifier, {10, 6, nil}, :valid_attrs}, {:%{}, {10, 18, nil}}, {:"{", {10, 19, nil}}, {:eol, {10, 20, 1}}, {:kw_identifier, {11, 7, nil}, :author_list}, {:"[", {11, 20, nil}}, {:bin_string, {11, 21, nil}, ["some author"]}, {:"]", {11, 34, nil}}, {:",", {11, 35, 1}}, {:kw_identifier, {12, 7, nil}, :category}, {:bin_string, {12, 17, ...}, ["some category"]}, {:",", {12, ...}}, {:kw_identifier, {...}, ...}, {:bin_string, ...}, {...}, ...]}
lib/credo/code.ex:104: Credo.Code.to_tokens/1
lib/credo/check/consistency/space_around_operators/collector.ex:10: Credo.Check.Consistency.SpaceAroundOperators.Collector.collect_matches/2
lib/credo/check/consistency/collector.ex:126: anonymous fn/3 in Credo.Check.Consistency.Collector.find_issues/4
(elixir) lib/enum.ex:1327: Enum."-map/2-lists^map/1-0-"/2
lib/credo/check/consistency/collector.ex:125: Credo.Check.Consistency.Collector.find_issues/4
lib/credo/check/consistency/space_around_operators/collector.ex:2: Credo.Check.Consistency.SpaceAroundOperators.Collector.find_and_append_issues/4
lib/credo/check/runner.ex:148: Credo.Check.Runner.run_check/3
(elixir) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
Function: #Function<11.71096419/0 in Credo.Check.Runner.run_checks_that_run_on_all/2>
Args: []
** (EXIT from #PID<0.92.0>) an exception was raised:
** (MatchError) no match of right hand side value: {:ok, [{:identifier, {1, 1, nil}, :defmodule}, {:alias, {1, 11, nil}, :Library}, {:., {1, 18, nil}}, {:alias, {1, 19, nil}, :BooksTest}, {:do, {1, 29, nil}}, {:eol, {1, 31, 1}}, {:identifier, {2, 3, nil}, :use}, {:alias, {2, 7, nil}, :Library}, {:., {2, 14, nil}}, {:alias, {2, 15, nil}, :DataCase}, {:eol, {2, 23, 2}}, {:identifier, {4, 3, nil}, :alias}, {:alias, {4, 9, nil}, :Library}, {:., {4, 16, nil}}, {:alias, {4, 17, nil}, :Books}, {:eol, {4, 22, 2}}, {:identifier, {6, 3, nil}, :describe}, {:bin_string, {6, 12, nil}, ["books"]}, {:do, {6, 20, nil}}, {:eol, {6, 22, 1}}, {:identifier, {7, 5, nil}, :alias}, {:alias, {7, 11, nil}, :Library}, {:., {7, 18, nil}}, {:alias, {7, 19, nil}, :Books}, {:., {7, 24, nil}}, {:alias, {7, 25, nil}, :Book}, {:eol, {7, 29, 1}}, {:identifier, {8, 5, nil}, :alias}, {:alias, {8, 11, nil}, :Library}, {:., {8, 18, nil}}, {:alias, {8, 19, nil}, :Users}, {:eol, {8, 24, 2}}, {:at_op, {10, 5, nil}, :@}, {:identifier, {10, 6, nil}, :valid_attrs}, {:%{}, {10, 18, nil}}, {:"{", {10, 19, nil}}, {:eol, {10, 20, 1}}, {:kw_identifier, {11, 7, nil}, :author_list}, {:"[", {11, 20, nil}}, {:bin_string, {11, 21, nil}, ["some author"]}, {:"]", {11, 34, nil}}, {:",", {11, 35, 1}}, {:kw_identifier, {12, 7, nil}, :category}, {:bin_string, {12, 17, ...}, ["some category"]}, {:",", {12, ...}}, {:kw_identifier, {...}, ...}, {:bin_string, ...}, {...}, ...]}
lib/credo/code.ex:104: Credo.Code.to_tokens/1
lib/credo/check/consistency/space_around_operators/collector.ex:10: Credo.Check.Consistency.SpaceAroundOperators.Collector.collect_matches/2
lib/credo/check/consistency/collector.ex:126: anonymous fn/3 in Credo.Check.Consistency.Collector.find_issues/4
(elixir) lib/enum.ex:1327: Enum."-map/2-lists^map/1-0-"/2
lib/credo/check/consistency/collector.ex:125: Credo.Check.Consistency.Collector.find_issues/4
lib/credo/check/consistency/space_around_operators/collector.ex:2: Credo.Check.Consistency.SpaceAroundOperators.Collector.find_and_append_issues/4
lib/credo/check/runner.ex:148: Credo.Check.Runner.run_check/3
(elixir) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
```

I attempted to update to the latest version of `credo` (`1.0.0`) but the output does not change:

![image](https://user-images.githubusercontent.com/194400/60322772-2e189900-9978-11e9-95ed-4c85980fae67.png)

By process of elimination, I narrowed it down to the **one** file that fails credo:
```
mix credo test/library/books/books_test.exs
```
![image](https://user-images.githubusercontent.com/194400/60323996-74232c00-997b-11e9-941f-a5ec060188ea.png)

# What _Next_...?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.