AXForum  
Вернуться   AXForum > Microsoft Dynamics NAV > NAV: Blogs
CRM
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 05.04.2018, 11:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
waldo: Al Code Analysis Rules (Diagnostic Descriptors)
Источник: http://dynamicsuser.net/nav/b/waldo/...ic-descriptors
==============



Since my last blog about the new Code Analysis for Al development, I have been wondering what rules Microsoft actually applies in which Code Analyzer. My good friend an colleague is all into decompiling and reflecting – and he helped my find my way to the object model that Microsoft creates for the Source Code Analysis – to get to the “Diagnostic Descriptors”. We did that in PowerShell – of course (I might share the code when it’s ready to – it will end up on my PowerShell Repository eventually).

Below the result. As you know, there are 3 “cops” (Code Analyzers). Let’s see the result per Code Analyzer

AppSourceCop

IdTitleDescriptionMessageFormatCategoryDefault SeveretyIsEnabledByDefault

AS0001Tables cannot be deleted.Tables cannot be deleted.Table ‘{0}’ has been deleted.UpgradeError
TRUE

AS0002Fields cannot be deleted.Fields cannot be deleted.Field ‘{0}’ has been deleted from table ‘{1}’.UpgradeError
TRUE

AS0003The previous version was not found.The previous version was not found.The previous version was not found. Name='{0}’, Publisher='{1}’, Version'{2}’UpgradeWarning
TRUE

AS0004Fields cannot change type.Fields cannot change type.Field ‘{0}’ has changed type from ‘{1}’ to ‘{2}’. Type changes are not allowed.UpgradeError
TRUE

AS0005Fields cannot change name.Fields cannot change name.Field ‘{0}’ has changed name to ‘{1}’. Name changes are not allowed.UpgradeError
TRUE

AS0006Tables cannot change name.Tables cannot change name.Table ‘{0}’ has changed name to ‘{1}’. Name changes are not allowed.UpgradeError
TRUE

AS0007Properties cannot change value.Properties cannot change value.The property ‘{0}’ has changed value. Value change is not allowed for this property.UpgradeError
TRUE

AS0008Keys cannot change name.Keys cannot change name.Key ‘{0}’ has changed name to ‘{1}’. Name changes are not allowed.UpgradeError
TRUE

AS0009Key fields cannot be changed.Key fields cannot be changed.Key ‘{0}’ has changed the key fields. Changes to the field list are not allowed.UpgradeError
TRUE

AS0010Keys cannot be deleted.Keys cannot be deleted.Key ‘{0}’ has been deleted. Key deletions is not allowed.UpgradeError
TRUE

AS0011A prefix is requiredA prefix is requiredThe identifier ‘{0}’ must have the prefix ‘{1}’.ExtensibilityError
TRUE

AS0012A suffix is requiredA suffix is requiredThe identifier ‘{0}’ must have the suffix ‘{1}’.ExtensibilityError
TRUE

AS0013The field identifier must be within the allowed range.The field identifier must be within the allowed range.The field identifier ‘{0}’ is not valid. It must be within the allowed range ‘{1}’ – ‘{2}’ExtensibilityError
TRUE

AS0014The project manifest must contain the allocated identifier range.The project manifest must contain the allocated identifier range.The project manifest must contain the allocated identifier range.ExtensibilityError
TRUE


CodeCop

IdTitleDescriptionMessageFormatCategoryDefault SeveretyIsEnabledByDefault

AA0001There must be exactly one space character on each side of a binary operator such as := + – AND OR =.There must be exactly one space character on each side of a binary operator such as := + – AND OR =. The parameter comma operator however, should have no spaces.There must be exactly one space character on each side of ‘{0}’.ReadabilityWarning
TRUE

AA0002There must be no space character.There must be no space character between a unary operator and its argument.There must be no space character after ‘{0}’.ReadabilityWarning
TRUE

AA0003There must be exactly one space character between the NOT operator and its argument.There must be exactly one space character between the NOT operator and its argument.There must be exactly one space character after ‘{0}’.ReadabilityWarning
TRUE

AA0005Only use BEGIN..END to enclose compound statements.Only use BEGIN..END to enclose compound statements.Only use BEGIN..END to enclose compound statements.ReadabilityWarning
TRUE

AA0008Function calls should have parenthesis even if they do not have any parameters.Use parenthesis in a function call even if the function does not have any parameters.You must specify open and close parenthesis after ‘{0}’.ReadabilityWarning
TRUE

