Skip to content

Commit

Permalink
Prepare relative paths.
Browse files Browse the repository at this point in the history
Fixes #244.

Signed-off-by: Carlos Coêlho <[email protected]>
  • Loading branch information
chocoelho committed May 31, 2018
1 parent d4753df commit 8165dd9
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions prospector/postfilter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# -*- coding: utf-8 -*-
import os

from prospector.suppression import get_suppressions


Expand Down Expand Up @@ -25,22 +28,24 @@ def filter_messages(relative_filepaths, root, messages):
filtered = []
for message in messages:
# first get rid of the pylint informational messages
relative_message_path = os.path.relpath(message.location.path)

if message.source == 'pylint' and message.code in ('suppressed-message',):
continue

# some files are skipped entirely by messages
if message.location.path in paths_to_ignore:
if relative_message_path in paths_to_ignore:
continue

# some lines are skipped entirely by messages
if message.location.path in lines_to_ignore:
if message.location.line in lines_to_ignore[message.location.path]:
if relative_message_path in lines_to_ignore:
if message.location.line in lines_to_ignore[relative_message_path]:
continue

# and some lines have only certain messages explicitly ignored
if message.location.path in messages_to_ignore:
if message.location.line in messages_to_ignore[message.location.path]:
if message.code in messages_to_ignore[message.location.path][message.location.line]:
if relative_message_path in messages_to_ignore:
if message.location.line in messages_to_ignore[relative_message_path]:
if message.code in messages_to_ignore[relative_message_path][message.location.line]:
continue

# otherwise this message was not filtered
Expand Down

0 comments on commit 8165dd9

Please sign in to comment.