-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SNOW-921048] Add linter to fail pipeline
- Loading branch information
1 parent
bc329ab
commit cf8d096
Showing
5 changed files
with
102 additions
and
71 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
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_cap.capitalization = pascal_case | ||
dotnet_naming_rule.enforce_pascal_case.style = pascal_case_cap | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |