Rule Catalog
Everything a rule can be about, and the properties it can look at in each, from commitfence catalog.
On this page
This page is written from the output of commitfence catalog csharp, so it says what the program says. A rule is for one artifact type; its where and require name properties of that type.
A property that reads the file is known from the text of the file alone, so a review of named files can judge it. One that needs the build is known only from the compiler, so only a review that builds (--push, --staged, --base, --all) can judge it.
Artifact types#
if-statement: An if statement. Each else if is an if statement of its own, and it is found where the if keyword after the else is.method: A method of a class, struct, record or interface. Constructors, local functions, lambdas and accessors are not methods.class: A class. Structs, records and interfaces are not classes.usage: A place where code refers to a type or to a member of a type, as the compiler resolved the name. Only known from the build.
if-statement#
An if statement. Each else if is an if statement of its own, and it is found where the if keyword after the else is.
commitfence catalog csharp if-statement
| Property | Value | Known from | What it holds |
|---|---|---|---|
statementsInBody | number | reads the file | How many statements the body holds, braces or not. The body is the branch taken when the condition holds; an else branch is not part of it. A body without braces holds one statement. |
bodyFitsOnOneLine | true or false | reads the file | Whether what is inside the body, from the first token of its first statement to the last token of its last one, sits on one line. The braces and comments are not counted. An empty body fits. |
fitsOnOneLine | true or false | reads the file | Whether the whole if statement, from the if keyword to the end of its last branch, sits on one line. |
braces | true or false | reads the file | Whether the body is written inside braces. |
isElseIf | true or false | reads the file | Whether this if statement is the one after an else. |
hasElse | true or false | reads the file | Whether an else follows the body. |
lines | number | reads the file | How many lines the if statement takes, from the if keyword to its end. |
method#
A method of a class, struct, record or interface. Constructors, local functions, lambdas and accessors are not methods.
commitfence catalog csharp method
| Property | Value | Known from | What it holds |
|---|---|---|---|
name | text | reads the file | The name of the method. |
writtenAccess | text | reads the file | The access keyword written in the file, or none. |
modifiers | text | reads the file | Every modifier keyword written, in the order written, separated by a space. |
isOverride | true or false | reads the file | Whether the method is written with the override keyword. |
declaredAccess | text | needs the build | The access the method really has, as the compiler says: the language's default applied when none is written. |
containingType | text | reads the file | The kind of type the method is immediately declared in, or none. A record struct is a record. |
containingTypeName | text | reads the file | The name of that type, or empty. |
containingTypeWrittenAccess | text | reads the file | The access keyword written on that type, or none. |
containingTypeDeclaredAccess | text | needs the build | The declared access of that type, as the compiler says (every part of a partial type taken together), or none. |
parameterCount | number | reads the file | How many parameters the method has. |
statements | number | reads the file | How many statements are directly in the body; an expression body counts one, a method without a body none. |
lines | number | reads the file | How many lines the method takes, attributes included, documentation comment not. |
fitsOnOneLine | true or false | reads the file | Whether the whole method sits on one line. |
documentationPresent | true or false | reads the file | Whether a documentation comment comes right before the method. |
attributes | text | reads the file | The names of the attributes, as written, separated by a comma and a space. |
class#
A class. Structs, records and interfaces are not classes.
commitfence catalog csharp class
| Property | Value | Known from | What it holds |
|---|---|---|---|
name | text | reads the file | The name of the class. |
writtenAccess | text | reads the file | The access keyword written in the file, or none. |
modifiers | text | reads the file | Every modifier keyword written, in the order written, separated by a space. |
declaredAccess | text | needs the build | The access the class really has, as the compiler says: the language's default applied when none is written, and every part of a partial class taken together. |
containingType | text | reads the file | The kind of type the class is immediately declared in, or none for a class that is not nested. |
isPartial | true or false | reads the file | Whether this part of the class is written partial. |
lines | number | reads the file | How many lines the class takes, attributes included, documentation comment not. |
fitsOnOneLine | true or false | reads the file | Whether the whole class sits on one line. |
documentationPresent | true or false | reads the file | Whether a documentation comment comes right before the class. |
attributes | text | reads the file | The names of the attributes, as written, separated by a comma and a space. |
usage#
A place where code refers to a type or to a member of a type, as the compiler resolved the name. Only known from the build.
This artifact is known only from the build.
commitfence catalog csharp usage
| Property | Value | Known from | What it holds |
|---|---|---|---|
target | text | needs the build | What the name refers to, as the compiler resolved it: a member written as Type.Member with the type's full name and no parameters, such as System.DateTime.Now, or a type's full name. A constructor counts as its type. |
targetType | text | needs the build | The full name of the type that is used, or that holds the member that is used. |
targetAssembly | text | needs the build | The name of the assembly that type comes from. |
Something wrong or unclear on this page? Tell us on GitHub