AA0013When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character.When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character.When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character.ReadabilityWarning
TRUE

AA0018The END, IF, REPEAT, FOR, WHILE, and CASE statement should always start a line.The END, IF, REPEAT, FOR, WHILE, and CASE statement should always start a line.The ‘{0}’ keyword should always start a line.ReadabilityWarning
TRUE

AA0021Variable declarations should be ordered by type.Variable declarations should be ordered by type. In general, object and complex variable types are listed first followed by simple variables.Variable declarations should be ordered by type.ReadabilityWarning
TRUE

AA0022Substitute the IF THEN ELSE structure with a CASE.An IF followed by two or more ELSE IF should be replaced with a CASE.Substitute the IF THEN ELSE structure with a CASE.ReadabilityWarning
TRUE

AA0074TextConst variable names should have an approved suffix.TextConst variable names should have a suffix (an approved three-letter suffix: Msg, Tok, Err, Qst, Lbl, Txt) describing usage.TextConst variable ‘{0}’ must have a suffix from this list: Msg, Tok, Err, Qst, Lbl, Txt.ReadabilityWarning
TRUE

AA0136Do not write code that will never be hit.Do not write code that will never be hit.Unreachable code detected.DesignWarning
TRUE

AA0137Do not declare variables that are unused.Do not declare variables that are unused.Variable ‘{0}’ is unused in the method ‘{1}’.DesignWarning
TRUE

AA0139Do not assign a text to a target with smaller size.Do not assign a text to a target with smaller size.Possible overflow assigning ‘{0}’ to ‘{1}’.DesignWarning
TRUE

AA0161Only use ASSERTERROR in Test Codeunits.Only use ASSERTERROR in Test Codeunits.Only use ASSERTERROR in Test Codeunits.DesignWarning
TRUE

AA0194Only write actions that have an effect.Remember to specify either the ‘OnAction’ trigger or ‘RunObject’ property on an action.Remember to specify either the ‘OnAction’ trigger or ‘RunObject’ property on an action.DesignWarning
TRUE


PerTenantExtensionCop

IdTitleDescriptionMessageFormatCategoryDefault SeveretyIsEnabledByDefault

PTE0001Object ID must be in free range.Object ID must be in free range.{0} ‘{1}’ has an ID of [{2}]. It must be between 50000 and 50099.ObjectValidation

Error
TRUE

PTE0002Field ID must be in free range.Field ID must be in free range.Field ‘{0}’ has an ID of [{1}]. It must be between 50000 and 50099.ObjectValidation

Error
TRUE

PTE0003Functions must not subscribe to CompanyOpen events.Functions must not subscribe to CompanyOpen events.Function {0} subscribes to {1}.ObjectValidation

Error
TRUE

PTE0004Table definitions must have a matching permission set.Table definitions must have a matching permission set.Table ‘{0}’ is missing a matching permission set.ObjectValidation

Error
TRUE

PTE0005Property ‘target’ has invalid value.‘Internal’ is a reserved usage for the ‘target’ property.App.json ‘target’ property must not be set to ‘Internal’.PackageValidation

Error
TRUE

PTE0006Encryption key functions must not be invoked.Encryption key functions must not be invoked.Encryption key function ‘{0}’ is not allowed. PackageValidation

Error
TRUE

PTE0007Test assertion functions are not allowed in a non-test context.Test assertion functions are not allowed in a non-test context.Assertion function ‘{0}’ must not be invoked.PackageValidation

Error
TRUE

PTE0008Fields must use ApplicationArea property.Fields must use ApplicationArea property.Field with name ‘{0}’ must have a value for the ApplicationArea property.PackageValidation

Error
TRUE


Enjoy!




Источник: http://dynamicsuser.net/nav/b/waldo/...ic-descriptors
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
waldo: Enable the updated Code Analysis for AL Blog bot NAV: Blogs 0 26.03.2018 08:11
waldo: Enable Code Analysis for AL Blog bot NAV: Blogs 0 23.01.2018 08:12
waldo: Microsoft Dynamics NAV Source Code Analysis – LineCount Blog bot NAV: Blogs 0 02.03.2017 07:14
goshoom: Custom rules for Code Upgrade Tool Blog bot DAX Blogs 0 15.12.2014 02:11
wiki.dynamicsbook: Changes Made in Navision Attain 3.60 Blog bot Dynamics CRM: Blogs 0 02.09.2008 13:23
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 12:36.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.