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,PythonFileConsumer,SubscriptionCheck
Visitor that computes
CoreMetrics.NCLOC_DATA_KEY and CoreMetrics.COMMENT_LINES metrics used by the DevCockpit.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.sonar.plugins.python.api.PythonCheck
PythonCheck.CheckScope, PythonCheck.PreciseIssueNested classes/interfaces inherited from interface org.sonar.plugins.python.api.SubscriptionCheck
SubscriptionCheck.Context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsNoSonarComment(Trivia trivia) countDocstringLines(StringLiteral docstring) intintintprotected voidhandleDocString(StringLiteral docstring) voidinitialize(SubscriptionCheck.Context context) voidvoidscanFile(PythonVisitorContext visitorContext) tokenLineNumbers(Token token) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.sonar.plugins.python.api.PythonCheck
scopeMethods inherited from interface org.sonar.plugins.python.api.PythonFileConsumer
scanWithoutParsing
-
Constructor Details
-
FileLinesVisitor
public FileLinesVisitor(boolean isNotebook) -
FileLinesVisitor
public FileLinesVisitor()
-
-
Method Details
-
scanFile
- Specified by:
scanFilein interfacePythonFileConsumer- Overrides:
scanFilein classPythonSubscriptionCheck
-
initialize
-
handleDocString
-
countDocstringLines
-
tokenLineNumbers
-
containsNoSonarComment
-
leaveFile
public void leaveFile()- Overrides:
leaveFilein classPythonSubscriptionCheck
-
getLinesWithNoSonar
-
getLinesOfCode
-
getCommentLineCount
public int getCommentLineCount() -
getExecutableLines
-
getStatements
public int getStatements() -
getClassDefs
public int getClassDefs()
-