{"action":"created","comment":{"url":"https://api.github.com/repos/AtomLinter/linter-elixirc/pulls/comments/111625514","pull_request_review_id":32885687,"id":111625514,"diff_hunk":"@@ -55,11 +68,21 @@ const isMixProject = async (filePath) => {\n   return existsSync(join(project, 'mix.exs'));\n };\n \n+const isUmbrellaProject = async (filePath) => {\n+  const project = await elixirProjectPath(filePath);\n+  return existsSync(join(project, 'apps'));\n+}\n+\n const isTestFile = async (filePath) => {\n   const project = await elixirProjectPath(filePath);\n   const relativePath = relative(project, filePath);\n-  // Is the first directory of the relative path \"test\"?\n-  return relativePath.split(sep)[0] === 'test';\n+  if (isUmbrellaProject()) {\n+    // Is the structure \"apps/app_name/test/...\"\n+    return relativePath.split(sep)[2] === 'test';\n+  } else {","path":"lib/init.js","position":37,"original_position":37,"commit_id":"2d758118266b5bb82550c932127e16569132ddde","original_commit_id":"2d758118266b5bb82550c932127e16569132ddde","user":{"login":"Arcanemagus","id":427137,"avatar_url":"https://avatars3.githubusercontent.com/u/427137?v=3","gravatar_id":"","url":"https://api.github.com/users/Arcanemagus","html_url":"https://github.com/Arcanemagus","followers_url":"https://api.github.com/users/Arcanemagus/followers","following_url":"https://api.github.com/users/Arcanemagus/following{/other_user}","gists_url":"https://api.github.com/users/Arcanemagus/gists{/gist_id}","starred_url":"https://api.github.com/users/Arcanemagus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Arcanemagus/subscriptions","organizations_url":"https://api.github.com/users/Arcanemagus/orgs","repos_url":"https://api.github.com/users/Arcanemagus/repos","events_url":"https://api.github.com/users/Arcanemagus/events{/privacy}","received_events_url":"https://api.github.com/users/Arcanemagus/received_events","type":"User","site_admin":false},"body":"Since the function will `return` anyway if the conditional is true, you can just end the `if` and leave the following statements out of it.\r\n\r\nSo this would look like:\r\n\r\n```js\r\n  if (isUmbrellaProject()) {\r\n    // Is the structure \"apps/app_name/test/...\"\r\n    return relativePath.split(sep)[2] === 'test';\r\n  }\r\n  // Is the structure \"test/...\"\r\n  return relativePath.split(sep)[0] === 'test';\r\n```","created_at":"2017-04-14T19:43:30Z","updated_at":"2017-04-14T19:43:43Z","html_url":"https://github.com/AtomLinter/linter-elixirc/pull/86#discussion_r111625514","pull_request_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/pulls/86","_links":{"self":{"href":"https://api.github.com/repos/AtomLinter/linter-elixirc/pulls/comments/111625514"},"html":{"href":"https://github.com/AtomLinter/linter-elixirc/pull/86#discussion_r111625514"},"pull_request":{"href":"https://api.github.com/repos/AtomLinter/linter-elixirc/pulls/86"}}},"pull_request":{"url":"https://api.github.com/repos/AtomLinter/linter-elixirc/pulls/86","id":115950202,"html_url":"https://github.com/AtomLinter/linter-elixirc/pull/86","diff_url":"https://github.com/AtomLinter/linter-elixirc/pull/86.diff","patch_url":"https://github.com/AtomLinter/linter-elixirc/pull/86.patch","issue_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/issues/86","number":86,"state":"open","locked":false,"title":"Account for umbrella projects when determining project path","user":{"login":"mauricerkelly","id":729402,"avatar_url":"https://avatars3.githubusercontent.com/u/729402?v=3","gravatar_id":"","url":"https://api.github.com/users/mauricerkelly","html_url":"https://github.com/mauricerkelly","followers_url":"https://api.github.com/users/mauricerkelly/followers","following_url":"https://api.github.com/users/mauricerkelly/following{/other_user}","gists_url":"https://api.github.com/users/mauricerkelly/gists{/gist_id}","starred_url":"https://api.github.com/users/mauricerkelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauricerkelly/subscriptions","organizations_url":"https://api.github.com/users/mauricerkelly/orgs","repos_url":"https://api.github.com/users/mauricerkelly/repos","events_url":"https://api.github.com/users/mauricerkelly/events{/privacy}","received_events_url":"https://api.github.com/users/mauricerkelly/received_events","type":"User","site_admin":false},"body":"I'd previously noticed that I was having some problems with linting in umbrella projects. With some debugging, I noticed that the Elixir project path was being determined by the location of the `mix.exs` file. Unfortunately there are multiple Mix files in an umbrella project, so we need to take the top-level one to determine the project directory.\r\n\r\nUmbrella projects are characterised by the following structure\r\n\r\n```\r\nproject_dir/\r\n |\r\n +-- mix.exs\r\n +-- apps/\r\n      |\r\n       +-- app_name/\r\n            |\r\n            +- mix.exs\r\n```\r\n\r\nThe existing `findElixirProjectPath()` function will find the lowest level `mix.exs` file. I have modified this function to check for `apps` in the project structure two levels up. If that exists AND there is another `mix.exs` file up there, then the function will assume an umbrella project, and return that directory. Otherwise it falls back to the regular pattern.","created_at":"2017-04-14T15:55:14Z","updated_at":"2017-04-14T19:43:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2af996562aa8e48e2e1b4bd84dcf52aa447108c3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/pulls/86/commits","review_comments_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/pulls/86/comments","review_comment_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/issues/86/comments","statuses_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/statuses/2d758118266b5bb82550c932127e16569132ddde","head":{"label":"mauricerkelly:improve-support-for-umbrella-projects","ref":"improve-support-for-umbrella-projects","sha":"2d758118266b5bb82550c932127e16569132ddde","user":{"login":"mauricerkelly","id":729402,"avatar_url":"https://avatars3.githubusercontent.com/u/729402?v=3","gravatar_id":"","url":"https://api.github.com/users/mauricerkelly","html_url":"https://github.com/mauricerkelly","followers_url":"https://api.github.com/users/mauricerkelly/followers","following_url":"https://api.github.com/users/mauricerkelly/following{/other_user}","gists_url":"https://api.github.com/users/mauricerkelly/gists{/gist_id}","starred_url":"https://api.github.com/users/mauricerkelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauricerkelly/subscriptions","organizations_url":"https://api.github.com/users/mauricerkelly/orgs","repos_url":"https://api.github.com/users/mauricerkelly/repos","events_url":"https://api.github.com/users/mauricerkelly/events{/privacy}","received_events_url":"https://api.github.com/users/mauricerkelly/received_events","type":"User","site_admin":false},"repo":{"id":83470550,"name":"linter-elixirc","full_name":"mauricerkelly/linter-elixirc","owner":{"login":"mauricerkelly","id":729402,"avatar_url":"https://avatars3.githubusercontent.com/u/729402?v=3","gravatar_id":"","url":"https://api.github.com/users/mauricerkelly","html_url":"https://github.com/mauricerkelly","followers_url":"https://api.github.com/users/mauricerkelly/followers","following_url":"https://api.github.com/users/mauricerkelly/following{/other_user}","gists_url":"https://api.github.com/users/mauricerkelly/gists{/gist_id}","starred_url":"https://api.github.com/users/mauricerkelly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mauricerkelly/subscriptions","organizations_url":"https://api.github.com/users/mauricerkelly/orgs","repos_url":"https://api.github.com/users/mauricerkelly/repos","events_url":"https://api.github.com/users/mauricerkelly/events{/privacy}","received_events_url":"https://api.github.com/users/mauricerkelly/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mauricerkelly/linter-elixirc","description":"Atom Linter plugin for ElixirC","fork":true,"url":"https://api.github.com/repos/mauricerkelly/linter-elixirc","forks_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/forks","keys_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/teams","hooks_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/hooks","issue_events_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/issues/events{/number}","events_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/events","assignees_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/assignees{/user}","branches_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/branches{/branch}","tags_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/tags","blobs_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/git/refs{/sha}","trees_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/statuses/{sha}","languages_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/languages","stargazers_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/stargazers","contributors_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/contributors","subscribers_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/subscribers","subscription_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/subscription","commits_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/commits{/sha}","git_commits_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/git/commits{/sha}","comments_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/comments{/number}","issue_comment_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/issues/comments{/number}","contents_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/contents/{+path}","compare_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/merges","archive_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/downloads","issues_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/issues{/number}","pulls_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/pulls{/number}","milestones_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/milestones{/number}","notifications_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/labels{/name}","releases_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/releases{/id}","deployments_url":"https://api.github.com/repos/mauricerkelly/linter-elixirc/deployments","created_at":"2017-02-28T19:23:18Z","updated_at":"2017-02-28T19:23:20Z","pushed_at":"2017-04-14T19:05:13Z","git_url":"git://github.com/mauricerkelly/linter-elixirc.git","ssh_url":"git@github.com:mauricerkelly/linter-elixirc.git","clone_url":"https://github.com/mauricerkelly/linter-elixirc.git","svn_url":"https://github.com/mauricerkelly/linter-elixirc","homepage":"https://atom.io/packages/linter-elixirc","size":106,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"AtomLinter:master","ref":"master","sha":"b65bb822ace6a530582f196402a435b5ad372e30","user":{"login":"AtomLinter","id":7242824,"avatar_url":"https://avatars3.githubusercontent.com/u/7242824?v=3","gravatar_id":"","url":"https://api.github.com/users/AtomLinter","html_url":"https://github.com/AtomLinter","followers_url":"https://api.github.com/users/AtomLinter/followers","following_url":"https://api.github.com/users/AtomLinter/following{/other_user}","gists_url":"https://api.github.com/users/AtomLinter/gists{/gist_id}","starred_url":"https://api.github.com/users/AtomLinter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AtomLinter/subscriptions","organizations_url":"https://api.github.com/users/AtomLinter/orgs","repos_url":"https://api.github.com/users/AtomLinter/repos","events_url":"https://api.github.com/users/AtomLinter/events{/privacy}","received_events_url":"https://api.github.com/users/AtomLinter/received_events","type":"Organization","site_admin":false},"repo":{"id":26124839,"name":"linter-elixirc","full_name":"AtomLinter/linter-elixirc","owner":{"login":"AtomLinter","id":7242824,"avatar_url":"https://avatars3.githubusercontent.com/u/7242824?v=3","gravatar_id":"","url":"https://api.github.com/users/AtomLinter","html_url":"https://github.com/AtomLinter","followers_url":"https://api.github.com/users/AtomLinter/followers","following_url":"https://api.github.com/users/AtomLinter/following{/other_user}","gists_url":"https://api.github.com/users/AtomLinter/gists{/gist_id}","starred_url":"https://api.github.com/users/AtomLinter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AtomLinter/subscriptions","organizations_url":"https://api.github.com/users/AtomLinter/orgs","repos_url":"https://api.github.com/users/AtomLinter/repos","events_url":"https://api.github.com/users/AtomLinter/events{/privacy}","received_events_url":"https://api.github.com/users/AtomLinter/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/AtomLinter/linter-elixirc","description":"Atom Linter plugin for ElixirC","fork":false,"url":"https://api.github.com/repos/AtomLinter/linter-elixirc","forks_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/forks","keys_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/teams","hooks_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/hooks","issue_events_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/issues/events{/number}","events_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/events","assignees_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/assignees{/user}","branches_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/branches{/branch}","tags_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/tags","blobs_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/git/refs{/sha}","trees_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/statuses/{sha}","languages_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/languages","stargazers_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/stargazers","contributors_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/contributors","subscribers_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/subscribers","subscription_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/subscription","commits_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/commits{/sha}","git_commits_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/git/commits{/sha}","comments_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/comments{/number}","issue_comment_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/issues/comments{/number}","contents_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/contents/{+path}","compare_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/merges","archive_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/downloads","issues_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/issues{/number}","pulls_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/pulls{/number}","milestones_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/milestones{/number}","notifications_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/labels{/name}","releases_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/releases{/id}","deployments_url":"https://api.github.com/repos/AtomLinter/linter-elixirc/deployments","created_at":"2014-11-03T15:25:40Z","updated_at":"2017-02-27T23:33:10Z","pushed_at":"2017-04-14T19:05:14Z","git_url":"git://github.com/AtomLinter/linter-elixirc.git","ssh_url":"git@github.com:AtomLinter/linter-elixirc.git","clone_url":"https://github.com/AtomLinter/linter-elixirc.git","svn_url":"https://github.com/AtomLinter/linter-elixirc","homepage":"https://atom.io/packages/linter-elixirc","size":106,"stargazers_count":11,"watchers_count":11,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"open_issues_count":3,"forks":10,"open_issues":3,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AtomLinter/linter-elixirc/pulls/86"},"html":{"href":"https://github.com/AtomLinter/linter-elixirc/pull/86"},"issue":{"href":"https://api.github.com/repos/AtomLinter/linter-elixirc/issues/86"},"comments":{"href":"https://api.github.com/repos/AtomLinter/linter-elixirc/issues/86/comments"},"review_comments":{"href":"https://api.github.com/repos/AtomLinter/linter-elixirc/pulls/86/comments"},"review_comment":{"href":"https://api.github.com/repos/AtomLinter/linter-elixirc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AtomLinter/linter-elixirc/pulls/86/commits"},"statuses":{"href":"https://api.github.com/repos/AtomLinter/linter-elixirc/statuses/2d758118266b5bb82550c932127e16569132ddde"}}}}
{"actor":{"display_login":"Arcanemagus"}}