{"action":"created","comment":{"url":"https://api.github.com/repos/openwisp/openwisp-utils/pulls/comments/240006463","pull_request_review_id":182945654,"id":240006463,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MDAwNjQ2Mw==","diff_hunk":"@@ -205,3 +206,42 @@ def _find_issue_mentions(message):\n         'issues': issues,\n         'good_mentions': good_mentions\n     }\n+\n+\n+def _parse_endline_check_args():\n+    \"\"\"\n+    Parse and return CLI arguments\n+    \"\"\"\n+    parser = argparse.ArgumentParser(description='Ensures all file have '\n+                                     'a blank line at the end of the file.')\n+    parser.add_argument('--skipscript',\n+                        help='put path and extentions to skip like `! -path file`',\n+                        required=False,\n+                        type=str)\n+    return parser.parse_args()\n+\n+\n+def check_end_line():\n+    \"\"\"\n+    Ensures all file have\n+    a blank line at the end of the file\n+    \"\"\"\n+    args = _parse_endline_check_args()\n+    excludepath = '! -path \"../.*\" ! -path \"*.pyc\" ! -path \"*__.py\" ! -path \"*.svg\" ! -path \"*.png\" '\n+    excludepath = excludepath + '! -path \"*/*.egg-info/*\" ! -path \"../.*/*\" ! -path \"../*/.*\" '\n+    excludepath = excludepath + '! -path \"*/test*/*\" '\n+    if args.skipscript is not None:\n+        excludepath = excludepath + str(args.skipscript)\n+    # QA Check\n+    cwdn = os.getcwd()\n+    filelist = subprocess.check_output('find .. -type f ' + excludepath, cwd=cwdn, shell=True)\n+    filelist = filelist.decode('utf-8')\n+    filelist = filelist.split('\\n')\n+    for pathvar in filelist[: - 1]:\n+        check = subprocess.check_output('tail -c 1 ' + pathvar, cwd=cwdn, shell=True)\n+        try:\n+            if(check.decode('utf-8') != '\\n'):\n+                print(pathvar + \" doesn't have a blank line at the end\")\n+                sys.exit(1)\n+        except UnicodeDecodeError:\n+            print(pathvar + \" is a binary file\")","path":"openwisp_utils/qa.py","position":50,"original_position":50,"commit_id":"8601907e1d526488016fd28b15c720fc50e23507","original_commit_id":"8601907e1d526488016fd28b15c720fc50e23507","user":{"login":"atb00ker","id":24985760,"node_id":"MDQ6VXNlcjI0OTg1NzYw","avatar_url":"https://avatars0.githubusercontent.com/u/24985760?v=4","gravatar_id":"","url":"https://api.github.com/users/atb00ker","html_url":"https://github.com/atb00ker","followers_url":"https://api.github.com/users/atb00ker/followers","following_url":"https://api.github.com/users/atb00ker/following{/other_user}","gists_url":"https://api.github.com/users/atb00ker/gists{/gist_id}","starred_url":"https://api.github.com/users/atb00ker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atb00ker/subscriptions","organizations_url":"https://api.github.com/users/atb00ker/orgs","repos_url":"https://api.github.com/users/atb00ker/repos","events_url":"https://api.github.com/users/atb00ker/events{/privacy}","received_events_url":"https://api.github.com/users/atb00ker/received_events","type":"User","site_admin":false},"body":"I don't think printing that it's a binary file will help. Any particular reason for this?","created_at":"2018-12-08T14:30:25Z","updated_at":"2018-12-08T14:34:20Z","html_url":"https://github.com/openwisp/openwisp-utils/pull/30#discussion_r240006463","pull_request_url":"https://api.github.com/repos/openwisp/openwisp-utils/pulls/30","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/openwisp/openwisp-utils/pulls/comments/240006463"},"html":{"href":"https://github.com/openwisp/openwisp-utils/pull/30#discussion_r240006463"},"pull_request":{"href":"https://api.github.com/repos/openwisp/openwisp-utils/pulls/30"}}},"pull_request":{"url":"https://api.github.com/repos/openwisp/openwisp-utils/pulls/30","id":236295252,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM2Mjk1MjUy","html_url":"https://github.com/openwisp/openwisp-utils/pull/30","diff_url":"https://github.com/openwisp/openwisp-utils/pull/30.diff","patch_url":"https://github.com/openwisp/openwisp-utils/pull/30.patch","issue_url":"https://api.github.com/repos/openwisp/openwisp-utils/issues/30","number":30,"state":"open","locked":false,"title":"[qa] Add a check for empty line #29","user":{"login":"unsuitable001","id":26590510,"node_id":"MDQ6VXNlcjI2NTkwNTEw","avatar_url":"https://avatars1.githubusercontent.com/u/26590510?v=4","gravatar_id":"","url":"https://api.github.com/users/unsuitable001","html_url":"https://github.com/unsuitable001","followers_url":"https://api.github.com/users/unsuitable001/followers","following_url":"https://api.github.com/users/unsuitable001/following{/other_user}","gists_url":"https://api.github.com/users/unsuitable001/gists{/gist_id}","starred_url":"https://api.github.com/users/unsuitable001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unsuitable001/subscriptions","organizations_url":"https://api.github.com/users/unsuitable001/orgs","repos_url":"https://api.github.com/users/unsuitable001/repos","events_url":"https://api.github.com/users/unsuitable001/events{/privacy}","received_events_url":"https://api.github.com/users/unsuitable001/received_events","type":"User","site_admin":false},"body":"This update adds a check for empty line is present at the end of all files in the repository\r\nGCI Task - https://codein.withgoogle.com/dashboard/task-instances/4670648862375936/\r\n\r\nFixes #29","created_at":"2018-12-05T19:30:34Z","updated_at":"2018-12-08T14:34:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ea0d6443f5a18ed189e0d8cb45b04990ec67bf69","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/openwisp/openwisp-utils/pulls/30/commits","review_comments_url":"https://api.github.com/repos/openwisp/openwisp-utils/pulls/30/comments","review_comment_url":"https://api.github.com/repos/openwisp/openwisp-utils/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openwisp/openwisp-utils/issues/30/comments","statuses_url":"https://api.github.com/repos/openwisp/openwisp-utils/statuses/8601907e1d526488016fd28b15c720fc50e23507","head":{"label":"unsuitable001:master","ref":"master","sha":"8601907e1d526488016fd28b15c720fc50e23507","user":{"login":"unsuitable001","id":26590510,"node_id":"MDQ6VXNlcjI2NTkwNTEw","avatar_url":"https://avatars1.githubusercontent.com/u/26590510?v=4","gravatar_id":"","url":"https://api.github.com/users/unsuitable001","html_url":"https://github.com/unsuitable001","followers_url":"https://api.github.com/users/unsuitable001/followers","following_url":"https://api.github.com/users/unsuitable001/following{/other_user}","gists_url":"https://api.github.com/users/unsuitable001/gists{/gist_id}","starred_url":"https://api.github.com/users/unsuitable001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unsuitable001/subscriptions","organizations_url":"https://api.github.com/users/unsuitable001/orgs","repos_url":"https://api.github.com/users/unsuitable001/repos","events_url":"https://api.github.com/users/unsuitable001/events{/privacy}","received_events_url":"https://api.github.com/users/unsuitable001/received_events","type":"User","site_admin":false},"repo":{"id":160494934,"node_id":"MDEwOlJlcG9zaXRvcnkxNjA0OTQ5MzQ=","name":"openwisp-utils","full_name":"unsuitable001/openwisp-utils","private":false,"owner":{"login":"unsuitable001","id":26590510,"node_id":"MDQ6VXNlcjI2NTkwNTEw","avatar_url":"https://avatars1.githubusercontent.com/u/26590510?v=4","gravatar_id":"","url":"https://api.github.com/users/unsuitable001","html_url":"https://github.com/unsuitable001","followers_url":"https://api.github.com/users/unsuitable001/followers","following_url":"https://api.github.com/users/unsuitable001/following{/other_user}","gists_url":"https://api.github.com/users/unsuitable001/gists{/gist_id}","starred_url":"https://api.github.com/users/unsuitable001/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unsuitable001/subscriptions","organizations_url":"https://api.github.com/users/unsuitable001/orgs","repos_url":"https://api.github.com/users/unsuitable001/repos","events_url":"https://api.github.com/users/unsuitable001/events{/privacy}","received_events_url":"https://api.github.com/users/unsuitable001/received_events","type":"User","site_admin":false},"html_url":"https://github.com/unsuitable001/openwisp-utils","description":"Python and Django utilities shared between different openwisp modules","fork":true,"url":"https://api.github.com/repos/unsuitable001/openwisp-utils","forks_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/forks","keys_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/teams","hooks_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/hooks","issue_events_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/issues/events{/number}","events_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/events","assignees_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/assignees{/user}","branches_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/branches{/branch}","tags_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/tags","blobs_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/languages","stargazers_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/stargazers","contributors_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/contributors","subscribers_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/subscribers","subscription_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/subscription","commits_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/contents/{+path}","compare_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/merges","archive_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/downloads","issues_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/issues{/number}","pulls_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/labels{/name}","releases_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/releases{/id}","deployments_url":"https://api.github.com/repos/unsuitable001/openwisp-utils/deployments","created_at":"2018-12-05T09:39:17Z","updated_at":"2018-12-08T12:50:03Z","pushed_at":"2018-12-08T12:50:01Z","git_url":"git://github.com/unsuitable001/openwisp-utils.git","ssh_url":"git@github.com:unsuitable001/openwisp-utils.git","clone_url":"https://github.com/unsuitable001/openwisp-utils.git","svn_url":"https://github.com/unsuitable001/openwisp-utils","homepage":null,"size":113,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openwisp:master","ref":"master","sha":"921cc11a544943ac7f5c088da631987161c5e9c6","user":{"login":"openwisp","id":1150243,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNTAyNDM=","avatar_url":"https://avatars1.githubusercontent.com/u/1150243?v=4","gravatar_id":"","url":"https://api.github.com/users/openwisp","html_url":"https://github.com/openwisp","followers_url":"https://api.github.com/users/openwisp/followers","following_url":"https://api.github.com/users/openwisp/following{/other_user}","gists_url":"https://api.github.com/users/openwisp/gists{/gist_id}","starred_url":"https://api.github.com/users/openwisp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openwisp/subscriptions","organizations_url":"https://api.github.com/users/openwisp/orgs","repos_url":"https://api.github.com/users/openwisp/repos","events_url":"https://api.github.com/users/openwisp/events{/privacy}","received_events_url":"https://api.github.com/users/openwisp/received_events","type":"Organization","site_admin":false},"repo":{"id":95099346,"node_id":"MDEwOlJlcG9zaXRvcnk5NTA5OTM0Ng==","name":"openwisp-utils","full_name":"openwisp/openwisp-utils","private":false,"owner":{"login":"openwisp","id":1150243,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExNTAyNDM=","avatar_url":"https://avatars1.githubusercontent.com/u/1150243?v=4","gravatar_id":"","url":"https://api.github.com/users/openwisp","html_url":"https://github.com/openwisp","followers_url":"https://api.github.com/users/openwisp/followers","following_url":"https://api.github.com/users/openwisp/following{/other_user}","gists_url":"https://api.github.com/users/openwisp/gists{/gist_id}","starred_url":"https://api.github.com/users/openwisp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openwisp/subscriptions","organizations_url":"https://api.github.com/users/openwisp/orgs","repos_url":"https://api.github.com/users/openwisp/repos","events_url":"https://api.github.com/users/openwisp/events{/privacy}","received_events_url":"https://api.github.com/users/openwisp/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/openwisp/openwisp-utils","description":"Python and Django utilities shared between different openwisp modules","fork":false,"url":"https://api.github.com/repos/openwisp/openwisp-utils","forks_url":"https://api.github.com/repos/openwisp/openwisp-utils/forks","keys_url":"https://api.github.com/repos/openwisp/openwisp-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openwisp/openwisp-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openwisp/openwisp-utils/teams","hooks_url":"https://api.github.com/repos/openwisp/openwisp-utils/hooks","issue_events_url":"https://api.github.com/repos/openwisp/openwisp-utils/issues/events{/number}","events_url":"https://api.github.com/repos/openwisp/openwisp-utils/events","assignees_url":"https://api.github.com/repos/openwisp/openwisp-utils/assignees{/user}","branches_url":"https://api.github.com/repos/openwisp/openwisp-utils/branches{/branch}","tags_url":"https://api.github.com/repos/openwisp/openwisp-utils/tags","blobs_url":"https://api.github.com/repos/openwisp/openwisp-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openwisp/openwisp-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openwisp/openwisp-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/openwisp/openwisp-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openwisp/openwisp-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/openwisp/openwisp-utils/languages","stargazers_url":"https://api.github.com/repos/openwisp/openwisp-utils/stargazers","contributors_url":"https://api.github.com/repos/openwisp/openwisp-utils/contributors","subscribers_url":"https://api.github.com/repos/openwisp/openwisp-utils/subscribers","subscription_url":"https://api.github.com/repos/openwisp/openwisp-utils/subscription","commits_url":"https://api.github.com/repos/openwisp/openwisp-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/openwisp/openwisp-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/openwisp/openwisp-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/openwisp/openwisp-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/openwisp/openwisp-utils/contents/{+path}","compare_url":"https://api.github.com/repos/openwisp/openwisp-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openwisp/openwisp-utils/merges","archive_url":"https://api.github.com/repos/openwisp/openwisp-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openwisp/openwisp-utils/downloads","issues_url":"https://api.github.com/repos/openwisp/openwisp-utils/issues{/number}","pulls_url":"https://api.github.com/repos/openwisp/openwisp-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/openwisp/openwisp-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/openwisp/openwisp-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openwisp/openwisp-utils/labels{/name}","releases_url":"https://api.github.com/repos/openwisp/openwisp-utils/releases{/id}","deployments_url":"https://api.github.com/repos/openwisp/openwisp-utils/deployments","created_at":"2017-06-22T09:35:55Z","updated_at":"2018-12-06T06:13:24Z","pushed_at":"2018-12-08T14:00:14Z","git_url":"git://github.com/openwisp/openwisp-utils.git","ssh_url":"git@github.com:openwisp/openwisp-utils.git","clone_url":"https://github.com/openwisp/openwisp-utils.git","svn_url":"https://github.com/openwisp/openwisp-utils","homepage":null,"size":117,"stargazers_count":36,"watchers_count":36,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":24,"open_issues":11,"watchers":36,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openwisp/openwisp-utils/pulls/30"},"html":{"href":"https://github.com/openwisp/openwisp-utils/pull/30"},"issue":{"href":"https://api.github.com/repos/openwisp/openwisp-utils/issues/30"},"comments":{"href":"https://api.github.com/repos/openwisp/openwisp-utils/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/openwisp/openwisp-utils/pulls/30/comments"},"review_comment":{"href":"https://api.github.com/repos/openwisp/openwisp-utils/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openwisp/openwisp-utils/pulls/30/commits"},"statuses":{"href":"https://api.github.com/repos/openwisp/openwisp-utils/statuses/8601907e1d526488016fd28b15c720fc50e23507"}},"author_association":"NONE"}}
{"actor":{"display_login":"atb00ker"}}