Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions content/docs/analyzers/ApplicationCop/AC0037.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
+++
title = 'Use the configured app.json publisher pattern'
linkTitle = 'AC0037'

[params]
id = 'AC0037'
severity = 'Info'
category = 'Design'
codeAction = false
ignoreObsolete = true
+++

AC0037 checks the app's `publisher` against a configured regular-expression convention. It is disabled by default because publisher naming is an organization-specific convention.

### Configure the pattern

Add an `AllowPattern`, a `DisallowPattern`, or both under `Manifest.Publisher` in `alcops.json`:

{{< highlight json >}}
{
"Manifest": {
"Publisher": {
"AllowPattern": "^Contoso Ltd\\.$"
}
}
}
{{< /highlight >}}

Patterns use .NET regular-expression syntax. `AllowPattern` requires a match; `DisallowPattern` reports a match. Anchor patterns with `^` and `$` when the entire publisher value must match.

The rule does not check for a missing publisher when no pattern is configured. `publisher` is a required app manifest property, so manifest validation already handles its absence.

### Enable the rule

Add AC0037 to the project's `.ruleset.json`:

{{< highlight json >}}
{
"name": "My Project Ruleset",
"rules": [
{
"id": "AC0037",
"action": "Info"
}
]
}
{{< /highlight >}}

### When the diagnostic is reported

AC0037 reports on `publisher` when a configured pattern is invalid or times out, the value does not match `AllowPattern`, or it matches `DisallowPattern`. No diagnostic is reported when neither pattern is configured.
1 change: 1 addition & 0 deletions content/docs/analyzers/ApplicationCop/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,6 @@ ApplicationCop inspects how objects are modeled: tables, fields, pages, enums, l
| [AC0034](ac0034/) | Register a Telemetry Logger in this app | Info | — | |
| [AC0035](ac0035/) | Rest Client is not initialized with a custom Http Client Handler | Warning | ✓ | |
| [AC0036](ac0036/) | Action property duplicates the value of its RunObject target | Info | ✓ | |
| [AC0037](ac0037/) | Use the configured app.json publisher pattern | Info | — | |

**Note:** Rules marked with "—" in the Enabled column are disabled by default and must be explicitly enabled in your project's ruleset file.
31 changes: 31 additions & 0 deletions content/docs/getting-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The `alcops.json` file provides analyzer-specific configuration. Place it in the
| `MaintainabilityIndexThreshold` | integer | `20` | Minimum maintainability index before a diagnostic is reported |
| `LanguagesToTranslate` | string[] | `null` | Language codes to check for missing translations |
| `NamingPatterns` | object | `null` | Per-target naming pattern overrides |
| `Manifest` | object | `{}` | Opt-in ApplicationCop checks for app.json conventions; all six related rules are disabled by default |
| `UseSequentialGuidScope` | string | `null` | Set to `"AllGuidFields"` to require sequential GUIDs on all GUID fields |

Property names are case-insensitive. Comments and trailing commas are allowed. An empty, whitespace-only, comment-only or JSON-null local file uses defaults without CM0001. A declared inherited configuration must still contain a JSON object.
Expand Down Expand Up @@ -145,6 +146,36 @@ Specify which language codes must have translations present in the `.xlf` files.
}
```

### Manifest

The `Manifest` object configures opt-in ApplicationCop checks for `app.json`. Each rule must also be enabled in the project's `.ruleset.json`; all six are disabled by default.

```json
{
"Manifest": {
"Publisher": {
"AllowPattern": "^Contoso Ltd\\.$"
},
"ContextSensitiveHelpUrl": {
"AllowPattern": "^https://help\\.contoso\\.example/.+$"
},
"ResourceExposurePolicy": {
"AllowDebugging": false,
"AllowDownloadingSource": false
},
"RequiredFeatures": ["NoImplicitWith", "TranslationFile"],
"DisallowSuppressWarnings": true,
"VersionMajorMatchesApplication": true
}
}
```

`Publisher` and `ContextSensitiveHelpUrl` accept `AllowPattern` and `DisallowPattern` regular expressions. `ResourceExposurePolicy` compares only the boolean flags you configure. `RequiredFeatures` lists compiler feature names from the app manifest; a feature unknown to the compiler version being used is ignored. `DisallowSuppressWarnings` and `VersionMajorMatchesApplication` default to `false`.

| Rule | Manifest property |
|------|-------------------|
| [AC0037](../../analyzers/applicationcop/ac0037/) | `publisher` |

{{% alert title="Note" %}}
The `alcops.json` file is read when the analyzer loads. In VS Code, changes to this file require reloading the window (`Ctrl+Shift+P` → **Developer: Reload Window**) to take effect.
{{% /alert %}}
Expand Down