Skip to content

Configuration

Every stylebro_* setting, in .editorconfig under [*.cs]. Each rule's page explains its settings with examples; this page lists them all in one place. Severities work like any analyzer's (dotnet_diagnostic.BRO1001.severity = none), and the package's preset sets the defaults listed here unless your .editorconfig says otherwise. Some rules also follow the SDK's own settings (csharp_prefer_braces, csharp_using_directive_placement, dotnet_style_qualification_for_*, dotnet_naming_rule.*, max_line_length, ...): see their rule pages.

Which rules the preset turns on depends on its version, an MSBuild property (in Directory.Build.props or the project file), not an .editorconfig key:

<StyleBroPreset> Rules
unset the package's major version: 1.0 in all of 1.x
1.0, 1.1, ... the rules up to that release; newer releases' rules stay off
latest every rule in the package
none no preset: rules at their own defaults (rules added after 1.0 off), no preset settings

A version newer than the package warns (STYLEBRO002) and uses the package's newest; any other value fails the build (STYLEBRO001). See versioning.

[*.cs]
stylebro_null_check_style = equality_operator
Key Values Default Rules
stylebro_member_order kinds, comma-separated: field, constructor, finalizer, delegate, event, enum, interface, property, indexer, conversion, operator, extension, method, struct, class that list (StyleCop's order) BRO1001
stylebro_member_access_order accessibilities, comma-separated: public, internal, protected_internal, protected, private_protected, private that list BRO1001
stylebro_member_constants_first true, false true BRO1001
stylebro_member_static_first true, false true BRO1001
stylebro_member_readonly_first true, false true BRO1001
stylebro_keep_overloads_together true, false, same_access false BRO1001
stylebro_allow_semicolon_after_closing_brace true, false (true: Sonar's S1116, the ; after a type's or namespace's } stays) false BRO1101
stylebro_constructor_initializer_placement own_line, same_line own_line BRO1105
stylebro_empty_string_style string_empty, literal string_empty BRO1106
stylebro_split_list_first_item next_line, same_line next_line BRO1107, BRO1108
stylebro_allow_leading_multiline_lambda true, false (true: a first argument that is a multi-line lambda, anonymous method or anonymous object may keep the other arguments on its closing line) false BRO1107, BRO1108
stylebro_closing_parenthesis_placement last_item, own_line last_item BRO1110
stylebro_constraint_placement own_line, same_line own_line BRO1111
stylebro_null_check_style pattern_matching, equality_operator pattern_matching BRO1133, BRO1148
stylebro_upper_case_literal_suffixes all, l_only, lone_l (Sonar's S818: only a suffix that is just l) all BRO1135
stylebro_allow_null_forgiving_on_unannotated true, false (true: Sonar's S8969, a ! on a value declared without nullable annotations stays) false BRO1147
stylebro_allow_nested_dynamic_ifs true, false (true: Sonar's S1066, nested ifs with a dynamic condition aren't merged) false BRO1149
stylebro_params_arrays all, except_object_and_jagged (Sonar's S3878: not for params object[], params Array[] or jagged arrays) all BRO1151
stylebro_object_creation_parentheses omit, include omit BRO1141
stylebro_private_field_naming camelCase, _camelCase not set: the SDK's naming rules decide, else camelCase BRO1303, BRO1307, BRO1310
stylebro_private_mutable_static_field_naming camelCase, _camelCase not set: a naming rule requiring just static decides, else stylebro_private_field_naming's style BRO1303
stylebro_allow_leading_underscore_in_pascal_fields true, false false BRO1306
stylebro_private_static_field_naming PascalCase, camelCase, _camelCase not set: the SDK's naming rules decide, else PascalCase BRO1306
stylebro_allowed_hungarian_prefixes prefixes, comma-separated none BRO1310
stylebro_allow_common_hungarian_prefixes true, false true BRO1310
stylebro_rename_public_api true, false false BRO1302-BRO1314: names other assemblies see
stylebro_tuple_element_name_casing PascalCase, camelCase PascalCase BRO1311
stylebro_match_base_parameter_names all, non_generic_methods (Sonar's S927: methods only, not where the base's parameter type is a type parameter the member fills in) all BRO1313
stylebro_allowed_namespace_components names, comma-separated none BRO1312
stylebro_trailing_comma include, omit include BRO1401, BRO1509
stylebro_comment_blank_line_exempt_prefixes prefixes, comma-separated, case-sensitive none BRO1504
stylebro_allow_adjacent_single_line_members true, false false BRO1505
stylebro_blank_line_below_standalone_comments allow, remove (like StyleCop's SA1512) allow BRO1506
stylebro_allow_empty_single_line_blocks true, false false BRO1508, BRO1509
stylebro_allow_consecutive_usings true, false true BRO1514
stylebro_allow_single_line_jump_statements true, false false BRO1514
stylebro_braces_statements all, if_and_loops (Sonar's S121: not using, lock, fixed or a deconstructing foreach) all BRO1514-BRO1516
stylebro_arrow_placement_when_wrapping end_of_line, beginning_of_line end_of_line BRO1521
stylebro_equals_placement_when_wrapping end_of_line, beginning_of_line end_of_line BRO1522
stylebro_blank_line_between_switch_sections include, omit, omit_after_block include BRO1526
stylebro_document_exposed_elements true, false true BRO1601
stylebro_document_internal_elements true, false true BRO1601
stylebro_document_private_elements true, false false BRO1601
stylebro_inheritdoc_style compact, spaced compact BRO1601
stylebro_exclude_from_punctuation_check tag names, comma-separated seealso BRO1603
stylebro_file_header_company text not set: the rule does nothing BRO1615
stylebro_file_header_copyright text (\n, {companyName}, {fileName}) StyleCop's copyright text BRO1615
stylebro_file_header_decoration a line of text none BRO1615
stylebro_summary_layout multi_line, single_line_when_fits multi_line BRO1616
stylebro_layout_by csharpier, or not set not set BRO1149 lays a merged condition out as CSharpier would; BRO1514-BRO1516 count a statement CSharpier will split as multi-line. stylebro-migrate writes it when the repository uses CSharpier (getting started)
stylebro_layout_print_width a number 100 (CSharpier's) with stylebro_layout_by = csharpier: CSharpier's printWidth

Coming from StyleCop, stylebro-migrate writes these from your stylecop.json and rule settings.