{"action":"created","comment":{"url":"https://api.github.com/repos/SonarSource/sonar-go/pulls/comments/182797135","pull_request_review_id":113669327,"id":182797135,"diff_hunk":"@@ -0,0 +1,76 @@\n+/*\n+ * SonarQube Go Plugin\n+ * Copyright (C) 2018-2018 SonarSource SA\n+ * mailto:info AT sonarsource DOT com\n+ *\n+ * This program is free software; you can redistribute it and/or\n+ * modify it under the terms of the GNU Lesser General Public\n+ * License as published by the Free Software Foundation; either\n+ * version 3 of the License, or (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+ * Lesser General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU Lesser General Public License\n+ * along with this program; if not, write to the Free Software Foundation,\n+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n+ */\n+package org.sonar.commonruleengine.checks;\n+\n+import java.util.List;\n+import java.util.regex.Pattern;\n+import org.sonar.check.Rule;\n+import org.sonar.check.RuleProperty;\n+import org.sonar.commonruleengine.EngineContext;\n+import org.sonar.uast.UastNode;\n+import org.sonar.uast.UastNode.Kind;\n+import org.sonar.uast.UastNode.Token;\n+\n+@Rule(key = \"S100\")\n+public class FunctionNameConventionCheck extends Check {\n+\n+  private static final String MESSAGE = \"Rename \\'%s\\' to match the regular expression %s.\";\n+  private static final String DEFAULT_FORMAT = \"^[a-zA-Z0-9]+$\";\n+\n+  @RuleProperty(\n+    key = \"format\",\n+    description = \"Regular expression used to check the function names against\",\n+    defaultValue = DEFAULT_FORMAT)\n+  public String format = DEFAULT_FORMAT;\n+\n+  private Pattern namePattern;\n+\n+  public FunctionNameConventionCheck() {\n+    super(Kind.FUNCTION);\n+  }\n+\n+  @Override\n+  public void initialize(EngineContext context) {\n+    super.initialize(context);\n+    namePattern = Pattern.compile(format);\n+  }\n+\n+  @Override\n+  public void visitNode(UastNode node) {\n+    // exclude java constructors\n+    if (node.nativeNode.equals(\"CONSTRUCTOR\")) {","path":"common-rule-engine/src/main/java/org/sonar/commonruleengine/checks/FunctionNameConventionCheck.java","position":58,"original_position":58,"commit_id":"d1715ece61b4aefee98c3ddc278b63cbf50b93e6","original_commit_id":"d1715ece61b4aefee98c3ddc278b63cbf50b93e6","user":{"login":"m-g-sonar","id":10588758,"avatar_url":"https://avatars2.githubusercontent.com/u/10588758?v=4","gravatar_id":"","url":"https://api.github.com/users/m-g-sonar","html_url":"https://github.com/m-g-sonar","followers_url":"https://api.github.com/users/m-g-sonar/followers","following_url":"https://api.github.com/users/m-g-sonar/following{/other_user}","gists_url":"https://api.github.com/users/m-g-sonar/gists{/gist_id}","starred_url":"https://api.github.com/users/m-g-sonar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/m-g-sonar/subscriptions","organizations_url":"https://api.github.com/users/m-g-sonar/orgs","repos_url":"https://api.github.com/users/m-g-sonar/repos","events_url":"https://api.github.com/users/m-g-sonar/events{/privacy}","received_events_url":"https://api.github.com/users/m-g-sonar/received_events","type":"User","site_admin":false},"body":"I would prefer to have an extra `CONSTRUCTOR` kind added in UastNode.Kind, which can not be fed by Go, but can by Java (kotlin has a notion of constructor). Then you can simply check that the node is not a `CONSTRUCTOR`.","created_at":"2018-04-19T15:54:18Z","updated_at":"2018-04-19T15:56:00Z","html_url":"https://github.com/SonarSource/sonar-go/pull/254#discussion_r182797135","pull_request_url":"https://api.github.com/repos/SonarSource/sonar-go/pulls/254","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonar-go/pulls/comments/182797135"},"html":{"href":"https://github.com/SonarSource/sonar-go/pull/254#discussion_r182797135"},"pull_request":{"href":"https://api.github.com/repos/SonarSource/sonar-go/pulls/254"}}},"pull_request":{"url":"https://api.github.com/repos/SonarSource/sonar-go/pulls/254","id":182745321,"html_url":"https://github.com/SonarSource/sonar-go/pull/254","diff_url":"https://github.com/SonarSource/sonar-go/pull/254.diff","patch_url":"https://github.com/SonarSource/sonar-go/pull/254.patch","issue_url":"https://api.github.com/repos/SonarSource/sonar-go/issues/254","number":254,"state":"open","locked":false,"title":"Rule S100: Function and method names should comply with a naming convention","user":{"login":"vilchik-elena","id":10108186,"avatar_url":"https://avatars1.githubusercontent.com/u/10108186?v=4","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":"Fixes #103 ","created_at":"2018-04-19T11:24:18Z","updated_at":"2018-04-19T15:56:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4d69a8ebc2a5b046db3cdff300622cee8b65731c","assignee":{"login":"vilchik-elena","id":10108186,"avatar_url":"https://avatars1.githubusercontent.com/u/10108186?v=4","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},"assignees":[{"login":"vilchik-elena","id":10108186,"avatar_url":"https://avatars1.githubusercontent.com/u/10108186?v=4","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}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":850109905,"url":"https://api.github.com/repos/SonarSource/sonar-go/labels/in%20progress","name":"in progress","color":"ededed","default":false},{"id":850256960,"url":"https://api.github.com/repos/SonarSource/sonar-go/labels/new-rule","name":"new-rule","color":"afffda","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/SonarSource/sonar-go/pulls/254/commits","review_comments_url":"https://api.github.com/repos/SonarSource/sonar-go/pulls/254/comments","review_comment_url":"https://api.github.com/repos/SonarSource/sonar-go/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SonarSource/sonar-go/issues/254/comments","statuses_url":"https://api.github.com/repos/SonarSource/sonar-go/statuses/d1715ece61b4aefee98c3ddc278b63cbf50b93e6","head":{"label":"SonarSource:issue-103","ref":"issue-103","sha":"d1715ece61b4aefee98c3ddc278b63cbf50b93e6","user":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars0.githubusercontent.com/u/545988?v=4","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"repo":{"id":122954189,"name":"sonar-go","full_name":"SonarSource/sonar-go","owner":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars0.githubusercontent.com/u/545988?v=4","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SonarSource/sonar-go","description":"SonarGo: Go Analyzer for SonarQube","fork":false,"url":"https://api.github.com/repos/SonarSource/sonar-go","forks_url":"https://api.github.com/repos/SonarSource/sonar-go/forks","keys_url":"https://api.github.com/repos/SonarSource/sonar-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/sonar-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/sonar-go/teams","hooks_url":"https://api.github.com/repos/SonarSource/sonar-go/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/sonar-go/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/sonar-go/events","assignees_url":"https://api.github.com/repos/SonarSource/sonar-go/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/sonar-go/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/sonar-go/tags","blobs_url":"https://api.github.com/repos/SonarSource/sonar-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/sonar-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/sonar-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/sonar-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/sonar-go/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/sonar-go/languages","stargazers_url":"https://api.github.com/repos/SonarSource/sonar-go/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/sonar-go/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/sonar-go/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/sonar-go/subscription","commits_url":"https://api.github.com/repos/SonarSource/sonar-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/sonar-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/sonar-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/sonar-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/sonar-go/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/sonar-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/sonar-go/merges","archive_url":"https://api.github.com/repos/SonarSource/sonar-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/sonar-go/downloads","issues_url":"https://api.github.com/repos/SonarSource/sonar-go/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/sonar-go/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/sonar-go/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/sonar-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/sonar-go/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/sonar-go/releases{/id}","deployments_url":"https://api.github.com/repos/SonarSource/sonar-go/deployments","created_at":"2018-02-26T10:33:29Z","updated_at":"2018-04-19T09:53:27Z","pushed_at":"2018-04-19T15:53:00Z","git_url":"git://github.com/SonarSource/sonar-go.git","ssh_url":"git@github.com:SonarSource/sonar-go.git","clone_url":"https://github.com/SonarSource/sonar-go.git","svn_url":"https://github.com/SonarSource/sonar-go","homepage":"https://docs.sonarqube.org/display/PLUG/SonarGo","size":1221,"stargazers_count":16,"watchers_count":16,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":52,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":52,"watchers":16,"default_branch":"master"}},"base":{"label":"SonarSource:master","ref":"master","sha":"57b67df050fc39e5ad4219d075a27ac0bd7545e1","user":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars0.githubusercontent.com/u/545988?v=4","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"repo":{"id":122954189,"name":"sonar-go","full_name":"SonarSource/sonar-go","owner":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars0.githubusercontent.com/u/545988?v=4","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SonarSource/sonar-go","description":"SonarGo: Go Analyzer for SonarQube","fork":false,"url":"https://api.github.com/repos/SonarSource/sonar-go","forks_url":"https://api.github.com/repos/SonarSource/sonar-go/forks","keys_url":"https://api.github.com/repos/SonarSource/sonar-go/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/sonar-go/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/sonar-go/teams","hooks_url":"https://api.github.com/repos/SonarSource/sonar-go/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/sonar-go/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/sonar-go/events","assignees_url":"https://api.github.com/repos/SonarSource/sonar-go/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/sonar-go/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/sonar-go/tags","blobs_url":"https://api.github.com/repos/SonarSource/sonar-go/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/sonar-go/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/sonar-go/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/sonar-go/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/sonar-go/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/sonar-go/languages","stargazers_url":"https://api.github.com/repos/SonarSource/sonar-go/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/sonar-go/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/sonar-go/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/sonar-go/subscription","commits_url":"https://api.github.com/repos/SonarSource/sonar-go/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/sonar-go/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/sonar-go/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/sonar-go/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/sonar-go/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/sonar-go/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/sonar-go/merges","archive_url":"https://api.github.com/repos/SonarSource/sonar-go/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/sonar-go/downloads","issues_url":"https://api.github.com/repos/SonarSource/sonar-go/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/sonar-go/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/sonar-go/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/sonar-go/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/sonar-go/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/sonar-go/releases{/id}","deployments_url":"https://api.github.com/repos/SonarSource/sonar-go/deployments","created_at":"2018-02-26T10:33:29Z","updated_at":"2018-04-19T09:53:27Z","pushed_at":"2018-04-19T15:53:00Z","git_url":"git://github.com/SonarSource/sonar-go.git","ssh_url":"git@github.com:SonarSource/sonar-go.git","clone_url":"https://github.com/SonarSource/sonar-go.git","svn_url":"https://github.com/SonarSource/sonar-go","homepage":"https://docs.sonarqube.org/display/PLUG/SonarGo","size":1221,"stargazers_count":16,"watchers_count":16,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":52,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":52,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonar-go/pulls/254"},"html":{"href":"https://github.com/SonarSource/sonar-go/pull/254"},"issue":{"href":"https://api.github.com/repos/SonarSource/sonar-go/issues/254"},"comments":{"href":"https://api.github.com/repos/SonarSource/sonar-go/issues/254/comments"},"review_comments":{"href":"https://api.github.com/repos/SonarSource/sonar-go/pulls/254/comments"},"review_comment":{"href":"https://api.github.com/repos/SonarSource/sonar-go/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SonarSource/sonar-go/pulls/254/commits"},"statuses":{"href":"https://api.github.com/repos/SonarSource/sonar-go/statuses/d1715ece61b4aefee98c3ddc278b63cbf50b93e6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"m-g-sonar"}}