Skip to content

Commit

Permalink
Merge pull request #87 from carlio/reduce-warnings
Browse files Browse the repository at this point in the history
Reduce warnings
  • Loading branch information
carlio committed Jan 4, 2015
2 parents 768d391 + e0877c4 commit 92994ec
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .prospector.yml
Expand Up @@ -28,9 +28,14 @@ pyroma:
run: true

pylint:
disable:
- W0141
- R0903
options:
max-line-length: 120

pep8:
disable:
- E126
options:
max-line-length: 120
2 changes: 1 addition & 1 deletion prospector/autodetect.py
Expand Up @@ -94,7 +94,7 @@ def find_from_path(path):
try:
encoding = determine_pyfile_encoding(item_path, default='utf8')
with codecs.open(item_path, encoding=encoding) as fip:
names |= find_from_imports(fip.read())
names |= find_from_imports(fip.read())
except UnicodeDecodeError as err:
# this warning is issued: (1) in determine_pyfile_encoding for
# badly authored files (contains non-utf8 in a comment line), or
Expand Down
8 changes: 8 additions & 0 deletions prospector/blender_combinations.yaml
Expand Up @@ -180,3 +180,11 @@ combinations:
- # pep8-naming incorrectly suggests that the first argument of a metaclass __new__ method should be 'cls'
- pylint: C0204
- pep8: N804

- # class names should be camelcase
- pep8: N801
- pylint: C0103

- # too complex
- mccabe: MC0001
- pylint: R0912
9 changes: 8 additions & 1 deletion prospector/config/__init__.py
Expand Up @@ -9,6 +9,12 @@


class ProspectorConfig(object):
# There are several methods on this class which could technically
# be functions (they don't use the 'self' argument) but that would
# make this module/class a bit ugly.
# Also the 'too many instance attributes' warning is ignored, as this
# is a config object and its sole purpose is to hold many properties!
# pylint:disable=no-self-use,too-many-instance-attributes

def __init__(self):
self.config, self.arguments = self._configure_prospector()
Expand All @@ -25,6 +31,7 @@ def __init__(self):
self.libraries = self._find_used_libraries(self.config)
self.tools_to_run = self._determine_tool_runners(self.config, self.profile)
self.ignores = self._determine_ignores(self.config, self.profile, self.libraries)
self.configured_by = {}

def get_tools(self, found_files):
self.configured_by = {}
Expand Down Expand Up @@ -92,7 +99,7 @@ def _get_profile(self, path, config):
)

for possible_profile in poss_profs:
prospector_yaml = os.path.join(path, *possible_profile)
prospector_yaml = os.path.join(path, *possible_profile) # pylint:disable=star-args
if os.path.exists(prospector_yaml) and os.path.isfile(prospector_yaml):
profile_provided = True
profile_names.append(prospector_yaml)
Expand Down
4 changes: 4 additions & 0 deletions prospector/finder.py
Expand Up @@ -8,6 +8,10 @@ class SingleFiles(object):
then we'll use this object instead of the FoundFiles to
give all the functionality needed to check a single file.
"""
# The 'even if ignored' parameters are kept to show this is meant
# to be API compatible with FoundFiles, but pylint will warn, so
# let's disable
# pylint:disable=unused-argument
def __init__(self, files, rootpath):
self.files = files
self.rootpath = rootpath
Expand Down
3 changes: 2 additions & 1 deletion prospector/formatters/pylint.py
Expand Up @@ -24,7 +24,8 @@ def render(self, summary=True, messages=True):
output.append(header)

# ={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
# prospector/configuration.py:65: [C0111(missing-docstring), build_default_sources] Missing function docstring
# prospector/configuration.py:65: [C0111(missing-docstring), build_default_sources] \
# Missing function docstring

template = '%(path)s:%(line)s: [%(code)s(%(source)s), %(function)s] %(message)s'
output.append(template % {
Expand Down
1 change: 1 addition & 0 deletions prospector/tools/frosted/__init__.py
Expand Up @@ -88,6 +88,7 @@ def run(self, found_files):
try:
check_path(filepath, reporter)
except UnicodeDecodeError:
# pylint:disable=pointless-except
pass

return reporter.get_messages()
4 changes: 2 additions & 2 deletions prospector/tools/pyflakes/__init__.py
Expand Up @@ -63,15 +63,15 @@ def record_message(
)
self._messages.append(message)

def unexpectedError(self, filename, msg):
def unexpectedError(self, filename, msg): # noqa
self.record_message(
filename=filename,
code='FL9997',
message=msg,
)

# pylint: disable=R0913
def syntaxError(self, filename, msg, lineno, offset, text):
def syntaxError(self, filename, msg, lineno, offset, text): # noqa
self.record_message(
filename=filename,
line=lineno,
Expand Down
6 changes: 5 additions & 1 deletion prospector/tools/pylint/__init__.py
Expand Up @@ -28,7 +28,7 @@ def flush(self):
pass


class stdout_wrapper(object):
class stdout_wrapper(object): # noqa

def __init__(self, hide_stdout):
self.hide_stdout = hide_stdout
Expand All @@ -47,6 +47,10 @@ def __exit__(self, exc_type, exc_val, exc_tb):


class PylintTool(ToolBase):
# There are several methods on this class which could technically
# be functions (they don't use the 'self' argument) but that would
# make this module/class a bit ugly.
# pylint:disable=no-self-use

def __init__(self):
self._args = self._extra_sys_path = None
Expand Down

0 comments on commit 92994ec

Please sign in to comment.