feat: use built-in dotnet format linter for csharp language (#4627)

* chore: add test case for csharp language which should pass

it shows that the current version of linter for csharp language reports false positive issues

* feat: use built-in linter for csharp language

https://github.com/dotnet/format/issues/1268

* chore: remove dotnet-format installation from install-dotnet.sh

dotnet format is a part of .NET 6 SDK and shouldn't be installed separately anymore

* docs: update linter name for dotnet

instead of dotnet-format built-in format command from dotnet is used (points to the same repository as before)

* chore: update linter name for dotnet in tests

---------

Co-authored-by: Zack Koppert <zkoppert@github.com>
This commit is contained in:
Vadim Hatsura 2023-10-16 20:31:03 +02:00 committed by GitHub
parent ffa8788acd
commit 80476af4f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 6 deletions

View file

@ -0,0 +1,14 @@
using System;
namespace HelloWorld;
internal enum Foo
{
Bar = 1,
Baz = 2
}
public class TestClass
{
public required Foo Bar { get; set; }
}

View file

@ -54,7 +54,7 @@ Developers on **GitHub** can call the **GitHub Action** to lint their codebase w
| **AWS CloudFormation templates** | [cfn-lint](https://github.com/aws-cloudformation/cfn-python-lint/) |
| **Azure Resource Manager (ARM)** | [arm-ttk](https://github.com/azure/arm-ttk) |
| **C++** | [cpp-lint](https://github.com/cpplint/cpplint) / [clang-format](https://clang.llvm.org/docs/ClangFormatStyleOptions.html) |
| **C#** | [dotnet-format](https://github.com/dotnet/format) / [clang-format](https://clang.llvm.org/docs/ClangFormatStyleOptions.html) |
| **C#** | [dotnet format](https://github.com/dotnet/format) / [clang-format](https://clang.llvm.org/docs/ClangFormatStyleOptions.html) |
| **CSS** | [stylelint](https://stylelint.io/) |
| **Clojure** | [clj-kondo](https://github.com/borkdude/clj-kondo) |
| **CoffeeScript** | [coffeelint](https://coffeelint.github.io/) |

View file

@ -286,7 +286,7 @@ LINTER_NAMES_ARRAY['CLOJURE']="clj-kondo"
LINTER_NAMES_ARRAY['CLOUDFORMATION']="cfn-lint"
LINTER_NAMES_ARRAY['COFFEESCRIPT']="coffeelint"
LINTER_NAMES_ARRAY['CPP']="cpplint"
LINTER_NAMES_ARRAY['CSHARP']="dotnet-format"
LINTER_NAMES_ARRAY['CSHARP']="dotnet"
LINTER_NAMES_ARRAY['CSS']="stylelint"
LINTER_NAMES_ARRAY['DART']="dart"
LINTER_NAMES_ARRAY['DOCKERFILE_HADOLINT']="hadolint"
@ -911,7 +911,7 @@ LINTER_COMMANDS_ARRAY['CLOJURE']="clj-kondo --config ${CLOJURE_LINTER_RULES} --l
LINTER_COMMANDS_ARRAY['CLOUDFORMATION']="cfn-lint --config-file ${CLOUDFORMATION_LINTER_RULES}"
LINTER_COMMANDS_ARRAY['COFFEESCRIPT']="coffeelint -f ${COFFEESCRIPT_LINTER_RULES}"
LINTER_COMMANDS_ARRAY['CPP']="cpplint"
LINTER_COMMANDS_ARRAY['CSHARP']="dotnet-format --folder --check --exclude / --include"
LINTER_COMMANDS_ARRAY['CSHARP']="dotnet format whitespace --folder --verify-no-changes --exclude / --include"
LINTER_COMMANDS_ARRAY['CSS']="stylelint --config ${CSS_LINTER_RULES}"
LINTER_COMMANDS_ARRAY['DART']="dartanalyzer --fatal-infos --fatal-warnings --options ${DART_LINTER_RULES}"
LINTER_COMMANDS_ARRAY['DOCKERFILE_HADOLINT']="hadolint -c ${DOCKERFILE_HADOLINT_LINTER_RULES}"

View file

@ -5,4 +5,3 @@ set -euo pipefail
curl --retry 5 --retry-delay 5 -sLO https://dot.net/v1/dotnet-install.sh
chmod +x dotnet-install.sh
./dotnet-install.sh --install-dir /usr/share/dotnet -channel STS -version latest
/usr/share/dotnet/dotnet tool install --tool-path /usr/bin dotnet-format --version 5.0.211103

View file

@ -107,7 +107,7 @@ control "super-linter-installed-commands" do
{ linter_name: "coffeelint"},
{ linter_name: "cpplint"},
{ linter_name: "dart"},
{ linter_name: "dotnet-format"},
{ linter_name: "dotnet"},
{ linter_name: "dotenv-linter"},
{ linter_name: "editorconfig-checker", version_option: "-version"},
{ linter_name: "eslint"},
@ -161,7 +161,7 @@ control "super-linter-installed-commands" do
SLIM_IMAGE_REMOVED_LINTERS=%w(
arm-ttk
clippy
dotnet-format
dotnet
dotenv-linter
pwsh
rustfmt