Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Allow users to skip lines #136

Merged
merged 4 commits into from

2 participants

@sigmavirus24

This will disable pep8 for that line. It's simplistic but it works and it is
an elegant (and commonplace solution) to #27.

Tools like flake8 use # NOQA to skip PyFlakes errors when necessary,
coverage uses # (No coverage), so I figured I'd leave this more generic
than was suggested in #27. Also this makes the patch a lot simpler since
we don't have to reparse the comment to ignore only a specific type of error
or warning.

sigmavirus24 added some commits
@sigmavirus24 sigmavirus24 Allow users to skip a line.
This will disable pep8 for that line. It's simplistic but it works and it is
an elegant (and commonplace solution) to #27.
4695145
@sigmavirus24 sigmavirus24 Refactor a bit. 0ab87b4
sigmavirus24 added some commits
@sigmavirus24 sigmavirus24 The original modification was insufficient.
You might get E90* errors since there is no line to finish the object or
function/method call before the EOF. This fixes that properly. My apologies
for the error.
8b2ea84
@sigmavirus24 sigmavirus24 Some people reported E501 continued to appear
Even though I couldn't reproduce it in a clean virtualenv, I have added this
to be entirely certain that their issues do not persist.
855af3e
@florentx florentx merged commit 58178a8 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 8, 2012
  1. @sigmavirus24

    Allow users to skip a line.

    sigmavirus24 authored
    This will disable pep8 for that line. It's simplistic but it works and it is
    an elegant (and commonplace solution) to #27.
  2. @sigmavirus24

    Refactor a bit.

    sigmavirus24 authored
Commits on Nov 14, 2012
  1. @sigmavirus24

    The original modification was insufficient.

    sigmavirus24 authored
    You might get E90* errors since there is no line to finish the object or
    function/method call before the EOF. This fixes that properly. My apologies
    for the error.
Commits on Dec 1, 2012
  1. @sigmavirus24

    Some people reported E501 continued to appear

    sigmavirus24 authored
    Even though I couldn't reproduce it in a clean virtualenv, I have added this
    to be entirely certain that their issues do not persist.
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +5 −0 pep8.py
View
5 pep8.py
@@ -264,6 +264,8 @@ def maximum_line_length(physical_line, max_line_length):
line = physical_line.rstrip()
length = len(line)
if length > max_line_length:
+ if line.strip().lower().endswith('# nopep8'):
+ return
if hasattr(line, 'decode'): # Python 2
# The line could contain multi-byte characters
try:
@@ -477,6 +479,9 @@ def continuation_line_indentation(logical_line, tokens, indent_level, verbose):
print(">>> " + tokens[0][4].rstrip())
for token_type, text, start, end, line in tokens:
+ if line.strip().lower().endswith('# nopep8'):
+ continue
+
newline = row < start[0] - first_row
if newline:
row = start[0] - first_row
Something went wrong with that request. Please try again.