AL-Go icon indicating copy to clipboard operation
AL-Go copied to clipboard

customCodeCops for BusinessCentral.LinterCop does not seem to work

Open BertDeTemmerman opened this issue 1 year ago • 7 comments

I have added the setting customCodeCops to my AL-Go-Settings.json:

  "customCodeCops": [
    "https://github.com/StefanMaron/BusinessCentral.LinterCop/releases/download/v0.30.0/BusinessCentral.LinterCop.current.dll"
  ],

(similar to Stefan Maron is using here)

On a seperate branch, I've removed a caption from an action, so the BCLinterCop givess the warning.

BCLinterCop active

If I commit this and create a PR, the pipeline triggers. But it doesn't seem to use the BCLinterCop.

.\alc.exe /project:"c:\sources\App" /packagecachepath:"c:\sources\.packages" /out:"c:\sources\.output\ESC bv_Calculation_21.0.2147483647.0.app" /analyzer:C:\build\vsix\extension\bin\Analyzers\Microsoft.Dynamics.Nav.CodeCop.dll /analyzer:C:\build\vsix\extension\bin\Analyzers\Microsoft.Dynamics.Nav.AppSourceCop.dll /analyzer:C:\build\vsix\extension\bin\Analyzers\Microsoft.Dynamics.Nav.UICop.dll /ruleset:c:\shared\.github\.vscode\module.ruleset.json /enableexternalrulesets /SourceRepositoryUrl:"https://github.com/ESCbv/TestALGOAppSource2" /SourceCommit:"709c6ede636df90d80624c325e73a840e1d25ca9" /BuildBy:"AL-Go for GitHub,v4.0" /BuildUrl:"https://github.com/ESCbv/TestALGOAppSource2/actions/runs/6625078712" /assemblyprobingpaths:"C:\Program Files\dotnet\shared","C:\ProgramData\BcContainerHelper\Extensions\bcCalculation6625078712\.netPackages\Service"

Other warnings are given

  Warning: AL0749 The type 'CalculationHeader' of the parameter 'Calculation Header ESCA' of the public method 'RecalculateCalculationPrices' has 'Internal' accessibility. The method will not be callable outside of this module without an implicit conversion.
  Warning: AL0603 An implicit conversion is being performed from a value of type 'Enum Microsoft.Foundation.Enums."Unit Cost Calculation Type"' to a value of type 'Integer'. This conversion can lead to unexpected runtime issues. This warning will become an error in a future release.
  c:\sources\App\src\codeunit\CalculationEventMgt.codeunit.al(146,9): info AA0210: The table Calculation Line ESCA does not contain a key with the field Status.

What am I missing to make customCodeCops work? Thanks in advance.

BertDeTemmerman avatar Oct 24 '23 10:10 BertDeTemmerman

Your setting looks correct. If you include the full log, I will be be able to see whether this is because the setting isn't read and which version you are running etc. etc.

freddydk avatar Oct 24 '23 16:10 freddydk

Sorry for the delay.

The full logs: logs_44 (1).zip

BertDeTemmerman avatar Nov 06 '23 13:11 BertDeTemmerman

I'm experiencing the same problem. Here's my log, starting from the beginning of the Run Pipeline step, and ending after listing the parameters.

As you can see, I've provided a URL for the customCodeCop property, but when listing the parameters, the array is empty. There's no log about whether the download succeeded, or was even attempted.

cegekaJG avatar Jan 24 '24 12:01 cegekaJG

Is there any progress with this? We're starting to have problems with checks that succeed when they should fail.

cegekaJG avatar Mar 08 '24 10:03 cegekaJG

We have been caught up with BC 24 issues, so unfortunately nothing yet.

freddydk avatar Mar 08 '24 10:03 freddydk

@freddydk any timeline on this? It's a bit annoying our custom codecops are not executed.

dsaveyn avatar Apr 12 '24 13:04 dsaveyn

The reason for this is, that despite the documentation saying so, CustomCodeCops cannot be a URL today. The fix for this is in BcContainerHelper and in a PR here: https://github.com/microsoft/navcontainerhelper/pull/3488

When that has merged, you would need to add "vsixFile": "latest" to your settings file as well as the Lintercop from @StefanMaron requires the latest AL Language Exrension.

You can see a test run with the Lintercop here: https://github.com/BusinessCentralApps/buildorder/actions/runs/8679462223

freddydk avatar Apr 14 '24 10:04 freddydk