diff --git a/.EditorConfig b/.EditorConfig deleted file mode 100644 index 61ab3ee2c..000000000 --- a/.EditorConfig +++ /dev/null @@ -1,61 +0,0 @@ -root = true -# All files -[*.*] -indent_style = space -indent_size = 4 -insert_final_newline = true -trim_trailing_whitespace = true -charset = utf-8 -max_line_length=150 - -# Interfaces should start with I and PascalCase -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_and_pascal_case -dotnet_naming_rule.interfaces_begin_with_I.required_prefix = I -dotnet_naming_symbols.interfaces.applicable_kinds = interface -dotnet_diagnostic.interfaces_begin_with_I.severity = warning -dotnet_diagnostic.interfaces_begin_with_I.enabled = true - -# Static fields should start with _s -dotnet_naming_rule.static_fields_begin_with_s.severity = warning -dotnet_naming_rule.static_fields_begin_with_s.symbols = static_fields -dotnet_naming_rule.static_fields_begin_with_s.style = custom -dotnet_naming_rule.static_fields_begin_with_s.custom_recommended_prefix = _r -dotnet_naming_rule.static_fields_begin_with_s.required_prefix = _r -dotnet_naming_rule.static_fields_begin_with_s.capitalization = camel_case -dotnet_naming_symbols.static_fields.applicable_kinds = field -dotnet_naming_symbols.static_fields.applicable_accessibilities = public, internal, private, protected, protected_internal -dotnet_naming_symbols.static_fields.required_modifiers = static -dotnet_diagnostic.static_fields_begin_with_s.severity = warning -dotnet_diagnostic.static_fields_begin_with_s.enabled = true - -# Enforce use of Pascal case in enums, classes, const and methods -dotnet_naming_rule.enforce_pascal_case.severity = suggestion -dotnet_naming_rule.enforce_pascal_case.symbols = methods, enums, consts, public_methods, public_classes -dotnet_naming_rule.enforce_pascal_case.style = pascal_case -dotnet_naming_symbols.methods.applicable_kinds = method -dotnet_naming_symbols.enums.applicable_kinds = enum -dotnet_naming_symbols.consts.applicable_kinds = field -dotnet_naming_symbols.consts.applicable_modifiers = const -dotnet_naming_symbols.public_methods.applicable_kinds = method -dotnet_naming_symbols.public_methods.applicable_accessibilities = public -dotnet_naming_symbols.public_classes.applicable_kinds = class -dotnet_naming_symbols.public_classes.applicable_accessibilities = public -dotnet_diagnostic.enforce_pascal_case.severity = suggestion -dotnet_diagnostic.enforce_pascal_case.enabled = true - -# private and internal members should start with underscore -dotnet_naming_rule.private_and_internal_members_start_with_underscore.severity = warning -dotnet_naming_rule.private_and_internal_members_start_with_underscore.symbols = private_fields, internal_fields, private_properties, internal_properties, private_methods, internal_methods -dotnet_naming_rule.private_and_internal_members_start_with_underscore.style = underscore_prefix -dotnet_naming_symbols.private_fields.applicable_kinds = field -dotnet_naming_symbols.internal_fields.applicable_kinds = field -dotnet_naming_symbols.private_properties.applicable_kinds = property -dotnet_naming_symbols.internal_properties.applicable_kinds = property -dotnet_naming_symbols.private_methods.applicable_kinds = method -dotnet_naming_symbols.internal_methods.applicable_kinds = method -dotnet_naming_symbols.private_methods.applicable_accessibilities = private -dotnet_naming_symbols.internal_methods.applicable_accessibilities = internal -dotnet_diagnostic.private_and_internal_members_start_with_underscore.severity = warning -dotnet_diagnostic.private_and_internal_members_start_with_underscore.enabled = true diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..73ce17651 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,73 @@ +root = true +# yml files +[*.yml] +indent_style = space +indent_size = 2 + +# All files +[*.*] +indent_style = space +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true +charset = utf-8 +max_line_length = 150 + +## Interfaces should start with I and PascalCase +dotnet_naming_style.prefix_and_pascal_case.required_prefix = I +dotnet_naming_style.prefix_and_pascal_case.capitalization = pascal_case +dotnet_naming_symbols.interfaces.applicable_kinds = interface +dotnet_naming_rule.interfaces_begin_with_I.severity = error +dotnet_naming_rule.interfaces_begin_with_I.symbols = interfaces +dotnet_naming_rule.interfaces_begin_with_I.style = prefix_and_pascal_case +dotnet_diagnostic.interfaces_begin_with_I.enabled = true + +## Static fields should start with _s +dotnet_naming_style.prefix_s.required_prefix = _s +dotnet_naming_style.prefix_s.capitalization = camel_case +dotnet_naming_rule.static_fields_begin_with_s.style = prefix_s +dotnet_naming_symbols.static_fields.applicable_kinds = field +dotnet_naming_symbols.static_fields.applicable_accessibilities = public, internal, private, protected, protected_internal +dotnet_naming_symbols.static_fields.required_modifiers = static +dotnet_naming_rule.static_fields_begin_with_s.severity = error +dotnet_naming_rule.static_fields_begin_with_s.symbols = static_fields +dotnet_diagnostic.static_fields_begin_with_s.enabled = true + +## Internal or private member should prefixed with _ +dotnet_naming_style.internal_prefix_.required_prefix = _ +dotnet_naming_style.internal_prefix_.capitalization = camel_case +dotnet_naming_rule.private_internal_prefix_.style = internal_prefix_ +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = internal, private, protected_internal +dotnet_naming_rule.private_internal_prefix_.severity = error +dotnet_naming_rule.private_internal_prefix_.symbols = private_internal_fields +dotnet_diagnostic.private_internal_prefix_.enabled = true + +# Enforce use of Pascal case in enums, classes, const and methods +dotnet_naming_style.pascal_case_style.capitalization = pascal_case +dotnet_naming_rule.enforce_pascal_case.style = pascal_case_style +dotnet_naming_symbols.methods.applicable_kinds = method +dotnet_naming_symbols.enums.applicable_kinds = enum +dotnet_naming_symbols.consts.applicable_kinds = field +dotnet_naming_symbols.consts.applicable_modifiers = const +dotnet_naming_symbols.public_methods.applicable_kinds = method +dotnet_naming_symbols.public_methods.applicable_accessibilities = public +dotnet_naming_symbols.public_classes.applicable_kinds = class +dotnet_naming_symbols.public_classes.applicable_accessibilities = public +dotnet_naming_symbols.enum_members.applicable_kinds = enum_member +dotnet_naming_symbols.enum_members.applicable_accessibilities = * +dotnet_naming_rule.enforce_pascal_case.severity = error +dotnet_naming_rule.enforce_pascal_case.symbols = methods, enums, consts, public_methods, public_classes, enum_members +dotnet_diagnostic.enforce_pascal_case.enabled = true + + +# Naming styles for different symbol kinds +dotnet_naming_style.camel_case_style.capitalization = camel_case +dotnet_naming_rule.method_parameters_should_be_camel_case.symbols = method_parameters +dotnet_naming_rule.method_parameters_should_be_camel_case.style = camel_case_style +dotnet_naming_symbols.method_parameters.applicable_kinds = parameter +dotnet_naming_symbols.method_parameters.applicable_accessibilities = * +dotnet_naming_symbols.method_parameters.required_modifiers = * +dotnet_naming_rule.method_parameters_should_be_camel_case.severity = error +dotnet_naming_rule.enforce_pascal_case.symbols = method_parameters +dotnet_diagnostic.method_parameters_should_be_camel_case.enabled = true diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 1c00a29aa..b72f02ca9 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -13,6 +13,7 @@ on: tags: description: "Linter" required: false +permissions: { } concurrency: # older builds for the same pull request number or branch should be cancelled @@ -26,14 +27,20 @@ jobs: steps: - name: Check out Git repository uses: actions/checkout@v3 - - name: Set up .NET - uses: actions/setup-dotnet@v1 with: - dotnet-version: '8.0.x' - dotnet-quality: 'ga' - - name: Run linters - uses: wearerequired/lint-action@v2 + depth: 0 + + - name: Set up .NET + uses: actions/setup-dotnet@v4 with: - dotnet_format: true - continue_on_error: true - check_name: ${linter} run + dotnet-version: '6.0.103' + + - name: Install dotnet format + run: dotnet tool install -g dotnet-format + + - name: Add dotnet tools to PATH + run: echo "$HOME/.dotnet/tools" >> $GITHUB_PATH + + - name: Run Linter Bash Script + run: | + bash ci/scripts/linter.sh diff --git a/Snowflake.Data/Core/Session/ISessionPoolEventHandler.cs b/Snowflake.Data/Core/Session/ISessionPoolEventHandler.cs index 2b16959a2..f8d78262a 100644 --- a/Snowflake.Data/Core/Session/ISessionPoolEventHandler.cs +++ b/Snowflake.Data/Core/Session/ISessionPoolEventHandler.cs @@ -5,7 +5,7 @@ internal interface ISessionPoolEventHandler void OnNewSessionCreated(SessionPool sessionPool); void OnWaitingForSessionStarted(SessionPool sessionPool); - + void OnWaitingForSessionStarted(SessionPool sessionPool, long millisLeft); void OnWaitingForSessionSuccessful(SessionPool sessionPool); diff --git a/ci/scripts/linter.sh b/ci/scripts/linter.sh new file mode 100755 index 000000000..c4dfec3f5 --- /dev/null +++ b/ci/scripts/linter.sh @@ -0,0 +1,24 @@ +#!/bin/bash -e +# +# Apply Linter to changed files in PR +set -e +set -o pipefail + +current_branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} +git fetch --no-tags origin master:master +git fetch --no-tags origin $current_branch:$current_branch + +BASE_SHA=$(git merge-base $GITHUB_BASE_REF $current_branch) + +changed_files=$(git diff --name-only $BASE_SHA HEAD) + +echo "All files changed:" +for file in $changed_files; do + echo "$file" +done + +echo "Run dotnet restore" +dotnet restore + +echo "Running Dotnet format to changed files" +dotnet format --include $changed_files --verify-no-changes --no-restore