From 3d869bfa47426b470f2201350f613e7c7b061234 Mon Sep 17 00:00:00 2001 From: Steven Lizano Date: Thu, 21 Mar 2024 13:58:09 -0600 Subject: [PATCH] change linter to be executed from bash --- .DS_Store | Bin 10244 -> 10244 bytes .github/workflows/linter.yml | 9 ++------- .gitignore | 3 +++ ci/linter.sh | 27 +++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 7 deletions(-) create mode 100755 ci/linter.sh diff --git a/.DS_Store b/.DS_Store index 9f4658b0f32abb7905bed2122c98d1e7f971ce30..587d22f40cacf91ee5897bece5ae27e5c0e6eaf6 100644 GIT binary patch delta 441 zcmZn(XbG6$&uF_bU^hRb?PMN-n%JHQ1_lNe20ey!hD?T%+fU zt{!znl~2JdUyxxKoSdIq0Mx_4kZdsdseljT&dCN+g&LC8)n=B4ItoUnrnNc>)rLj} zMmh>+W(KvjoE)Oc`qn}5**Up+`Q4K@ipk6L0Cls&+{BQ$Qkdn%D|P1_lNe20ey!hD?T%+@&dvRO`49IJXsMgY_FJEQ;r diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 757820718..4e37d7830 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -37,10 +37,5 @@ jobs: with: dotnet-version: "6.0.x" - name: Run linters - uses: wearerequired/lint-action@v2 - with: - dotnet_format: true - continue_on_error: false - github_token: ${{ secrets.GITHUB_TOKEN }} - check_name: ${linter} run - auto_fix: true \ No newline at end of file + shell: bash + run: ./ci/linter.sh \ No newline at end of file diff --git a/.gitignore b/.gitignore index 325ad49d6..71094d10f 100644 --- a/.gitignore +++ b/.gitignore @@ -309,3 +309,6 @@ whitesource/ Snowflake.Data.Tests/macos_*_performance.csv Snowflake.Data.Tests/windows_*_performance.csv Snowflake.Data.Tests/unix_*_performance.csv + +# MacOs only files +**/.DS_Store diff --git a/ci/linter.sh b/ci/linter.sh new file mode 100755 index 000000000..06236cec2 --- /dev/null +++ b/ci/linter.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Ensure the script stops if there's an error +set -e + +# Fetch latest commits and branches from origin to ensure the comparison is up-to-date +git fetch origin master + +# List files that have been modified in the current branch compared to master +# This filters for files ending in .cs (C# files) +modified_files=$(git diff --name-only origin/master...HEAD | grep '\.cs$') + +# Check if modified_files is empty +if [ -z "$modified_files" ]; then + echo "No C# files have been modified." +else + echo "Modified C# files:" + echo "$modified_files" + + # Run dotnet format on each modified file + for file in $modified_files; do + echo "Formatting $file" + dotnet format "$file" --check --verbosity diagnostic + done + + echo "Formatting complete." +fi