Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
bin/
bin/
obj/
201 changes: 158 additions & 43 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,43 +1,158 @@
root = true

[*]
indent_style = space
trim_trailing_whitespace = true

[{*.yml,*.props, *.*proj}]
indent_size = 2

[*.cs]
indent_size = 4

# CA1822: Mark members as static
dotnet_diagnostic.ca1822.severity = silent

csharp_style_expression_bodied_methods = true:suggestion
csharp_style_namespace_declarations = file_scoped

# Microsoft .NET properties
csharp_new_line_before_members_in_object_initializers = false
csharp_preferred_modifier_order = public, private, protected, internal, new, sealed, abstract, virtual, static, readonly, override, extern, unsafe, volatile, async:suggestion
csharp_using_directive_placement = inside_namespace:silent
dotnet_sort_system_directives_first = false

# ReSharper properties
resharper_blank_lines_after_block_statements = 0
resharper_blank_lines_around_auto_property = 0
resharper_blank_lines_around_local_method = 0
resharper_braces_for_for = required
resharper_braces_for_foreach = required
resharper_braces_for_ifelse = required
resharper_csharp_blank_lines_around_field = 0
resharper_csharp_blank_lines_around_invocable = 0
resharper_csharp_indent_invocation_pars = none
resharper_csharp_insert_final_newline = true
resharper_csharp_max_line_length = 100
resharper_csharp_wrap_arguments_style = chop_if_long
resharper_instance_members_qualify_declared_in = base_class
resharper_parentheses_redundancy_style = remove
resharper_place_expr_method_on_single_line = true
resharper_remove_blank_lines_near_braces_in_declarations = false
resharper_wrap_array_initializer_style = chop_if_long
resharper_wrap_object_and_collection_initializer_style = wrap_if_long
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.{json,jsonc,yml,yaml,props,targets,csproj,fsproj,slnx,slnf,xml,config}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.{cs,fs}]
dotnet_analyzer_diagnostic.severity = warning

[*.cs]
# --- Language version and style: latest, expression-oriented, explicit intent ---
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
# Constructors too. Left unset, the default (block bodies) is raised to a warning by the bulk
# severity above and fails every one-line constructor (IDE0021).
csharp_style_expression_bodied_constructors = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_namespace_declarations = file_scoped:warning
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_prefer_switch_expression = true:warning
csharp_style_pattern_matching_over_as_with_null_check = true:warning
csharp_style_prefer_null_check_over_type_check = true:warning
csharp_prefer_simple_using_statement = true:warning
csharp_style_prefer_top_level_statements = true:suggestion
csharp_style_prefer_method_group_conversion = true:suggestion
csharp_using_directive_placement = outside_namespace:warning

# Prefer auto-implemented properties over trivial hand-written backing fields. Set the severity
# here, not on dotnet_style_prefer_auto_properties below, which is the same rule: a
# dotnet_diagnostic entry overrides the option's trailing severity, so the second has no effect.
dotnet_diagnostic.IDE0032.severity = warning

# The bulk severity above raises IDE0058 (unused expression value) to a warning, which requires
# `_ =` on every discarded result, including each Assert.Throws in a test project. Keep it silent.
dotnet_diagnostic.IDE0058.severity = silent

# The one globalization rule AnalysisLevel=latest-recommended leaves silent: string.Equals
# without a StringComparison. CA1304/1305/1309/1310/1311 already warn (opinions/globalization.md).
dotnet_diagnostic.CA1307.severity = warning

# The one Meziantou.Analyzer TimeProvider rule that ships disabled: prefer overloads taking a
# TimeProvider. MA0166/MA0188 ship enabled at info severity and are raised to warnings by the
# bulk dotnet_analyzer_diagnostic.severity above (opinions/datetime.md).
dotnet_diagnostic.MA0167.severity = warning

# --- Nullability and correctness ---
dotnet_style_require_accessibility_modifiers = always:warning
dotnet_style_readonly_field = true:warning
dotnet_style_prefer_auto_properties = true # severity: IDE0032 above
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_collection_expression = true:warning
dotnet_style_object_initializer = true:suggestion
dotnet_style_coalesce_expression = true:warning
dotnet_style_null_propagation = true:warning

# --- Naming: standard .NET conventions ---
dotnet_naming_rule.interfaces_begin_with_i.severity = warning
dotnet_naming_rule.interfaces_begin_with_i.symbols = interfaces
dotnet_naming_rule.interfaces_begin_with_i.style = prefix_i
dotnet_naming_symbols.interfaces.applicable_kinds = interface
dotnet_naming_style.prefix_i.required_prefix = I
dotnet_naming_style.prefix_i.capitalization = pascal_case

