{"action":"created","issue":{"url":"https://api.github.com/repos/stevan/p5-App-Critique/issues/11","repository_url":"https://api.github.com/repos/stevan/p5-App-Critique","labels_url":"https://api.github.com/repos/stevan/p5-App-Critique/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/stevan/p5-App-Critique/issues/11/comments","events_url":"https://api.github.com/repos/stevan/p5-App-Critique/issues/11/events","html_url":"https://github.com/stevan/p5-App-Critique/pull/11","id":165211300,"number":11,"title":"Moved the file filters into their own plugin.","user":{"login":"stuartskelton","id":472342,"avatar_url":"https://avatars.githubusercontent.com/u/472342?v=3","gravatar_id":"","url":"https://api.github.com/users/stuartskelton","html_url":"https://github.com/stuartskelton","followers_url":"https://api.github.com/users/stuartskelton/followers","following_url":"https://api.github.com/users/stuartskelton/following{/other_user}","gists_url":"https://api.github.com/users/stuartskelton/gists{/gist_id}","starred_url":"https://api.github.com/users/stuartskelton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stuartskelton/subscriptions","organizations_url":"https://api.github.com/users/stuartskelton/orgs","repos_url":"https://api.github.com/users/stuartskelton/repos","events_url":"https://api.github.com/users/stuartskelton/events{/privacy}","received_events_url":"https://api.github.com/users/stuartskelton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-13T00:29:14Z","updated_at":"2016-07-13T08:22:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/stevan/p5-App-Critique/pulls/11","html_url":"https://github.com/stevan/p5-App-Critique/pull/11","diff_url":"https://github.com/stevan/p5-App-Critique/pull/11.diff","patch_url":"https://github.com/stevan/p5-App-Critique/pull/11.patch"},"body":"The Plugin version of #8. Its pretty much a carbon copy with just a few things moved about.\r\n\r\nExcept for a tinnie tiny bug I noticed with respect to `_filter`, if the default or fallback subroutine requires more than just $opt to be passed in, like no-violations, then it would have failed. Lucky it was a noisy fail, but a fail none the less.\r\n\r\nI am starting to get the feeling I want to use named params when dealing with the file filters, as it would remove some ambiguity on what param goes where. "},"comment":{"url":"https://api.github.com/repos/stevan/p5-App-Critique/issues/comments/232289695","html_url":"https://github.com/stevan/p5-App-Critique/pull/11#issuecomment-232289695","issue_url":"https://api.github.com/repos/stevan/p5-App-Critique/issues/11","id":232289695,"user":{"login":"stevan","id":45678,"avatar_url":"https://avatars.githubusercontent.com/u/45678?v=3","gravatar_id":"","url":"https://api.github.com/users/stevan","html_url":"https://github.com/stevan","followers_url":"https://api.github.com/users/stevan/followers","following_url":"https://api.github.com/users/stevan/following{/other_user}","gists_url":"https://api.github.com/users/stevan/gists{/gist_id}","starred_url":"https://api.github.com/users/stevan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevan/subscriptions","organizations_url":"https://api.github.com/users/stevan/orgs","repos_url":"https://api.github.com/users/stevan/repos","events_url":"https://api.github.com/users/stevan/events{/privacy}","received_events_url":"https://api.github.com/users/stevan/received_events","type":"User","site_admin":false},"created_at":"2016-07-13T08:22:35Z","updated_at":"2016-07-13T08:22:35Z","body":"So, I like the idea of named arguments, and I hacked up a quick version of the `regex` one to show what I mean. This also allows us to avoid passing in the `$opt` and instead unpack it into  args more specific (see below), it also allows us to have the `success` and `failure` handlers (again see below).\r\n```\r\nsub _regex {\r\n    my (%args) = @_;\r\n    return sub {\r\n        return unless $args{filter};\r\n        my $path = $_[0]->path->stringify;\r\n        my $f = $args{filter};        \r\n        my $is_match = $args{invert} ? $path !~ /$f/ : $path =~ /$f/;\r\n        if ( $args{verbose} ) {\r\n            if ($is_match) {\r\n                $args{success}->( $path );\r\n            }\r\n            else {\r\n                $args{failure}->( $path );\r\n            }\r\n        }\r\n        return !!$is_match;\r\n    };\r\n}\r\n```\r\nHopefully this makes sense, it should be a relatively straightforward tweak, let me know if you run into issues or have questions.\r\n"}}
{"actor":{"display_login":"stevan"}}