{"action":"created","issue":{"url":"https://api.github.com/repos/JosefPihrt/Roslynator/issues/405","repository_url":"https://api.github.com/repos/JosefPihrt/Roslynator","labels_url":"https://api.github.com/repos/JosefPihrt/Roslynator/issues/405/labels{/name}","comments_url":"https://api.github.com/repos/JosefPihrt/Roslynator/issues/405/comments","events_url":"https://api.github.com/repos/JosefPihrt/Roslynator/issues/405/events","html_url":"https://github.com/JosefPihrt/Roslynator/issues/405","id":338671896,"node_id":"MDU6SXNzdWUzMzg2NzE4OTY=","number":405,"title":"Suggestion RCS1073: Use Alternate Example","user":{"login":"slatejn","id":40867755,"node_id":"MDQ6VXNlcjQwODY3NzU1","avatar_url":"https://avatars1.githubusercontent.com/u/40867755?v=4","gravatar_id":"","url":"https://api.github.com/users/slatejn","html_url":"https://github.com/slatejn","followers_url":"https://api.github.com/users/slatejn/followers","following_url":"https://api.github.com/users/slatejn/following{/other_user}","gists_url":"https://api.github.com/users/slatejn/gists{/gist_id}","starred_url":"https://api.github.com/users/slatejn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slatejn/subscriptions","organizations_url":"https://api.github.com/users/slatejn/orgs","repos_url":"https://api.github.com/users/slatejn/repos","events_url":"https://api.github.com/users/slatejn/events{/privacy}","received_events_url":"https://api.github.com/users/slatejn/received_events","type":"User","site_admin":false},"labels":[{"id":711300207,"node_id":"MDU6TGFiZWw3MTEzMDAyMDc=","url":"https://api.github.com/repos/JosefPihrt/Roslynator/labels/Area-Analyzers","name":"Area-Analyzers","color":"0000CD","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-07-05T17:59:41Z","updated_at":"2018-08-24T12:57:39Z","closed_at":null,"author_association":"NONE","body":"The second example shows a null return which is generally not the best idea as it requires extra handling. Examples in a tool that enforces best practices shouldn't demonstrate a potentially problem creating example (missing a null check against the return value).\r\nSuggest an alternate test example that more clearly illustrates the requirement and still returns the (bool) evaluation of an if statement:\r\n## Code with Diagnostic\r\n```c#\r\nint x = 1;\r\nif (x.Length > 0) // RCS1073\r\n{\r\n    return true;\r\n}\r\nelse\r\n{\r\n    return false;\r\n}\r\n```\r\n## Code with Fix\r\n```c#\r\nint x = 1;\r\nvar evalCondition = (x.Length > 0);\r\nreturn evalCondition;\r\n```"},"comment":{"url":"https://api.github.com/repos/JosefPihrt/Roslynator/issues/comments/415750888","html_url":"https://github.com/JosefPihrt/Roslynator/issues/405#issuecomment-415750888","issue_url":"https://api.github.com/repos/JosefPihrt/Roslynator/issues/405","id":415750888,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTc1MDg4OA==","user":{"login":"Debbus72","id":34112915,"node_id":"MDQ6VXNlcjM0MTEyOTE1","avatar_url":"https://avatars0.githubusercontent.com/u/34112915?v=4","gravatar_id":"","url":"https://api.github.com/users/Debbus72","html_url":"https://github.com/Debbus72","followers_url":"https://api.github.com/users/Debbus72/followers","following_url":"https://api.github.com/users/Debbus72/following{/other_user}","gists_url":"https://api.github.com/users/Debbus72/gists{/gist_id}","starred_url":"https://api.github.com/users/Debbus72/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Debbus72/subscriptions","organizations_url":"https://api.github.com/users/Debbus72/orgs","repos_url":"https://api.github.com/users/Debbus72/repos","events_url":"https://api.github.com/users/Debbus72/events{/privacy}","received_events_url":"https://api.github.com/users/Debbus72/received_events","type":"User","site_admin":false},"created_at":"2018-08-24T12:57:39Z","updated_at":"2018-08-24T12:57:39Z","author_association":"NONE","body":"@slatejn For the whole 'return null should be avoided' statement, I would suggest that you look at the new C# 8.0 Nullable Reference Types ( [blog](https://blogs.msdn.microsoft.com/dotnet/2017/11/15/nullable-reference-types-in-csharp/) and [magazine](https://msdn.microsoft.com/en-us/magazine/mt829270.aspx) articles ). \r\n\r\nThere may be room for additional analyzers regarding the new Nullable Reference types feature, but please let RCS1073 stay as-is."}}
{"actor":{"display_login":"Debbus72"}}