forked from StefanMaron/BusinessCentral.LinterCop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
100 additions
and
35 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Command Line | ||
|
||
The LinterCop can be referenced as a code analyser on executing the Business Central AL Compiler from the command line. | ||
|
||
## AL Compiler | ||
|
||
Download the `BusinessCentral.LinterCop.AL-14.0.983287.dll` from the [releases](https://github.com/StefanMaron/BusinessCentral.LinterCop/releases) and place it into your AL Language extension folder. For Example `%userprofile%\.vscode\extensions\ms-dynamics-smb.al-14.0.983287\bin\` | ||
|
||
Run the AL Compiler `. %userprofile%\.vscode\extensions\ms-dynamics-smb.al-14.0.983287\bin\alc.exe /project:"<PathToYourAlProject>" /packagecachepath:"<PathToYour.alpackages>" /analyzer:"userprofile%\.vscode\extensions\ms-dynamics-smb.al-14.0.983287\bin\usinessCentral.LinterCop.AL-14.0.983287.dll"` | ||
|
||
**Note:** It's important to match the specific AL version of the LinterCop.dll with the exact same version of the AL Compiler. | ||
|
||
|
||
## BcContainerHelper | ||
|
||
For manual compile you can use the `Compile-AppInBcContainer` command and pass the path or url to the `BusinessCentral.LinterCop.dll` in via the parameter `-CustomCodeCops`. For example `-CustomCodeCops "https://github.com/StefanMaron/BusinessCentral.LinterCop/releases/latest/download/BusinessCentral.LinterCop.dll"`. | ||
|
||
If passing the `BusinessCentral.LinterCop.dll` as path instead of a url, be aware that the file needs to be placed in a folder shared with the container. Further note that you should have BcContainerHelper version 6.0.16 (or newer) installed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# DevOps | ||
|
||
Integrating additional Code Cops, like the LinterCop, in your DevOps workflow will improve the maintainability and transparency of the AL code. | ||
|
||
Automate tedious manual checks during pull requestlike checking for coding conventions and identifying possible run-time errors. | ||
|
||
|
||
## AL-Go for GitHub | ||
|
||
[AL-Go! for GitHub](https://github.com/microsoft/AL-Go) is a plug-and-play DevOps solution for Business Central app development on GitHub. | ||
|
||
Built-in support for custom Code Cops is available out-of-the-box, allowing for easy configuration of the LinterCop. | ||
|
||
 | ||
https://github.com/microsoft/AL-Go/blob/main/Scenarios/settings.md#advanced-settings | ||
|
||
In the [settings.json](https://github.com/microsoft/AL-Go/blob/main/Scenarios/settings.md) you can specify the url to dll file of the LinterCop, where you also need to enable downloading the latest VSIX. | ||
|
||
```json | ||
{ | ||
"vsixFile": "latest", | ||
"customCodeCops": [ | ||
"https://github.com/StefanMaron/BusinessCentral.LinterCop/releases/latest/download/BusinessCentral.LinterCop.dll" | ||
] | ||
} | ||
``` | ||
|
||
## BcContainerHelper | ||
|
||
If you are using `Run-ALPipeline` in your build pipelines you can also pass the path or url to the `BusinessCentral.LinterCop.dll` in via the parameter `-CustomCodeCops`. | ||
|
||
```PowerShell | ||
-CustomCodeCops "https://github.com/StefanMaron/BusinessCentral.LinterCop/releases/latest/download/BusinessCentral.LinterCop.dll" | ||
``` | ||
|
||
If passing the `BusinessCentral.LinterCop.dll` as path instead of a url, be aware that the file needs to be placed in a folder shared with the container. Further note that you should have BcContainerHelper version 6.0.16 (or newer) installed. | ||
|
||
To have the correct compiler dependecies you should also load the latest compiler from the marketplace. Add `-vsixFile (Get-LatestAlLanguageExtensionUrl)` to do so. | ||
|
||
## Azure DevOps | ||
|
||
You can let your build pipelines download the latest version of the `BusinessCentral.LinterCop.dll` via the GitHub API. You can find an example for this in the [DownloadFile.ps1](https://github.com/StefanMaron/vsc-lintercop/blob/master/DownloadFile.ps1) script used by the BusinessCentral.LinterCop VS Code helper extension for automatic updates. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Visual Studio Code | ||
|
||
Get the [BusinessCentral.LinterCop](https://marketplace.visualstudio.com/items?itemName=StefanMaron.businesscentral-lintercop) VS Code extension from the Visual Studio Code Marketplace. | ||
|
||
**Tip:** It's also possible to manually add `"${analyzerfolder}BusinessCentral.LinterCop.dll"` to the `"al.codeAnalyzers"` setting in either user, workspace or folder settings. | ||
|
||
# Example | ||
|
||
An example `settings.json` where the LinterCop is configured. | ||
|
||
```json | ||
"al.codeAnalyzers": [ | ||
"${CodeCop}", | ||
"${UICop}", | ||
"${PerTenantExtensionCop}", | ||
"${analyzerfolder}BusinessCentral.LinterCop.dll", | ||
], | ||
``` | ||
|
||
**Tip:** Be aware that folder settings overwrite workspace and workspace overwrite user settings. If you have codecops defined in folder settings, the codecops defined in the user settings won't be applied. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters