{"action":"created","comment":{"url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/comments/184861019","pull_request_review_id":116144498,"id":184861019,"diff_hunk":"@@ -471,9 +471,46 @@ async function removeAllSessionWebSocketHandlers (server, sessionId) {\n   }\n }\n \n+/**\n+ * Verify whether the given application is compatible to the\n+ * platform where it is going to be installed and tested.\n+ *\n+ * @param {string} app - The actual path to the application bundle\n+ * @param {boolean} isSimulator - Should be set to `true` if the test will be executed on Simulator\n+ * @returns {?boolean} The function returns `null` if the application does not exist or there is no\n+ * `CFBundleSupportedPlatforms` key in its Info.plist manifest.\n+ * `true` is returned if the bundle architecture matches the device architecture.\n+ * @throws {Error} If bundle architecture does not match the device architecture.\n+ */\n+async function verifyApplicationPlatform (app, isSimulator) {\n+  log.debug('Verifying application platform');\n+\n+  const infoPlist = path.resolve(app, 'Info.plist');\n+  if (!await fs.exists(infoPlist)) {\n+    log.debug(`'${infoPlist}' does not exist`);\n+    return null;\n+  }\n+\n+  const {CFBundleSupportedPlatforms} = await plist.parsePlistFile(infoPlist);\n+  log.debug(`CFBundleSupportedPlatforms: ${JSON.stringify(CFBundleSupportedPlatforms)}`);\n+  if (!_.isArray(CFBundleSupportedPlatforms)) {\n+    log.debug(`CFBundleSupportedPlatforms key does not exist in '${infoPlist}'`);\n+    return null;\n+  }\n+\n+  const isAppSupported = (isSimulator && CFBundleSupportedPlatforms.includes('iPhoneSimulator'))","path":"lib/utils.js","position":38,"original_position":38,"commit_id":"882fe9176157f2bf288c0c2ff4c39488fd55d0e8","original_commit_id":"882fe9176157f2bf288c0c2ff4c39488fd55d0e8","user":{"login":"jlipps","id":605053,"avatar_url":"https://avatars3.githubusercontent.com/u/605053?v=4","gravatar_id":"","url":"https://api.github.com/users/jlipps","html_url":"https://github.com/jlipps","followers_url":"https://api.github.com/users/jlipps/followers","following_url":"https://api.github.com/users/jlipps/following{/other_user}","gists_url":"https://api.github.com/users/jlipps/gists{/gist_id}","starred_url":"https://api.github.com/users/jlipps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlipps/subscriptions","organizations_url":"https://api.github.com/users/jlipps/orgs","repos_url":"https://api.github.com/users/jlipps/repos","events_url":"https://api.github.com/users/jlipps/events{/privacy}","received_events_url":"https://api.github.com/users/jlipps/received_events","type":"User","site_admin":false},"body":"since we only use `isAppSupported` for the sake of one conditional, why not just put the condition into the conditional and axe the constant altogether?","created_at":"2018-04-28T17:54:54Z","updated_at":"2018-04-28T17:55:00Z","html_url":"https://github.com/appium/appium-xcuitest-driver/pull/657#discussion_r184861019","pull_request_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/657","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/comments/184861019"},"html":{"href":"https://github.com/appium/appium-xcuitest-driver/pull/657#discussion_r184861019"},"pull_request":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/657"}}},"pull_request":{"url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/657","id":184270796,"html_url":"https://github.com/appium/appium-xcuitest-driver/pull/657","diff_url":"https://github.com/appium/appium-xcuitest-driver/pull/657.diff","patch_url":"https://github.com/appium/appium-xcuitest-driver/pull/657.patch","issue_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/657","number":657,"state":"open","locked":false,"title":"Add application platform verification","user":{"login":"mykola-mokhnach","id":7767781,"avatar_url":"https://avatars1.githubusercontent.com/u/7767781?v=4","gravatar_id":"","url":"https://api.github.com/users/mykola-mokhnach","html_url":"https://github.com/mykola-mokhnach","followers_url":"https://api.github.com/users/mykola-mokhnach/followers","following_url":"https://api.github.com/users/mykola-mokhnach/following{/other_user}","gists_url":"https://api.github.com/users/mykola-mokhnach/gists{/gist_id}","starred_url":"https://api.github.com/users/mykola-mokhnach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mykola-mokhnach/subscriptions","organizations_url":"https://api.github.com/users/mykola-mokhnach/orgs","repos_url":"https://api.github.com/users/mykola-mokhnach/repos","events_url":"https://api.github.com/users/mykola-mokhnach/events{/privacy}","received_events_url":"https://api.github.com/users/mykola-mokhnach/received_events","type":"User","site_admin":false},"body":"There are still enough people that don't know the difference between emulator and simulator and think that the same application binary could be shared between real devices and simulators. This gonna make them not so self confident.","created_at":"2018-04-26T09:00:41Z","updated_at":"2018-04-28T17:55:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"83e8d8e877dd700bc38db5cfa06b717a5adb0776","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/657/commits","review_comments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/657/comments","review_comment_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/657/comments","statuses_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/statuses/882fe9176157f2bf288c0c2ff4c39488fd55d0e8","head":{"label":"mykola-mokhnach:platform_verify","ref":"platform_verify","sha":"882fe9176157f2bf288c0c2ff4c39488fd55d0e8","user":{"login":"mykola-mokhnach","id":7767781,"avatar_url":"https://avatars1.githubusercontent.com/u/7767781?v=4","gravatar_id":"","url":"https://api.github.com/users/mykola-mokhnach","html_url":"https://github.com/mykola-mokhnach","followers_url":"https://api.github.com/users/mykola-mokhnach/followers","following_url":"https://api.github.com/users/mykola-mokhnach/following{/other_user}","gists_url":"https://api.github.com/users/mykola-mokhnach/gists{/gist_id}","starred_url":"https://api.github.com/users/mykola-mokhnach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mykola-mokhnach/subscriptions","organizations_url":"https://api.github.com/users/mykola-mokhnach/orgs","repos_url":"https://api.github.com/users/mykola-mokhnach/repos","events_url":"https://api.github.com/users/mykola-mokhnach/events{/privacy}","received_events_url":"https://api.github.com/users/mykola-mokhnach/received_events","type":"User","site_admin":false},"repo":{"id":71982109,"name":"appium-xcuitest-driver","full_name":"mykola-mokhnach/appium-xcuitest-driver","owner":{"login":"mykola-mokhnach","id":7767781,"avatar_url":"https://avatars1.githubusercontent.com/u/7767781?v=4","gravatar_id":"","url":"https://api.github.com/users/mykola-mokhnach","html_url":"https://github.com/mykola-mokhnach","followers_url":"https://api.github.com/users/mykola-mokhnach/followers","following_url":"https://api.github.com/users/mykola-mokhnach/following{/other_user}","gists_url":"https://api.github.com/users/mykola-mokhnach/gists{/gist_id}","starred_url":"https://api.github.com/users/mykola-mokhnach/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mykola-mokhnach/subscriptions","organizations_url":"https://api.github.com/users/mykola-mokhnach/orgs","repos_url":"https://api.github.com/users/mykola-mokhnach/repos","events_url":"https://api.github.com/users/mykola-mokhnach/events{/privacy}","received_events_url":"https://api.github.com/users/mykola-mokhnach/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mykola-mokhnach/appium-xcuitest-driver","description":"Appium iOS driver, backed by Apple XCUITest ","fork":true,"url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver","forks_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/forks","keys_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/teams","hooks_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/hooks","issue_events_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/issues/events{/number}","events_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/events","assignees_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/assignees{/user}","branches_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/branches{/branch}","tags_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/tags","blobs_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/languages","stargazers_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/stargazers","contributors_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/contributors","subscribers_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/subscribers","subscription_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/subscription","commits_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/contents/{+path}","compare_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/merges","archive_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/downloads","issues_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/issues{/number}","pulls_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/labels{/name}","releases_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/releases{/id}","deployments_url":"https://api.github.com/repos/mykola-mokhnach/appium-xcuitest-driver/deployments","created_at":"2016-10-26T08:24:43Z","updated_at":"2018-04-26T18:08:56Z","pushed_at":"2018-04-26T18:10:56Z","git_url":"git://github.com/mykola-mokhnach/appium-xcuitest-driver.git","ssh_url":"git@github.com:mykola-mokhnach/appium-xcuitest-driver.git","clone_url":"https://github.com/mykola-mokhnach/appium-xcuitest-driver.git","svn_url":"https://github.com/mykola-mokhnach/appium-xcuitest-driver","homepage":null,"size":25574,"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,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"appium:master","ref":"master","sha":"beb43870140b8875bdee8e008da01abdf88f6549","user":{"login":"appium","id":3221291,"avatar_url":"https://avatars2.githubusercontent.com/u/3221291?v=4","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"repo":{"id":47652761,"name":"appium-xcuitest-driver","full_name":"appium/appium-xcuitest-driver","owner":{"login":"appium","id":3221291,"avatar_url":"https://avatars2.githubusercontent.com/u/3221291?v=4","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appium/appium-xcuitest-driver","description":"Appium iOS driver, backed by Apple XCUITest ","fork":false,"url":"https://api.github.com/repos/appium/appium-xcuitest-driver","forks_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/forks","keys_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/teams","hooks_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/hooks","issue_events_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/events{/number}","events_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/events","assignees_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/assignees{/user}","branches_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/branches{/branch}","tags_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/tags","blobs_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/languages","stargazers_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/stargazers","contributors_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/contributors","subscribers_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/subscribers","subscription_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/subscription","commits_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/contents/{+path}","compare_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/merges","archive_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/downloads","issues_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues{/number}","pulls_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/labels{/name}","releases_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/releases{/id}","deployments_url":"https://api.github.com/repos/appium/appium-xcuitest-driver/deployments","created_at":"2015-12-08T22:11:37Z","updated_at":"2018-04-27T18:16:18Z","pushed_at":"2018-04-27T18:16:18Z","git_url":"git://github.com/appium/appium-xcuitest-driver.git","ssh_url":"git@github.com:appium/appium-xcuitest-driver.git","clone_url":"https://github.com/appium/appium-xcuitest-driver.git","svn_url":"https://github.com/appium/appium-xcuitest-driver","homepage":null,"size":25597,"stargazers_count":202,"watchers_count":202,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":153,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":153,"open_issues":2,"watchers":202,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/657"},"html":{"href":"https://github.com/appium/appium-xcuitest-driver/pull/657"},"issue":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/657"},"comments":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/issues/657/comments"},"review_comments":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/657/comments"},"review_comment":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/pulls/657/commits"},"statuses":{"href":"https://api.github.com/repos/appium/appium-xcuitest-driver/statuses/882fe9176157f2bf288c0c2ff4c39488fd55d0e8"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jlipps"}}