The AL Lint extension is designed for AL. The main purpose is to test AL Code against guidelines for clean code.
The extension will check your code as you are working on it. It checks the open file and shows warnings.
Provides two commands
-
Refactor - Move one or more lines of code into a new function or new codeunit. (In Prototype)
-
Clean Code - Check your current object against coding guidelines for clean code. This will generate a summary report. (Not working yet)
Some AL code
allint.enabled
- enable/disable allint.allint.statusbar
- enable/disable statusbar.allint.checkcommit
- check code for COMMIT.allint.checkhungariannotation
- check code for hungarian notation.allint.hungariannotationoptions
- defines Hungarian Notation options.allint.maxnumberoffunctionlines
- The limit how many lines a function should have. Blank lines and comments are not taken into account. Set to 0 to deactivate.
By default the extension will check the following abbreviations Record,Rec Integer,Int Code,Cod Function,Func Codeunit,Cdu Page,Pag Text,Txt Field,Fld
Which can be changed by modifying the HungarianNotationOptions setting like this "Record,Rec;Integer,Int;Code,Cod;Function,Func;Codeunit,Cdu;Page,Pag;Text,Txt;Field,Fld"
The status bar will show which function you are editing and its hallstead complexity and cyclomatic complexity.
If the text is green, you are good. Orange and Red should explain itsself.
https://en.wikipedia.org/wiki/Halstead_complexity_measures
- run npm install inside
vscode-allint
folder
Debugging the client code is as easy as debugging a normal extension. Set a breakpoint in the client code and debug the extension by pressing F5. For a detailed description about launching and debugging an extension see Running and Debugging Your Extension.
Since the server is started by the LanguageClient running in the extension (client), we need to attach a debugger to the running server. To do so, switch to the Debug viewlet and select the launch configuration Attach to Server and press F5. This will attach the debugger to the server.
More Details: https://code.visualstudio.com/docs/extensions/example-language-server#_debugging-both-client-and-server
Next up is the refactoring command and then uploading the summary to a report
Fixes on maintainability index and cycolomatic complexity
Code comments are now excluded from processing.
Some refactoring. Added a check on function length. By default any function longer then 40 lines will be warned.
Fixed a number of issues reported on GitHub.
Check on underscore in variables
First version of refactoring is implemented. The function is always called "foo" and does not yet check if the selection makes sense or depends on variables. Fixed issue with system variables Rec and xRec not being recognised as Hungarian Notation. Added fields to the model with Hungarian Notation check. Check for using WITH statement in Tables and Pages. Warning if local and local variables have the same name. Text Constants throw warning if they have the old notation (TextXXX). Temporary Table Variables must have TEMP, BUFFER, ARGS or ARGUMENTS in the name. Check for reserved words, e.g. a function name called "Action" or a field called "SetRange". Complex Type variables that are declared with object id instead of name give warning. Cleaned up the Type Script a bit here and there.
WARNING: You can not yet disable the new features.
Implemented setting and fixed reported issues.
First version