C# Class StyleCopPlus.CodeHelper

Helper methods for analyzing code.
Mostra file Open project: shuruev/StyleCopPlus

Public Methods

Method Description
ExtractNamesToCheck ( string fullName, string settingName ) : string[]

Extracts names that should be checked.

ExtractPureName ( string nameToCheck, bool removeAt ) : string

Extracts pure name to check.

FindNextValueableNode ( Node target ) : Node

Finds next valuable node.

FindPreviousValueableNode ( Node target ) : Node

Finds previous valuable node.

GetElementByLine ( CsDocument document, int lineNumber ) : ICodeElement

Gets first code element at specified line number.

GetElementSizeByDeclaration ( CsElement element ) : int

Gets element size in line count.

GetExpressionByLine ( CsDocument document, int lineNumber ) : Expression

Gets first expression at specified line number.

GetLabels ( CsElement element ) : List

Gets labels.

GetLocalDeclarations ( CsElement element ) : List

Gets local declarations.

GetNameWithAt ( IEnumerable fullTokens, string fullName ) : string

Gets name with usage of @ character.

GetNodeByLine ( CsDocument document, int lineNumber ) : Node

Gets first node by specified line number.

GetParameters ( CsElement element ) : List

Gets a list of parameters for an element.

GetRootExpression ( Expression expression ) : Expression

Finds the root expression.

GetSummaryText ( CsElement element ) : string

Gets summary text for specified element.

GetTypeParameters ( CsElement element ) : List

Gets a list of type parameters for an element.

IsInternal ( CsElement element ) : bool

Checks whether specified element has internal access modifier.

IsOperator ( CsElement element ) : bool

Checks whether specified element is operator.

IsPartial ( CsElement element ) : bool

Checks whether specified element is partial.

IsPrivate ( CsElement element ) : bool

Checks whether specified element has private access modifier.

IsPrivateEventHandler ( CsElement element ) : bool

Checks whether specified element describes private event handler.

IsProtected ( CsElement element ) : bool

Checks whether specified element has protected access modifier.

IsProtectedEventHandler ( CsElement element ) : bool

Checks whether specified element describes protected event handler.

IsPublic ( CsElement element ) : bool

Checks whether specified element has public access modifier.

IsStatic ( CsElement element ) : bool

Checks whether specified element is static.

IsTestMethod ( CsElement element ) : bool

Checks whether specified element describes test method.

MakeXml ( string text ) : XmlDocument

Creates XML document from its inner text.

Private Methods

Method Description
CheckEventHandlerMethod ( CsElement element ) : bool

Checks whether specified method could act as event handler.

CheckEventHandlerParameters ( StyleCop.CSharp.Method method ) : bool

Checks whether specified method has parameters suitable for being event handler.

ConvertParameters ( IEnumerable parameters ) : List

Converts native parameters to parameter items.

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

Tries to find code element by line.

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

Tries to find expression by line.

GetLabelsStatementVisitor ( Statement statement, Expression parentExpression, Statement parentStatement, CsElement parentElement, List result ) : bool

Analyzes statements for getting labels.

GetLocalDeclarationsStatementVisitor ( Statement statement, Expression parentExpression, Statement parentStatement, CsElement parentElement, List declarations ) : bool

Analyzes statements for getting local declarations.

GetParametersExpressionVisitor ( Expression expression, Expression parentExpression, Statement parentStatement, CsElement parentElement, List result ) : bool

Analyzes expression for getting parameters.

Method Details

ExtractNamesToCheck() public static method

Extracts names that should be checked.
public static ExtractNamesToCheck ( string fullName, string settingName ) : string[]
fullName string
settingName string
return string[]

ExtractPureName() public static method

Extracts pure name to check.
public static ExtractPureName ( string nameToCheck, bool removeAt ) : string
nameToCheck string
removeAt bool
return string

FindNextValueableNode() public static method

Finds next valuable node.
public static FindNextValueableNode ( Node target ) : Node
target Node
return Node

FindPreviousValueableNode() public static method

Finds previous valuable node.
public static FindPreviousValueableNode ( Node target ) : Node
target Node
return Node

GetElementByLine() public static method

Gets first code element at specified line number.
public static GetElementByLine ( CsDocument document, int lineNumber ) : ICodeElement
document CsDocument
lineNumber int
return ICodeElement

GetElementSizeByDeclaration() public static method

Gets element size in line count.
public static GetElementSizeByDeclaration ( CsElement element ) : int
element CsElement
return int

GetExpressionByLine() public static method

Gets first expression at specified line number.
public static GetExpressionByLine ( CsDocument document, int lineNumber ) : Expression
document CsDocument
lineNumber int
return Expression

GetLabels() public static method

Gets labels.
public static GetLabels ( CsElement element ) : List
element CsElement
return List

GetLocalDeclarations() public static method

Gets local declarations.
public static GetLocalDeclarations ( CsElement element ) : List
element CsElement
return List

GetNameWithAt() public static method

Gets name with usage of @ character.
public static GetNameWithAt ( IEnumerable fullTokens, string fullName ) : string
fullTokens IEnumerable
fullName string
return string

GetNodeByLine() public static method

Gets first node by specified line number.
public static GetNodeByLine ( CsDocument document, int lineNumber ) : Node
document CsDocument
lineNumber int
return Node

GetParameters() public static method

Gets a list of parameters for an element.
public static GetParameters ( CsElement element ) : List
element CsElement
return List

GetRootExpression() public static method

Finds the root expression.
public static GetRootExpression ( Expression expression ) : Expression
expression Expression
return Expression

GetSummaryText() public static method

Gets summary text for specified element.
public static GetSummaryText ( CsElement element ) : string
element CsElement
return string

GetTypeParameters() public static method

Gets a list of type parameters for an element.
public static GetTypeParameters ( CsElement element ) : List
element CsElement
return List

IsInternal() public static method

Checks whether specified element has internal access modifier.
public static IsInternal ( CsElement element ) : bool
element CsElement
return bool

IsOperator() public static method

Checks whether specified element is operator.
public static IsOperator ( CsElement element ) : bool
element CsElement
return bool

IsPartial() public static method

Checks whether specified element is partial.
public static IsPartial ( CsElement element ) : bool
element CsElement
return bool

IsPrivate() public static method

Checks whether specified element has private access modifier.
public static IsPrivate ( CsElement element ) : bool
element CsElement
return bool

IsPrivateEventHandler() public static method

Checks whether specified element describes private event handler.
public static IsPrivateEventHandler ( CsElement element ) : bool
element CsElement
return bool

IsProtected() public static method

Checks whether specified element has protected access modifier.
public static IsProtected ( CsElement element ) : bool
element CsElement
return bool

IsProtectedEventHandler() public static method

Checks whether specified element describes protected event handler.
public static IsProtectedEventHandler ( CsElement element ) : bool
element CsElement
return bool

IsPublic() public static method

Checks whether specified element has public access modifier.
public static IsPublic ( CsElement element ) : bool
element CsElement
return bool

IsStatic() public static method

Checks whether specified element is static.
public static IsStatic ( CsElement element ) : bool
element CsElement
return bool

IsTestMethod() public static method

Checks whether specified element describes test method.
public static IsTestMethod ( CsElement element ) : bool
element CsElement
return bool

MakeXml() public static method

Creates XML document from its inner text.
public static MakeXml ( string text ) : XmlDocument
text string
return System.Xml.XmlDocument