Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: C# and VB .NET Format Fixes #3741

Merged
merged 9 commits into from
Jul 21, 2024
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l

- Fixes
- [terrascan](https://runterrascan.io/) fixed errors and removed redundant code
- [dotnet-format](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-format) various performance improvements and ability to specify sln or proj paths

- Doc

Expand Down
18 changes: 14 additions & 4 deletions megalinter/descriptors/csharp.megalinter-descriptor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,30 @@ linters:
linter_text: |
dotnet-format requires a `.sln` or `.csproj` file to run correctly.
linter_url: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-format
linter_repo: https://github.com/dotnet/format
linter_repo: https://github.com/dotnet/sdk
linter_rules_configuration_url: https://github.com/dotnet/sdk/tree/main/documentation/format/docs
linter_image_url: https://user-images.githubusercontent.com/9797472/61659851-6bbdc880-ac7d-11e9-95f7-d30c7de1a18a.png
cli_lint_errors_count: regex_count
cli_lint_errors_regex: ".cs\\([0-9]+,[0-9]+\\):\\s(?:warning|error)"
cli_executable: dotnet
cli_lint_mode: project
cli_lint_extra_args:
- "format"
- "{{WORKSPACE}}"
cli_lint_extra_args_after:
- "--include **/*.cs"
- "--verify-no-changes"
cli_lint_fix_arg_name: "--megalinter-fix-flag" # Workaround for DotnetFormatLinter class behavior
cli_lint_fix_remove_args:
- "--verify-no-changes"
cli_help_extra_args:
- format
examples:
- "dotnet format {{WORKSPACE}} --verify-no-changes"
- "dotnet format {{WORKSPACE}}" # Fix
- "dotnet format --verify-no-changes"
- "dotnet format Solution.sln --verify-no-changes"
- "dotnet format Folder/Solution.sln --verify-no-changes"
- "dotnet format Project.csproj --verify-no-changes"
- "dotnet format" # Fix

# CSharpier
- class: DotNetToolLinter
linter_name: csharpier
Expand Down Expand Up @@ -70,6 +79,7 @@ linters:
vscode:
- name: csharpier-vscode
url: https://marketplace.visualstudio.com/items?itemName=csharpier.csharpier-vscode

# Roslynator
- class: RoslynatorLinter
linter_name: roslynator
Expand Down
16 changes: 12 additions & 4 deletions megalinter/descriptors/vbdotnet.megalinter-descriptor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,26 @@ linters:
linter_text: |
dotnet-format requires a `.sln` or `.vbproj` file to run correctly.
linter_url: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-format
linter_repo: https://github.com/dotnet/format
linter_repo: https://github.com/dotnet/sdk
linter_rules_configuration_url: https://github.com/dotnet/sdk/tree/main/documentation/format/docs
linter_image_url: https://user-images.githubusercontent.com/9797472/61659851-6bbdc880-ac7d-11e9-95f7-d30c7de1a18a.png
cli_lint_errors_count: regex_count
cli_lint_errors_regex: ".vb\\([0-9]+,[0-9]+\\):\\s(?:warning|error)"
cli_executable: dotnet
cli_lint_mode: project
cli_lint_extra_args:
- "format"
- "{{WORKSPACE}}"
cli_lint_extra_args_after:
- "--include **/*.vb"
- "--verify-no-changes"
cli_lint_fix_arg_name: "--megalinter-fix-flag" # Workaround to allow fix
cli_lint_fix_remove_args:
- "--verify-no-changes"
cli_help_extra_args:
- format
examples:
- "dotnet format {{WORKSPACE}} --verify-no-changes"
- "dotnet format {{WORKSPACE}}" # Fix
- "dotnet format --verify-no-changes"
- "dotnet format Solution.sln --verify-no-changes"
- "dotnet format Folder/Solution.sln --verify-no-changes"
- "dotnet format Project.vbproj --verify-no-changes"
- "dotnet format" # Fix