C# Class StyleCop.CSharp.ReadabilityRules

The readability rules.
Mostra file Open project: Visual-Stylecop/Visual-StyleCop Class Usage Examples

Public Methods

Method Description
AnalyzeDocument ( CodeDocument document ) : void

Checks the methods within the given document.

DelayAnalysis ( CodeDocument document, int passNumber ) : bool

Returns a value indicating whether to delay analysis of this document until the next pass.

DoAnalysis ( CodeDocument document ) : bool

Private Methods

Method Description
CheckBuiltInType ( Node type, CsDocument document ) : void

Checks a type to determine whether it should use one of the built-in types.

CheckBuiltInTypeForMemberAccessExpressions ( Node type ) : void

Checks a type to determine whether it should use one of the built-in types.

CheckClassMemberRulesForElements ( CsElement element, StyleCop.CSharp.ClassBase parentClass, Dictionary members ) : bool

Checks the items within the given element.

CheckClassMemberRulesForExpression ( Expression expression, Expression parentExpression, CsElement parentElement, StyleCop.CSharp.ClassBase parentClass, Dictionary members ) : void

Parses the given expression.

CheckClassMemberRulesForExpressions ( IEnumerable expressions, Expression parentExpression, CsElement parentElement, StyleCop.CSharp.ClassBase parentClass, Dictionary members ) : void

Parses the list of expressions.

CheckClassMemberRulesForLiteralToken ( Node tokenNode, Expression expression, Expression parentExpression, CsElement parentElement, StyleCop.CSharp.ClassBase parentClass, Dictionary members ) : void

Parses the given literal token.

CheckClassMemberRulesForStatements ( ICollection statements, CsElement parentElement, StyleCop.CSharp.ClassBase parentClass, Dictionary members ) : void

Parses the given statement list.

CheckEmptyString ( Node stringNode ) : void

Checks a string to determine whether it is using an incorrect empty string notation.

CheckForRegionsInElement ( CsElement element, Settings settings ) : void

Processes the given element.

CheckShorthandForNullableTypes ( StyleCop.CSharp.CsToken type ) : void

Checks the generic type uses the shorthand declaration format.

ContainsVariable ( VariableCollection variables, string word, StyleCop.CSharp.CsToken item ) : bool

Determines whether a matching local variable is contained in the given variable list.

IsBaseRequired ( string memberName, StyleCop.CSharp.ClassBase parentClass, Dictionary members ) : bool

Calculates whether the base prefix is required.

IsConstVariableDeclaration ( Node assignmentOperator ) : bool

Determines whether the statement is declaring a constant field or variable.

IsLiteralTokenPrecededByMemberAccessSymbol ( Node literalTokenNode, MasterList masterList ) : bool

Determines whether the given token is preceded by a member access symbol.

IsLocalMember ( string word, StyleCop.CSharp.CsToken item, ICodeUnit parent ) : bool

Determines whether the given word is the name of a local variable.

IsMethodParameterDeclaration ( Node node ) : bool

Determines whether the node is part of a method parameter.

IsObjectInitializerLeftHandSideExpression ( Expression expression ) : bool

Determines whether the given expression is the left-hand-side literal in any of the assignment expressions within an object initialize expression.

This method checks for the following situation: class MyClass { public bool Member { get { return true; } } public void SomeMethod() { MyObjectType someObject = new MyObjectType { Member = this.Member }; } } In this case, StyleCop will raise a violation since it looks like the Member token should be prefixed by 'this.', however, it is actually referring to a property on the MyObjectType type.

IsThisRequired ( Node tokenNode, Expression expression, StyleCop.CSharp.ClassBase parentClass, Dictionary members ) : bool

Checks a token to see if it should be prefixed (with this. or maybe another prefix).

IsThisRequiredFromMemberList ( Expression expression, StyleCop.CSharp.ClassBase parentClass, IEnumerable matchesForPassedMethod, IEnumerable matchesForGenericMethod, string memberName ) : bool

Checks a token to see if it should be prefixed (with this. or maybe another prefix).

IsThisRequiredFromMemberList ( IEnumerable matchesForPassedMethod ) : bool

Checks a token to see if it should be prefixed (with this. or maybe another prefix).

IterateTokenList ( CsDocument document, Settings settings ) : void

Checks the built-in types and empty strings within a document.

ProcessElement ( CsElement element, CsElement parentElement, object context ) : bool

Checks the given element.

ProcessExpression ( Expression expression, Expression parentExpression, Statement parentStatement, CsElement parentElement, object context ) : bool

Checks the given expression.

Method Details

AnalyzeDocument() public method

Checks the methods within the given document.
public AnalyzeDocument ( CodeDocument document ) : void
document CodeDocument /// The document to check. ///
return void

DelayAnalysis() public method

Returns a value indicating whether to delay analysis of this document until the next pass.
public DelayAnalysis ( CodeDocument document, int passNumber ) : bool
document CodeDocument /// The document to analyze. ///
passNumber int /// The current pass number. ///
return bool

DoAnalysis() public method

public DoAnalysis ( CodeDocument document ) : bool
document CodeDocument
return bool