├── global.json ├── dotnet-tools.json ├── src ├── Program.cs ├── GetTheForkOut.sln ├── GetTheForkOut.csproj └── DeleteCommand.cs ├── .github └── workflows │ ├── ci.yaml │ └── publish.yaml ├── LICENSE.md ├── .gitignore ├── README.md └── .editorconfig /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "projects": [ "src" ], 3 | "sdk": { 4 | "version": "5.0.400", 5 | "rollForward": "latestFeature" 6 | } 7 | } -------------------------------------------------------------------------------- /dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "cake.tool": { 6 | "version": "1.1.0", 7 | "commands": [ 8 | "dotnet-cake" 9 | ] 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/Program.cs: -------------------------------------------------------------------------------- 1 | using GetTheForkOut; 2 | using Spectre.Console.Cli; 3 | 4 | namespace GetTheForkOut 5 | { 6 | public static class Program 7 | { 8 | public static int Main(string[] args) 9 | { 10 | var app = new CommandApp(); 11 | app.Configure(config => 12 | { 13 | config.SetApplicationName("dotnet get-the-fork-out"); 14 | }); 15 | 16 | return app.Run(args); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: Continuous Integration 2 | on: pull_request 3 | 4 | env: 5 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true 6 | DOTNET_CLI_TELEMETRY_OPTOUT: true 7 | 8 | jobs: 9 | build: 10 | name: Build 11 | if: "!contains(github.event.head_commit.message, 'skip-ci')" 12 | strategy: 13 | matrix: 14 | kind: ['linux', 'windows', 'macOS'] 15 | include: 16 | - kind: linux 17 | os: ubuntu-latest 18 | - kind: windows 19 | os: windows-latest 20 | - kind: macOS 21 | os: macos-latest 22 | runs-on: ${{ matrix.os }} 23 | steps: 24 | - name: Checkout 25 | uses: actions/checkout@v2 26 | with: 27 | fetch-depth: 0 28 | 29 | - name: Setup dotnet 5.0.400 30 | uses: actions/setup-dotnet@v1 31 | with: 32 | dotnet-version: 5.0.400 33 | 34 | - name: Build 35 | shell: bash 36 | run: | 37 | dotnet tool restore 38 | dotnet cake -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Patrik Svensson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /src/GetTheForkOut.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.0.31717.71 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GetTheForkOut", "GetTheForkOut.csproj", "{5CE5185F-4342-444A-8F45-215694AE4449}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {5CE5185F-4342-444A-8F45-215694AE4449}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {5CE5185F-4342-444A-8F45-215694AE4449}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {5CE5185F-4342-444A-8F45-215694AE4449}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {5CE5185F-4342-444A-8F45-215694AE4449}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {DE5A07FC-D68D-43ED-8B77-3102047789EA} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Misc folders 2 | [Bb]in/ 3 | [Oo]bj/ 4 | [Tt]emp/ 5 | [Pp]ackages/ 6 | /.artifacts/ 7 | src/Example/examples 8 | src/Example/samples 9 | /[Tt]ools/ 10 | 11 | # Cakeup 12 | cakeup-x86_64-latest.exe 13 | 14 | # .NET Core CLI 15 | /.dotnet/ 16 | /.packages/ 17 | dotnet-install.sh* 18 | *.lock.json 19 | 20 | # Visual Studio 21 | .vs/ 22 | .vscode/ 23 | launchSettings.json 24 | *.sln.ide/ 25 | 26 | # Rider 27 | src/.idea/**/workspace.xml 28 | src/.idea/**/tasks.xml 29 | src/.idea/dictionaries 30 | src/.idea/**/dataSources/ 31 | src/.idea/**/dataSources.ids 32 | src/.idea/**/dataSources.xml 33 | src/.idea/**/dataSources.local.xml 34 | src/.idea/**/sqlDataSources.xml 35 | src/.idea/**/dynamic.xml 36 | src/.idea/**/uiDesigner.xml 37 | 38 | ## Ignore Visual Studio temporary files, build results, and 39 | ## files generated by popular Visual Studio add-ons. 40 | 41 | # User-specific files 42 | *.suo 43 | *.user 44 | *.sln.docstates 45 | *.userprefs 46 | *.GhostDoc.xml 47 | *StyleCop.Cache 48 | 49 | # Build results 50 | [Dd]ebug/ 51 | [Rr]elease/ 52 | x64/ 53 | *_i.c 54 | *_p.c 55 | *.ilk 56 | *.meta 57 | *.obj 58 | *.pch 59 | *.pdb 60 | *.pgc 61 | *.pgd 62 | *.rsp 63 | *.sbr 64 | *.tlb 65 | *.tli 66 | *.tlh 67 | *.tmp 68 | *.log 69 | *.vspscc 70 | *.vssscc 71 | .builds 72 | 73 | # Visual Studio profiler 74 | *.psess 75 | *.vsp 76 | *.vspx 77 | 78 | # ReSharper is a .NET coding add-in 79 | _ReSharper* 80 | 81 | # NCrunch 82 | *.ncrunch* 83 | .*crunch*.local.xml 84 | _NCrunch_* 85 | 86 | # NuGet Packages Directory 87 | packages 88 | 89 | # Windows 90 | Thumbs.db -------------------------------------------------------------------------------- /src/GetTheForkOut.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net5.0 6 | enable 7 | get-the-fork-out 8 | enable 9 | 9 10 | true 11 | dotnet-get-the-fork-out 12 | true 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | preview 25 | normal 26 | 27 | 28 | 29 | 30 | A dotnet tool to delete GitHub forks for a user. 31 | Patrik Svensson 32 | git 33 | https://github.com/patriksvensson/get-the-fork-out 34 | https://github.com/patriksvensson/get-the-fork-out 35 | MIT 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /.github/workflows/publish.yaml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | 8 | env: 9 | DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true 10 | DOTNET_CLI_TELEMETRY_OPTOUT: true 11 | 12 | jobs: 13 | 14 | ################################################### 15 | # BUILD 16 | ################################################### 17 | 18 | build: 19 | name: Build 20 | if: "!contains(github.event.head_commit.message, 'skip-ci')" 21 | strategy: 22 | matrix: 23 | kind: ['linux', 'windows', 'macOS'] 24 | include: 25 | - kind: linux 26 | os: ubuntu-latest 27 | - kind: windows 28 | os: windows-latest 29 | - kind: macOS 30 | os: macos-latest 31 | runs-on: ${{ matrix.os }} 32 | steps: 33 | - name: Checkout 34 | uses: actions/checkout@v2 35 | with: 36 | fetch-depth: 0 37 | 38 | - name: Setup dotnet 5.0.400 39 | uses: actions/setup-dotnet@v1 40 | with: 41 | dotnet-version: 5.0.400 42 | 43 | - name: Build 44 | shell: bash 45 | run: | 46 | dotnet tool restore 47 | dotnet cake 48 | 49 | ################################################### 50 | # PUBLISH 51 | ################################################### 52 | 53 | publish: 54 | name: Publish 55 | needs: [build] 56 | if: "!contains(github.event.head_commit.message, 'skip-ci')" 57 | runs-on: ubuntu-latest 58 | steps: 59 | - name: Checkout 60 | uses: actions/checkout@v2 61 | with: 62 | fetch-depth: 0 63 | 64 | - name: Setup dotnet 5.0.400 65 | uses: actions/setup-dotnet@v1 66 | with: 67 | dotnet-version: 5.0.400 68 | 69 | - name: Publish 70 | shell: bash 71 | run: | 72 | dotnet tool restore 73 | dotnet cake --target="publish" \ 74 | --nuget-key="${{secrets.NUGET_API_KEY}}" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Get the fork out 2 | 3 | A dotnet tool to delete GitHub forks for a user. 4 | 5 | ## Disclaimer 6 | 7 | Do not run this application without fully knowing what it does. 8 | Deleted forks CAN NOT be recovered once deleted. 9 | 10 | ## Installing 11 | 12 | ``` 13 | > dotnet tool install -g get-the-fork-out 14 | ``` 15 | 16 | ## Usage 17 | 18 | ``` 19 | USAGE: 20 | dotnet get-the-fork-out [OPTIONS] 21 | 22 | ARGUMENTS: 23 | The GitHub API key to use. 24 | The API key must have the following permissions: 25 | public_repo, delete_repo 26 | OPTIONS: 27 | -h, --help Prints help information 28 | --i-know-what-i-am-doing No prompts will be shown. 29 | WARNING: All forks will automatically be deleted 30 | ``` 31 | 32 | ## Example 33 | 34 | ``` 35 | ❯ dotnet get-the-fork-out 36 | ┌────────────────────────┬─────────────────┬──────────────────────────────┐ 37 | │ Owner │ Repository │ Last updated │ 38 | ├────────────────────────┼─────────────────┼──────────────────────────────┤ 39 | │ patriksvensson │ vscode │ 2021-10-05 21:50:35 │ 40 | │ patriksvensson │ kubernetes │ 2021-10-05 21:50:45 │ 41 | └────────────────────────┴─────────────────┴──────────────────────────────┘ 42 | ┌─WARNING─────────────────────────────────────────────────────────────────┐ 43 | │ This tool is used to DELETE forks owned by the user patriksvensson. │ 44 | │ Deleted forks cannot be restored. Press CTRL+C to abort at any time. │ 45 | └─────────────────────────────────────────────────────────────────────────┘ 46 | Are you sure that you want to continue? [y/n] (n): y 47 | 48 | Delete patriksvensson/vscode [y/n] (n): y 49 | ✅ Deleted patriksvensson/vscode 50 | 51 | Delete patriksvensson/kubernetes [y/n] (n): y 52 | ✅ Deleted patriksvensson/kubernetes 53 | ``` 54 | -------------------------------------------------------------------------------- /src/DeleteCommand.cs: -------------------------------------------------------------------------------- 1 | using Octokit; 2 | using Spectre.Console; 3 | using Spectre.Console.Cli; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.ComponentModel; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace GetTheForkOut 11 | { 12 | public sealed class DeleteCommand : AsyncCommand 13 | { 14 | public sealed class Settings : CommandSettings 15 | { 16 | [CommandArgument(0, "")] 17 | [Description( 18 | "The GitHub API key to use.\nThe API key must have the following permissions: " + 19 | "[blue]public_repo[/], [blue]delete:packages[/]")] 20 | public string ApiKey { get; } 21 | 22 | [CommandOption("--i-know-what-i-am-doing")] 23 | [DefaultValue(false)] 24 | [Description( 25 | "No prompts will be shown.\n" + 26 | "[yellow]WARNING:[/] All forks will automatically be deleted")] 27 | public bool Force { get; } 28 | 29 | public Settings(string apiKey, bool force) 30 | { 31 | ApiKey = apiKey ?? throw new ArgumentNullException(nameof(apiKey)); 32 | Force = force; 33 | } 34 | } 35 | 36 | public override async Task ExecuteAsync(CommandContext context, Settings settings) 37 | { 38 | var client = new GitHubClient(new ProductHeaderValue("Get-The-Fork-Out")); 39 | client.Credentials = new Credentials(settings.ApiKey); 40 | var user = await client.User.Current(); 41 | 42 | var forks = await GetAllForks(client); 43 | if (!forks.Any()) 44 | { 45 | AnsiConsole.MarkupLine($"No forks for user [yellow]{user.Login}[/] to delete."); 46 | return 0; 47 | } 48 | 49 | if (!ShowConfirmation(user, forks)) 50 | { 51 | return -1; 52 | } 53 | 54 | foreach (var fork in forks) 55 | { 56 | if (!settings.Force) 57 | { 58 | AnsiConsole.WriteLine(); 59 | } 60 | 61 | // Show confirmation prompt 62 | if (ConfirmDelete(fork, settings)) 63 | { 64 | // Delete the fork 65 | await client.Repository.Delete(fork.Owner.Login, fork.Name); 66 | AnsiConsole.MarkupLine($"✅ Deleted [yellow]{fork.Owner.Login}[/]/[yellow]{fork.Name}[/]"); 67 | } 68 | } 69 | 70 | return 0; 71 | } 72 | 73 | private static bool ShowConfirmation(User user, List forks) 74 | { 75 | var table = new Table().Expand(); 76 | table.AddColumns("Owner", "Repository", "Last updated"); 77 | foreach (var fork in forks) 78 | { 79 | table.AddRow( 80 | fork.Owner.Login.EscapeMarkup(), 81 | fork.Name.EscapeMarkup(), 82 | fork.UpdatedAt.ToString("G").EscapeMarkup()); 83 | } 84 | 85 | AnsiConsole.Write(table); 86 | AnsiConsole.Write(new Panel( 87 | $"This tool is used to [red u b]DELETE[/] forks owned by " + 88 | $"the user [yellow]{user.Login}[/].\n" + 89 | "Deleted forks [b]cannot[/] be restored. " + 90 | "Press [white]CTRL+C[/] to abort at any time.") 91 | .Header("[yellow]WARNING[/]") 92 | .BorderColor(Color.Red) 93 | .Expand()); 94 | 95 | return AnsiConsole.Confirm("Are you sure that you want to continue?", defaultValue: false); 96 | } 97 | 98 | private static async Task> GetAllForks(GitHubClient client) 99 | { 100 | var page = 1; 101 | var result = new List(); 102 | 103 | var user = await client.User.Current(); 104 | var repositories = await AnsiConsole.Status().StartAsync("Retrieving forks...", async (status) => 105 | { 106 | while (page < 10) 107 | { 108 | var repositories = await client.Repository.GetAllForUser( 109 | user.Login, 110 | new ApiOptions 111 | { 112 | StartPage = page, 113 | PageSize = 30, 114 | PageCount = 1, 115 | }); 116 | 117 | if (repositories.Count == 0) 118 | { 119 | break; 120 | } 121 | 122 | result.AddRange(repositories); 123 | page++; 124 | } 125 | 126 | return result; 127 | }); 128 | 129 | return repositories 130 | .Where(repo => repo.Fork) 131 | .OrderBy(repo => repo.UpdatedAt) 132 | .ToList(); 133 | } 134 | 135 | private static bool ConfirmDelete(Repository fork, Settings settings) 136 | { 137 | if (settings.Force) 138 | { 139 | return true; 140 | } 141 | 142 | return AnsiConsole.Confirm($"Delete [yellow]{fork.Owner.Login}[/]/[yellow]{fork.Name}[/]", defaultValue: false); 143 | } 144 | } 145 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = CRLF 7 | indent_style = space 8 | indent_size = 4 9 | insert_final_newline = false 10 | trim_trailing_whitespace = true 11 | 12 | [*.sln] 13 | indent_style = tab 14 | 15 | [*.{csproj,vbproj,vcxproj,vcxproj.filters}] 16 | indent_size = 2 17 | 18 | [*.{xml,config,props,targets,nuspec,ruleset}] 19 | indent_size = 2 20 | 21 | [*.{yml,yaml}] 22 | indent_size = 2 23 | 24 | [*.json] 25 | indent_size = 2 26 | 27 | [*.md] 28 | trim_trailing_whitespace = false 29 | 30 | [*.sh] 31 | end_of_line = lf 32 | 33 | [*.cs] 34 | # Sort using and Import directives with System.* appearing first 35 | dotnet_sort_system_directives_first = true 36 | dotnet_separate_import_directive_groups = false 37 | 38 | # Avoid "this." and "Me." if not necessary 39 | dotnet_style_qualification_for_field = false:refactoring 40 | dotnet_style_qualification_for_property = false:refactoring 41 | dotnet_style_qualification_for_method = false:refactoring 42 | dotnet_style_qualification_for_event = false:refactoring 43 | 44 | # Use language keywords instead of framework type names for type references 45 | dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion 46 | dotnet_style_predefined_type_for_member_access = true:suggestion 47 | 48 | # Suggest more modern language features when available 49 | dotnet_style_object_initializer = true:suggestion 50 | dotnet_style_collection_initializer = true:suggestion 51 | dotnet_style_coalesce_expression = true:suggestion 52 | dotnet_style_null_propagation = true:suggestion 53 | dotnet_style_explicit_tuple_names = true:suggestion 54 | 55 | # Non-private static fields are PascalCase 56 | dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion 57 | dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields 58 | dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style 59 | dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field 60 | dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected 61 | dotnet_naming_symbols.non_private_static_fields.required_modifiers = static 62 | dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case 63 | 64 | # Non-private readonly fields are PascalCase 65 | dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion 66 | dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields 67 | dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style 68 | dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field 69 | dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected 70 | dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly 71 | dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case 72 | 73 | # Constants are PascalCase 74 | dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion 75 | dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants 76 | dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style 77 | dotnet_naming_symbols.constants.applicable_kinds = field, local 78 | dotnet_naming_symbols.constants.required_modifiers = const 79 | dotnet_naming_style.constant_style.capitalization = pascal_case 80 | 81 | # Instance fields are camelCase and start with _ 82 | dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion 83 | dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields 84 | dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style 85 | dotnet_naming_symbols.instance_fields.applicable_kinds = field 86 | dotnet_naming_style.instance_field_style.capitalization = camel_case 87 | dotnet_naming_style.instance_field_style.required_prefix = _ 88 | 89 | # Locals and parameters are camelCase 90 | dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion 91 | dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters 92 | dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style 93 | dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local 94 | dotnet_naming_style.camel_case_style.capitalization = camel_case 95 | 96 | # Local functions are PascalCase 97 | dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion 98 | dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions 99 | dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style 100 | dotnet_naming_symbols.local_functions.applicable_kinds = local_function 101 | dotnet_naming_style.local_function_style.capitalization = pascal_case 102 | 103 | # By default, name items with PascalCase 104 | dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion 105 | dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members 106 | dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style 107 | dotnet_naming_symbols.all_members.applicable_kinds = * 108 | dotnet_naming_style.pascal_case_style.capitalization = pascal_case 109 | 110 | # Newline settings 111 | csharp_new_line_before_open_brace = all 112 | csharp_new_line_before_else = true 113 | csharp_new_line_before_catch = true 114 | csharp_new_line_before_finally = true 115 | csharp_new_line_before_members_in_object_initializers = true 116 | csharp_new_line_before_members_in_anonymous_types = true 117 | csharp_new_line_between_query_expression_clauses = true 118 | 119 | # Indentation preferences 120 | csharp_indent_block_contents = true 121 | csharp_indent_braces = false 122 | csharp_indent_case_contents = true 123 | csharp_indent_case_contents_when_block = true 124 | csharp_indent_switch_labels = true 125 | csharp_indent_labels = flush_left 126 | 127 | # Prefer "var" everywhere 128 | csharp_style_var_for_built_in_types = true:suggestion 129 | csharp_style_var_when_type_is_apparent = true:suggestion 130 | csharp_style_var_elsewhere = true:suggestion 131 | 132 | # Prefer method-like constructs to have a block body 133 | csharp_style_expression_bodied_methods = false:none 134 | csharp_style_expression_bodied_constructors = false:none 135 | csharp_style_expression_bodied_operators = false:none 136 | 137 | # Prefer property-like constructs to have an expression-body 138 | csharp_style_expression_bodied_properties = true:none 139 | csharp_style_expression_bodied_indexers = true:none 140 | csharp_style_expression_bodied_accessors = true:none 141 | 142 | # Suggest more modern language features when available 143 | csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion 144 | csharp_style_pattern_matching_over_as_with_null_check = true:suggestion 145 | csharp_style_inlined_variable_declaration = true:suggestion 146 | csharp_style_throw_expression = true:suggestion 147 | csharp_style_conditional_delegate_call = true:suggestion 148 | 149 | # Space preferences 150 | csharp_space_after_cast = false 151 | csharp_space_after_colon_in_inheritance_clause = true 152 | csharp_space_after_comma = true 153 | csharp_space_after_dot = false 154 | csharp_space_after_keywords_in_control_flow_statements = true 155 | csharp_space_after_semicolon_in_for_statement = true 156 | csharp_space_around_binary_operators = before_and_after 157 | csharp_space_around_declaration_statements = do_not_ignore 158 | csharp_space_before_colon_in_inheritance_clause = true 159 | csharp_space_before_comma = false 160 | csharp_space_before_dot = false 161 | csharp_space_before_open_square_brackets = false 162 | csharp_space_before_semicolon_in_for_statement = false 163 | csharp_space_between_empty_square_brackets = false 164 | csharp_space_between_method_call_empty_parameter_list_parentheses = false 165 | csharp_space_between_method_call_name_and_opening_parenthesis = false 166 | csharp_space_between_method_call_parameter_list_parentheses = false 167 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false 168 | csharp_space_between_method_declaration_name_and_open_parenthesis = false 169 | csharp_space_between_method_declaration_parameter_list_parentheses = false 170 | csharp_space_between_parentheses = false 171 | csharp_space_between_square_brackets = false 172 | 173 | # Blocks are allowed 174 | csharp_prefer_braces = true:silent 175 | csharp_preserve_single_line_blocks = true 176 | csharp_preserve_single_line_statements = true --------------------------------------------------------------------------------