Skip to content

Commit

Permalink
enhancement: C# and VB .NET Format Fixes (#3741)
Browse files Browse the repository at this point in the history
* csharp dotnet format updated

* vb dotnet format updated

* repository edge not required

* updated changelog

* Revert "repository edge not required"

This reverts commit e4581f3.
  • Loading branch information
TommyE123 authored Jul 21, 2024
1 parent a00e854 commit 39b597d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
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

0 comments on commit 39b597d

Please sign in to comment.