{"action":"created","comment":{"url":"https://api.github.com/repos/SonarCommunity/sonar-flex/pulls/comments/35951065","id":35951065,"diff_hunk":"@@ -49,12 +49,32 @@ public void init() {\n \n   @Override\n   public void visitNode(AstNode astNode) {\n-    AstNode lastAstNode = astNode.getLastChild();\n-    if (lastAstNode.getFirstChild().is(FlexGrammar.STATEMENT)\n-      && lastAstNode.getFirstChild().getFirstChild().isNot(FlexGrammar.BREAK_STATEMENT, FlexGrammar.RETURN_STATEMENT, FlexGrammar.THROW_STATEMENT)) {\n+    int jumpStmtNumber = astNode.getDescendants(FlexGrammar.BREAK_STATEMENT, FlexGrammar.RETURN_STATEMENT, FlexGrammar.THROW_STATEMENT).size();\n+\n+    if (jumpStmtNumber < 2) {\n+      AstNode lastAstNode = astNode.getLastChild();\n+      visitLastDirective(astNode, lastAstNode);\n+    }\n+  }\n+\n+  private void visitLastDirective(AstNode astNode, AstNode directive) {\n+    if (isBlock(directive)) {\n+      visitLastDirective(astNode, directive.getFirstChild().getFirstChild().getLastChild());\n+      return;\n+    }\n+    if (directive.getFirstChild().is(FlexGrammar.STATEMENT)\n+      && directive.getFirstChild().getFirstChild().isNot(FlexGrammar.BREAK_STATEMENT, FlexGrammar.RETURN_STATEMENT, FlexGrammar.THROW_STATEMENT)) {\n       getContext().createLineViolation(this, \"Last statement in this switch-clause should be an unconditional break.\",\n         Iterables.getLast(astNode.getChildren(FlexGrammar.CASE_LABEL)));\n     }\n   }\n \n+  private boolean isBlock(AstNode astNode) {","path":"flex-checks/src/main/java/org/sonar/flex/checks/NonEmptyCaseWithoutBreakCheck.java","position":27,"original_position":27,"commit_id":"656bf0064fc26f94b6d60f0823a90f56b1eee008","original_commit_id":"656bf0064fc26f94b6d60f0823a90f56b1eee008","user":{"login":"pynicolas","id":6371790,"avatar_url":"https://avatars.githubusercontent.com/u/6371790?v=3","gravatar_id":"","url":"https://api.github.com/users/pynicolas","html_url":"https://github.com/pynicolas","followers_url":"https://api.github.com/users/pynicolas/followers","following_url":"https://api.github.com/users/pynicolas/following{/other_user}","gists_url":"https://api.github.com/users/pynicolas/gists{/gist_id}","starred_url":"https://api.github.com/users/pynicolas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pynicolas/subscriptions","organizations_url":"https://api.github.com/users/pynicolas/orgs","repos_url":"https://api.github.com/users/pynicolas/repos","events_url":"https://api.github.com/users/pynicolas/events{/privacy}","received_events_url":"https://api.github.com/users/pynicolas/received_events","type":"User","site_admin":false},"body":"@vilchik-elena Could we fix quality flaws in this pull request?","created_at":"2015-07-31T07:12:49Z","updated_at":"2015-07-31T07:12:49Z","html_url":"https://github.com/SonarCommunity/sonar-flex/pull/18#discussion_r35951065","pull_request_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/SonarCommunity/sonar-flex/pulls/comments/35951065"},"html":{"href":"https://github.com/SonarCommunity/sonar-flex/pull/18#discussion_r35951065"},"pull_request":{"href":"https://api.github.com/repos/SonarCommunity/sonar-flex/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/SonarCommunity/sonar-flex/pulls/18","id":41249408,"html_url":"https://github.com/SonarCommunity/sonar-flex/pull/18","diff_url":"https://github.com/SonarCommunity/sonar-flex/pull/18.diff","patch_url":"https://github.com/SonarCommunity/sonar-flex/pull/18.patch","issue_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/issues/18","number":18,"state":"open","locked":false,"title":"SONARFLEX-49 FP NonEmptyCaseWithoutBreak","user":{"login":"vilchik-elena","id":10108186,"avatar_url":"https://avatars.githubusercontent.com/u/10108186?v=3","gravatar_id":"","url":"https://api.github.com/users/vilchik-elena","html_url":"https://github.com/vilchik-elena","followers_url":"https://api.github.com/users/vilchik-elena/followers","following_url":"https://api.github.com/users/vilchik-elena/following{/other_user}","gists_url":"https://api.github.com/users/vilchik-elena/gists{/gist_id}","starred_url":"https://api.github.com/users/vilchik-elena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vilchik-elena/subscriptions","organizations_url":"https://api.github.com/users/vilchik-elena/orgs","repos_url":"https://api.github.com/users/vilchik-elena/repos","events_url":"https://api.github.com/users/vilchik-elena/events{/privacy}","received_events_url":"https://api.github.com/users/vilchik-elena/received_events","type":"User","site_admin":false},"body":"conditional returns and block","created_at":"2015-07-30T15:46:03Z","updated_at":"2015-07-31T07:12:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9f1f29b2ed0173875a9db18b9118b0f56325a3a2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/pulls/18/commits","review_comments_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/pulls/18/comments","review_comment_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/issues/18/comments","statuses_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/statuses/656bf0064fc26f94b6d60f0823a90f56b1eee008","head":{"label":"SonarCommunity:SONARFLEX-49","ref":"SONARFLEX-49","sha":"656bf0064fc26f94b6d60f0823a90f56b1eee008","user":{"login":"SonarCommunity","id":1303819,"avatar_url":"https://avatars.githubusercontent.com/u/1303819?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarCommunity","html_url":"https://github.com/SonarCommunity","followers_url":"https://api.github.com/users/SonarCommunity/followers","following_url":"https://api.github.com/users/SonarCommunity/following{/other_user}","gists_url":"https://api.github.com/users/SonarCommunity/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarCommunity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarCommunity/subscriptions","organizations_url":"https://api.github.com/users/SonarCommunity/orgs","repos_url":"https://api.github.com/users/SonarCommunity/repos","events_url":"https://api.github.com/users/SonarCommunity/events{/privacy}","received_events_url":"https://api.github.com/users/SonarCommunity/received_events","type":"Organization","site_admin":false},"repo":{"id":4544996,"name":"sonar-flex","full_name":"SonarCommunity/sonar-flex","owner":{"login":"SonarCommunity","id":1303819,"avatar_url":"https://avatars.githubusercontent.com/u/1303819?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarCommunity","html_url":"https://github.com/SonarCommunity","followers_url":"https://api.github.com/users/SonarCommunity/followers","following_url":"https://api.github.com/users/SonarCommunity/following{/other_user}","gists_url":"https://api.github.com/users/SonarCommunity/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarCommunity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarCommunity/subscriptions","organizations_url":"https://api.github.com/users/SonarCommunity/orgs","repos_url":"https://api.github.com/users/SonarCommunity/repos","events_url":"https://api.github.com/users/SonarCommunity/events{/privacy}","received_events_url":"https://api.github.com/users/SonarCommunity/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SonarCommunity/sonar-flex","description":"","fork":false,"url":"https://api.github.com/repos/SonarCommunity/sonar-flex","forks_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/forks","keys_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/teams","hooks_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/hooks","issue_events_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/issues/events{/number}","events_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/events","assignees_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/assignees{/user}","branches_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/branches{/branch}","tags_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/tags","blobs_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/languages","stargazers_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/stargazers","contributors_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/contributors","subscribers_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/subscribers","subscription_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/subscription","commits_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/contents/{+path}","compare_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/merges","archive_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/downloads","issues_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/issues{/number}","pulls_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/labels{/name}","releases_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/releases{/id}","created_at":"2012-06-04T08:38:45Z","updated_at":"2015-07-16T13:35:26Z","pushed_at":"2015-07-31T07:04:06Z","git_url":"git://github.com/SonarCommunity/sonar-flex.git","ssh_url":"git@github.com:SonarCommunity/sonar-flex.git","clone_url":"https://github.com/SonarCommunity/sonar-flex.git","svn_url":"https://github.com/SonarCommunity/sonar-flex","homepage":"http://docs.codehaus.org/display/SONAR/Flex+Plugin","size":3780,"stargazers_count":4,"watchers_count":4,"language":"ActionScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":4,"default_branch":"master"}},"base":{"label":"SonarCommunity:master","ref":"master","sha":"3fd19d86986d60375857ddf2f21c1cbfa1591496","user":{"login":"SonarCommunity","id":1303819,"avatar_url":"https://avatars.githubusercontent.com/u/1303819?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarCommunity","html_url":"https://github.com/SonarCommunity","followers_url":"https://api.github.com/users/SonarCommunity/followers","following_url":"https://api.github.com/users/SonarCommunity/following{/other_user}","gists_url":"https://api.github.com/users/SonarCommunity/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarCommunity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarCommunity/subscriptions","organizations_url":"https://api.github.com/users/SonarCommunity/orgs","repos_url":"https://api.github.com/users/SonarCommunity/repos","events_url":"https://api.github.com/users/SonarCommunity/events{/privacy}","received_events_url":"https://api.github.com/users/SonarCommunity/received_events","type":"Organization","site_admin":false},"repo":{"id":4544996,"name":"sonar-flex","full_name":"SonarCommunity/sonar-flex","owner":{"login":"SonarCommunity","id":1303819,"avatar_url":"https://avatars.githubusercontent.com/u/1303819?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarCommunity","html_url":"https://github.com/SonarCommunity","followers_url":"https://api.github.com/users/SonarCommunity/followers","following_url":"https://api.github.com/users/SonarCommunity/following{/other_user}","gists_url":"https://api.github.com/users/SonarCommunity/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarCommunity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarCommunity/subscriptions","organizations_url":"https://api.github.com/users/SonarCommunity/orgs","repos_url":"https://api.github.com/users/SonarCommunity/repos","events_url":"https://api.github.com/users/SonarCommunity/events{/privacy}","received_events_url":"https://api.github.com/users/SonarCommunity/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SonarCommunity/sonar-flex","description":"","fork":false,"url":"https://api.github.com/repos/SonarCommunity/sonar-flex","forks_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/forks","keys_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/teams","hooks_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/hooks","issue_events_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/issues/events{/number}","events_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/events","assignees_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/assignees{/user}","branches_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/branches{/branch}","tags_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/tags","blobs_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/languages","stargazers_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/stargazers","contributors_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/contributors","subscribers_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/subscribers","subscription_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/subscription","commits_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/contents/{+path}","compare_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/merges","archive_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/downloads","issues_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/issues{/number}","pulls_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/labels{/name}","releases_url":"https://api.github.com/repos/SonarCommunity/sonar-flex/releases{/id}","created_at":"2012-06-04T08:38:45Z","updated_at":"2015-07-16T13:35:26Z","pushed_at":"2015-07-31T07:04:06Z","git_url":"git://github.com/SonarCommunity/sonar-flex.git","ssh_url":"git@github.com:SonarCommunity/sonar-flex.git","clone_url":"https://github.com/SonarCommunity/sonar-flex.git","svn_url":"https://github.com/SonarCommunity/sonar-flex","homepage":"http://docs.codehaus.org/display/SONAR/Flex+Plugin","size":3780,"stargazers_count":4,"watchers_count":4,"language":"ActionScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SonarCommunity/sonar-flex/pulls/18"},"html":{"href":"https://github.com/SonarCommunity/sonar-flex/pull/18"},"issue":{"href":"https://api.github.com/repos/SonarCommunity/sonar-flex/issues/18"},"comments":{"href":"https://api.github.com/repos/SonarCommunity/sonar-flex/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/SonarCommunity/sonar-flex/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/SonarCommunity/sonar-flex/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SonarCommunity/sonar-flex/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/SonarCommunity/sonar-flex/statuses/656bf0064fc26f94b6d60f0823a90f56b1eee008"}}}}