Back to Roslyn

How editorconfig, options, and diagnostics ids all fit together

src/VisualStudio/Core/Def/CodeCleanup/readme.md

11.0.10014.8 KB
Original Source

How editorconfig, options, and diagnostics ids all fit together

Turns out this is kinda complicated. At the bottom there is a table that maps an editorconfig option to its associated Diagnostic Ids. In some cases a single Id is reported for multiple analyzer options, in other a single editorconfig option can have two diagnostic Ids.

Items that start with dotnet_ and file_header_template are defined in CodeStyleOptions2 and exported for the code cleanup UI in CommonCodeCleanUpFixerDiagnosticIds.

Items that start with csharp_ are defined in CSharpCodeStyleOptions and exported for the code cleanup UI in CSharpCodeCleanUpFixerDiagnosticIds

Items that start with visual_basic_ are defined in VisualBasicCodeStyleOptions amd exported for the code cleanup UI in VisualBasicCodeCleanUpFixerDiagnosticIds

For editorconfig items that are handled by the formatter they are not exported for the code cleanup UI as our code cleanup service as a single yes/no option for formatting that determines if these are read and fixed.

editorconfigDiagnostic Ids
dotnet_code_quality_unused_parametersIDE0060
dotnet_remove_unnecessary_suppression_exclusionsIDE0079
dotnet_separate_import_directive_groupsIDE0065
dotnet_sort_system_directives_firstIDE0065
dotnet_style_allow_multiple_blank_lines_experimentalIDE2000
dotnet_style_allow_statement_immediately_after_block_experimentalIDE2003
dotnet_style_coalesce_expressionIDE0029
dotnet_style_collection_initializerIDE0028
dotnet_style_explicit_tuple_namesIDE0033
dotnet_style_namespace_match_folderIDE0130
dotnet_style_null_propagationIDE0031
dotnet_style_object_initializerIDE0017
dotnet_style_operator_placement_when_wrappingN/A handled by formatter
dotnet_style_parentheses_in_arithmetic_binary_operatorsIDE0047/IDE0048
dotnet_style_parentheses_in_other_binary_operatorsIDE0047/IDE0048
dotnet_style_parentheses_in_other_operatorsIDE0047/IDE0048
dotnet_style_parentheses_in_relational_binary_operatorsIDE0047/IDE0048
dotnet_style_predefined_type_for_locals_parameters_membersIDE0049
dotnet_style_predefined_type_for_member_accessIDE0049
dotnet_style_prefer_auto_propertiesIDE0032
dotnet_style_prefer_compound_assignmentIDE0054/IDE0074
dotnet_style_prefer_conditional_expression_over_assignmentIDE0045
dotnet_style_prefer_conditional_expression_over_returnIDE0046
dotnet_style_prefer_inferred_anonymous_type_member_namesIDE0037
dotnet_style_prefer_inferred_tuple_namesIDE0037
dotnet_style_prefer_is_null_check_over_reference_equality_methodIDE0041
dotnet_style_prefer_simplified_boolean_expressionsIDE0075
dotnet_style_prefer_simplified_interpolationIDE0071
dotnet_style_qualification_for_eventIDE0003/IDE0009
dotnet_style_qualification_for_fieldIDE0003/IDE0009
dotnet_style_qualification_for_methodIDE0003/IDE0009
dotnet_style_qualification_for_propertyIDE0003/IDE0009
dotnet_style_readonly_fieldIDE0044
dotnet_style_require_accessibility_modifiersIDE0040
csharp_indent_block_contentsN/A handled by formatter
csharp_indent_bracesN/A handled by formatter
csharp_indent_case_contentsN/A handled by formatter
csharp_indent_case_contents_when_blockN/A handled by formatter
csharp_indent_labelsN/A handled by formatter
csharp_indent_switch_labelsN/A handled by formatter
csharp_new_line_before_catchN/A handled by formatter
csharp_new_line_before_elseN/A handled by formatter
csharp_new_line_before_finallyN/A handled by formatter
csharp_new_line_before_members_in_anonymous_typesN/A handled by formatter
csharp_new_line_before_members_in_object_initializersN/A handled by formatter
csharp_new_line_before_open_braceN/A handled by formatter
csharp_new_line_between_query_expression_clausesN/A handled by formatter
csharp_prefer_bracesIDE0011
csharp_prefer_simple_default_expressionIDE0034
csharp_prefer_simple_using_statementIDE0063
csharp_prefer_static_local_functionIDE0062
csharp_preferred_modifier_orderIDE0036
csharp_preserve_single_line_blocksN/A handled by formatter
csharp_preserve_single_line_statementsN/A handled by formatter
csharp_space_after_castN/A handled by formatter
csharp_space_after_colon_in_inheritance_clauseN/A handled by formatter
csharp_space_after_commaN/A handled by formatter
csharp_space_after_dotN/A handled by formatter
csharp_space_after_keywords_in_control_flow_statementsN/A handled by formatter
csharp_space_after_semicolon_in_for_statementN/A handled by formatter
csharp_space_around_binary_operatorsN/A handled by formatter
csharp_space_around_declaration_statementsN/A handled by formatter
csharp_space_before_colon_in_inheritance_clauseN/A handled by formatter
csharp_space_before_commaN/A handled by formatter
csharp_space_before_dotN/A handled by formatter
csharp_space_before_open_square_bracketsN/A handled by formatter
csharp_space_before_semicolon_in_for_statementN/A handled by formatter
csharp_space_between_empty_square_bracketsN/A handled by formatter
csharp_space_between_method_call_empty_parameter_list_parenthesesN/A handled by formatter
csharp_space_between_method_call_name_and_opening_parenthesisN/A handled by formatter
csharp_space_between_method_call_parameter_list_parenthesesN/A handled by formatter
csharp_space_between_method_declaration_empty_parameter_list_parenthesesN/A handled by formatter
csharp_space_between_method_declaration_name_and_open_parenthesisN/A handled by formatter
csharp_space_between_method_declaration_parameter_list_parenthesesN/A handled by formatter
csharp_space_between_parenthesesN/A handled by formatter
csharp_space_between_square_bracketsN/A handled by formatter
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimentalIDE2004
csharp_style_allow_blank_lines_between_consecutive_braces_experimentalIDE2002
csharp_style_allow_embedded_statements_on_same_line_experimentalIDE2001
csharp_style_conditional_delegate_callIDE1005
csharp_style_deconstructed_variable_declarationIDE0042
csharp_style_expression_bodied_accessorsIDE0027
csharp_style_expression_bodied_constructorsIDE0021
csharp_style_expression_bodied_indexersIDE0026
csharp_style_expression_bodied_lambdasIDE0053
csharp_style_expression_bodied_local_functionsIDE0061
csharp_style_expression_bodied_methodsIDE0022
csharp_style_expression_bodied_operatorsIDE0023/IDE0024
csharp_style_expression_bodied_propertiesIDE0025
csharp_style_implicit_object_creation_when_type_is_apparentIDE0090
csharp_style_inlined_variable_declarationIDE0018
csharp_style_namespace_declarationsIDE0161
csharp_style_pattern_matching_over_as_with_null_checkIDE0019
csharp_style_pattern_matching_over_is_with_cast_checkIDE0020
csharp_style_prefer_extended_property_patternIDE0170
csharp_style_prefer_index_operatorIDE0056
csharp_style_prefer_local_over_anonymous_functionIDE0039
csharp_style_prefer_method_group_conversionIDE0200
csharp_style_prefer_not_patternIDE0083
csharp_style_prefer_null_check_over_type_checkIDE0150
csharp_style_prefer_null_check_over_type_checkIDE0150
csharp_style_prefer_pattern_matchingIDE0078
csharp_style_prefer_range_operatorIDE0057
csharp_style_prefer_switch_expressionIDE0066
csharp_style_prefer_tuple_swapIDE0180
csharp_style_throw_expressionIDE0016
csharp_style_unused_value_assignment_preferenceIDE0059
csharp_style_unused_value_expression_statement_preferenceIDE0058
csharp_style_var_elsewhereIDE0007/IDE0008
csharp_style_var_for_built_in_typesIDE0007/IDE0008
csharp_style_var_when_type_is_apparentIDE0007/IDE0008
csharp_using_directive_placementIDE0065
file_header_templateIDE0073
visual_basic_preferred_modifier_orderIDE0036
visual_basic_style_prefer_isnot_expressionIDE0084
visual_basic_style_prefer_simplified_object_creationIDE0140
visual_basic_style_unused_value_assignment_preferenceIDE0059
visual_basic_style_unused_value_expression_statement_preferenceIDE0058