{"action":"created","issue":{"url":"https://api.github.com/repos/rrrene/credo/issues/160","repository_url":"https://api.github.com/repos/rrrene/credo","labels_url":"https://api.github.com/repos/rrrene/credo/issues/160/labels{/name}","comments_url":"https://api.github.com/repos/rrrene/credo/issues/160/comments","events_url":"https://api.github.com/repos/rrrene/credo/issues/160/events","html_url":"https://github.com/rrrene/credo/issues/160","id":173306819,"number":160,"title":"Credo 0.4.9 blows up with a list of excluded files.","user":{"login":"austinsmorris","id":1616868,"avatar_url":"https://avatars.githubusercontent.com/u/1616868?v=3","gravatar_id":"","url":"https://api.github.com/users/austinsmorris","html_url":"https://github.com/austinsmorris","followers_url":"https://api.github.com/users/austinsmorris/followers","following_url":"https://api.github.com/users/austinsmorris/following{/other_user}","gists_url":"https://api.github.com/users/austinsmorris/gists{/gist_id}","starred_url":"https://api.github.com/users/austinsmorris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/austinsmorris/subscriptions","organizations_url":"https://api.github.com/users/austinsmorris/orgs","repos_url":"https://api.github.com/users/austinsmorris/repos","events_url":"https://api.github.com/users/austinsmorris/events{/privacy}","received_events_url":"https://api.github.com/users/austinsmorris/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-25T20:49:49Z","updated_at":"2016-08-25T21:21:08Z","closed_at":null,"body":"I have an umbrella app.  In my `/config/.credo.exs` file, I have defined some excluded files like so:\r\n\r\n```\r\n        included: [\"lib/\", \"src/\", \"web/\", \"apps/\"],\r\n        excluded: [\r\n          ~r\"/_build/\",\r\n          ~r\"/deps/\",\r\n          \"apps/foo/mix.exs\",\r\n          \"apps/foo/test/\",\r\n          \"apps/bar/mix.exs\",\r\n          \"apps/bar/test/\",\r\n          \"apps/baz/mix.exs\",\r\n          \"apps/baz/test/\",\r\n          \"apps/bat/test/\",\r\n          \"apps/bat/mix.exs\",\r\n        ]\r\n```\r\n\r\nWhen I run `mix credo` it blows up with the following error:\r\n\r\n```\r\n** (FunctionClauseError) no function clause matching in MapSet.difference/2\r\n    (elixir) lib/map_set.ex:119: MapSet.difference([\"apps/foo/config/dev.exs\", \"apps/foo/test/test_helper.exs\", (blah blah blah long list of filenames], #MapSet<[\"./apps/foo/mix.exs\"]>)\r\n    lib/credo/sources.ex:53: Credo.Sources.exclude/2\r\n    lib/credo/sources.ex:28: Credo.Sources.find/1\r\n    lib/credo/cli/command/suggest.ex:41: anonymous fn/1 in Credo.CLI.Command.Suggest.load_and_validate_source_files/1\r\n    (stdlib) timer.erl:166: :timer.tc/1\r\n    lib/credo/cli/command/suggest.ex:39: Credo.CLI.Command.Suggest.load_and_validate_source_files/1\r\n    lib/credo/cli/command/suggest.ex:16: Credo.CLI.Command.Suggest.run/2\r\n    lib/credo/cli.ex:58: Credo.CLI.main/1\r\n```\r\n\r\nThe problem looks to be in `Credo.Sources` here:\r\n\r\n```\r\n  defp exclude(files, []), do: files\r\n  defp exclude(files, [pattern | remaining_patterns]) when is_binary(pattern) do\r\n    exclude_paths = recurse_path(pattern) |> Enum.into(MapSet.new)\r\n\r\n    files\r\n    |> MapSet.difference(exclude_paths)\r\n    |> exclude(remaining_patterns)\r\n  end\r\n```\r\n\r\n`files` is a list, not a `MapSet`, so `MapSet.difference/2` gets mad..."},"comment":{"url":"https://api.github.com/repos/rrrene/credo/issues/comments/242544474","html_url":"https://github.com/rrrene/credo/issues/160#issuecomment-242544474","issue_url":"https://api.github.com/repos/rrrene/credo/issues/160","id":242544474,"user":{"login":"britto","id":54433,"avatar_url":"https://avatars.githubusercontent.com/u/54433?v=3","gravatar_id":"","url":"https://api.github.com/users/britto","html_url":"https://github.com/britto","followers_url":"https://api.github.com/users/britto/followers","following_url":"https://api.github.com/users/britto/following{/other_user}","gists_url":"https://api.github.com/users/britto/gists{/gist_id}","starred_url":"https://api.github.com/users/britto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/britto/subscriptions","organizations_url":"https://api.github.com/users/britto/orgs","repos_url":"https://api.github.com/users/britto/repos","events_url":"https://api.github.com/users/britto/events{/privacy}","received_events_url":"https://api.github.com/users/britto/received_events","type":"User","site_admin":false},"created_at":"2016-08-25T21:21:08Z","updated_at":"2016-08-25T21:21:08Z","body":"@austinsmorris Nevermind! I could reproduce the bug locally, it happens when we have regexes **followed by** binaries in our exclusion patterns.\r\n\r\nThanks for reporting. I'm working on a fix 👍\r\n\r\nFor now, you can work around this bug by leaving all regexes at the end of the list."}}
{"actor":{"display_login":"britto"}}