Package org.sonar.python.metrics
Class FileLinesVisitor
- java.lang.Object
-
- org.sonar.plugins.python.api.PythonSubscriptionCheck
-
- org.sonar.python.metrics.FileLinesVisitor
-
- All Implemented Interfaces:
PythonCheck,SubscriptionCheck
public class FileLinesVisitor extends PythonSubscriptionCheck
Visitor that computesCoreMetrics.NCLOC_DATA_KEYandCoreMetrics.COMMENT_LINESmetrics used by the DevCockpit.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.sonar.plugins.python.api.PythonCheck
PythonCheck.PreciseIssue
-
Nested classes/interfaces inherited from interface org.sonar.plugins.python.api.SubscriptionCheck
SubscriptionCheck.Context
-
-
Constructor Summary
Constructors Constructor Description FileLinesVisitor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleancontainsNoSonarComment(Trivia trivia)static Set<Integer>countDocstringLines(StringLiteral docstring)intgetClassDefs()intgetCommentLineCount()Set<Integer>getExecutableLines()Set<Integer>getLinesOfCode()Set<Integer>getLinesWithNoSonar()intgetStatements()protected voidhandleDocString(StringLiteral docstring)voidinitialize(SubscriptionCheck.Context context)voidleaveFile()voidscanFile(PythonVisitorContext visitorContext)static Set<Integer>tokenLineNumbers(Token token)
-
-
-
Method Detail
-
scanFile
public void scanFile(PythonVisitorContext visitorContext)
- Specified by:
scanFilein interfacePythonCheck- Overrides:
scanFilein classPythonSubscriptionCheck
-
initialize
public void initialize(SubscriptionCheck.Context context)
-
handleDocString
protected void handleDocString(@Nullable StringLiteral docstring)
-
countDocstringLines
public static Set<Integer> countDocstringLines(@Nullable StringLiteral docstring)
-
containsNoSonarComment
public static boolean containsNoSonarComment(Trivia trivia)
-
leaveFile
public void leaveFile()
- Overrides:
leaveFilein classPythonSubscriptionCheck
-
getCommentLineCount
public int getCommentLineCount()
-
getStatements
public int getStatements()
-
getClassDefs
public int getClassDefs()
-
-