mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-07 21:44:18 +00:00
Fixed errors found during linters test
This commit is contained in:
parent
e376e7bc9f
commit
0e8a0625d5
5 changed files with 13 additions and 13 deletions
|
|
@ -68,7 +68,7 @@ class StyleGuide(object):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def options(self):
|
def options(self):
|
||||||
"""The parsed options.
|
"""Return the parsed options.
|
||||||
|
|
||||||
An instance of :class:`optparse.Values` containing parsed options.
|
An instance of :class:`optparse.Values` containing parsed options.
|
||||||
"""
|
"""
|
||||||
|
|
@ -76,7 +76,7 @@ class StyleGuide(object):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def paths(self):
|
def paths(self):
|
||||||
"""The extra arguments passed as paths."""
|
"""Return the extra arguments passed as paths."""
|
||||||
return self._application.paths
|
return self._application.paths
|
||||||
|
|
||||||
def check_files(self, paths=None):
|
def check_files(self, paths=None):
|
||||||
|
|
@ -178,7 +178,7 @@ class Report(object):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def total_errors(self):
|
def total_errors(self):
|
||||||
"""The total number of errors found by Flake8."""
|
"""Return the total number of errors found by Flake8."""
|
||||||
return self._application.result_count
|
return self._application.result_count
|
||||||
|
|
||||||
def get_statistics(self, violation):
|
def get_statistics(self, violation):
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ from flake8.main import application
|
||||||
|
|
||||||
def main(argv=None):
|
def main(argv=None):
|
||||||
# type: (Union[NoneType, List[str]]) -> NoneType
|
# type: (Union[NoneType, List[str]]) -> NoneType
|
||||||
"""Main entry-point for the flake8 command-line tool.
|
"""Create the main entry-point for the flake8 command-line tool.
|
||||||
|
|
||||||
This handles the creation of an instance of :class:`Application`, runs it,
|
This handles the creation of an instance of :class:`Application`, runs it,
|
||||||
and then exits the application.
|
and then exits the application.
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ class Option(object):
|
||||||
self._opt = None
|
self._opt = None
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
"""Simple representation of an Option class."""
|
"""Return simple representation of an Option class."""
|
||||||
return (
|
return (
|
||||||
'Option({0}, {1}, action={action}, default={default}, '
|
'Option({0}, {1}, action={action}, default={default}, '
|
||||||
'dest={dest}, type={type}, callback={callback}, help={help},'
|
'dest={dest}, type={type}, callback={callback}, help={help},'
|
||||||
|
|
@ -268,7 +268,7 @@ class OptionManager(object):
|
||||||
setattr(options, option.dest, option.normalize(old_value))
|
setattr(options, option.dest, option.normalize(old_value))
|
||||||
|
|
||||||
def parse_args(self, args=None, values=None):
|
def parse_args(self, args=None, values=None):
|
||||||
"""Simple proxy to calling the OptionParser's parse_args method."""
|
"""Implement simple proxy to calling the OptionParser's parse_args method."""
|
||||||
self.generate_epilog()
|
self.generate_epilog()
|
||||||
self.update_version_string()
|
self.update_version_string()
|
||||||
options, xargs = self.parser.parse_args(args, values)
|
options, xargs = self.parser.parse_args(args, values)
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class Plugin(object):
|
||||||
"""Wrap an EntryPoint from setuptools and other logic."""
|
"""Wrap an EntryPoint from setuptools and other logic."""
|
||||||
|
|
||||||
def __init__(self, name, entry_point):
|
def __init__(self, name, entry_point):
|
||||||
""""Initialize our Plugin.
|
"""Initialize our Plugin.
|
||||||
|
|
||||||
:param str name:
|
:param str name:
|
||||||
Name of the entry-point as it was registered with setuptools.
|
Name of the entry-point as it was registered with setuptools.
|
||||||
|
|
@ -97,7 +97,7 @@ class Plugin(object):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def plugin(self):
|
def plugin(self):
|
||||||
"""The loaded (and cached) plugin associated with the entry-point.
|
"""Load (and cache) plugin associated with the entry-point.
|
||||||
|
|
||||||
This property implicitly loads the plugin and then caches it.
|
This property implicitly loads the plugin and then caches it.
|
||||||
"""
|
"""
|
||||||
|
|
@ -373,7 +373,7 @@ class PluginTypeManager(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _generate_call_function(method_name, optmanager, *args, **kwargs):
|
def _generate_call_function(method_name, optmanager, *args, **kwargs):
|
||||||
def generated_function(plugin):
|
def generated_function(plugin):
|
||||||
"""Function that attempts to call a specific method on a plugin."""
|
"""Attempt to call a specific method on a plugin."""
|
||||||
method = getattr(plugin, method_name, None)
|
method = getattr(plugin, method_name, None)
|
||||||
if (method is not None and
|
if (method is not None and
|
||||||
isinstance(method, collections.Callable)):
|
isinstance(method, collections.Callable)):
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class PluginClass(object):
|
||||||
version = '1.0.0'
|
version = '1.0.0'
|
||||||
|
|
||||||
def __init__(self, tree):
|
def __init__(self, tree):
|
||||||
"""Dummy constructor to provide mandatory parameter."""
|
"""Provide mandatory parameter using dummy constructor."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
@ -25,7 +25,7 @@ class PluginClass(object):
|
||||||
|
|
||||||
|
|
||||||
def plugin_func(func):
|
def plugin_func(func):
|
||||||
"""Decorator for file plugins which are implemented as functions."""
|
"""Implement decorator for file plugins as functions."""
|
||||||
func.name = 'test'
|
func.name = 'test'
|
||||||
func.version = '1.0.0'
|
func.version = '1.0.0'
|
||||||
return func
|
return func
|
||||||
|
|
@ -33,13 +33,13 @@ def plugin_func(func):
|
||||||
|
|
||||||
@plugin_func
|
@plugin_func
|
||||||
def plugin_func_gen(tree):
|
def plugin_func_gen(tree):
|
||||||
"""Simple file plugin function yielding the expected report."""
|
"""Yield the expected report with simple file plugin funciton."""
|
||||||
yield EXPECTED_REPORT + (type(plugin_func_gen), )
|
yield EXPECTED_REPORT + (type(plugin_func_gen), )
|
||||||
|
|
||||||
|
|
||||||
@plugin_func
|
@plugin_func
|
||||||
def plugin_func_list(tree):
|
def plugin_func_list(tree):
|
||||||
"""Simple file plugin function returning a list of reports."""
|
"""Return a list of reports with simple file plugin function."""
|
||||||
return [EXPECTED_REPORT + (type(plugin_func_list), )]
|
return [EXPECTED_REPORT + (type(plugin_func_list), )]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue