Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the .editorconfig to have support newer rules #385

Merged
merged 3 commits into from
Sep 15, 2022
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 16 additions & 9 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
tab_width = 4
trim_trailing_whitespace = true

###############################################################################
Expand Down Expand Up @@ -176,6 +177,7 @@ dotnet_sort_system_directives_first = true
# require null-coalescing expressions,
# require collection-initializers,
# require explicit tuple names,
# suggest namespace match folder names,
# require null-propogation
# require object-initializers,
#
Expand Down Expand Up @@ -210,6 +212,7 @@ dotnet_sort_system_directives_first = true
dotnet_style_coalesce_expression = true:error
dotnet_style_collection_initializer = true:error
dotnet_style_explicit_tuple_names = true:error
dotnet_style_namespace_match_folder = true:suggestion
dotnet_style_null_propagation = true:error
dotnet_style_object_initializer = true:error

Expand Down Expand Up @@ -372,16 +375,18 @@ csharp_space_between_square_brackets = false
# require expression-bodied operators when on a single line,
# require expression-bodied properties when on a single line,
#
# error on simplified new expression,
# error on new expressions when created type is apparent
#
# require inlined variable declarations,
#
# require file scoped namespace declarations,
#
# require local over anonymous functions,
# require pattern-matching over "as" with "null" check,
# require pattern-matching over "is" with "cast" check,
#
# require index operators where possible,
# require range operators where possible,
# error on index operators where possible,
# error on range operators where possible,
# require the "not" pattern where possible,
# require pattern-matching where possible,
# require switch expressions where possible,
Expand Down Expand Up @@ -412,14 +417,17 @@ csharp_style_implicit_object_creation_when_type_is_apparent = false:error

csharp_style_inlined_variable_declaration = true:error

csharp_style_namespace_declarations = file_scoped:error

csharp_style_pattern_local_over_anonymous_function = true:error
csharp_style_pattern_matching_over_as_with_null_check = true:error
csharp_style_pattern_matching_over_is_with_cast_check = true:error

csharp_style_prefer_index_operator = true:error
csharp_style_prefer_range_operator = true:error
csharp_style_prefer_index_operator = false:error
csharp_style_prefer_method_group_conversion = true:suggestion
csharp_style_prefer_not_pattern = true:error
csharp_style_prefer_pattern_matching = true:error
csharp_style_prefer_range_operator = false:error
csharp_style_prefer_switch_expression = true:error

csharp_style_throw_expression = true:error
Expand All @@ -439,8 +447,7 @@ csharp_style_var_when_type_is_apparent = true:error
csharp_using_directive_placement = outside_namespace:error

###############################################################################
# Supress diagnostics that don't apply to ClangSharp
# Set dotnet analyzer rules to:
# disable CA1401: P/Invoke method '*' should not be visible
###############################################################################
dotnet_diagnostic.CA1069.severity = none
dotnet_diagnostic.CA1826.severity = none
dotnet_diagnostic.IDE0060.severity = none
dotnet_diagnostic.CA1401.severity = silent
19 changes: 16 additions & 3 deletions sources/ClangSharp.Interop/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.

###############################################################################
# EditorConfig is awesome: http://EditorConfig.org
###############################################################################
Expand All @@ -23,6 +25,17 @@ dotnet_naming_rule.public_and_protected_declarations_should_be_pascal_case.sever
dotnet_naming_rule.type_parameters_should_be_pascal_case_prefixed_with_t.severity = none

###############################################################################
# Supress diagnostics that don't apply to ClangSharp P/Invokes
###############################################################################
dotnet_diagnostic.CA1401.severity = none
# Set dotnet style options to:
# disable certain parent style options since they are not applicable to interop
###############################################################################
csharp_style_expression_bodied_methods = when_on_single_line:none
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:none
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:none
dotnet_style_prefer_conditional_expression_over_assignment = true:none
dotnet_style_prefer_conditional_expression_over_return = true:none
csharp_style_prefer_pattern_matching = true:none
csharp_style_var_elsewhere = true:none
csharp_style_var_for_built_in_types = true:none
csharp_style_var_when_type_is_apparent = true:none
15 changes: 7 additions & 8 deletions sources/ClangSharp.Interop/CXAvailabilityKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c
// Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information.

namespace ClangSharp.Interop
namespace ClangSharp.Interop;

public enum CXAvailabilityKind
{
public enum CXAvailabilityKind
{
CXAvailability_Available,
CXAvailability_Deprecated,
CXAvailability_NotAvailable,
CXAvailability_NotAccessible,
}
CXAvailability_Available,
CXAvailability_Deprecated,
CXAvailability_NotAvailable,
CXAvailability_NotAccessible,
}
49 changes: 24 additions & 25 deletions sources/ClangSharp.Interop/CXCallingConv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,29 @@
// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c
// Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information.

namespace ClangSharp.Interop
namespace ClangSharp.Interop;

public enum CXCallingConv
{
public enum CXCallingConv
{
CXCallingConv_Default = 0,
CXCallingConv_C = 1,
CXCallingConv_X86StdCall = 2,
CXCallingConv_X86FastCall = 3,
CXCallingConv_X86ThisCall = 4,
CXCallingConv_X86Pascal = 5,
CXCallingConv_AAPCS = 6,
CXCallingConv_AAPCS_VFP = 7,
CXCallingConv_X86RegCall = 8,
CXCallingConv_IntelOclBicc = 9,
CXCallingConv_Win64 = 10,
CXCallingConv_X86_64Win64 = CXCallingConv_Win64,
CXCallingConv_X86_64SysV = 11,
CXCallingConv_X86VectorCall = 12,
CXCallingConv_Swift = 13,
CXCallingConv_PreserveMost = 14,
CXCallingConv_PreserveAll = 15,
CXCallingConv_AArch64VectorCall = 16,
CXCallingConv_SwiftAsync = 17,
CXCallingConv_Invalid = 100,
CXCallingConv_Unexposed = 200,
}
CXCallingConv_Default = 0,
CXCallingConv_C = 1,
CXCallingConv_X86StdCall = 2,
CXCallingConv_X86FastCall = 3,
CXCallingConv_X86ThisCall = 4,
CXCallingConv_X86Pascal = 5,
CXCallingConv_AAPCS = 6,
CXCallingConv_AAPCS_VFP = 7,
CXCallingConv_X86RegCall = 8,
CXCallingConv_IntelOclBicc = 9,
CXCallingConv_Win64 = 10,
CXCallingConv_X86_64Win64 = CXCallingConv_Win64,
CXCallingConv_X86_64SysV = 11,
CXCallingConv_X86VectorCall = 12,
CXCallingConv_Swift = 13,
CXCallingConv_PreserveMost = 14,
CXCallingConv_PreserveAll = 15,
CXCallingConv_AArch64VectorCall = 16,
CXCallingConv_SwiftAsync = 17,
CXCallingConv_Invalid = 100,
CXCallingConv_Unexposed = 200,
}
13 changes: 6 additions & 7 deletions sources/ClangSharp.Interop/CXChildVisitResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c
// Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information.

namespace ClangSharp.Interop
namespace ClangSharp.Interop;

public enum CXChildVisitResult
{
public enum CXChildVisitResult
{
CXChildVisit_Break,
CXChildVisit_Continue,
CXChildVisit_Recurse,
}
CXChildVisit_Break,
CXChildVisit_Continue,
CXChildVisit_Recurse,
}
13 changes: 6 additions & 7 deletions sources/ClangSharp.Interop/CXCodeCompleteResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c
// Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information.

namespace ClangSharp.Interop
namespace ClangSharp.Interop;

public unsafe partial struct CXCodeCompleteResults
{
public unsafe partial struct CXCodeCompleteResults
{
public CXCompletionResult* Results;
public CXCompletionResult* Results;

[NativeTypeName("unsigned int")]
public uint NumResults;
}
[NativeTypeName("unsigned int")]
public uint NumResults;
}
17 changes: 8 additions & 9 deletions sources/ClangSharp.Interop/CXCodeComplete_Flags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c
// Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information.

namespace ClangSharp.Interop
namespace ClangSharp.Interop;

