{"action":"created","issue":{"url":"https://api.github.com/repos/rrrene/credo/issues/561","repository_url":"https://api.github.com/repos/rrrene/credo","labels_url":"https://api.github.com/repos/rrrene/credo/issues/561/labels{/name}","comments_url":"https://api.github.com/repos/rrrene/credo/issues/561/comments","events_url":"https://api.github.com/repos/rrrene/credo/issues/561/events","html_url":"https://github.com/rrrene/credo/issues/561","id":335940652,"node_id":"MDU6SXNzdWUzMzU5NDA2NTI=","number":561,"title":"ABC size with Ecto query","user":{"login":"Apelsinka223","id":6092419,"node_id":"MDQ6VXNlcjYwOTI0MTk=","avatar_url":"https://avatars1.githubusercontent.com/u/6092419?v=4","gravatar_id":"","url":"https://api.github.com/users/Apelsinka223","html_url":"https://github.com/Apelsinka223","followers_url":"https://api.github.com/users/Apelsinka223/followers","following_url":"https://api.github.com/users/Apelsinka223/following{/other_user}","gists_url":"https://api.github.com/users/Apelsinka223/gists{/gist_id}","starred_url":"https://api.github.com/users/Apelsinka223/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Apelsinka223/subscriptions","organizations_url":"https://api.github.com/users/Apelsinka223/orgs","repos_url":"https://api.github.com/users/Apelsinka223/repos","events_url":"https://api.github.com/users/Apelsinka223/events{/privacy}","received_events_url":"https://api.github.com/users/Apelsinka223/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2018-06-26T18:29:07Z","updated_at":"2018-09-24T21:13:37Z","closed_at":null,"author_association":"NONE","body":"### Environment\r\n\r\n* Credo version (`mix credo -v`): 0.9.0-rc8\r\n* Erlang/Elixir version (`elixir -v`): 1.6.1\r\n* Operating system: macOS\r\n\r\nGot a warning on this function\r\n```\r\ndef fun() do\r\n  Favorite\r\n  |> where(user_id: ^user.id)\r\n  |> join(:left, [f], t in Template, f.entity_id == t.id and f.entity_type == \"template\")\r\n  |> join(:left, [f, t], d in Document, f.entity_id == d.id and f.entity_type == \"document\")\r\n  |> join(:left, [f, t, d], dt in Template, dt.id == d.template_id)\r\n  |> join(:left, [f, t, d, dt], c in Category, c.id == t.category_id or c.id == dt.category_id)\r\n  |> select([f, t, d, dt, c], c)\r\n  |> distinct(true)\r\n  |> Repo.all()\r\nend\r\n```\r\n\r\n`Function is too complex (ABC size is 34, max is 30).`\r\n\r\nNot sure if it is correct behavior, but I didn't expect that Ecto query will be taken into ABC size\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/rrrene/credo/issues/comments/424127139","html_url":"https://github.com/rrrene/credo/issues/561#issuecomment-424127139","issue_url":"https://api.github.com/repos/rrrene/credo/issues/561","id":424127139,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNDEyNzEzOQ==","user":{"login":"roehst","id":21047691,"node_id":"MDQ6VXNlcjIxMDQ3Njkx","avatar_url":"https://avatars0.githubusercontent.com/u/21047691?v=4","gravatar_id":"","url":"https://api.github.com/users/roehst","html_url":"https://github.com/roehst","followers_url":"https://api.github.com/users/roehst/followers","following_url":"https://api.github.com/users/roehst/following{/other_user}","gists_url":"https://api.github.com/users/roehst/gists{/gist_id}","starred_url":"https://api.github.com/users/roehst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roehst/subscriptions","organizations_url":"https://api.github.com/users/roehst/orgs","repos_url":"https://api.github.com/users/roehst/repos","events_url":"https://api.github.com/users/roehst/events{/privacy}","received_events_url":"https://api.github.com/users/roehst/received_events","type":"User","site_admin":false},"created_at":"2018-09-24T21:13:37Z","updated_at":"2018-09-24T21:13:37Z","author_association":"NONE","body":"@rrrene  @Apelsinka223 TL;DR I m not 100% sure on this but my 2 cents it that the field access operator is being counted as function call so you are getting +11 points for it. So detecting when it is a call and when it is the field access operator should solve it (working on it)"}}
{"actor":{"display_login":"roehst"}}