mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-22 00:31:07 -05:00
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:
parent
ffa8788acd
commit
80476af4f7
5 changed files with 19 additions and 6 deletions
14
.automation/test/csharp/csharp_good_02.cs
Normal file
14
.automation/test/csharp/csharp_good_02.cs
Normal 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; }
|
||||||
|
}
|
|
@ -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/) |
|
| **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) |
|
| **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++** | [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/) |
|
| **CSS** | [stylelint](https://stylelint.io/) |
|
||||||
| **Clojure** | [clj-kondo](https://github.com/borkdude/clj-kondo) |
|
| **Clojure** | [clj-kondo](https://github.com/borkdude/clj-kondo) |
|
||||||
| **CoffeeScript** | [coffeelint](https://coffeelint.github.io/) |
|
| **CoffeeScript** | [coffeelint](https://coffeelint.github.io/) |
|
||||||
|
|
|
@ -286,7 +286,7 @@ LINTER_NAMES_ARRAY['CLOJURE']="clj-kondo"
|
||||||
LINTER_NAMES_ARRAY['CLOUDFORMATION']="cfn-lint"
|
LINTER_NAMES_ARRAY['CLOUDFORMATION']="cfn-lint"
|
||||||
LINTER_NAMES_ARRAY['COFFEESCRIPT']="coffeelint"
|
LINTER_NAMES_ARRAY['COFFEESCRIPT']="coffeelint"
|
||||||
LINTER_NAMES_ARRAY['CPP']="cpplint"
|
LINTER_NAMES_ARRAY['CPP']="cpplint"
|
||||||
LINTER_NAMES_ARRAY['CSHARP']="dotnet-format"
|
LINTER_NAMES_ARRAY['CSHARP']="dotnet"
|
||||||
LINTER_NAMES_ARRAY['CSS']="stylelint"
|
LINTER_NAMES_ARRAY['CSS']="stylelint"
|
||||||
LINTER_NAMES_ARRAY['DART']="dart"
|
LINTER_NAMES_ARRAY['DART']="dart"
|
||||||
LINTER_NAMES_ARRAY['DOCKERFILE_HADOLINT']="hadolint"
|
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['CLOUDFORMATION']="cfn-lint --config-file ${CLOUDFORMATION_LINTER_RULES}"
|
||||||
LINTER_COMMANDS_ARRAY['COFFEESCRIPT']="coffeelint -f ${COFFEESCRIPT_LINTER_RULES}"
|
LINTER_COMMANDS_ARRAY['COFFEESCRIPT']="coffeelint -f ${COFFEESCRIPT_LINTER_RULES}"
|
||||||
LINTER_COMMANDS_ARRAY['CPP']="cpplint"
|
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['CSS']="stylelint --config ${CSS_LINTER_RULES}"
|
||||||
LINTER_COMMANDS_ARRAY['DART']="dartanalyzer --fatal-infos --fatal-warnings --options ${DART_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}"
|
LINTER_COMMANDS_ARRAY['DOCKERFILE_HADOLINT']="hadolint -c ${DOCKERFILE_HADOLINT_LINTER_RULES}"
|
||||||
|
|
|
@ -5,4 +5,3 @@ set -euo pipefail
|
||||||
curl --retry 5 --retry-delay 5 -sLO https://dot.net/v1/dotnet-install.sh
|
curl --retry 5 --retry-delay 5 -sLO https://dot.net/v1/dotnet-install.sh
|
||||||
chmod +x dotnet-install.sh
|
chmod +x dotnet-install.sh
|
||||||
./dotnet-install.sh --install-dir /usr/share/dotnet -channel STS -version latest
|
./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
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ control "super-linter-installed-commands" do
|
||||||
{ linter_name: "coffeelint"},
|
{ linter_name: "coffeelint"},
|
||||||
{ linter_name: "cpplint"},
|
{ linter_name: "cpplint"},
|
||||||
{ linter_name: "dart"},
|
{ linter_name: "dart"},
|
||||||
{ linter_name: "dotnet-format"},
|
{ linter_name: "dotnet"},
|
||||||
{ linter_name: "dotenv-linter"},
|
{ linter_name: "dotenv-linter"},
|
||||||
{ linter_name: "editorconfig-checker", version_option: "-version"},
|
{ linter_name: "editorconfig-checker", version_option: "-version"},
|
||||||
{ linter_name: "eslint"},
|
{ linter_name: "eslint"},
|
||||||
|
@ -161,7 +161,7 @@ control "super-linter-installed-commands" do
|
||||||
SLIM_IMAGE_REMOVED_LINTERS=%w(
|
SLIM_IMAGE_REMOVED_LINTERS=%w(
|
||||||
arm-ttk
|
arm-ttk
|
||||||
clippy
|
clippy
|
||||||
dotnet-format
|
dotnet
|
||||||
dotenv-linter
|
dotenv-linter
|
||||||
pwsh
|
pwsh
|
||||||
rustfmt
|
rustfmt
|
||||||
|
|
Loading…
Reference in a new issue