Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mandatory affix required despite using namespaces (AS0011 and AS0054) #7675

Closed
tgdoat44 opened this issue Mar 1, 2024 · 1 comment
Closed
Labels

Comments

@tgdoat44
Copy link

tgdoat44 commented Mar 1, 2024

1. Describe the bug
I've been adding namespaces to all my projects and wanted to remove the now unnecessary affixes from the object names. The namespace is now sufficient to identify the objects uniquely.

However, I am still receiving errors that I have to define and use mandatory affixes. If I remove the affix tags from the AppSourceCop.json, I receive AS0054 "The AppSourceCop configuration must specify one of the following properties: 'mandatorySuffix', 'mandatoryPrefix', or 'mandatoryAffixes'".

As soon as I define "mandatoryAffixes" in AppSourceCop.json, I receive the subsequent error, that my objects have to use a mandatory affix (Code AS0011 "The identifier 'This is a test' must have at least one of the mandatory affixes 'AFFIX'.").

2. To Reproduce
I have tested this in a clean project (AL: Go!) with following settings:

  • BC 23 / Runtime 12.0
  • AL Extension v12.6.936426
  • settings.json:
{
    "al.enableCodeAnalysis": true,
    "al.codeAnalyzers": [
        "${PerTenantExtensionCop}",
        "${CodeCop}",
        "${AppSourceCop}",
        "${UICop}"
    ]
}
  • app.json (relevant parts):
{
  ...
  "application": "23.0.0.0",
  "platform": "23.0.0.0",
  "runtime": "12.0",
  "features": [
    "TranslationFile",
    "NoImplicitWith",
    "NoPromotedActionProperties"
  ],
  "target": "Cloud"
}

3. Expected behavior
The idea of namespaces is to replace the need for the affixes. When using namespaces, the affixes should no longer be mandatory and creating objects without affixes has to be possible without errors from the code cops.

4. Actual behavior
The errors AS0011 and AS0054 were thrown. Objects could not be defined without an affix even though the namespace was used.

5. Versions:

  • AL Language: v12.6.936426
  • Visual Studio Code: 1.86.1
  • Business Central: 23.1
  • List of Visual Studio Code extensions that you have installed: AL Langauge
@BazookaMusic
Copy link

Unfortunately, this is by design. There are still cases that namespaces do not cover properly. For example, you can add fields via a table extension and somehow it has to be ensured that these fields will not collide with base app/other publisher's fields.

Due to this and other issues, we haven't removed the requirement for affixes in this release.

The current design of the namespaces is the first step towards moving away from affixes, but unfortunately, they are still required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants