Skip to content

Commit

Permalink
style(Flake8Checker): add docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
rubik committed Jul 8, 2015
1 parent 10e0b0d commit 3c64a03
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions radon/complexity.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,14 @@ class Flake8Checker(object):
max_cc = -1

def __init__(self, tree, filename):
'''Accept the AST tree and a filename (unused).'''
self.tree = tree

version = property(lambda self: __import__('radon').__version__)

@classmethod
def add_options(cls, parser): # pragma: no cover
'''Add custom options to the global parser.'''
parser.add_option('--radon-max-cc', default=-1, action='store',
type='int', help='Radon complexity threshold')
parser.add_option('--radon-no-assert', dest='no_assert',
Expand All @@ -126,10 +128,12 @@ def add_options(cls, parser): # pragma: no cover

@classmethod
def parse_options(cls, options): # pragma: no cover
'''Save actual options as class attributes.'''
cls.max_cc = options.radon_max_cc
cls.no_assert = options.no_assert

def run(self):
'''Run the ComplexityVisitor over the AST tree.'''
if self.max_cc < 0:
return
visitor = ComplexityVisitor.from_ast(self.tree,
Expand Down

0 comments on commit 3c64a03

Please sign in to comment.