Redigera

Dela via


AppSourceCop Analyzer Rules

AppSourceCop is an analyzer that enforces rules that must be respected by extensions meant to be published to Microsoft AppSource.

Rules

Id Title Category Default severity
AS0001 Tables and table extensions that have been published must not be deleted. Upgrade Error
AS0002 Fields must not be deleted. Upgrade Error
AS0003 The previous version of the extension could not be found. Upgrade Error
AS0004 Fields must not change type, since dependent extensions may break Upgrade Error
AS0005 Fields must not change name Upgrade Error
AS0006 Tables that have been published must not change name. Upgrade Error
AS0007 Objects that have been published must not change namespace. Upgrade Error
AS0008 Defining reserved namespaces is not allowed. Configuration Error
AS0009 Key fields must not be changed Upgrade Error
AS0010 Keys must not be deleted Upgrade Error
AS0011 An affix is required Extensibility Error
AS0013 The field identifier must be within the allowed range Extensibility Error
AS0014 The project manifest must contain the allocated identifier range Extensibility Error
AS0015 TranslationFile must be enabled. Extensibility Error
AS0016 Fields of field class 'Normal' must use the DataClassification property and its value should be different from ToBeClassified Extensibility Error
AS0018 A procedure belonging to the public API cannot be removed Upgrade Error
AS0019 Event attributes cannot be removed Upgrade Error
AS0020 The type of events cannot be changed. Upgrade Error
AS0021 An argument in an event attribute cannot be changed to false. Upgrade Error
AS0022 An external scope cannot be removed Upgrade Error
AS0023 A return type cannot be modified in external procedures Upgrade Error
AS0024 Parameters cannot be removed or added in external procedures Upgrade Error
AS0025 Parameters cannot be modified, renamed, or removed from events. Upgrade Error
AS0026 The type and subtype of parameters cannot be modified in events and external procedures Upgrade Error
AS0027 Modifying the array size of a parameter in events and external procedures is not allowed Upgrade Error
AS0028 Reducing the array size of a parameter in events and external procedures is not allowed Upgrade Error
AS0029 Pages and PageExtensions that have been published must not be deleted, since dependent extensions may break Upgrade Error
AS0030 Pages that have been published must not be renamed. Upgrade Error
AS0031 Actions that have been published must not be deleted. Upgrade Error
AS0032 Controls that have been published must not be deleted. Upgrade Error
AS0033 Views that have been published must not be deleted. Upgrade Error
AS0034 Unsupported table property change Upgrade Error
AS0035 Unsupported page property change Upgrade Warning
AS0036 Unsupported table field property change Upgrade Error
AS0038 Unsupported table key property change Upgrade Error
AS0039 Removing properties that cause destructive changes is not allowed Upgrade Error
AS0040 Removing properties that cause destructive changes is not allowed Upgrade Warning
AS0041 Table field property changes that cause destructive changes must not be removed Upgrade Error
AS0042 Table key property changes that cause destructive changes must not be removed Upgrade Error
AS0043 The clustered key must not be deleted Upgrade Error
AS0044 Property changes that cause destructive changes are not allowed Upgrade Error
AS0047 The extension name is too long. Extensibility Error
AS0048 The publisher name is too long. Extensibility Error
AS0049 The access modifier of an application object cannot be changed to a value that provides less access. Extensibility Error
AS0050 The extensibility of an application object cannot be removed Extensibility Error
AS0051 Manifest property is required for AppSource submission Extensibility Error
AS0052 The property 'url' must be set to a valid URL Extensibility Error
AS0053 The compilation target of an application must be a value that is allowed in a multi-tenant SaaS environment Extensibility Error
AS0054 The AppSourceCop configuration must specify the set of affixes used by the application Configuration Error
AS0055 The AppSourceCop configuration must specify the list of countries/regions targeted by the application Configuration Hidden
AS0056 The country/region codes specified in the 'supportedCountries' property must be valid ISO 3166-1 alpha-2 codes Configuration Warning
AS0057 Translations must be provided for all the locales in which the application will be available Extensibility Hidden
AS0058 Only use AssertError in Test Codeunits Extensibility Error
AS0059 Reserved database tables are read-only in a multi-tenant environment Extensibility Error
AS0060 Unsafe methods cannot be invoked in an AppSource application Extensibility Error
AS0061 Procedures must not subscribe to CompanyOpen events Extensibility Error
AS0062 Page controls and actions must use the ApplicationArea property Extensibility Error
AS0063 Removing a var modifier in events is not allowed Upgrade Error
AS0064 Interface implementations that have been published must not be deleted. Upgrade Error
AS0065 Interfaces that have been published must not be deleted. Upgrade Error
AS0066 A new method to an interface that has been published must not be added. Upgrade Error
AS0067 Adding an interface to an enum that has been published must have a default implementation. Upgrade Error
AS0068 Changing a table extension's target is not allowed. Upgrade Error
AS0069 An enum field replacing an option field should have at least the same number of members. Upgrade Error
AS0070 An enum field replacing an option field should preserve the member names. Upgrade Error
AS0071 An enum field replacing an option field should preserve the member ordinal values. Upgrade Error
AS0072 The ObsoleteTag property and the Tag in the Obsolete attribute must be set to the next release version. Design Hidden
AS0073 Obsolete Tag must be set. Design Hidden
AS0074 The Obsolete Tag must be the same across branches. Design Hidden
AS0075 Obsolete Reason must be set. Design Warning
AS0076 Obsolete Tag format. Design Hidden
AS0077 Adding a var modifier in events is not allowed Upgrade Error
AS0078 Adding or removing a var modifier in external procedures is not allowed Upgrade Error
AS0079 An affix is required for procedures defined in extension objects. Extensibility Warning
AS0080 Fields must not decrease in length Upgrade Error
AS0081 InternalsVisibleTo should not be used as a security feature. Extensibility Warning
AS0082 It is not allowed to rename an enum value. Upgrade Error
AS0083 It is not allowed to delete a value from an enum. Upgrade Error
AS0084 The ID range assigned to the extension must be within the allowed range Extensibility Error
AS0085 Use the 'application' property instead of specifying explicit dependencies. Extensibility Warning
AS0086 Fields must not increase in length Upgrade Warning
AS0087 Translations of enum value captions must not contain commas Extensibility Warning
AS0088 Objects with an ID that can be referenced and which have been published must not be deleted. Upgrade Error
AS0089 Objects that can be referenced and which have been published must not be deleted. Upgrade Error
AS0090 Objects that can be referenced and which have been published must not be renamed. Upgrade Error
AS0091 One or more dependencies of the previous version of the extension could not be found. Upgrade Error
AS0092 The app.json file must specify an Azure Application Insights resource. Configuration Warning
AS0094 Permission Sets should not be defined in XML files. Configuration Warning
AS0095 The access modifier of a table field cannot be changed to a value that provides less access. Configuration Error
AS0096 The name of an extension cannot be changed. Configuration Error
AS0097 The publisher name of an extension cannot be changed. Configuration Error
AS0098 An affix is needed. Extensibility Warning
AS0099 The member ID should be within the allowed range Extensibility Info
AS0100 The 'application' property must be specified in the app.json file. Extensibility Error
AS0101 The 'Isolated' argument cannot be changed, added, or removed. Upgrade Error
AS0102 Cannot add a return value to a procedure Upgrade Error
AS0103 Table definitions must have a matching permission set. Configuration Warning
AS0104 The extension name is not valid. Extensibility Error
AS0105 Object pending obsoletion contains an expired ObsoleteTag. Design Error
AS0106 A variable belonging to the public API cannot be removed. Design Error
AS0107 The access modifier of a variable that belongs to the public API cannot be changed to a value that provides less access. Design Error
AS0108 The type of a variable belonging to the public API cannot be changed. Design Error
AS0109 The type of the table has changed from Normal to Temporary. Upgrade Warning
AS0110 Permission set extensions should not include permissions for objects defined in another application. Extensibility Warning
AS0111 Permission set extensions should not include permission sets defined in another application. Extensibility Warning
AS0112 Permission set extensions should not include permission sets which include permissions for objects defined in another application. Extensibility Warning
AS0113 Permission set extensions should not include wildcard permissions. Extensibility Warning
AS0114 The name of an external business event cannot be changed. Upgrade Error
AS0115 The obsolete state cannot change directly from 'No' to 'Removed'. Upgrade Error
AS0116 Source application for the moved symbol cannot be found. Upgrade Warning
AS0117 Application object is moved without the use of PendingMove. Upgrade Warning
AS0118 The length of a field part of the primary key cannot change. Upgrade Error
AS0119 The value of the MovedTo property in the source symbol does not match the destination AppId. Upgrade Warning
AS0120 The value of the MovedFrom property in the destination object does not match the source AppId. Upgrade Warning
AS0121 When a symbol is moved the name must remain the same. Upgrade Error
AS0122 Source symbol for the moved symbol cannot be found in the package with the given AppId. Upgrade Warning
AS0123 A key cannot be declared as clustered on an existing table. Upgrade Error
AS0124 Changing an extension object's target is not allowed. Upgrade Error
AS0125 Changes the XLIFF translation ID are not allowed. Upgrade Info
AS0126 InternalsVisibleTo should not specifying a different publisher name than the one of this extension. Extensibility Warning
AS0127 Objects should be placed in a namespace with at least two levels. Extensibility Warning
AS0128 An interface must not be removed from the the list of extended interfaces on an interface that has been published. Upgrade Error
AS0129 An interface must not be added to the the list of extended interfaces on an interface that has been published. Upgrade Error

Note

Several rules enforced by the AppSourceCop analyzer are incompatible with rules enforced by the PerTenantExtensionCop. Make sure to enable only one of these at a time.

Note

Failing to comply with the rules whose default severity is set to Error will fail the submission of your extension to the AppSource marketplace. It is recommended, but not mandatory to comply with the rules whose severity is marked as Warning or Info.

Configuration

The AppSourceCop analyzer can be further configured by adding a file named AppSourceCop.json in the project's root folder. The AL Language extension will offer IntelliSense for this file.

The following table describes the settings in the AppSourceCop.json file:

Setting Mandatory Value
name No The name of a previous version of this package with which you want to compare the current package for breaking changes.
publisher No The publisher of a previous version of this package with which you want to compare the current package for breaking changes.
version Yes The version of a previous version of this package with which you want to compare the current package for breaking changes.
mandatoryAffixes No Affixes that must be prepended or appended to the name of all new application objects, extension objects, and fields.
supportedCountries No The set of country codes, in the alpha-2 ISO 3166 format, in which the application will be available.
targetVersion No Specifies the next Major.Minor version of the extension in the current branch in order to validate the ObsoleteTag values with AS0072. This is only relevant when the default obsoleteTagPattern '(\d+)\.(\d+)' is used. This property is being deprecated in favor of obsoleteTagVersion.
obsoleteTagVersion No Specifies the next Major.Minor version of the extension in the current branch in order to validate the ObsoleteTag values with AS0072. This is only relevant when the default obsoleteTagPattern '(\d+)\.(\d+)' is used.
obsoleteTagPattern No The Obsolete tag pattern used by AS0076. This should be a valid regular expression. By default, the pattern '(\d+)\.(\d+)' is used.
obsoleteTagPatternDescription No A human-readable description for the ObsoleteTagPattern regular expression. This is used in diagnostics reported by AS0076. By default, 'Major.Minor' is used.
obsoleteTagAllowedVersions No A comma-separated list of Major.Minor versions that will be allowed as ObsoleteTag values by AS0072. This is only relevant when the default obsoleteTagPattern '(\d+)\.(\d+)' is used.
baselinePackageCachePath No The path to the folder containing the baseline and its dependencies with which you want to compare the current package for breaking changes. By default, the package cache path for the current project is used (see 'al.packageCachePath' setting).
obsoleteTagMinAllowedMajorMinor No The minimum version of ObsoleteTag (Major.Minor) allowed during compilation. Referencing an obsolete pending object with an obsolete tag lower than the specified version will trigger the rule AS0105. Note that enabling this setting has a performance impact.

