{"action":"created","comment":{"url":"https://api.github.com/repos/ament/ament_lint/pulls/comments/27748514","id":27748514,"diff_hunk":"@@ -382,6 +386,16 @@ def IsValidFile(filename):\n     return filename.endswith('.cmake') or os.path.basename(filename).lower() == 'cmakelists.txt'\n \n def ProcessFile(filename):\n+    # Store and then restore the filters to prevent pragmas in the file from persisting.\n+    original_filters = list(_lint_state.filters)\n+    try:\n+        return _ProcessFile(filename)","path":"ament_lint_cmake/ament_lint_cmake/cmakelint.py","position":32,"original_position":32,"commit_id":"04b8e00a1c557a5ef98126aa370d9b1f69c6e4a2","original_commit_id":"04b8e00a1c557a5ef98126aa370d9b1f69c6e4a2","user":{"login":"wjwwood","id":100427,"avatar_url":"https://avatars.githubusercontent.com/u/100427?v=3","gravatar_id":"","url":"https://api.github.com/users/wjwwood","html_url":"https://github.com/wjwwood","followers_url":"https://api.github.com/users/wjwwood/followers","following_url":"https://api.github.com/users/wjwwood/following{/other_user}","gists_url":"https://api.github.com/users/wjwwood/gists{/gist_id}","starred_url":"https://api.github.com/users/wjwwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjwwood/subscriptions","organizations_url":"https://api.github.com/users/wjwwood/orgs","repos_url":"https://api.github.com/users/wjwwood/repos","events_url":"https://api.github.com/users/wjwwood/events{/privacy}","received_events_url":"https://api.github.com/users/wjwwood/received_events","type":"User","site_admin":false},"body":"I don't think so, because the `_lint_state` object is a global and `_ProcessFile` (potentially) mutates it. If I were to implement this in the `_ProcessFile` function then I would just wrap the whole thing in a try/finally (which is what I've done). Is there something you were thinking I should do instead?","created_at":"2015-04-03T19:02:06Z","updated_at":"2015-04-03T19:02:06Z","html_url":"https://github.com/ament/ament_lint/pull/16#discussion_r27748514","pull_request_url":"https://api.github.com/repos/ament/ament_lint/pulls/16","_links":{"self":{"href":"https://api.github.com/repos/ament/ament_lint/pulls/comments/27748514"},"html":{"href":"https://github.com/ament/ament_lint/pull/16#discussion_r27748514"},"pull_request":{"href":"https://api.github.com/repos/ament/ament_lint/pulls/16"}}},"pull_request":{"url":"https://api.github.com/repos/ament/ament_lint/pulls/16","id":32478954,"html_url":"https://github.com/ament/ament_lint/pull/16","diff_url":"https://github.com/ament/ament_lint/pull/16.diff","patch_url":"https://github.com/ament/ament_lint/pull/16.patch","issue_url":"https://api.github.com/repos/ament/ament_lint/issues/16","number":16,"state":"open","locked":false,"title":"Some fixes to ament_lint_cmake","user":{"login":"wjwwood","id":100427,"avatar_url":"https://avatars.githubusercontent.com/u/100427?v=3","gravatar_id":"","url":"https://api.github.com/users/wjwwood","html_url":"https://github.com/wjwwood","followers_url":"https://api.github.com/users/wjwwood/followers","following_url":"https://api.github.com/users/wjwwood/following{/other_user}","gists_url":"https://api.github.com/users/wjwwood/gists{/gist_id}","starred_url":"https://api.github.com/users/wjwwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjwwood/subscriptions","organizations_url":"https://api.github.com/users/wjwwood/orgs","repos_url":"https://api.github.com/users/wjwwood/repos","events_url":"https://api.github.com/users/wjwwood/events{/privacy}","received_events_url":"https://api.github.com/users/wjwwood/received_events","type":"User","site_admin":false},"body":"Two main things:\r\n\r\n- added a `--filters` option to `ament_lint_cmake`\r\n- added the ability to set filters for a file using a CMake comment\r\n\r\n@dirk-thomas @esteve @tfoote for review.","created_at":"2015-04-02T02:44:05Z","updated_at":"2015-04-03T19:02:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"56e5ef4edab87ea4fa9814bdb38a4b2c00f04624","assignee":{"login":"wjwwood","id":100427,"avatar_url":"https://avatars.githubusercontent.com/u/100427?v=3","gravatar_id":"","url":"https://api.github.com/users/wjwwood","html_url":"https://github.com/wjwwood","followers_url":"https://api.github.com/users/wjwwood/followers","following_url":"https://api.github.com/users/wjwwood/following{/other_user}","gists_url":"https://api.github.com/users/wjwwood/gists{/gist_id}","starred_url":"https://api.github.com/users/wjwwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjwwood/subscriptions","organizations_url":"https://api.github.com/users/wjwwood/orgs","repos_url":"https://api.github.com/users/wjwwood/repos","events_url":"https://api.github.com/users/wjwwood/events{/privacy}","received_events_url":"https://api.github.com/users/wjwwood/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ament/ament_lint/pulls/16/commits","review_comments_url":"https://api.github.com/repos/ament/ament_lint/pulls/16/comments","review_comment_url":"https://api.github.com/repos/ament/ament_lint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ament/ament_lint/issues/16/comments","statuses_url":"https://api.github.com/repos/ament/ament_lint/statuses/04b8e00a1c557a5ef98126aa370d9b1f69c6e4a2","head":{"label":"ament:fixup_ament_lint_cmake","ref":"fixup_ament_lint_cmake","sha":"04b8e00a1c557a5ef98126aa370d9b1f69c6e4a2","user":{"login":"ament","id":7365061,"avatar_url":"https://avatars.githubusercontent.com/u/7365061?v=3","gravatar_id":"","url":"https://api.github.com/users/ament","html_url":"https://github.com/ament","followers_url":"https://api.github.com/users/ament/followers","following_url":"https://api.github.com/users/ament/following{/other_user}","gists_url":"https://api.github.com/users/ament/gists{/gist_id}","starred_url":"https://api.github.com/users/ament/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ament/subscriptions","organizations_url":"https://api.github.com/users/ament/orgs","repos_url":"https://api.github.com/users/ament/repos","events_url":"https://api.github.com/users/ament/events{/privacy}","received_events_url":"https://api.github.com/users/ament/received_events","type":"Organization","site_admin":false},"repo":{"id":20264700,"name":"ament_lint","full_name":"ament/ament_lint","owner":{"login":"ament","id":7365061,"avatar_url":"https://avatars.githubusercontent.com/u/7365061?v=3","gravatar_id":"","url":"https://api.github.com/users/ament","html_url":"https://github.com/ament","followers_url":"https://api.github.com/users/ament/followers","following_url":"https://api.github.com/users/ament/following{/other_user}","gists_url":"https://api.github.com/users/ament/gists{/gist_id}","starred_url":"https://api.github.com/users/ament/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ament/subscriptions","organizations_url":"https://api.github.com/users/ament/orgs","repos_url":"https://api.github.com/users/ament/repos","events_url":"https://api.github.com/users/ament/events{/privacy}","received_events_url":"https://api.github.com/users/ament/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ament/ament_lint","description":"","fork":false,"url":"https://api.github.com/repos/ament/ament_lint","forks_url":"https://api.github.com/repos/ament/ament_lint/forks","keys_url":"https://api.github.com/repos/ament/ament_lint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ament/ament_lint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ament/ament_lint/teams","hooks_url":"https://api.github.com/repos/ament/ament_lint/hooks","issue_events_url":"https://api.github.com/repos/ament/ament_lint/issues/events{/number}","events_url":"https://api.github.com/repos/ament/ament_lint/events","assignees_url":"https://api.github.com/repos/ament/ament_lint/assignees{/user}","branches_url":"https://api.github.com/repos/ament/ament_lint/branches{/branch}","tags_url":"https://api.github.com/repos/ament/ament_lint/tags","blobs_url":"https://api.github.com/repos/ament/ament_lint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ament/ament_lint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ament/ament_lint/git/refs{/sha}","trees_url":"https://api.github.com/repos/ament/ament_lint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ament/ament_lint/statuses/{sha}","languages_url":"https://api.github.com/repos/ament/ament_lint/languages","stargazers_url":"https://api.github.com/repos/ament/ament_lint/stargazers","contributors_url":"https://api.github.com/repos/ament/ament_lint/contributors","subscribers_url":"https://api.github.com/repos/ament/ament_lint/subscribers","subscription_url":"https://api.github.com/repos/ament/ament_lint/subscription","commits_url":"https://api.github.com/repos/ament/ament_lint/commits{/sha}","git_commits_url":"https://api.github.com/repos/ament/ament_lint/git/commits{/sha}","comments_url":"https://api.github.com/repos/ament/ament_lint/comments{/number}","issue_comment_url":"https://api.github.com/repos/ament/ament_lint/issues/comments{/number}","contents_url":"https://api.github.com/repos/ament/ament_lint/contents/{+path}","compare_url":"https://api.github.com/repos/ament/ament_lint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ament/ament_lint/merges","archive_url":"https://api.github.com/repos/ament/ament_lint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ament/ament_lint/downloads","issues_url":"https://api.github.com/repos/ament/ament_lint/issues{/number}","pulls_url":"https://api.github.com/repos/ament/ament_lint/pulls{/number}","milestones_url":"https://api.github.com/repos/ament/ament_lint/milestones{/number}","notifications_url":"https://api.github.com/repos/ament/ament_lint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ament/ament_lint/labels{/name}","releases_url":"https://api.github.com/repos/ament/ament_lint/releases{/id}","created_at":"2014-05-28T16:34:17Z","updated_at":"2015-04-02T00:29:20Z","pushed_at":"2015-04-02T02:44:05Z","git_url":"git://github.com/ament/ament_lint.git","ssh_url":"git@github.com:ament/ament_lint.git","clone_url":"https://github.com/ament/ament_lint.git","svn_url":"https://github.com/ament/ament_lint","homepage":null,"size":592,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":1,"default_branch":"master"}},"base":{"label":"ament:master","ref":"master","sha":"2d644073d201ca6cdb7dd2e89cc4b6477e3f47d1","user":{"login":"ament","id":7365061,"avatar_url":"https://avatars.githubusercontent.com/u/7365061?v=3","gravatar_id":"","url":"https://api.github.com/users/ament","html_url":"https://github.com/ament","followers_url":"https://api.github.com/users/ament/followers","following_url":"https://api.github.com/users/ament/following{/other_user}","gists_url":"https://api.github.com/users/ament/gists{/gist_id}","starred_url":"https://api.github.com/users/ament/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ament/subscriptions","organizations_url":"https://api.github.com/users/ament/orgs","repos_url":"https://api.github.com/users/ament/repos","events_url":"https://api.github.com/users/ament/events{/privacy}","received_events_url":"https://api.github.com/users/ament/received_events","type":"Organization","site_admin":false},"repo":{"id":20264700,"name":"ament_lint","full_name":"ament/ament_lint","owner":{"login":"ament","id":7365061,"avatar_url":"https://avatars.githubusercontent.com/u/7365061?v=3","gravatar_id":"","url":"https://api.github.com/users/ament","html_url":"https://github.com/ament","followers_url":"https://api.github.com/users/ament/followers","following_url":"https://api.github.com/users/ament/following{/other_user}","gists_url":"https://api.github.com/users/ament/gists{/gist_id}","starred_url":"https://api.github.com/users/ament/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ament/subscriptions","organizations_url":"https://api.github.com/users/ament/orgs","repos_url":"https://api.github.com/users/ament/repos","events_url":"https://api.github.com/users/ament/events{/privacy}","received_events_url":"https://api.github.com/users/ament/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ament/ament_lint","description":"","fork":false,"url":"https://api.github.com/repos/ament/ament_lint","forks_url":"https://api.github.com/repos/ament/ament_lint/forks","keys_url":"https://api.github.com/repos/ament/ament_lint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ament/ament_lint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ament/ament_lint/teams","hooks_url":"https://api.github.com/repos/ament/ament_lint/hooks","issue_events_url":"https://api.github.com/repos/ament/ament_lint/issues/events{/number}","events_url":"https://api.github.com/repos/ament/ament_lint/events","assignees_url":"https://api.github.com/repos/ament/ament_lint/assignees{/user}","branches_url":"https://api.github.com/repos/ament/ament_lint/branches{/branch}","tags_url":"https://api.github.com/repos/ament/ament_lint/tags","blobs_url":"https://api.github.com/repos/ament/ament_lint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ament/ament_lint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ament/ament_lint/git/refs{/sha}","trees_url":"https://api.github.com/repos/ament/ament_lint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ament/ament_lint/statuses/{sha}","languages_url":"https://api.github.com/repos/ament/ament_lint/languages","stargazers_url":"https://api.github.com/repos/ament/ament_lint/stargazers","contributors_url":"https://api.github.com/repos/ament/ament_lint/contributors","subscribers_url":"https://api.github.com/repos/ament/ament_lint/subscribers","subscription_url":"https://api.github.com/repos/ament/ament_lint/subscription","commits_url":"https://api.github.com/repos/ament/ament_lint/commits{/sha}","git_commits_url":"https://api.github.com/repos/ament/ament_lint/git/commits{/sha}","comments_url":"https://api.github.com/repos/ament/ament_lint/comments{/number}","issue_comment_url":"https://api.github.com/repos/ament/ament_lint/issues/comments{/number}","contents_url":"https://api.github.com/repos/ament/ament_lint/contents/{+path}","compare_url":"https://api.github.com/repos/ament/ament_lint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ament/ament_lint/merges","archive_url":"https://api.github.com/repos/ament/ament_lint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ament/ament_lint/downloads","issues_url":"https://api.github.com/repos/ament/ament_lint/issues{/number}","pulls_url":"https://api.github.com/repos/ament/ament_lint/pulls{/number}","milestones_url":"https://api.github.com/repos/ament/ament_lint/milestones{/number}","notifications_url":"https://api.github.com/repos/ament/ament_lint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ament/ament_lint/labels{/name}","releases_url":"https://api.github.com/repos/ament/ament_lint/releases{/id}","created_at":"2014-05-28T16:34:17Z","updated_at":"2015-04-02T00:29:20Z","pushed_at":"2015-04-02T02:44:05Z","git_url":"git://github.com/ament/ament_lint.git","ssh_url":"git@github.com:ament/ament_lint.git","clone_url":"https://github.com/ament/ament_lint.git","svn_url":"https://github.com/ament/ament_lint","homepage":null,"size":592,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ament/ament_lint/pulls/16"},"html":{"href":"https://github.com/ament/ament_lint/pull/16"},"issue":{"href":"https://api.github.com/repos/ament/ament_lint/issues/16"},"comments":{"href":"https://api.github.com/repos/ament/ament_lint/issues/16/comments"},"review_comments":{"href":"https://api.github.com/repos/ament/ament_lint/pulls/16/comments"},"review_comment":{"href":"https://api.github.com/repos/ament/ament_lint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ament/ament_lint/pulls/16/commits"},"statuses":{"href":"https://api.github.com/repos/ament/ament_lint/statuses/04b8e00a1c557a5ef98126aa370d9b1f69c6e4a2"}}}}