Skip to content

Commit

Permalink
Cleanup analyzer rules (#1686)
Browse files Browse the repository at this point in the history
  • Loading branch information
satvu authored Jun 26, 2023
1 parent ccb3e0c commit 060d97d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
7 changes: 3 additions & 4 deletions docs/analyzer-rules/AZFW0001.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@
| **Category** |[Usage]|
| **Severity** |Error|


## Cause

This rule is triggered when invalid, WebJobs, binding attributes are used in the function definition.
This rule is triggered when invalid WebJobs binding attributes are used in the function definition.

## Rule description

The Azure Functions .NET Worker uses a different input and output binding model, which is incompatible with the WebJobs binding
model used by the Azure Functions in-process model.

In order to support the existing bindings and triggers, a new set of packages, compatible with the new binding model, have been introduced, those
packages follow a naming convention that makes it easy to find a suitable replacement, simply by changing the prefix `Microsoft.Azure.WebJobs.Extensions.*` for `Microsoft.Azure.Functions.Worker.Extensions.*`. For example:
In order to support the existing bindings and triggers, a new set of packages, compatible with the new binding model, have been introduced. Those
packages follow a naming convention that makes it easy to find a suitable replacement, simply by changing the prefix `Microsoft.Azure.WebJobs.Extensions.*` to `Microsoft.Azure.Functions.Worker.Extensions.*`. For example:

If you have a reference to `Microsoft.Azure.WebJobs.Extensions.ServiceBus`, replace that with a reference to `Microsoft.Azure.Functions.Worker.Extensions.ServiceBus`

Expand Down
6 changes: 3 additions & 3 deletions docs/analyzer-rules/AZFW0005.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

## Cause

This rule is triggered when multiple Azure Functions Binding Attributes are grouped together on a method, parameter, or property syntax.
This rule is triggered when multiple Azure Functions binding attributes are grouped together on a method, parameter, or property syntax.

## Rule description

Azure Functions Binding Attributes are used to decorate a method, parameter, or property syntax. Only one binding can be associated with any syntax.
Azure Functions binding attributes are used to decorate a method, parameter, or property syntax. Only one binding can be associated with any syntax.

## How to fix violations

Expand All @@ -24,4 +24,4 @@ If you have multiple bindings on a method, create a custom return type with the

## When to suppress warnings

This rule should not be suppressed because this error will prevent your Azure Functions from running.
This rule should not be suppressed because this error will prevent your functions from running.
4 changes: 2 additions & 2 deletions docs/analyzer-rules/AZFW0006.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ This rule is triggered when a Symbol necessary for Azure Function metadata gener

## Rule description

Symbols are searched for and loaded from the user compilation to gather Function metadata information. If the are not found, then the user's Azure Function will not run.
Symbols are searched for and loaded from the user compilation to gather function metadata information. If the are not found, then the user's function will not run.

## How to fix violations

Make sure you have added all necessary imports to your compilation.

## When to suppress warnings

This rule should not be suppressed because this error will prevent your Azure Functions from running.
This rule should not be suppressed because this error will prevent your functions from running.
4 changes: 2 additions & 2 deletions docs/analyzer-rules/AZFW0007.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Each Azure Function can have only one HTTP response binding type.

## How to fix violations

Make sure you have only one HTTP response binding type associated with an Azure Function. If you have a custom return type, please check all of the properties to verify that there is only one HTTP response binding type.
Make sure you have only one HTTP response binding type associated with a function. If you have a custom return type, please check all of the properties to verify that there is only one HTTP response binding type.

## When to suppress warnings

This rule should not be suppressed because this error will prevent your Azure Functions from running.
This rule should not be suppressed because this error will prevent your functions from running.
12 changes: 6 additions & 6 deletions docs/analyzer-rules/AZFW0008.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@

## Cause

This rule is triggered when an Input or Trigger Binding of an Azure Function has an invalid Cardinality.
This rule is triggered when an input or trigger binding of an Azure Function has an invalid cardinality.

## Rule description

"Cardinality" dictates whether or not an input is batched together or processed individually. It is defined by using the argument "IsBatched" in an Azure Functions Input or Trigger Binding attribute. When IsBatched is true, Cardinality is set to `Many`. When IsBatched is false, Cardinality is set to `One`.
"Cardinality" dictates whether or not an input is batched together or processed individually. It is defined by using the argument "IsBatched" in an input or trigger binding attribute. When IsBatched is true, cardinality is set to `Many`. When IsBatched is false, cardinality is set to `One`.

All Input and Trigger Bindings must correctly declare a compatible "IsBatched" value and parameter input type. For example, for bindings where `IsBatched = true`, the input parameter type must be an iterable collection like `string[]` or `List<string>`. Combining `IsBatched = true` with a parameter of `string[]` is valid, but combining `IsBatched = true` with a parameter of `string` is invalid.
All input and trigger bindings must correctly declare a compatible "IsBatched" value and parameter input type. For example, for bindings where `IsBatched = true`, the input parameter type must be an iterable collection like `string[]` or `List<string>`. Combining `IsBatched = true` with a parameter of `string[]` is valid, but combining `IsBatched = true` with a parameter of `string` is invalid.

_**Note:**_ The default value of `IsBatched` changes depending on the Input or Trigger Binding type. The default value of `IsBatched` for each type can be found in the dotnet-isolated [extensions libraries](https://github.com/Azure/azure-functions-dotnet-worker/tree/main/extensions). If a value is not explicitly provided in the named arguments of the attribute, the default value will be used.
_**Note:**_ The default value of `IsBatched` changes depending on the binding type. The default value of `IsBatched` for each type can be found in the dotnet-isolated [extensions libraries](https://github.com/Azure/azure-functions-dotnet-worker/tree/main/extensions). If a value is not explicitly provided in the named arguments of the attribute, the default value will be used.

## How to fix violations

If an Input or Trigger Bindings has `IsBatched = true` (explicitly or by default), the input parameter type must be changed to an iterable collection. Otherwise, `IsBatched` needs to be set to false.
If an input or trigger binding has `IsBatched = true` (explicitly or by default), the input parameter type must be changed to an iterable collection. Otherwise, `IsBatched` needs to be set to false.

## When to suppress warnings

This rule should not be suppressed because this error will prevent your Azure Functions from running.
This rule should not be suppressed because this error will prevent your functions from running.

0 comments on commit 060d97d

Please sign in to comment.