Skip to content

Commit

Permalink
Use local dotnet-format version (#1759)
Browse files Browse the repository at this point in the history
We have a specific version of `dotnet-format` specified in local tools
but our commands have been using the version in the current SDK.
  • Loading branch information
gunndabad authored Dec 19, 2024
1 parent 27ec329 commit d4bdd23
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
- name: Lint
run: |
git fetch origin main --quiet --depth=1
CHANGED_FILES=$(git diff --name-only origin/main $GITHUB_SHA | { grep -oP '^TeachingRecordSystem\/\K.*\.cs(proj)?$' || true; })
if [ "$CHANGED_FILES" == "" ]; then
Expand All @@ -46,7 +47,7 @@ jobs:
echo "::notice::Linting changed files only"
fi
dotnet format --verify-no-changes $INCLUDE_ARG
dotnet dotnet-format --verify-no-changes $INCLUDE_ARG
working-directory: TeachingRecordSystem

validate_terraform:
Expand Down
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ test:

# Format the .NET solution and Terraform code
format:
@cd {{solution-root}} && dotnet format
@cd {{solution-root}} && dotnet dotnet-format
@terraform fmt terraform/aks

# Format any un-committed .tf or .cs files
Expand All @@ -64,7 +64,7 @@ format-changed:

$changedCsFiles = (Get-ChangedFiles "{{solution-root}}/**/*.cs") | foreach { $_ -Replace "^{{solution-root}}/", "" }
if ($changedCsFiles.Length -gt 0) {
$dotnetArgs = @("format", "--no-restore", "--include") + $changedCsFiles
$dotnetArgs = @("dotnet-format", "--no-restore", "--include") + $changedCsFiles
cd {{solution-root}} && dotnet $dotnetArgs
}

Expand Down

0 comments on commit d4bdd23

Please sign in to comment.