public enum CXCodeComplete_Flags
{
public enum CXCodeComplete_Flags
{
CXCodeComplete_IncludeMacros = 0x01,
CXCodeComplete_IncludeCodePatterns = 0x02,
CXCodeComplete_IncludeBriefComments = 0x04,
CXCodeComplete_SkipPreamble = 0x08,
CXCodeComplete_IncludeCompletionsWithFixIts = 0x10,
}
CXCodeComplete_IncludeMacros = 0x01,
CXCodeComplete_IncludeCodePatterns = 0x02,
CXCodeComplete_IncludeBriefComments = 0x04,
CXCodeComplete_SkipPreamble = 0x08,
CXCodeComplete_IncludeCompletionsWithFixIts = 0x10,
}
15 changes: 7 additions & 8 deletions sources/ClangSharp.Interop/CXComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c
// Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information.

namespace ClangSharp.Interop
namespace ClangSharp.Interop;

public unsafe partial struct CXComment
{
public unsafe partial struct CXComment
{
[NativeTypeName("const void *")]
public void* ASTNode;
[NativeTypeName("const void *")]
public void* ASTNode;

[NativeTypeName("CXTranslationUnit")]
public CXTranslationUnitImpl* TranslationUnit;
}
[NativeTypeName("CXTranslationUnit")]
public CXTranslationUnitImpl* TranslationUnit;
}
17 changes: 8 additions & 9 deletions sources/ClangSharp.Interop/CXCommentInlineCommandRenderKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c
// Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information.

namespace ClangSharp.Interop
namespace ClangSharp.Interop;

public enum CXCommentInlineCommandRenderKind
{
public enum CXCommentInlineCommandRenderKind
{
CXCommentInlineCommandRenderKind_Normal,
CXCommentInlineCommandRenderKind_Bold,
CXCommentInlineCommandRenderKind_Monospaced,
CXCommentInlineCommandRenderKind_Emphasized,
CXCommentInlineCommandRenderKind_Anchor,
}
CXCommentInlineCommandRenderKind_Normal,
CXCommentInlineCommandRenderKind_Bold,
CXCommentInlineCommandRenderKind_Monospaced,
CXCommentInlineCommandRenderKind_Emphasized,
CXCommentInlineCommandRenderKind_Anchor,
}
33 changes: 16 additions & 17 deletions sources/ClangSharp.Interop/CXCommentKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@
// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c
// Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information.

namespace ClangSharp.Interop
namespace ClangSharp.Interop;

public enum CXCommentKind
{
public enum CXCommentKind
{
CXComment_Null = 0,
CXComment_Text = 1,
CXComment_InlineCommand = 2,
CXComment_HTMLStartTag = 3,
CXComment_HTMLEndTag = 4,
CXComment_Paragraph = 5,
CXComment_BlockCommand = 6,
CXComment_ParamCommand = 7,
CXComment_TParamCommand = 8,
CXComment_VerbatimBlockCommand = 9,
CXComment_VerbatimBlockLine = 10,
CXComment_VerbatimLine = 11,
CXComment_FullComment = 12,
}
CXComment_Null = 0,
CXComment_Text = 1,
CXComment_InlineCommand = 2,
CXComment_HTMLStartTag = 3,
CXComment_HTMLEndTag = 4,
CXComment_Paragraph = 5,
CXComment_BlockCommand = 6,
CXComment_ParamCommand = 7,
CXComment_TParamCommand = 8,
CXComment_VerbatimBlockCommand = 9,
CXComment_VerbatimBlockLine = 10,
CXComment_VerbatimLine = 11,
CXComment_FullComment = 12,
}
13 changes: 6 additions & 7 deletions sources/ClangSharp.Interop/CXCommentParamPassDirection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c
// Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information.

namespace ClangSharp.Interop
namespace ClangSharp.Interop;

public enum CXCommentParamPassDirection
{
public enum CXCommentParamPassDirection
{
CXCommentParamPassDirection_In,
CXCommentParamPassDirection_Out,
CXCommentParamPassDirection_InOut,
}
CXCommentParamPassDirection_In,
CXCommentParamPassDirection_Out,
CXCommentParamPassDirection_InOut,
}
11 changes: 5 additions & 6 deletions sources/ClangSharp.Interop/CXCompilationDatabase_Error.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c
// Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information.

namespace ClangSharp.Interop
namespace ClangSharp.Interop;

public enum CXCompilationDatabase_Error
{
public enum CXCompilationDatabase_Error
{
CXCompilationDatabase_NoError = 0,
CXCompilationDatabase_CanNotLoadDatabase = 1,
}
CXCompilationDatabase_NoError = 0,
CXCompilationDatabase_CanNotLoadDatabase = 1,
}
Loading