The name, publisher, version properties are used for specifying a previous version of the current package. This package must be located in the baseline package cache folder of your extension. This cache can be specified using the baselinePackageCachePath property. If this property is not specified, the dependency package cache path of the extension will be used instead. The al.packageCachePath setting allows you to specify the path to the folder that will act as the cache for the dependencies symbol files used by your project. AppSourceCop will compare the previous version of your extension with its current version and will report any breaking changes introduced by the current package.

The mandatoryAffixes property specifies strings that must be prepended or appended to the names of all new objects, extension objects and fields. By using these affixes, you can prevent clashes between objects added by your extension and objects added by other extensions.

The supportedCountries property specifies the codes that correspond to the countries/regions for which the product allows AppSource submissions. For more information, see Availability and supported Countries/Regions and Translations

The properties obsoleteTagVersion, obsoleteTagPattern, and obsoleteTagPatternDescription can be used to enable additional validation on object obsoletion. These are not required for AppSource submissions.

Example

In the following example, we will configure AppSourceCop to validate that all new elements have a name that contains one of the specified affixes.

Note

Make sure that code analysis is enabled and ${AppSourceCop} is specified in the list of enabled code analyzers. For more information see AL Language Extension Configuration.

We start by creating the default "Hello world" extension.

pageextension 50100 CustomerListExt extends "Customer List"
{
    trigger OnOpenPage();
    begin
        begin
            Message('App published: Hello world');
        end;
    end;
}

We continue by adding the configuration file AppSourceCop.json in the project's root folder and setting its content to the following.

{
    "mandatoryAffixes": [ "Foo", "Bar" ]
}

Important

If you are running a multi-root workspace environment, you must have one AppSourceCop.json file in the root folder of each of the projects. For more information, see Working with multiple AL project folders within one workspace.

You are immediately greeted by the following error message:

AS0011: The identifier 'CustomerListExt' must have at least one of the mandatory affixes 'Foo, Bar'.

Prepending Foo to the name of the page extension object will fix this error and prevent clashes between this page extension and page extensions added by other developers.

Note

It is still possible to use the mandatoryPrefix and mandatorySuffix properties in the AppSourceCop.json. For more information see AS0011.

Using the Code Analysis Tool
Ruleset for the Code Analysis Tool
Using the Code Analysis Tools with the Ruleset