Skip to content

sirhc101/vscode-allint

Repository files navigation

AL Lint

The AL Lint extension is designed for AL. The main purpose is to test AL Code against guidelines for clean code.

Marketplace Installs GitHub issues GitHub pull requests License

Features

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)

Requirements

Some AL code

Extension Settings

  • 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.

Hungarian Notation Options

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"

Status Bar Explanation

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

Prepare Development setup

  • run npm install inside vscode-allint folder

Debugging both Client and Server

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

Known Issues

Next up is the refactoring command and then uploading the summary to a report

Release Notes

0.1.7

Fixes on maintainability index and cycolomatic complexity

0.1.6

Code comments are now excluded from processing.

0.1.4

Some refactoring. Added a check on function length. By default any function longer then 40 lines will be warned.

0.1.3

Fixed a number of issues reported on GitHub.

Check on underscore in variables

0.1.2

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.

0.1.1

Implemented setting and fixed reported issues.

0.1.0

First version

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published