Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Credo Fails on master 😞 #90

Open
nelsonic opened this issue Jun 29, 2019 · 0 comments
Open

Credo Fails on master 😞 #90

nelsonic opened this issue Jun 29, 2019 · 0 comments

Comments

@nelsonic
Copy link
Member

At present the project has a pre-commit hook which runs mix credo setup in #3

The output of running mix credo on master is: (failure)
image

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

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

By process of elimination, I narrowed it down to the one file that fails credo:

mix credo test/library/books/books_test.exs

image

What Next...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant