summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/flake8/formatting/base.py4
-rw-r--r--src/flake8/style_guide.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/flake8/formatting/base.py b/src/flake8/formatting/base.py
index 2ac0ed8..336bf50 100644
--- a/src/flake8/formatting/base.py
+++ b/src/flake8/formatting/base.py
@@ -139,7 +139,9 @@ class BaseFormatter(object):
if not self.options.show_source or error.physical_line is None:
return ''
- pointer = (' ' * error.column_number) + '^'
+ # Because column numbers are 1-indexed, we need to remove one to get
+ # the proper number of space characters.
+ pointer = (' ' * (error.column_number - 1)) + '^'
# Physical lines have a newline at the end, no need to add an extra
# one
return error.physical_line + pointer
diff --git a/src/flake8/style_guide.py b/src/flake8/style_guide.py
index 950d722..d9a6285 100644
--- a/src/flake8/style_guide.py
+++ b/src/flake8/style_guide.py
@@ -258,7 +258,9 @@ class StyleGuide(object):
:rtype:
int
"""
- error = Error(code, filename, line_number, column_number, text,
+ # NOTE(sigmavirus24): Apparently we're provided with 0-indexed column
+ # numbers so we have to offset that here.
+ error = Error(code, filename, line_number, column_number + 1, text,
physical_line)
error_is_selected = (self.should_report_error(error.code) is
Decision.Selected)