Skip to content

Commit

Permalink
Update documentation on IsExtensionMethod
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraser Greenroyd committed Feb 16, 2024
1 parent db1c8cb commit 7dca0ea
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## Details

The `IsExtensionMethod` check makes sure that an engine method within a **query, modify, or convert** class is classed as an extension method to the first object type. Extension methods are made by using the `this` keyword prior to the declaration of the first input parameter. If a method does not take any inputs to operate, then it is exempt from this check.
The `IsExtensionMethod` check makes sure that an engine method within a **query, modify, or convert** class is classed as an extension method to the first object type, providing the first object type is _not_ a system type. Extension methods are made by using the `this` keyword prior to the declaration of the first input parameter. If a method does not take any inputs to operate, then it is exempt from this check.

For example, the following method declaration will fail this check, because it is missing the `this` keyword before the first object:

Expand All @@ -28,4 +28,8 @@ public static bool MethodIsValid(this Panel myPanel, Opening myOpening)

Methods within the Compute and Create classes are exempt from this check.

Files contained within an Engines `Objects` folder are exempt from this check (e.g. files with the file path `Your_Toolkit/Toolkit_Engine/Objects/Foo.cs` will be exempt).
Files contained within an Engines `Objects` folder are exempt from this check (e.g. files with the file path `Your_Toolkit/Toolkit_Engine/Objects/Foo.cs` will be exempt).

## Exempted types

System types are also exempt from this requirement. A list of the system types currently exempted is available [here](https://github.com/BHoM/Test_Toolkit/blob/main/CodeComplianceTest_Engine/Query/Checks/IsExtensionMethod.cs#L60). If a system type is missing from this list, please feel free to raise a pull request to add it, or raise an issue for a member of the DevOps team to pick up.

0 comments on commit 7dca0ea

Please sign in to comment.