{"action":"closed","issue":{"url":"https://api.github.com/repos/dotnet/roslyn/issues/299","labels_url":"https://api.github.com/repos/dotnet/roslyn/issues/299/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/roslyn/issues/299/comments","events_url":"https://api.github.com/repos/dotnet/roslyn/issues/299/events","html_url":"https://github.com/dotnet/roslyn/issues/299","id":56919163,"number":299,"title":"(Proposal) Coding Guidelines allowances.","user":{"login":"AdamSpeight2008","id":900107,"avatar_url":"https://avatars.githubusercontent.com/u/900107?v=3","gravatar_id":"","url":"https://api.github.com/users/AdamSpeight2008","html_url":"https://github.com/AdamSpeight2008","followers_url":"https://api.github.com/users/AdamSpeight2008/followers","following_url":"https://api.github.com/users/AdamSpeight2008/following{/other_user}","gists_url":"https://api.github.com/users/AdamSpeight2008/gists{/gist_id}","starred_url":"https://api.github.com/users/AdamSpeight2008/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdamSpeight2008/subscriptions","organizations_url":"https://api.github.com/users/AdamSpeight2008/orgs","repos_url":"https://api.github.com/users/AdamSpeight2008/repos","events_url":"https://api.github.com/users/AdamSpeight2008/events{/privacy}","received_events_url":"https://api.github.com/users/AdamSpeight2008/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Area-Infrastructure","name":"Area-Infrastructure","color":"5319e7"},{"url":"https://api.github.com/repos/dotnet/roslyn/labels/Feature%20Request","name":"Feature Request","color":"fc2929"}],"state":"closed","locked":false,"assignee":{"login":"jaredpar","id":146967,"avatar_url":"https://avatars.githubusercontent.com/u/146967?v=3","gravatar_id":"","url":"https://api.github.com/users/jaredpar","html_url":"https://github.com/jaredpar","followers_url":"https://api.github.com/users/jaredpar/followers","following_url":"https://api.github.com/users/jaredpar/following{/other_user}","gists_url":"https://api.github.com/users/jaredpar/gists{/gist_id}","starred_url":"https://api.github.com/users/jaredpar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaredpar/subscriptions","organizations_url":"https://api.github.com/users/jaredpar/orgs","repos_url":"https://api.github.com/users/jaredpar/repos","events_url":"https://api.github.com/users/jaredpar/events{/privacy}","received_events_url":"https://api.github.com/users/jaredpar/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-02-07T17:47:47Z","updated_at":"2015-02-07T20:13:15Z","closed_at":"2015-02-07T20:13:15Z","body":"The coding guidelines should be alter to allow the following styles. which aids the readability of the code.\r\n\r\n* Align on the `:` of named parameters rather than lefthand edge of parmeter name\r\n```c#\r\npublic static ImmutableArray<Diagnostic> GetAllMethodBodyDiagnostics(CSharpCompilation compilation, CancellationToken cancellationToken) \r\n{ \r\n  DiagnosticBag diagnostics = DiagnosticBag.GetInstance(); \r\n  CompileMethodBodies( \r\n                compilation: compilation,  \r\n           moduleBeingBuilt: null,  \r\n          generateDebugInfo: false,  \r\n       hasDeclarationErrors: false,  \r\n                     filter: null,  \r\n                 filterTree: null,  \r\n       filterSpanWithinTree: null, \r\n                diagnostics: diagnostics,  \r\n          cancellationToken: cancellationToken ); \r\n  DocumentationCommentCompiler.WriteDocumentationCommentXml(compilation, null, null, diagnostics, cancellationToken); \r\n  compilation.ReportUnusedImports(diagnostics, cancellationToken); \r\n  \r\n  return diagnostics.ToReadOnlyAndFree(); \r\n} \r\n\r\n```\r\nvs\r\n```c#\r\npublic static ImmutableArray<Diagnostic> GetAllMethodBodyDiagnostics(CSharpCompilation compilation, CancellationToken cancellationToken) \r\n{ \r\n    DiagnosticBag diagnostics = DiagnosticBag.GetInstance(); \r\n    CompileMethodBodies( \r\n         compilation: compilation,  \r\n         moduleBeingBuilt: null,  \r\n         generateDebugInfo: false,  \r\n         hasDeclarationErrors: false,  \r\n         filter: null,  \r\n         filterTree: null,  \r\n         filterSpanWithinTree: null, \r\n         diagnostics: diagnostics,  \r\n         cancellationToken: cancellationToken); \r\n    DocumentationCommentCompiler.WriteDocumentationCommentXml(compilation, null, null, diagnostics, cancellationToken); \r\n    compilation.ReportUnusedImports(diagnostics, cancellationToken); *\r\n    return diagnostics.ToReadOnlyAndFree(); \r\n} \r\n\r\n```\r\n\r\n* Simple IF \r\nIf the If statement is small and has no else, and the code block is small enough.\r\nThe combined width is less than the 80 character width limit.\r\n```c#\r\nif( arg0 == null ) throw new ArgumentException( nameof( arg0 ) );\r\nif( arg0 == null ) { throw new ArgumentException( nameof( arg0 ) ); };\r\n```\r\nvs\r\n```c#\r\nif( arg0 == null )\r\n{\r\n    throw new ArgumentException( nameof( arg0 ) );\r\n}\r\n```\r\nConsider multiple guards statements you are approaching halve of the length of the screen, ever before you've reached the core of the method.\r\n\r\n* Simple case clause\r\n```c#\r\nselect ( value )\r\n{\r\n case 0: return \"Zero\";\r\n case 1: return \"One\";\r\n case 2: return \"Two\";\r\n // ...\r\n case 9: return \"Nine\";\r\n default:\r\n   return \"Foo\";\r\n}```\r\nvs\r\n```c#\r\nselect ( value )\r\n{\r\n case 0:\r\n   return \"Zero\";\r\n case 1: \r\n   return \"One\";\r\n case 2:\r\n    return \"Two\";\r\n // ... \r\n case 9:\r\n    return \"Nine\";\r\n default:\r\n   return \"Foo\";\r\n}\r\n```\r\n15 LoC rather than 25 or 35 if you need to include the `break`\r\n```\r\ncase 0: output = \"Zero\"; break; \r\n```\r\n\r\n* 2 space indentation  \r\nConsider the case of pattern-matching, each scope gets indented, 5 levels of indentation and you're already used a quarter of the permitted code width.\r\n\r\n* Method Parameter align vertically  \r\nIf the method signature is getting \"too\" wide, then consider vertical alignment.\r\n```c#\r\ninternal static MethodSymbol DefineScriptEntryPoint\r\n  (    CSharpCompilation           compilation,\r\n         PEModuleBuilder      moduleBeingBuilt,\r\n              TypeSymbol            returnType,\r\n                    bool  hasDeclarationErrors,\r\n           DiagnosticBag  diagnostics\r\n  ) \r\n{ \r\n```\r\n```c#\r\ninternal static MethodSymbol DefineScriptEntryPoint(CSharpCompilation compilation, PEModuleBuilder moduleBeingBuilt, TypeSymbol returnType, bool hasDeclarationErrors, DiagnosticBag diagnostics) \r\n{\r\n```"}}