megalinter
megalinter copied to clipboard
Upgrade dotnet to v6 + list_of_files for dotnet-format
Fixes https://github.com/oxsecurity/megalinter/issues/1642
MegaLinter status: :warning: WARNING
Descriptor | Linter | Files | Fixed | Errors | Elapsed time |
---|---|---|---|---|---|
✅ BASH | bash-exec | 7 | 0 | 0.02s | |
✅ BASH | shellcheck | 7 | 0 | 0.25s | |
✅ BASH | shfmt | 7 | 0 | 0 | 0.27s |
✅ COPYPASTE | jscpd | yes | no | 1.91s | |
✅ DOCKERFILE | hadolint | 103 | 0 | 18.35s | |
✅ JSON | eslint-plugin-jsonc | 20 | 0 | 0 | 2.08s |
✅ JSON | jsonlint | 18 | 0 | 3.68s | |
✅ JSON | v8r | 20 | 0 | 10.72s | |
:warning: MARKDOWN | markdownlint | 280 | 0 | 5 | 4.25s |
✅ MARKDOWN | markdown-link-check | 280 | 0 | 4.82s | |
✅ MARKDOWN | markdown-table-formatter | 280 | 0 | 0 | 6.48s |
✅ OPENAPI | spectral | 1 | 0 | 0.77s | |
:warning: PYTHON | bandit | 164 | 50 | 2.01s | |
✅ PYTHON | black | 164 | 0 | 0 | 3.19s |
✅ PYTHON | flake8 | 164 | 0 | 1.79s | |
✅ PYTHON | isort | 164 | 0 | 0 | 0.57s |
✅ PYTHON | mypy | 164 | 0 | 88.76s | |
✅ PYTHON | pylint | 164 | 0 | 14.29s | |
✅ REPOSITORY | git_diff | yes | no | 0.27s | |
✅ REPOSITORY | secretlint | yes | no | 11.27s | |
✅ REPOSITORY | trivy | yes | no | 20.87s | |
✅ SPELL | cspell | 660 | 0 | 18.74s | |
✅ SPELL | misspell | 491 | 0 | 0 | 0.61s |
✅ XML | xmllint | 3 | 0 | 0.0s | |
✅ YAML | prettier | 80 | 0 | 0 | 2.24s |
✅ YAML | v8r | 23 | 0 | 25.45s | |
✅ YAML | yamllint | 81 | 0 | 1.05s |
See errors details in artifact MegaLinter reports on CI Job page
@lextatic thanks for the tips , I made the updates :)
Updates done :)
@lextatic why this "whitespace" ? Aren't there other types of formatting than just whitespaces ? ^^
@lextatic why this "whitespace" ? Aren't there other types of formatting than just whitespaces ? ^^
Yes, dotnet-format can formate styling too, but it won't work without a .csproj
or .sln
file. So if you want to lint only .cs
files exactly as it used to in dotnet 5.0 you have to link whitespaces only with the --folder
argument. --folder
is option exclusive for linting with whitespace
.
Here's the doc I found about it: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-format
I also left some comments in this issue trying to explain a possible solution to solve this.
@lextatic why this "whitespace" ? Aren't there other types of formatting than just whitespaces ? ^^
On a second thought, someone linting .NET should probably have a .sln
or .proj
file anyway, and you already have a DEFAULT_WORKSPACE
var that could point megalinter in that direction.
So you could just add a .sln
or proj
file to your csharp and vb automated tests and go on with without changing anything, dropping the whitespace and --folder args altogether and having all of dotnet-format's functionality.
dotnet format --verify-no-changes --exclude / --include myfile.cs myfile2.cs
would work nicely as it is now.
Thinking about it, that seems the most plausible solution, I was worried about making the new code pass your previous tests but in this case we should adapt the tests as the system changed. And this would be just add the project
files.
@lextatic do you have an example of .sln file that would work ?
@lextatic do you have an example of .sln file that would work ?
Created a PR with such project files.
It looks like DevSkim has not been upgraded to dotnet 6.0 yet.
https://github.com/microsoft/DevSkim https://github.com/microsoft/DevSkim/pulls
:/ Do you know if it is possible to make dotnet 5 & dotnet 6 live together ? ( I never developed in dotnet)
There may be other ways as well, but I know the dotnet-core asdf plugin is capable of this.
:/ Do you know if it is possible to make dotnet 5 & dotnet 6 live together ? ( I never developed in dotnet)
Yes, I have both SDKs on my machine and they're interchangeable. You can have a global.json
file on a folder and when dotnet is executed from this location it uses the SDK configured in the file.
Reference: https://www.markheath.net/post/switching-between-netcore-sdk-versions
Is there a command like dotnet switch-to-v5
and dotnet switch-to-v6
that I could easily use ?
Is there a command like
dotnet switch-to-v5
anddotnet switch-to-v6
that I could easily use ?
Hmm, I guess dotnet new globaljson --sdk-version <version> --force
does exactly that, you just have to check if both versions are installed under .NET SDKs installed
upon using dotnet --info
For example:
dotnet new globaljson --sdk-version 5.0.408 --force
to use dotnet 5.0
and
dotnet new globaljson --sdk-version 6.0.302 --force
to use dotnet 6.0
https://docs.microsoft.com/en-us/dotnet/core/tools/global-json
Better yet:
dotnet new globaljson --sdk-version 5.0.0 --roll-forward latestMinor --force
and
dotnet new globaljson --sdk-version 6.0.0 --roll-forward latestMinor --force
@lextatic Just asked DevSkim if they planned an upgrade, it would ease our task here ^^
https://github.com/microsoft/DevSkim/issues/391
@lextatic FYI :) https://github.com/microsoft/DevSkim/issues/391#issuecomment-1215828197
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
If you think this pull request should stay open, please remove the O: stale 🤖
label or comment on the pull request.