CommitFence
Esc
↑ ↓ to moveEnter to open
Rules / Rule Catalog

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

PropertyValueKnown fromWhat it holds
statementsInBodynumberreads the fileHow 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.
bodyFitsOnOneLinetrue or falsereads the fileWhether 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.
fitsOnOneLinetrue or falsereads the fileWhether the whole if statement, from the if keyword to the end of its last branch, sits on one line.
bracestrue or falsereads the fileWhether the body is written inside braces.
isElseIftrue or falsereads the fileWhether this if statement is the one after an else.
hasElsetrue or falsereads the fileWhether an else follows the body.
linesnumberreads the fileHow 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

PropertyValueKnown fromWhat it holds
nametextreads the fileThe name of the method.
writtenAccesstextreads the fileThe access keyword written in the file, or none.
modifierstextreads the fileEvery modifier keyword written, in the order written, separated by a space.
isOverridetrue or falsereads the fileWhether the method is written with the override keyword.
declaredAccesstextneeds the buildThe access the method really has, as the compiler says: the language's default applied when none is written.
containingTypetextreads the fileThe kind of type the method is immediately declared in, or none. A record struct is a record.
containingTypeNametextreads the fileThe name of that type, or empty.
containingTypeWrittenAccesstextreads the fileThe access keyword written on that type, or none.
containingTypeDeclaredAccesstextneeds the buildThe declared access of that type, as the compiler says (every part of a partial type taken together), or none.
parameterCountnumberreads the fileHow many parameters the method has.
statementsnumberreads the fileHow many statements are directly in the body; an expression body counts one, a method without a body none.
linesnumberreads the fileHow many lines the method takes, attributes included, documentation comment not.
fitsOnOneLinetrue or falsereads the fileWhether the whole method sits on one line.
documentationPresenttrue or falsereads the fileWhether a documentation comment comes right before the method.
attributestextreads the fileThe 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

PropertyValueKnown fromWhat it holds
nametextreads the fileThe name of the class.
writtenAccesstextreads the fileThe access keyword written in the file, or none.
modifierstextreads the fileEvery modifier keyword written, in the order written, separated by a space.
declaredAccesstextneeds the buildThe 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.
containingTypetextreads the fileThe kind of type the class is immediately declared in, or none for a class that is not nested.
isPartialtrue or falsereads the fileWhether this part of the class is written partial.
linesnumberreads the fileHow many lines the class takes, attributes included, documentation comment not.
fitsOnOneLinetrue or falsereads the fileWhether the whole class sits on one line.
documentationPresenttrue or falsereads the fileWhether a documentation comment comes right before the class.
attributestextreads the fileThe 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

PropertyValueKnown fromWhat it holds
targettextneeds the buildWhat 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.
targetTypetextneeds the buildThe full name of the type that is used, or that holds the member that is used.
targetAssemblytextneeds the buildThe name of the assembly that type comes from.

Something wrong or unclear on this page? Tell us on GitHub