{"action":"created","comment":{"url":"https://api.github.com/repos/Saritasa/SaritasaTools/pulls/comments/136833870","pull_request_review_id":60427812,"id":136833870,"diff_hunk":"@@ -18,14 +19,22 @@ public static class EnumUtils\n     {\n #if NET40 || NET452 || NET461\n         /// <summary>\n-        /// Gets the value of Description attribute.\n+        /// Gets a description of enum value. If <see cref=\"DescriptionAttribute\"/> is specified for it, its value will be returned.\n         /// </summary>\n-        /// <param name=\"target\">Enum.</param>\n-        /// <returns>Description text.</returns>\n+        /// <param name=\"target\">Enum value.</param>\n+        /// <returns>Description of the value.</returns>\n         public static string GetDescription(Enum target)\n         {\n             var descAttribute = GetAttribute<DescriptionAttribute>(target);\n-            return descAttribute?.Description;\n+            if (descAttribute != null)\n+            {\n+                return descAttribute.Description;\n+            }\n+\n+            var value = target.ToString();\n+\n+            // Split the value with spaces if it is intercapped.\n+            return Regex.Replace(value, @\"((?<=[a-z])([A-Z])|(?<=[A-Z])([A-Z][a-z]))\", \" $1\", RegexOptions.Compiled);","path":"src/Saritasa.Tools.Common/Utils/EnumUtils.cs","position":31,"original_position":31,"commit_id":"a8dd0bb9e83a7ed6734f7071602ce461665e7ca1","original_commit_id":"a8dd0bb9e83a7ed6734f7071602ce461665e7ca1","user":{"login":"dermeister0","id":4054844,"avatar_url":"https://avatars1.githubusercontent.com/u/4054844?v=4","gravatar_id":"","url":"https://api.github.com/users/dermeister0","html_url":"https://github.com/dermeister0","followers_url":"https://api.github.com/users/dermeister0/followers","following_url":"https://api.github.com/users/dermeister0/following{/other_user}","gists_url":"https://api.github.com/users/dermeister0/gists{/gist_id}","starred_url":"https://api.github.com/users/dermeister0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dermeister0/subscriptions","organizations_url":"https://api.github.com/users/dermeister0/orgs","repos_url":"https://api.github.com/users/dermeister0/repos","events_url":"https://api.github.com/users/dermeister0/events{/privacy}","received_events_url":"https://api.github.com/users/dermeister0/received_events","type":"User","site_admin":false},"body":"It does not make sense to use RegexOptions.Compiled, if you create a new object every time. Need to make the Regex static field.","created_at":"2017-09-04T14:31:44Z","updated_at":"2017-09-04T14:31:44Z","html_url":"https://github.com/Saritasa/SaritasaTools/pull/43#discussion_r136833870","pull_request_url":"https://api.github.com/repos/Saritasa/SaritasaTools/pulls/43","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Saritasa/SaritasaTools/pulls/comments/136833870"},"html":{"href":"https://github.com/Saritasa/SaritasaTools/pull/43#discussion_r136833870"},"pull_request":{"href":"https://api.github.com/repos/Saritasa/SaritasaTools/pulls/43"}}},"pull_request":{"url":"https://api.github.com/repos/Saritasa/SaritasaTools/pulls/43","id":138575423,"html_url":"https://github.com/Saritasa/SaritasaTools/pull/43","diff_url":"https://github.com/Saritasa/SaritasaTools/pull/43.diff","patch_url":"https://github.com/Saritasa/SaritasaTools/pull/43.patch","issue_url":"https://api.github.com/repos/Saritasa/SaritasaTools/issues/43","number":43,"state":"open","locked":false,"title":"Improve logic for retrieving enum value description","user":{"login":"ko-vasilev","id":5964618,"avatar_url":"https://avatars1.githubusercontent.com/u/5964618?v=4","gravatar_id":"","url":"https://api.github.com/users/ko-vasilev","html_url":"https://github.com/ko-vasilev","followers_url":"https://api.github.com/users/ko-vasilev/followers","following_url":"https://api.github.com/users/ko-vasilev/following{/other_user}","gists_url":"https://api.github.com/users/ko-vasilev/gists{/gist_id}","starred_url":"https://api.github.com/users/ko-vasilev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ko-vasilev/subscriptions","organizations_url":"https://api.github.com/users/ko-vasilev/orgs","repos_url":"https://api.github.com/users/ko-vasilev/repos","events_url":"https://api.github.com/users/ko-vasilev/events{/privacy}","received_events_url":"https://api.github.com/users/ko-vasilev/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-08-31T03:53:06Z","updated_at":"2017-09-04T14:31:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8fe90f7bc1fccd67dc2a141a0ca7b1f2bd635f55","assignee":null,"assignees":[],"requested_reviewers":[{"login":"krasninja","id":8140942,"avatar_url":"https://avatars1.githubusercontent.com/u/8140942?v=4","gravatar_id":"","url":"https://api.github.com/users/krasninja","html_url":"https://github.com/krasninja","followers_url":"https://api.github.com/users/krasninja/followers","following_url":"https://api.github.com/users/krasninja/following{/other_user}","gists_url":"https://api.github.com/users/krasninja/gists{/gist_id}","starred_url":"https://api.github.com/users/krasninja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krasninja/subscriptions","organizations_url":"https://api.github.com/users/krasninja/orgs","repos_url":"https://api.github.com/users/krasninja/repos","events_url":"https://api.github.com/users/krasninja/events{/privacy}","received_events_url":"https://api.github.com/users/krasninja/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Saritasa/SaritasaTools/pulls/43/commits","review_comments_url":"https://api.github.com/repos/Saritasa/SaritasaTools/pulls/43/comments","review_comment_url":"https://api.github.com/repos/Saritasa/SaritasaTools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Saritasa/SaritasaTools/issues/43/comments","statuses_url":"https://api.github.com/repos/Saritasa/SaritasaTools/statuses/a8dd0bb9e83a7ed6734f7071602ce461665e7ca1","head":{"label":"Saritasa:feature/enum-description","ref":"feature/enum-description","sha":"a8dd0bb9e83a7ed6734f7071602ce461665e7ca1","user":{"login":"Saritasa","id":22166162,"avatar_url":"https://avatars0.githubusercontent.com/u/22166162?v=4","gravatar_id":"","url":"https://api.github.com/users/Saritasa","html_url":"https://github.com/Saritasa","followers_url":"https://api.github.com/users/Saritasa/followers","following_url":"https://api.github.com/users/Saritasa/following{/other_user}","gists_url":"https://api.github.com/users/Saritasa/gists{/gist_id}","starred_url":"https://api.github.com/users/Saritasa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Saritasa/subscriptions","organizations_url":"https://api.github.com/users/Saritasa/orgs","repos_url":"https://api.github.com/users/Saritasa/repos","events_url":"https://api.github.com/users/Saritasa/events{/privacy}","received_events_url":"https://api.github.com/users/Saritasa/received_events","type":"Organization","site_admin":false},"repo":{"id":56565229,"name":"SaritasaTools","full_name":"Saritasa/SaritasaTools","owner":{"login":"Saritasa","id":22166162,"avatar_url":"https://avatars0.githubusercontent.com/u/22166162?v=4","gravatar_id":"","url":"https://api.github.com/users/Saritasa","html_url":"https://github.com/Saritasa","followers_url":"https://api.github.com/users/Saritasa/followers","following_url":"https://api.github.com/users/Saritasa/following{/other_user}","gists_url":"https://api.github.com/users/Saritasa/gists{/gist_id}","starred_url":"https://api.github.com/users/Saritasa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Saritasa/subscriptions","organizations_url":"https://api.github.com/users/Saritasa/orgs","repos_url":"https://api.github.com/users/Saritasa/repos","events_url":"https://api.github.com/users/Saritasa/events{/privacy}","received_events_url":"https://api.github.com/users/Saritasa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Saritasa/SaritasaTools","description":"Development tools for company's .NET projects.","fork":false,"url":"https://api.github.com/repos/Saritasa/SaritasaTools","forks_url":"https://api.github.com/repos/Saritasa/SaritasaTools/forks","keys_url":"https://api.github.com/repos/Saritasa/SaritasaTools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Saritasa/SaritasaTools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Saritasa/SaritasaTools/teams","hooks_url":"https://api.github.com/repos/Saritasa/SaritasaTools/hooks","issue_events_url":"https://api.github.com/repos/Saritasa/SaritasaTools/issues/events{/number}","events_url":"https://api.github.com/repos/Saritasa/SaritasaTools/events","assignees_url":"https://api.github.com/repos/Saritasa/SaritasaTools/assignees{/user}","branches_url":"https://api.github.com/repos/Saritasa/SaritasaTools/branches{/branch}","tags_url":"https://api.github.com/repos/Saritasa/SaritasaTools/tags","blobs_url":"https://api.github.com/repos/Saritasa/SaritasaTools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Saritasa/SaritasaTools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Saritasa/SaritasaTools/git/refs{/sha}","trees_url":"https://api.github.com/repos/Saritasa/SaritasaTools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Saritasa/SaritasaTools/statuses/{sha}","languages_url":"https://api.github.com/repos/Saritasa/SaritasaTools/languages","stargazers_url":"https://api.github.com/repos/Saritasa/SaritasaTools/stargazers","contributors_url":"https://api.github.com/repos/Saritasa/SaritasaTools/contributors","subscribers_url":"https://api.github.com/repos/Saritasa/SaritasaTools/subscribers","subscription_url":"https://api.github.com/repos/Saritasa/SaritasaTools/subscription","commits_url":"https://api.github.com/repos/Saritasa/SaritasaTools/commits{/sha}","git_commits_url":"https://api.github.com/repos/Saritasa/SaritasaTools/git/commits{/sha}","comments_url":"https://api.github.com/repos/Saritasa/SaritasaTools/comments{/number}","issue_comment_url":"https://api.github.com/repos/Saritasa/SaritasaTools/issues/comments{/number}","contents_url":"https://api.github.com/repos/Saritasa/SaritasaTools/contents/{+path}","compare_url":"https://api.github.com/repos/Saritasa/SaritasaTools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Saritasa/SaritasaTools/merges","archive_url":"https://api.github.com/repos/Saritasa/SaritasaTools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Saritasa/SaritasaTools/downloads","issues_url":"https://api.github.com/repos/Saritasa/SaritasaTools/issues{/number}","pulls_url":"https://api.github.com/repos/Saritasa/SaritasaTools/pulls{/number}","milestones_url":"https://api.github.com/repos/Saritasa/SaritasaTools/milestones{/number}","notifications_url":"https://api.github.com/repos/Saritasa/SaritasaTools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Saritasa/SaritasaTools/labels{/name}","releases_url":"https://api.github.com/repos/Saritasa/SaritasaTools/releases{/id}","deployments_url":"https://api.github.com/repos/Saritasa/SaritasaTools/deployments","created_at":"2016-04-19T04:42:38Z","updated_at":"2017-03-14T02:04:29Z","pushed_at":"2017-09-04T11:08:44Z","git_url":"git://github.com/Saritasa/SaritasaTools.git","ssh_url":"git@github.com:Saritasa/SaritasaTools.git","clone_url":"https://github.com/Saritasa/SaritasaTools.git","svn_url":"https://github.com/Saritasa/SaritasaTools","homepage":"","size":2630,"stargazers_count":8,"watchers_count":8,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":11,"forks":4,"open_issues":11,"watchers":8,"default_branch":"master"}},"base":{"label":"Saritasa:develop","ref":"develop","sha":"9cf7613d38bd7f005d28fbf34a128f4814c071df","user":{"login":"Saritasa","id":22166162,"avatar_url":"https://avatars0.githubusercontent.com/u/22166162?v=4","gravatar_id":"","url":"https://api.github.com/users/Saritasa","html_url":"https://github.com/Saritasa","followers_url":"https://api.github.com/users/Saritasa/followers","following_url":"https://api.github.com/users/Saritasa/following{/other_user}","gists_url":"https://api.github.com/users/Saritasa/gists{/gist_id}","starred_url":"https://api.github.com/users/Saritasa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Saritasa/subscriptions","organizations_url":"https://api.github.com/users/Saritasa/orgs","repos_url":"https://api.github.com/users/Saritasa/repos","events_url":"https://api.github.com/users/Saritasa/events{/privacy}","received_events_url":"https://api.github.com/users/Saritasa/received_events","type":"Organization","site_admin":false},"repo":{"id":56565229,"name":"SaritasaTools","full_name":"Saritasa/SaritasaTools","owner":{"login":"Saritasa","id":22166162,"avatar_url":"https://avatars0.githubusercontent.com/u/22166162?v=4","gravatar_id":"","url":"https://api.github.com/users/Saritasa","html_url":"https://github.com/Saritasa","followers_url":"https://api.github.com/users/Saritasa/followers","following_url":"https://api.github.com/users/Saritasa/following{/other_user}","gists_url":"https://api.github.com/users/Saritasa/gists{/gist_id}","starred_url":"https://api.github.com/users/Saritasa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Saritasa/subscriptions","organizations_url":"https://api.github.com/users/Saritasa/orgs","repos_url":"https://api.github.com/users/Saritasa/repos","events_url":"https://api.github.com/users/Saritasa/events{/privacy}","received_events_url":"https://api.github.com/users/Saritasa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Saritasa/SaritasaTools","description":"Development tools for company's .NET projects.","fork":false,"url":"https://api.github.com/repos/Saritasa/SaritasaTools","forks_url":"https://api.github.com/repos/Saritasa/SaritasaTools/forks","keys_url":"https://api.github.com/repos/Saritasa/SaritasaTools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Saritasa/SaritasaTools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Saritasa/SaritasaTools/teams","hooks_url":"https://api.github.com/repos/Saritasa/SaritasaTools/hooks","issue_events_url":"https://api.github.com/repos/Saritasa/SaritasaTools/issues/events{/number}","events_url":"https://api.github.com/repos/Saritasa/SaritasaTools/events","assignees_url":"https://api.github.com/repos/Saritasa/SaritasaTools/assignees{/user}","branches_url":"https://api.github.com/repos/Saritasa/SaritasaTools/branches{/branch}","tags_url":"https://api.github.com/repos/Saritasa/SaritasaTools/tags","blobs_url":"https://api.github.com/repos/Saritasa/SaritasaTools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Saritasa/SaritasaTools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Saritasa/SaritasaTools/git/refs{/sha}","trees_url":"https://api.github.com/repos/Saritasa/SaritasaTools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Saritasa/SaritasaTools/statuses/{sha}","languages_url":"https://api.github.com/repos/Saritasa/SaritasaTools/languages","stargazers_url":"https://api.github.com/repos/Saritasa/SaritasaTools/stargazers","contributors_url":"https://api.github.com/repos/Saritasa/SaritasaTools/contributors","subscribers_url":"https://api.github.com/repos/Saritasa/SaritasaTools/subscribers","subscription_url":"https://api.github.com/repos/Saritasa/SaritasaTools/subscription","commits_url":"https://api.github.com/repos/Saritasa/SaritasaTools/commits{/sha}","git_commits_url":"https://api.github.com/repos/Saritasa/SaritasaTools/git/commits{/sha}","comments_url":"https://api.github.com/repos/Saritasa/SaritasaTools/comments{/number}","issue_comment_url":"https://api.github.com/repos/Saritasa/SaritasaTools/issues/comments{/number}","contents_url":"https://api.github.com/repos/Saritasa/SaritasaTools/contents/{+path}","compare_url":"https://api.github.com/repos/Saritasa/SaritasaTools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Saritasa/SaritasaTools/merges","archive_url":"https://api.github.com/repos/Saritasa/SaritasaTools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Saritasa/SaritasaTools/downloads","issues_url":"https://api.github.com/repos/Saritasa/SaritasaTools/issues{/number}","pulls_url":"https://api.github.com/repos/Saritasa/SaritasaTools/pulls{/number}","milestones_url":"https://api.github.com/repos/Saritasa/SaritasaTools/milestones{/number}","notifications_url":"https://api.github.com/repos/Saritasa/SaritasaTools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Saritasa/SaritasaTools/labels{/name}","releases_url":"https://api.github.com/repos/Saritasa/SaritasaTools/releases{/id}","deployments_url":"https://api.github.com/repos/Saritasa/SaritasaTools/deployments","created_at":"2016-04-19T04:42:38Z","updated_at":"2017-03-14T02:04:29Z","pushed_at":"2017-09-04T11:08:44Z","git_url":"git://github.com/Saritasa/SaritasaTools.git","ssh_url":"git@github.com:Saritasa/SaritasaTools.git","clone_url":"https://github.com/Saritasa/SaritasaTools.git","svn_url":"https://github.com/Saritasa/SaritasaTools","homepage":"","size":2630,"stargazers_count":8,"watchers_count":8,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":11,"forks":4,"open_issues":11,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Saritasa/SaritasaTools/pulls/43"},"html":{"href":"https://github.com/Saritasa/SaritasaTools/pull/43"},"issue":{"href":"https://api.github.com/repos/Saritasa/SaritasaTools/issues/43"},"comments":{"href":"https://api.github.com/repos/Saritasa/SaritasaTools/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/Saritasa/SaritasaTools/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/Saritasa/SaritasaTools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Saritasa/SaritasaTools/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/Saritasa/SaritasaTools/statuses/a8dd0bb9e83a7ed6734f7071602ce461665e7ca1"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"dermeister0"}}