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

Fix bug with nil parse_timeout #737

Merged
merged 1 commit into from Jan 26, 2020

Conversation

devonestes
Copy link
Contributor

There was a bug in here when using plugins that the parse_timeout was
nil, and then when I tried to use it with --config-name it crashed.
Here's what that crash looked like:

mix credo --files-included lib/sketchql/subscriptions/sync_schedules.ex --files-included lib/sketchql/subscriptions/stripe/api/client.ex --config-name new_files
** (FunctionClauseError) no function clause matching in Task.yield_many/2

    The following arguments were given to Task.yield_many/2:

        # 1
        [%Task{owner: #PID<0.93.0>, pid: #PID<0.116.0>, ref: #Reference<0.323361820.2247360518.21450>}, %Task{owner: #PID<0.93.0>, pid: #PID<0.117.0>, ref: #Reference<0.323361820.2247360518.21451>}]

        # 2
        nil

    Attempted function clauses (showing 1 out of 1):

        def yield_many(tasks, timeout) when timeout == :infinity or is_integer(timeout) and timeout >= 0

    (elixir) lib/task.ex:759: Task.yield_many/2
    lib/credo/sources.ex:129: Credo.Sources.read_files/2
    lib/credo/cli/task/load_and_validate_source_files.ex:13: anonymous fn/1 in Credo.CLI.Task.LoadAndValidateSourceFiles.call/2
    (stdlib) timer.erl:166: :timer.tc/1
    lib/credo/cli/task/load_and_validate_source_files.ex:11: Credo.CLI.Task.LoadAndValidateSourceFiles.call/2
    lib/credo/execution/task.ex:55: Credo.Execution.Task.do_run/3
    (elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3
    lib/credo/execution/task.ex:55: Credo.Execution.Task.do_run/3

This fixes the issue at hand, but doesn't figure out why that is nil
in the first place.

There was a bug in here when using plugins that the `parse_timeout` was
`nil`, and then when I tried to use it with `--config-name` it crashed.
Here's what that crash looked like:

```
mix credo --files-included lib/sketchql/subscriptions/sync_schedules.ex --files-included lib/sketchql/subscriptions/stripe/api/client.ex --config-name new_files
** (FunctionClauseError) no function clause matching in Task.yield_many/2

    The following arguments were given to Task.yield_many/2:

        # 1
        [%Task{owner: #PID<0.93.0>, pid: #PID<0.116.0>, ref: #Reference<0.323361820.2247360518.21450>}, %Task{owner: #PID<0.93.0>, pid: #PID<0.117.0>, ref: #Reference<0.323361820.2247360518.21451>}]

        # 2
        nil

    Attempted function clauses (showing 1 out of 1):

        def yield_many(tasks, timeout) when timeout == :infinity or is_integer(timeout) and timeout >= 0

    (elixir) lib/task.ex:759: Task.yield_many/2
    lib/credo/sources.ex:129: Credo.Sources.read_files/2
    lib/credo/cli/task/load_and_validate_source_files.ex:13: anonymous fn/1 in Credo.CLI.Task.LoadAndValidateSourceFiles.call/2
    (stdlib) timer.erl:166: :timer.tc/1
    lib/credo/cli/task/load_and_validate_source_files.ex:11: Credo.CLI.Task.LoadAndValidateSourceFiles.call/2
    lib/credo/execution/task.ex:55: Credo.Execution.Task.do_run/3
    (elixir) lib/enum.ex:1948: Enum."-reduce/3-lists^foldl/2-0-"/3
    lib/credo/execution/task.ex:55: Credo.Execution.Task.do_run/3
```

This fixes the issue at hand, but doesn't figure out why that is `nil`
in the first place.
@rrrene rrrene merged commit d44690e into rrrene:master Jan 26, 2020
@rrrene
Copy link
Owner

rrrene commented Jan 26, 2020

@devonestes Thx! 👍

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

Successfully merging this pull request may close these issues.

None yet

2 participants