# Constants take PascalCase. A rule with required_modifiers is more specific than the private-field
# rule below, so it wins for consts; without it, a private const needs an underscore prefix.
dotnet_naming_rule.constants_pascal_case.severity = warning
dotnet_naming_rule.constants_pascal_case.symbols = constants
dotnet_naming_rule.constants_pascal_case.style = pascal_case
dotnet_naming_symbols.constants.applicable_kinds = field, local
dotnet_naming_symbols.constants.applicable_accessibilities = *
dotnet_naming_symbols.constants.required_modifiers = const
dotnet_naming_style.pascal_case.capitalization = pascal_case

# Static readonly fields take PascalCase, as this repository has always used. Like the const rule,
# required_modifiers makes it more specific than the private-field rule below.
dotnet_naming_rule.static_readonly_pascal_case.severity = warning
dotnet_naming_rule.static_readonly_pascal_case.symbols = static_readonly_fields
dotnet_naming_rule.static_readonly_pascal_case.style = pascal_case
dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = *
dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly

dotnet_naming_rule.private_fields_camel_underscore.severity = warning
dotnet_naming_rule.private_fields_camel_underscore.symbols = private_fields
dotnet_naming_rule.private_fields_camel_underscore.style = underscore_camel
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_style.underscore_camel.required_prefix = _
dotnet_naming_style.underscore_camel.capitalization = camel_case

[*.fs]
fsharp_multiline_bracket_style = stroustrup

[*.cs]
# --- Repository choices for LeetCode solutions ---
# The var style rules above use var everywhere, which this repository has always done
# Methods are expression-bodied wherever they fit, not only on a single line
csharp_style_expression_bodied_methods = true:suggestion

# Test and benchmark methods are instance members, so xUnit and BenchmarkDotNet can discover them.
# MA0038 is Meziantou's deprecated duplicate of CA1822.
dotnet_diagnostic.CA1822.severity = none
dotnet_diagnostic.MA0038.severity = none

# Each problem lives in its own file as part of the partial Problem class
dotnet_diagnostic.MA0048.severity = none

# Signatures follow the ones LeetCode gives, which use List<T> and similar concrete types
dotnet_diagnostic.MA0016.severity = none
dotnet_diagnostic.CA1002.severity = none

# Node types expose public fields (ListNode.val, TreeNode.left), as LeetCode defines them
dotnet_diagnostic.CA1051.severity = none

# TODO comments are deliberate notes on solutions worth revisiting
dotnet_diagnostic.MA0026.severity = none

csharp_new_line_before_members_in_object_initializers = false
csharp_preferred_modifier_order = public, private, protected, internal, new, sealed, abstract, virtual, static, readonly, override, extern, unsafe, volatile, async:suggestion
dotnet_sort_system_directives_first = false

# ReSharper properties
resharper_blank_lines_after_block_statements = 0
resharper_blank_lines_around_auto_property = 0
resharper_blank_lines_around_local_method = 0
resharper_braces_for_for = required
resharper_braces_for_foreach = required
resharper_braces_for_ifelse = required
resharper_csharp_blank_lines_around_field = 0
resharper_csharp_blank_lines_around_invocable = 0
resharper_csharp_indent_invocation_pars = none
resharper_csharp_insert_final_newline = true
resharper_csharp_max_line_length = 100
resharper_csharp_wrap_arguments_style = chop_if_long
resharper_instance_members_qualify_declared_in = base_class
resharper_parentheses_redundancy_style = remove
resharper_place_expr_method_on_single_line = true
resharper_remove_blank_lines_near_braces_in_declarations = false
resharper_wrap_array_initializer_style = chop_if_long
resharper_wrap_object_and_collection_initializer_style = wrap_if_long

[LeetCode/**.cs]
# Console messages format each resource string once per command, so caching a CompositeFormat gains nothing
dotnet_diagnostic.CA1863.severity = none
# The app uses the static AnsiConsole by design, and Spectre.Console.Analyzer 1.0.0 crashes on this rule (AD0001)
dotnet_diagnostic.Spectre1010.severity = none
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
42 changes: 21 additions & 21 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
version: 2
updates:
- package-ecosystem: "docker"
directory: "/LeetCode"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "weekly"
groups:
xunit:
patterns:
- "xunit*"
spectre:
patterns:
- "Spectre*"
version: 2
updates:
- package-ecosystem: "docker"
directory: "/LeetCode"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "weekly"
groups:
xunit:
patterns:
- "xunit*"
spectre:
patterns:
- "Spectre*"
Loading
Loading