From b5499948d32b9a6d13d0d097fb808d791951ed61 Mon Sep 17 00:00:00 2001 From: Lex Date: Fri, 6 Jan 2023 03:49:06 -0300 Subject: [PATCH] Upgrade dotnet to v6 (#1680) * Upgrade dotnet to v6 + list_of_files for dotnet-format * Fixes * Fixes * Adding dotnet project files * Better .cs examples of bad code * Dotnet Upgrade project files (#1679) * Adding dotnet project files * Better .cs examples of bad code Co-authored-by: Alexandre Melotti * Update doc * Adding .csproj files to sample_project_fixes * Added .sln info on linter_text property * Updated linter URL and added {{WORKSPACE}} CLI arg * Unifying vb and csharp projects into one single solution * Upgrade dotnet version on linter dockers * Really upgrade dotnet everywhere * Revert "Upgrade dotnet version on linter dockers" This reverts commit 995e9df8be7e916d889535fb667d2a17532444e3. * Testing some Dockerfile configs * dotnet info * Trying to figure out dotnet version running on each test case * Checking root's workspace * Checking for tool versions * Removing dotnet-format install from Docker images * Updating linter versions and helps for dotnet-format * Reverting pre_coomands and configuring new dotnet format params * Forgot the "format" argument * Updating test reports * Fixed ERROR paths * Undowngrade DevSkim version * changelog * Remove version from DevSkim install line * Update TSQLLint version * fix dotnet format call * Using relative paths for worksapces * Detailed logging for debug * Revert "Using relative paths for worksapces" This reverts commit 92f57bc07d33e5da603cd8e18fd5ebf14e954c50. * Disabling list_of_files mode. * Reverting back to list_of_files * Echoing linting command * Checking workspace path * Fixing descriptor parsing * Fix parse * Trying to figure out why --include is failing * Testing the exact computed command manually * Testing relative paths * Checking file contnt before testing linter * Checking editorconfig contents * Adding editorconfigs to validate whitespaces. Also reverting all changes to descriptors. * Re-enabling detailed logging * Adding style error to csharp_bad_02.cs. * Testing whitespace formatting for vb only * I don't know anymore * Fixed VB descriptor * A few mroe tests with editorconfigs * Fixed pre-command syntax * Testing lint without --include parameter * Trying several path styles * Testing some different paths * Testing echo * More tests * Checking versions * Adding dotnet --info * Upgrade to dotnet 7 and removed list_of_files * Revert some changes for --list-of-files * More experiments * Ops * Fixing malformed file * Whoa, python sux * Change dotnet command * Updating reports for tests * Success linters also format bad files * Separating good and bad test projects * Revert back to dotnet6 * Updated success report files * Removing unused import from DotnetFormatLinter.py * Upgrade to dotnet 7 * Removing csharpier version specification from install cli * Revert "Upgrade to dotnet 7" This reverts commit 7630633e5db732ef6e85497f5c3adc958962b712. * Updating changelog, removed 'list_of_files' for now Co-authored-by: nvuillam Co-authored-by: Alexandre Melotti --- .automation/generated/linter-helps.json | 35 ++++++++++-------- .automation/test/csharp/bad/csharp_bad_01.cs | 11 ++++++ .automation/test/csharp/bad/csharp_bad_02.cs | 13 +++++++ .../test/csharp/bad/csharp_project.csproj | 10 +++++ .automation/test/csharp/csharp_bad_01.cs | Bin 1253 -> 0 bytes .../test/csharp/{ => good}/csharp_good_01.cs | 0 .../test/csharp/good/csharp_good_02.cs | 12 ++++++ .../test/csharp/good/csharp_project.csproj | 10 +++++ .../reports/ERROR-CSHARP_DOTNET_FORMAT.txt | 16 +++++--- .../reports/SUCCESS-CSHARP_DOTNET_FORMAT.txt | 10 +++-- .../csharp_for_fixes_1.cs | 0 .../csharp_project/csharp_project.csproj | 10 +++++ .../sample_project_fixes/dotnet_solution.sln | 31 ++++++++++++++++ .../vbdotnet_for_fixes_1.vb | 0 .../vbdotnet_project/vbdotnet_project.vbproj | 9 +++++ .../test/vbdotnet/bad/vb_projecty.vbproj | 9 +++++ .../test/vbdotnet/{ => bad}/vbdotnet_bad_1.vb | 0 .../test/vbdotnet/bad/vbdotnet_bad_2.vb | 7 ++++ .../test/vbdotnet/good/vb_projecty.vbproj | 9 +++++ .../vbdotnet/{ => good}/vbdotnet_good_1.vb | 0 .../test/vbdotnet/good/vbdotnet_good_2.vb | 7 ++++ .../reports/ERROR-VBDOTNET_DOTNET_FORMAT.txt | 24 ++++++++---- .../SUCCESS-VBDOTNET_DOTNET_FORMAT.txt | 10 +++-- CHANGELOG.md | 2 + Dockerfile | 18 ++++----- flavors/dotnet/Dockerfile | 14 +++---- flavors/security/Dockerfile | 4 +- linters/csharp_dotnet_format/Dockerfile | 5 +-- linters/repository_devskim/Dockerfile | 4 +- linters/sql_tsqllint/Dockerfile | 2 +- linters/vbdotnet_dotnet_format/Dockerfile | 5 +-- .../csharp.megalinter-descriptor.yml | 25 +++++++------ .../repository.megalinter-descriptor.yml | 4 +- .../descriptors/sql.megalinter-descriptor.yml | 5 +-- .../vbdotnet.megalinter-descriptor.yml | 25 ++++++------- megalinter/linters/DotnetFormatLinter.py | 8 ++-- 36 files changed, 249 insertions(+), 105 deletions(-) create mode 100644 .automation/test/csharp/bad/csharp_bad_01.cs create mode 100644 .automation/test/csharp/bad/csharp_bad_02.cs create mode 100644 .automation/test/csharp/bad/csharp_project.csproj delete mode 100644 .automation/test/csharp/csharp_bad_01.cs rename .automation/test/csharp/{ => good}/csharp_good_01.cs (100%) create mode 100644 .automation/test/csharp/good/csharp_good_02.cs create mode 100644 .automation/test/csharp/good/csharp_project.csproj rename .automation/test/sample_project_fixes/{ => csharp_project}/csharp_for_fixes_1.cs (100%) create mode 100644 .automation/test/sample_project_fixes/csharp_project/csharp_project.csproj create mode 100644 .automation/test/sample_project_fixes/dotnet_solution.sln rename .automation/test/sample_project_fixes/{ => vbdotnet_project}/vbdotnet_for_fixes_1.vb (100%) create mode 100644 .automation/test/sample_project_fixes/vbdotnet_project/vbdotnet_project.vbproj create mode 100644 .automation/test/vbdotnet/bad/vb_projecty.vbproj rename .automation/test/vbdotnet/{ => bad}/vbdotnet_bad_1.vb (100%) create mode 100644 .automation/test/vbdotnet/bad/vbdotnet_bad_2.vb create mode 100644 .automation/test/vbdotnet/good/vb_projecty.vbproj rename .automation/test/vbdotnet/{ => good}/vbdotnet_good_1.vb (100%) create mode 100644 .automation/test/vbdotnet/good/vbdotnet_good_2.vb diff --git a/.automation/generated/linter-helps.json b/.automation/generated/linter-helps.json index 0209b1cf627..b2f6bc82950 100644 --- a/.automation/generated/linter-helps.json +++ b/.automation/generated/linter-helps.json @@ -1580,30 +1580,35 @@ " list Shows list of available checks [aliases: l]" ], "dotnet-format": [ - "dotnet-format", - " dotnet-format", + "Description:", + " Formats code to match editorconfig settings.", "", "Usage:", - " dotnet-format [options] []", + " dotnet format [] [command] [options]", "", "Arguments:", - " A path to a solution file, a project file, or a folder containing a solution or project file. If a path is not specified then the current directory is used. [default: ]", + " The project or solution file to operate on. If a file is not specified, the command will search the current directory for one. [default: ]", "", "Options:", + " --diagnostics A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues.", + " [default: whichever ids are listed in the editorconfig file]", + " --severity The severity of diagnostics to fix. Allowed values are info, warn, and error.", " --no-restore Doesn't execute an implicit restore before formatting.", - " -f, --folder Whether to treat the `` argument as a simple folder of files.", - " -w, --fix-whitespace Run whitespace formatting. Run by default when not applying fixes.", - " -s, --fix-style Run code style analyzers and apply fixes.", - " -a, --fix-analyzers Run 3rd party analyzers and apply fixes.", - " --diagnostics A space separated list of diagnostic ids to use as a filter when fixing code style or 3rd party issues. [default: ]", - " --include A list of relative file or folder paths to include in formatting. All files are formatted if empty. [default: ]", - " --exclude A list of relative file or folder paths to exclude from formatting. [default: ]", - " --check Formats files without saving changes to disk. Terminates with a non-zero exit code if any files were formatted.", - " --report Accepts a file path, which if provided, will produce a json report in the given directory.", + " --verify-no-changes Verify no formatting changes would be performed. Terminates with a non-zero exit code if any files would have", + " been formatted.", + " --include A list of relative file or folder paths to include in formatting. All files are formatted if empty. [default:", + " all files in the solution or project]", + " --exclude A list of relative file or folder paths to exclude from formatting. [default: none]", + " --include-generated Format files generated by the SDK.", " -v, --verbosity Set the verbosity level. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]", " --binarylog Log all project or solution load information to a binary log file.", - " --version Show version information", - " -?, -h, --help Show help and usage information", + " --report Accepts a file path, which if provided, will produce a json report in the given directory.", + " -?, -h, --help Show command line help.", + "", + "Commands:", + " whitespace Run whitespace formatting. [default: ]", + " style Run code style analyzers and apply fixes. [default: ]", + " analyzers Run 3rd party analyzers and apply fixes. [default: ]", "" ], "dustilock": [ diff --git a/.automation/test/csharp/bad/csharp_bad_01.cs b/.automation/test/csharp/bad/csharp_bad_01.cs new file mode 100644 index 00000000000..b0f430afd10 --- /dev/null +++ b/.automation/test/csharp/bad/csharp_bad_01.cs @@ -0,0 +1,11 @@ +using System; + +namespace HelloWorld +{ + class Program { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff --git a/.automation/test/csharp/bad/csharp_bad_02.cs b/.automation/test/csharp/bad/csharp_bad_02.cs new file mode 100644 index 00000000000..ee40f8b0470 --- /dev/null +++ b/.automation/test/csharp/bad/csharp_bad_02.cs @@ -0,0 +1,13 @@ +using System; + +namespace HelloWorld +{ + class Program + { + static void Main (string[] args) + { + Console.WriteLine ("Hello World!"); + var value = 3 * 4 + 5; + } + } +} diff --git a/.automation/test/csharp/bad/csharp_project.csproj b/.automation/test/csharp/bad/csharp_project.csproj new file mode 100644 index 00000000000..74abf5c9766 --- /dev/null +++ b/.automation/test/csharp/bad/csharp_project.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/.automation/test/csharp/csharp_bad_01.cs b/.automation/test/csharp/csharp_bad_01.cs deleted file mode 100644 index fb79c65b97fe903ba468562da5a86a7d34b0462f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1253 zcmex=6kE^cmKJ|O{KK0!WiZUHd? zL17V5QBfX#aS1UI2_X?t5k_X9dKOkrR#r|CUT$6yFc5`Mf`SlQL_kDXL{LPOAIJ~^ z>fsj=f<@5aeJ`U{GLY6l7o$WMmd({C|W&0_Y_mfH)XTvaz#rFac$B z1sIqZnVDD_*;%2oj7&g>3$h6@uq!GViU^A-8#x9ha)>$=egG<$Vq^e%56K(`RyJl9 z21bxkT7nE9lbG0;VHN?65@cWzQZ#f76i#FPc7hT?D)snkuQxn@a+11Zi zo@DrEd{q4UhFhJtwoX$rUCS3=T=g~St4Y+X-sK&^&N82k-X3x`>FcnmSr(>jSN`#I z_)OV)^Ai8s!GZ9&cYB_qcCvJ)@ZSs?${&+jC4Nb{nWanp4a@ z@6PJ|pPmQYZJV?^Bq%6McUhQ6qDRY`o)fQL{m{O_XFPE#3-5tK{U2UoLLMv6z7n|@ zCM;EbvFfb1n@MfklFn&2G#5=13>4%!=ggBEJnvo;hFTf|%FZ zUGG;MY!p1TS?=nq$7g4G_U1g>7JVe-;VM_(NS8@=XE>%VnUdsF)_PK%CtSHlH%7GN zBa^>XZ~t-0unB*67ld#y=Ovu@xlE>K&G)rxJEK=D{kuzoVdcUJe>AgXIAsK?s$Ja= zzI^0(pnbyAJxk9OeOYD}(%unV!&F=MPwV8nBU8VGz1Ew3`9eT|&x-D>u12LLy~fw; z?j8KIiM`yP;iG`wjza&nF?uF#r}($})(6a)xne=~zby;bZjM?zr8+1or1$aHB5jre zXQnmBoE(1lR9M=W-)6CDnW`pgtgQ3z^~OgN@?s08Pia{d0j>ts@7MLCG+My zIXdfj%I>PW&SfPl*F;FFO;ccd7CF-`oTe9uz;Gw@}7dw(?S_k*Pz6I29D zui8A}JbFLEfa}h>n_>%96;{vv)1Sw-uXOW?y!@!2z6C3nuV}2DTmAG&m!$gISw(?? zq9F+@q&s}{i)-#W@R)y-m?Ec_%6@vL{bsAmur+^tcpMbY%l>;Sf3D?eyy@4wt7lv| zyuzgRn6z%eERWSfGZ&^iyl=WFmU?Hk{7GpsF3+6D3%FIITTkrddL`JBJ8g-?j3;wi zV|J8&ZPj0r$P_9$@7^yyPm%nupG99^i&%EsIe+u?S@nrwzvo4AX{eOv@~nQK_xQfz q?FP>zMHLpamnsDue>3m + + + Exe + net6.0 + enable + enable + + + diff --git a/.automation/test/csharp/reports/ERROR-CSHARP_DOTNET_FORMAT.txt b/.automation/test/csharp/reports/ERROR-CSHARP_DOTNET_FORMAT.txt index f4b4bc59757..515d7c368b6 100644 --- a/.automation/test/csharp/reports/ERROR-CSHARP_DOTNET_FORMAT.txt +++ b/.automation/test/csharp/reports/ERROR-CSHARP_DOTNET_FORMAT.txt @@ -1,10 +1,14 @@ -Results of dotnet-format linter (version 4.1.131201) +Results of dotnet-format linter (version 000) See documentation on https://megalinter.github.io/descriptors/csharp_dotnet_format/ ----------------------------------------------- -[ERROR] .automation/test/csharp/csharp_bad_01.cs - Formatting code files in workspace '.automation/test/csharp'. - csharp/csharp_bad_01.cs(1,33): Fix whitespace formatting. - Formatted code file '.automation/test/csharp/csharp_bad_01.cs'. - Format complete in 1295ms. +❌ [ERROR] .automation/test/csharp/csharp_bad_01.cs + .automation/test/csharp/csharp_bad_01.cs(5,18): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\n\s\s\s\s'. [.automation/test/csharp/csharp_project.csproj] + .automation/test/csharp/csharp_bad_02.cs(7,25): error WHITESPACE: Fix whitespace formatting. Delete 1 characters. [.automation/test/csharp/csharp_project.csproj] + .automation/test/csharp/csharp_bad_02.cs(9,30): error WHITESPACE: Fix whitespace formatting. Delete 1 characters. [.automation/test/csharp/csharp_project.csproj] + +❌ [ERROR] .automation/test/csharp/csharp_bad_02.cs + .automation/test/csharp/csharp_bad_01.cs(5,18): error WHITESPACE: Fix whitespace formatting. Replace 1 characters with '\n\s\s\s\s'. [.automation/test/csharp/csharp_project.csproj] + .automation/test/csharp/csharp_bad_02.cs(7,25): error WHITESPACE: Fix whitespace formatting. Delete 1 characters. [.automation/test/csharp/csharp_project.csproj] + .automation/test/csharp/csharp_bad_02.cs(9,30): error WHITESPACE: Fix whitespace formatting. Delete 1 characters. [.automation/test/csharp/csharp_project.csproj] diff --git a/.automation/test/csharp/reports/SUCCESS-CSHARP_DOTNET_FORMAT.txt b/.automation/test/csharp/reports/SUCCESS-CSHARP_DOTNET_FORMAT.txt index 12bca8f7579..8501088c00d 100644 --- a/.automation/test/csharp/reports/SUCCESS-CSHARP_DOTNET_FORMAT.txt +++ b/.automation/test/csharp/reports/SUCCESS-CSHARP_DOTNET_FORMAT.txt @@ -1,8 +1,10 @@ -Results of dotnet-format linter (version 4.1.131201) +Results of dotnet-format linter (version 000) See documentation on https://megalinter.github.io/descriptors/csharp_dotnet_format/ ----------------------------------------------- -[SUCCESS] .automation/test/csharp/csharp_good_01.cs - Formatting code files in workspace '.automation/test/csharp'. - Format complete in 1181ms. +✅ [SUCCESS] .automation/test/csharp/good/csharp_good_01.cs + + +✅ [SUCCESS] .automation/test/csharp/good/csharp_good_02.cs + diff --git a/.automation/test/sample_project_fixes/csharp_for_fixes_1.cs b/.automation/test/sample_project_fixes/csharp_project/csharp_for_fixes_1.cs similarity index 100% rename from .automation/test/sample_project_fixes/csharp_for_fixes_1.cs rename to .automation/test/sample_project_fixes/csharp_project/csharp_for_fixes_1.cs diff --git a/.automation/test/sample_project_fixes/csharp_project/csharp_project.csproj b/.automation/test/sample_project_fixes/csharp_project/csharp_project.csproj new file mode 100644 index 00000000000..74abf5c9766 --- /dev/null +++ b/.automation/test/sample_project_fixes/csharp_project/csharp_project.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/.automation/test/sample_project_fixes/dotnet_solution.sln b/.automation/test/sample_project_fixes/dotnet_solution.sln new file mode 100644 index 00000000000..af0d713e994 --- /dev/null +++ b/.automation/test/sample_project_fixes/dotnet_solution.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32630.192 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "csharp_project", "csharp_project\csharp_project.csproj", "{FF219771-9DBB-4FB0-8217-F77034831035}" +EndProject +Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "vbdotnet_project", "vbdotnet_project\vbdotnet_project.vbproj", "{AF06A915-8734-4B54-836D-A0E2BAE228EB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FF219771-9DBB-4FB0-8217-F77034831035}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FF219771-9DBB-4FB0-8217-F77034831035}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FF219771-9DBB-4FB0-8217-F77034831035}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FF219771-9DBB-4FB0-8217-F77034831035}.Release|Any CPU.Build.0 = Release|Any CPU + {AF06A915-8734-4B54-836D-A0E2BAE228EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF06A915-8734-4B54-836D-A0E2BAE228EB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF06A915-8734-4B54-836D-A0E2BAE228EB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF06A915-8734-4B54-836D-A0E2BAE228EB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4DFF31ED-FADA-4A6E-B9D4-51D89C3C1FFC} + EndGlobalSection +EndGlobal diff --git a/.automation/test/sample_project_fixes/vbdotnet_for_fixes_1.vb b/.automation/test/sample_project_fixes/vbdotnet_project/vbdotnet_for_fixes_1.vb similarity index 100% rename from .automation/test/sample_project_fixes/vbdotnet_for_fixes_1.vb rename to .automation/test/sample_project_fixes/vbdotnet_project/vbdotnet_for_fixes_1.vb diff --git a/.automation/test/sample_project_fixes/vbdotnet_project/vbdotnet_project.vbproj b/.automation/test/sample_project_fixes/vbdotnet_project/vbdotnet_project.vbproj new file mode 100644 index 00000000000..3edb2ae4157 --- /dev/null +++ b/.automation/test/sample_project_fixes/vbdotnet_project/vbdotnet_project.vbproj @@ -0,0 +1,9 @@ + + + + Exe + vb_projecty + net6.0 + + + diff --git a/.automation/test/vbdotnet/bad/vb_projecty.vbproj b/.automation/test/vbdotnet/bad/vb_projecty.vbproj new file mode 100644 index 00000000000..3edb2ae4157 --- /dev/null +++ b/.automation/test/vbdotnet/bad/vb_projecty.vbproj @@ -0,0 +1,9 @@ + + + + Exe + vb_projecty + net6.0 + + + diff --git a/.automation/test/vbdotnet/vbdotnet_bad_1.vb b/.automation/test/vbdotnet/bad/vbdotnet_bad_1.vb similarity index 100% rename from .automation/test/vbdotnet/vbdotnet_bad_1.vb rename to .automation/test/vbdotnet/bad/vbdotnet_bad_1.vb diff --git a/.automation/test/vbdotnet/bad/vbdotnet_bad_2.vb b/.automation/test/vbdotnet/bad/vbdotnet_bad_2.vb new file mode 100644 index 00000000000..ed079cbbdf1 --- /dev/null +++ b/.automation/test/vbdotnet/bad/vbdotnet_bad_2.vb @@ -0,0 +1,7 @@ +Imports System + +Public Module Hello + Public Sub Main( ) + Console.WriteLine("hello, world" + End Sub +End Module diff --git a/.automation/test/vbdotnet/good/vb_projecty.vbproj b/.automation/test/vbdotnet/good/vb_projecty.vbproj new file mode 100644 index 00000000000..3edb2ae4157 --- /dev/null +++ b/.automation/test/vbdotnet/good/vb_projecty.vbproj @@ -0,0 +1,9 @@ + + + + Exe + vb_projecty + net6.0 + + + diff --git a/.automation/test/vbdotnet/vbdotnet_good_1.vb b/.automation/test/vbdotnet/good/vbdotnet_good_1.vb similarity index 100% rename from .automation/test/vbdotnet/vbdotnet_good_1.vb rename to .automation/test/vbdotnet/good/vbdotnet_good_1.vb diff --git a/.automation/test/vbdotnet/good/vbdotnet_good_2.vb b/.automation/test/vbdotnet/good/vbdotnet_good_2.vb new file mode 100644 index 00000000000..c828d8309f3 --- /dev/null +++ b/.automation/test/vbdotnet/good/vbdotnet_good_2.vb @@ -0,0 +1,7 @@ +Imports System + +Public Module Hello + Public Sub Main() + Console.WriteLine("hello, world") + End Sub +End Module diff --git a/.automation/test/vbdotnet/reports/ERROR-VBDOTNET_DOTNET_FORMAT.txt b/.automation/test/vbdotnet/reports/ERROR-VBDOTNET_DOTNET_FORMAT.txt index 87e3dfcc2f0..cb2efbaa8ee 100644 --- a/.automation/test/vbdotnet/reports/ERROR-VBDOTNET_DOTNET_FORMAT.txt +++ b/.automation/test/vbdotnet/reports/ERROR-VBDOTNET_DOTNET_FORMAT.txt @@ -1,12 +1,20 @@ -Results of dotnet-format linter (version 4.1.131201) +Results of dotnet-format linter (version 000) See documentation on https://megalinter.github.io/descriptors/vbdotnet_dotnet_format/ ----------------------------------------------- -[ERROR] .automation/test/vbdotnet/vbdotnet_bad_1.vb - Formatting code files in workspace '.automation/test/vbdotnet'. - vbdotnet/vbdotnet_bad_1.vb(4,4): Fix whitespace formatting. - vbdotnet/vbdotnet_bad_1.vb(4,20): Fix whitespace formatting. - vbdotnet/vbdotnet_bad_1.vb(5,7): Fix whitespace formatting. - Formatted code file '.automation/test/vbdotnet/vbdotnet_bad_1.vb'. - Format complete in 1188ms. +❌ [ERROR] .automation/test/vbdotnet/vbdotnet_bad_1.vb + .automation/test/vbdotnet/vbdotnet_bad_1.vb(4,4): error WHITESPACE: Fix whitespace formatting. Insert '\s'. [.automation/test/vbdotnet/vb_projecty.vbproj] + .automation/test/vbdotnet/vbdotnet_bad_1.vb(4,20): error WHITESPACE: Fix whitespace formatting. Delete 2 characters. [.automation/test/vbdotnet/vb_projecty.vbproj] + .automation/test/vbdotnet/vbdotnet_bad_1.vb(5,7): error WHITESPACE: Fix whitespace formatting. Insert '\s\s'. [.automation/test/vbdotnet/vb_projecty.vbproj] + .automation/test/vbdotnet/vbdotnet_bad_2.vb(4,4): error WHITESPACE: Fix whitespace formatting. Insert '\s'. [.automation/test/vbdotnet/vb_projecty.vbproj] + .automation/test/vbdotnet/vbdotnet_bad_2.vb(4,20): error WHITESPACE: Fix whitespace formatting. Delete 2 characters. [.automation/test/vbdotnet/vb_projecty.vbproj] + .automation/test/vbdotnet/vbdotnet_bad_2.vb(5,7): error WHITESPACE: Fix whitespace formatting. Insert '\s\s'. [.automation/test/vbdotnet/vb_projecty.vbproj] + +❌ [ERROR] .automation/test/vbdotnet/vbdotnet_bad_2.vb + .automation/test/vbdotnet/vbdotnet_bad_1.vb(4,4): error WHITESPACE: Fix whitespace formatting. Insert '\s'. [.automation/test/vbdotnet/vb_projecty.vbproj] + .automation/test/vbdotnet/vbdotnet_bad_1.vb(4,20): error WHITESPACE: Fix whitespace formatting. Delete 2 characters. [.automation/test/vbdotnet/vb_projecty.vbproj] + .automation/test/vbdotnet/vbdotnet_bad_1.vb(5,7): error WHITESPACE: Fix whitespace formatting. Insert '\s\s'. [.automation/test/vbdotnet/vb_projecty.vbproj] + .automation/test/vbdotnet/vbdotnet_bad_2.vb(4,4): error WHITESPACE: Fix whitespace formatting. Insert '\s'. [.automation/test/vbdotnet/vb_projecty.vbproj] + .automation/test/vbdotnet/vbdotnet_bad_2.vb(4,20): error WHITESPACE: Fix whitespace formatting. Delete 2 characters. [.automation/test/vbdotnet/vb_projecty.vbproj] + .automation/test/vbdotnet/vbdotnet_bad_2.vb(5,7): error WHITESPACE: Fix whitespace formatting. Insert '\s\s'. [.automation/test/vbdotnet/vb_projecty.vbproj] diff --git a/.automation/test/vbdotnet/reports/SUCCESS-VBDOTNET_DOTNET_FORMAT.txt b/.automation/test/vbdotnet/reports/SUCCESS-VBDOTNET_DOTNET_FORMAT.txt index 63a94e4b7b0..ba77aa8104b 100644 --- a/.automation/test/vbdotnet/reports/SUCCESS-VBDOTNET_DOTNET_FORMAT.txt +++ b/.automation/test/vbdotnet/reports/SUCCESS-VBDOTNET_DOTNET_FORMAT.txt @@ -1,8 +1,10 @@ -Results of dotnet-format linter (version 4.1.131201) +Results of dotnet-format linter (version 000) See documentation on https://megalinter.github.io/descriptors/vbdotnet_dotnet_format/ ----------------------------------------------- -[SUCCESS] .automation/test/vbdotnet/vbdotnet_good_1.vb - Formatting code files in workspace '.automation/test/vbdotnet'. - Format complete in 1063ms. +✅ [SUCCESS] .automation/test/vbdotnet/good/vbdotnet_good_1.vb + + +✅ [SUCCESS] .automation/test/vbdotnet/good/vbdotnet_good_2.vb + diff --git a/CHANGELOG.md b/CHANGELOG.md index cd408fb1e56..4cb7185e84a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l - Fix perl linter skipping files +- Upgrade to dotnet 6.0, dotnet-format requires `.sln`, `.csproj` or `.vbproj` in the repo + - Linter versions upgrades - [csharpier](https://csharpier.com/) from 0.21.0 to **0.16.0** on 2022-12-29 - [stylelint](https://stylelint.io) from 14.16.0 to **14.16.1** on 2022-12-29 diff --git a/Dockerfile b/Dockerfile index b7d25e14dac..c05f82fd386 100644 --- a/Dockerfile +++ b/Dockerfile @@ -313,7 +313,7 @@ RUN rc-update add docker boot && rc-service docker start || true \ # CSHARP installation && wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ - && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest + && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" @@ -366,7 +366,7 @@ RUN mkdir -p ${PWSH_DIRECTORY} \ # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ # && chmod +x dotnet-install.sh \ -# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest +# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" @@ -408,7 +408,7 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ && /usr/share/dotnet/dotnet tool install -g dotnet-format \ # csharpier installation - && /usr/share/dotnet/dotnet tool install -g csharpier --version 0.16.0 \ + && /usr/share/dotnet/dotnet tool install -g csharpier \ # dartanalyzer installation && wget --tries=50 -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \ @@ -544,10 +544,10 @@ ENV PATH="~/.raku/bin:/opt/rakudo-pkg/bin:/opt/rakudo-pkg/share/perl6/site/bin:$ # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ # && chmod +x dotnet-install.sh \ -# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest +# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" -RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI --version 0.6.9 \ +RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI \ # dustilock installation && ML_THIRD_PARTY_DIR=/download/dustilock && \ @@ -601,10 +601,10 @@ RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI --version 0.6.9 \ # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ # && chmod +x dotnet-install.sh \ -# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest +# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" - && dotnet tool install --global --version 1.14.5 TSQLLint \ + && dotnet tool install --global TSQLLint \ # tflint installation # Managed with COPY --from=tflint /usr/local/bin/tflint /usr/bin/ @@ -624,10 +624,6 @@ RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI --version 0.6.9 \ ENV KICS_QUERIES_PATH=/opt/kics/assets/queries KICS_LIBRARIES_PATH=/opt/kics/assets/libraries # Managed with COPY --from=kics /app/bin/assets /opt/kics/assets/ -# dotnet-format installation -# Next line commented because already managed by another linter -# RUN /usr/share/dotnet/dotnet tool install -g dotnet-format - #OTHER__END ################################ diff --git a/flavors/dotnet/Dockerfile b/flavors/dotnet/Dockerfile index 8927533298d..ee426e386d3 100644 --- a/flavors/dotnet/Dockerfile +++ b/flavors/dotnet/Dockerfile @@ -235,7 +235,7 @@ RUN mkdir -p ${PWSH_DIRECTORY} \ # CSHARP installation && wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ - && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest + && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" @@ -255,7 +255,7 @@ RUN mkdir -p ${PWSH_DIRECTORY} \ # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ # && chmod +x dotnet-install.sh \ -# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest +# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" @@ -294,7 +294,7 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ && /usr/share/dotnet/dotnet tool install -g dotnet-format \ # csharpier installation - && /usr/share/dotnet/dotnet tool install -g csharpier --version 0.16.0 \ + && /usr/share/dotnet/dotnet tool install -g csharpier \ # hadolint installation # Managed with COPY --from=hadolint /bin/hadolint /usr/bin/hadolint @@ -362,14 +362,10 @@ RUN curl --retry 5 --retry-delay 5 -sLO "${ARM_TTK_URI}" \ # Next line commented because already managed by another linter # RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ # && chmod +x dotnet-install.sh \ -# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest +# && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest # Next line commented because already managed by another linter # ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" - && dotnet tool install --global --version 1.14.5 TSQLLint - -# dotnet-format installation -# Next line commented because already managed by another linter -# RUN /usr/share/dotnet/dotnet tool install -g dotnet-format + && dotnet tool install --global TSQLLint #OTHER__END diff --git a/flavors/security/Dockerfile b/flavors/security/Dockerfile index f78cefba2d6..b60ecf2fb4b 100644 --- a/flavors/security/Dockerfile +++ b/flavors/security/Dockerfile @@ -210,10 +210,10 @@ RUN printf '#!/bin/bash \n\nif [[ -x "$1" ]]; then exit 0; else echo "Error: Fil # devskim installation && wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ - && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest + && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" -RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI --version 0.6.9 \ +RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI \ # dustilock installation && ML_THIRD_PARTY_DIR=/download/dustilock && \ diff --git a/linters/csharp_dotnet_format/Dockerfile b/linters/csharp_dotnet_format/Dockerfile index 47b37b17dd7..1eb15fb93e8 100644 --- a/linters/csharp_dotnet_format/Dockerfile +++ b/linters/csharp_dotnet_format/Dockerfile @@ -107,13 +107,10 @@ ENV PATH="/node_modules/.bin:${PATH}" # CSHARP installation RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ - && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest + && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" -# dotnet-format installation -RUN /usr/share/dotnet/dotnet tool install -g dotnet-format - #OTHER__END ###################### diff --git a/linters/repository_devskim/Dockerfile b/linters/repository_devskim/Dockerfile index 06bbdd9c673..fc1f575613c 100644 --- a/linters/repository_devskim/Dockerfile +++ b/linters/repository_devskim/Dockerfile @@ -132,10 +132,10 @@ ENV PATH="/node-deps/node_modules/.bin:${PATH}" \ # devskim installation RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ - && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest + && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" -RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI --version 0.6.9 +RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI #OTHER__END diff --git a/linters/sql_tsqllint/Dockerfile b/linters/sql_tsqllint/Dockerfile index fb862bc2489..1786943fea0 100644 --- a/linters/sql_tsqllint/Dockerfile +++ b/linters/sql_tsqllint/Dockerfile @@ -107,7 +107,7 @@ ENV PATH="/node_modules/.bin:${PATH}" # tsqllint installation RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ - && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest + && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" RUN dotnet tool install --global TSQLLint diff --git a/linters/vbdotnet_dotnet_format/Dockerfile b/linters/vbdotnet_dotnet_format/Dockerfile index c076821a244..77dd03eafa9 100644 --- a/linters/vbdotnet_dotnet_format/Dockerfile +++ b/linters/vbdotnet_dotnet_format/Dockerfile @@ -107,13 +107,10 @@ ENV PATH="/node_modules/.bin:${PATH}" # VBDOTNET installation RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ - && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest + && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" -# dotnet-format installation -RUN /usr/share/dotnet/dotnet tool install -g dotnet-format - #OTHER__END ###################### diff --git a/megalinter/descriptors/csharp.megalinter-descriptor.yml b/megalinter/descriptors/csharp.megalinter-descriptor.yml index 0233ce41ddf..c66d739a331 100644 --- a/megalinter/descriptors/csharp.megalinter-descriptor.yml +++ b/megalinter/descriptors/csharp.megalinter-descriptor.yml @@ -19,29 +19,30 @@ install: - | RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ - && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest + && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest - ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" linters: # DOTNET FORMAT - class: DotnetFormatLinter linter_name: dotnet-format is_formatter: true - linter_url: https://github.com/dotnet/format + 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_image_url: https://user-images.githubusercontent.com/9797472/61659851-6bbdc880-ac7d-11e9-95f7-d30c7de1a18a.png + cli_executable: dotnet cli_lint_extra_args: - - "--folder" - - "--check" - - "--exclude" - - "/" - - "--include" - cli_lint_fix_arg_name: "--megalinter-fix-flag" # Workaround for PythonBlackOrIsortLinter class behavior + - "format" + - "{{WORKSPACE}}" + - "--verify-no-changes" + cli_lint_fix_arg_name: "--megalinter-fix-flag" # Workaround for DotnetFormatLinter class behavior cli_lint_fix_remove_args: - - "--check" + - "--verify-no-changes" linter_version_cache: "000" examples: - - "dotnet-format --folder --check --exclude / --include myfile.cs" - - "dotnet-format --folder --exclude / --include myfile.cs" # Fix + - "dotnet format {{WORKSPACE}} --verify-no-changes" + - "dotnet format {{WORKSPACE}}" # Fix install: dockerfile: - RUN /usr/share/dotnet/dotnet tool install -g dotnet-format @@ -66,7 +67,7 @@ linters: - "dotnet csharpier myfile.cs myfile2.cs" # Fix install: dockerfile: - - RUN /usr/share/dotnet/dotnet tool install -g csharpier --version 0.16.0 + - RUN /usr/share/dotnet/dotnet tool install -g csharpier ide: rider: - name: csharpier diff --git a/megalinter/descriptors/repository.megalinter-descriptor.yml b/megalinter/descriptors/repository.megalinter-descriptor.yml index 0073ec25b9e..a5cc9581ee9 100644 --- a/megalinter/descriptors/repository.megalinter-descriptor.yml +++ b/megalinter/descriptors/repository.megalinter-descriptor.yml @@ -92,9 +92,9 @@ linters: - | RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ - && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest + && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest - ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" - - RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI --version 0.6.9 + - RUN dotnet tool install --global Microsoft.CST.DevSkim.CLI ide: vscode: - name: VSCode DevSkim diff --git a/megalinter/descriptors/sql.megalinter-descriptor.yml b/megalinter/descriptors/sql.megalinter-descriptor.yml index 455e2f1c44c..7329efc732f 100644 --- a/megalinter/descriptors/sql.megalinter-descriptor.yml +++ b/megalinter/descriptors/sql.megalinter-descriptor.yml @@ -68,7 +68,6 @@ linters: examples: - "tsqllint myfile.sql" - "tsqllint myfile.sql myfile2.sql" - downgraded_version: true install: apk: - icu-libs @@ -83,9 +82,9 @@ linters: - | RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ - && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest + && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest - ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" - - RUN dotnet tool install --global --version 1.14.5 TSQLLint + - RUN dotnet tool install --global TSQLLint ide: vscode: - name: TSQL Lint diff --git a/megalinter/descriptors/vbdotnet.megalinter-descriptor.yml b/megalinter/descriptors/vbdotnet.megalinter-descriptor.yml index 1eb6eff0b59..973218a56ad 100644 --- a/megalinter/descriptors/vbdotnet.megalinter-descriptor.yml +++ b/megalinter/descriptors/vbdotnet.megalinter-descriptor.yml @@ -19,28 +19,27 @@ install: - | RUN wget --tries=5 -q -O dotnet-install.sh https://dot.net/v1/dotnet-install.sh \ && chmod +x dotnet-install.sh \ - && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 5.0 -version latest + && ./dotnet-install.sh --install-dir /usr/share/dotnet -channel 6.0 -version latest - ENV PATH="${PATH}:/root/.dotnet/tools:/usr/share/dotnet" linters: # DOTNET FORMAT - class: DotnetFormatLinter linter_name: dotnet-format is_formatter: true - linter_url: https://github.com/dotnet/format + 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_image_url: https://user-images.githubusercontent.com/9797472/61659851-6bbdc880-ac7d-11e9-95f7-d30c7de1a18a.png + cli_executable: dotnet cli_lint_extra_args: - - "--folder" - - "--check" - - "--exclude" - - "/" - - "--include" + - "format" + - "{{WORKSPACE}}" + - "--verify-no-changes" cli_lint_fix_arg_name: "--megalinter-fix-flag" # Workaround to allow fix cli_lint_fix_remove_args: - - "--check" + - "--verify-no-changes" linter_version_cache: "000" examples: - - "dotnet-format --folder --check --exclude / --include myfile.vb" - - "dotnet-format --folder --exclude / --include myfile.vb" - install: - dockerfile: - - RUN /usr/share/dotnet/dotnet tool install -g dotnet-format + - "dotnet format {{WORKSPACE}} --verify-no-changes" + - "dotnet format {{WORKSPACE}}" # Fix diff --git a/megalinter/linters/DotnetFormatLinter.py b/megalinter/linters/DotnetFormatLinter.py index ea5c8abc3b3..b7a47cc6060 100644 --- a/megalinter/linters/DotnetFormatLinter.py +++ b/megalinter/linters/DotnetFormatLinter.py @@ -3,8 +3,6 @@ Use dotnet-format to lint CSharp files """ -import os.path - from megalinter import Linter @@ -12,10 +10,10 @@ class DotnetFormatLinter(Linter): # Build the CLI command to call to lint a file def build_lint_command(self, file=None): + # cli_lint_mode = list_of_files or project + dotnet_format_command = " ".join(super().build_lint_command(None)) commands = [ - f'cd "{os.path.realpath(os.path.dirname(file))}" || exit 1', - " ".join(super().build_lint_command(os.path.basename(file))) - + " | tee /dev/tty2 2>&1", + dotnet_format_command + " | tee /dev/tty2 2>&1", 'exit "${PIPESTATUS[0]}"', ] return " && ".join(commands)