Skip to content

Commit 272ce15

Browse files
use github action for changed files
1 parent 5c623e5 commit 272ce15

File tree

5 files changed

+59
-23
lines changed

5 files changed

+59
-23
lines changed

.editorconfig

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
root = true
2+
# yml files
3+
[*.yml]
4+
indent_style = space
5+
indent_size = 2
6+
27
# All files
38
[*.*]
49
indent_style = space
510
indent_size = 4
611
insert_final_newline = true
712
trim_trailing_whitespace = true
813
charset = utf-8
9-
max_line_length = 152
14+
max_line_length = 150
1015

1116
# Interfaces should start with I and PascalCase
1217
# naming style
@@ -16,8 +21,9 @@ dotnet_naming_style.prefix_and_pascal_case.capitalization = pascal_case
1621
# naming symbols
1722
dotnet_naming_symbols.interfaces.applicable_kinds = interface
1823

19-
dotnet_naming_rule.interfaces_begin_with_I.severity = error
20-
dotnet_naming_rule.interfaces_begin_with_I.symbols = interfaces
21-
dotnet_naming_rule.interfaces_begin_with_I.style = prefix_and_pascal_case
24+
dotnet_naming_rule.interfaces_begin_with.severity = error
25+
dotnet_naming_rule.interfaces_begin_with.symbols = interfaces
26+
dotnet_naming_rule.interfaces_begin_with.style = prefix_and_pascal_case
27+
28+
dotnet_diagnostic.interfaces_begin_with.enabled = true
2229

23-
dotnet_diagnostic.interfaces_begin_with_I.enabled = true

.github/workflows/linter.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,27 @@ concurrency:
2323
jobs:
2424
run-linter:
2525
name: Run linter
26-
runs-on: ubuntu-latest
27-
permissions:
28-
contents: read
29-
packages: read
30-
statuses: read
26+
runs-on: windows-latest
3127
steps:
3228
- name: Check out Git repository
33-
uses: actions/checkout@v4
29+
uses: actions/checkout@v3
3430
with:
35-
fetch-depth: 0
36-
- name: Run linters
37-
uses: super-linter/[email protected]
38-
env:
39-
VALIDATE_ALL_CODEBASE: false
40-
VALIDATE_CHECKOV: false
41-
VALIDATE_JSCPD: false
42-
LINTER_RULES_PATH: .github/linters
43-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
depth: 0
4432

33+
- name: Set up .NET
34+
uses: actions/setup-dotnet@v4
35+
with:
36+
dotnet-version: '6.0.103'
37+
38+
- name: Install dotnet format
39+
run: dotnet tool install -g dotnet-format
40+
41+
- name: Add dotnet tools to PATH
42+
run: echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
43+
44+
# - name: Run dotnet restore
45+
# run: dotnet restore
46+
47+
- name: Run Linter Bash Script
48+
run: |
49+
bash ci/scripts/linter.sh

Snowflake.Data.Tests/Snowflake.Data.Tests.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net6.0;net7.0;net8.0;net462;net471;net472;net48;net481</TargetFrameworks>
4-
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">net6.0;net7.0;net8.0;</TargetFrameworks>
5-
<RuntimeFrameworkVersion>8.0.0</RuntimeFrameworkVersion>
3+
<TargetFrameworks>net8.0;net6.0;net471;net472</TargetFrameworks>
4+
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">net6.0;net8.0</TargetFrameworks>
5+
<RuntimeFrameworkVersion>6.0.0</RuntimeFrameworkVersion>
6+
<RuntimeFrameworkVersion Condition="'$(TargetFramework)' == 'net8.0'">8.0.0</RuntimeFrameworkVersion>
67
<Title>Snowflake.Data.Tests</Title>
78
<Description>Snowflake Connector for .NET</Description>
89
<Company>Snowflake Computing, Inc</Company>

Snowflake.Data/Core/badInterface.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ namespace Snowflake.Data.Core
33
public interface badInterface
44
{
55
void methodwithnocaps();
6+
7+
void
8+
reallyunnecessarylkongandaijhafkjdhafkjlahsdkjgfhasdjkghkjasdfghkjadshgkjdshgkjasdhgkjdsdhjkhdhhjadhjkfhdkjafhkjdshfkjasdhfkjasdhfkdhafahskljf(int algo);
69
}
710
}

ci/scripts/linter.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash -e
2+
#
3+
# Apply Linter to changed files in PR
4+
set -e
5+
set -o pipefail
6+
7+
current_branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
8+
git fetch --no-tags origin master:master
9+
git fetch --no-tags origin $current_branch:$current_branch
10+
11+
BASE_SHA=$(git merge-base $GITHUB_BASE_REF $current_branch)
12+
13+
changed_files=$(git diff --name-only $BASE_SHA HEAD)
14+
15+
echo "All files changed:"
16+
for file in $changed_files; do
17+
echo "$file"
18+
done
19+
20+
echo "Running Dotnet format to changed files"
21+
dotnet format --include $changed_files --verify-no-changes --no-restore

0 commit comments

Comments
 (0)