Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Specify SDK version in global.json - #2592

Merged
vitek-karas merged 2 commits into
dotnet:mainfrom
sbomer:fixLint
Feb 15, 2022
Merged

vitek-karas merged 2 commits into
dotnet:mainfrom
sbomer:fixLint

Conversation

@sbomer

@sbomer sbomer commented Feb 8, 2022

Copy link
Copy Markdown
Member

@vitek-karas I saw some strange behavior in the lint script again in #2585. It was failing in PR but not locally. I tracked this down to the fact that our global.json doesn't specify an SDK version, so it was running locally with a version of dotnet format from the 7.0 SDK I have installed.

The pipeline is already passing --verify-no-changes so I don't think we need to run it twice.

I took the allowPrerelease and rollForward settings from dotnet/runtime to make it possible to build the repo locally even with a later SDK (even though it becomes possible then to run into this issue). I don't have a strong preference on it and would be fine with requiring the exact SDK if you prefer.

@sbomer
sbomer requested a review from marek-safar as a code owner February 8, 2022 01:08
@sbomer
sbomer requested review from agocke and tlakollo February 8, 2022 17:13
@vitek-karas

Copy link
Copy Markdown
Member

I agree that my solution is partially wrong because it runs the same command in CI twice...
And having a somewhat fixed SDK version is definitely a good idea.

That said, removing the second invocation locally removes the "fix" I tried to make. You can try this, just add an internal method with unused parameter and run lint. It should "fail" due to IDE0060, but with your change it behaves as before - it simply says "Unable to fix IDE0060. No associated code fix found." and succeeds the command. It doesn't show why/where the problem is.

So I think that locally we should still run the tool twice - once to apply any automatic fixes it can, and second time to report detailed warnings for the things it couldn't fix.

The CI should be fine running it once with --verify-no-changes.

@sbomer sbomer self-assigned this Feb 9, 2022
@sbomer

sbomer commented Feb 9, 2022

Copy link
Copy Markdown
Member Author

Thanks @vitek-karas, I see what you mean. Personally I wouldn't mind having to run ./lint.sh --verify-no-changes locally to get the details, but I see the problem that running it twice addresses. It's confusing either way. I'll leave it as-is and just fix the SDK version here.

@sbomer sbomer changed the title Run dotnet format only once Specify SDK version in global.json Feb 9, 2022
@vitek-karas
vitek-karas merged commit 6e11d05 into dotnet:main Feb 15, 2022
vitek-karas added a commit that referenced this pull request Feb 16, 2022
* Fix how test find the ref pack to compile test cases against (#2610)

With latest VS we get a 6.0.2 runtime but only 6.0.1 ref pack. The tests so far expected to use the exact same version, but there's no hard rule that it will be the case.

Change the algorithm to search for highest available major.minor.* ref pack if the matching one doesn't exist.

* Specify SDK version in global.json (#2592)

Co-authored-by: Vitek Karas <[email protected]>
Co-authored-by: Sven Boemer <[email protected]>
@sbomer
sbomer deleted the fixLint branch February 22, 2022 18:13
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
* Fix how test find the ref pack to compile test cases against (dotnet/linker#2610)

With latest VS we get a 6.0.2 runtime but only 6.0.1 ref pack. The tests so far expected to use the exact same version, but there's no hard rule that it will be the case.

Change the algorithm to search for highest available major.minor.* ref pack if the matching one doesn't exist.

* Specify SDK version in global.json (dotnet/linker#2592)

Co-authored-by: Vitek Karas <[email protected]>
Co-authored-by: Sven Boemer <[email protected]>

Commit migrated from dotnet/linker@f7e921c
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants