dotnet / dotnet/format

Issues when files are not part of a subfolder

Open
#1,323 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
1.9k
Forks
173
Avg merge
10d 13h
Merged PRs (30d)
1

Description

I'm trying to apply a style fix to some of the projects on dotnet/sdk.

I've tried a bunch of things and none seem to work.

In essence, there is a solution filter at src/RazorSdk/Razor.slnf which contains a set of projects:
* some of them are under src/RazorSdk
* some others are under src/Test
* somne others are under src/BlazorWasmSdk
* I have an editor config where I marked IDE0073 as an error

When I run the following command, I get dotnet-format to apply the fixes correctly
```powershell
Get-ChildItem -File -Recurse -Filter *.cs | Resolve-Path -Relative | dotnet-format -s error --diagnostics IDE0073 .\Razor.slnf --include -
```

However when I try to do the same with files outside of the src/RazorSdk folder no fix is applied no matter what I try. Here are some things I've tried:

#### Passing relative paths from the current folder
```powershell
Get-ChildItem ..\BlazorWasmSdk\ -File -Recurse -Filter *.cs | Resolve-Path -Relative | dotnet-format -s error --diagnostics IDE0073 .\Razor.slnf --include -
```

#### Passing full paths from the current folder
```powershell
Get-ChildItem ..\BlazorWasmSdk\ -File -Recurse -Filter *.cs | Resolve-Path | dotnet-format -s error --diagnostics IDE0073 .\Razor.slnf --include -
```

#### Invoking from the root of the repo
```powershell
Get-ChildItem src\BlazorWasmSdk\ -File -Recurse -Filter *.cs | Resolve-Path | dotnet-format -s error --diagnostics IDE0073 .\src\RazorSdk\Razor.slnf --include -
```

It's not clear to me if I'm doing something wrong, however I would expect paths relative to the sln folder, or absolute paths to the file to work.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.