Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Wrong hanging indentation" - misreported, not clearing #41

Closed
shidarin opened this issue May 4, 2014 · 11 comments
Closed

"Wrong hanging indentation" - misreported, not clearing #41

shidarin opened this issue May 4, 2014 · 11 comments

Comments

@shidarin
Copy link

shidarin commented May 4, 2014

This bug must have started up in the last week, because it wasn't reported on my repo then, and the lines have not changed.

The following code is reported to have the wrong hanging indentation inside of the help text:

parser.add_argument(
    "-i",
    "--input",
    help="specify the filetype to convert from. Use when CDLConvert "
         "cannot determine the filetype automatically. Supported input "
         "formats are: "
         "{inputs}".format(inputs=str(INPUT_FORMATS.keys()))
)

I can't get this error to appear in Prospector, pep8, pylint or flake8. It immediately triggers if I change the indentation to an incorrect spacing.

Landscape Repo Error Page
Github Repo

Thanks for your continued help.

@myint
Copy link

myint commented May 4, 2014

This is from pylint. @shidarin, you probably don't have the latest pylint installed on your machine. This bug seems like it was introduced by this commit.

$ pylint --report=no foo.py
...
C:  5, 0: Wrong hanging indentation.
         "cannot determine the filetype automatically. Supported input "
    |    ^ (bad-continuation)
C:  6, 0: Wrong hanging indentation.
         "formats are: "
    |    ^ (bad-continuation)
C:  7, 0: Wrong hanging indentation.
         "{inputs}".format(inputs=str(INPUT_FORMATS.keys()))
    |    ^ (bad-continuation)
...

I agree with your assessment though. Your formatting is perfectly fine. pylint and landscape should not be complaining about this. Also, it seems strange that landscape identifies this stylistic issue as an "error".

@shidarin
Copy link
Author

shidarin commented May 4, 2014

@myint, you're totally right, I upgraded my pylint from 1.2.0 to 1.2.1 and am now getting the note.

Pylint seems to want:

parser.add_argument(
    "-i",
    "--input",
    help="specify the filetype to convert from. Use when CDLConvert "
    "cannot determine the filetype automatically. Supported input "
    "formats are: "
    "{inputs}".format(inputs=str(INPUT_FORMATS.keys()))
)

I've gone ahead and opened an issue for pylint here

The full 1.2.1 changelog is:

    * Restore the ability to specify the init-hook option via the
      configuration file, which was accidentally broken in 1.2.0.

    * Add a new warning [bad-continuation] for badly indentend continued
      lines.

    * Emit [assignment-from-none] when the function contains bare returns.
      Fixes BitBucket issue #191.

    * Added a new warning for closing over variables that are
      defined in loops. Fixes Bitbucket issue #176.

    * Do not warn about \u escapes in string literals when Unicode literals
      are used for Python 2.*. Fixes BitBucket issue #151.

    * Extend the checking for unbalanced-tuple-unpacking and
      unpacking-non-sequence to instance attribute unpacking as well.

    * Fix explicit checking of python script (1.2 regression, #219)

    * Restore --init-hook, renamed accidentally into --init-hooks in 1.2.0
      (#211)

    * Add 'indexing-exception' warning, which detects that indexing
      an exception occurs in Python 2 (behaviour removed in Python 3).

But since this is a pylint and not a landscape issue, I'll go ahead and close this out.

@shidarin shidarin closed this as completed May 4, 2014
@carlio
Copy link
Member

carlio commented May 5, 2014

Thanks for the report @shidarin . I agree with @myint , this shouldn't be reported by Landscape even if pylint does, and it certainly shouldn't be an error. I'll reopen this issue to at least change it to a 'style' error.

@carlio carlio reopened this May 5, 2014
@carlio
Copy link
Member

carlio commented May 5, 2014

@shidarin Oddly I can't reproduce this locally using pylint 1.2.1

I notice you don't have \ at the end of the lines, perhaps adding it would also remove the issue? i.e.:

parser.add_argument(
    "-i",
    "--input",
    help="specify the filetype to convert from. Use when CDLConvert " \
         "cannot determine the filetype automatically. Supported input " \
         "formats are: " \
         "{inputs}".format(inputs=str(INPUT_FORMATS.keys()))
)

@shidarin
Copy link
Author

shidarin commented May 5, 2014

I know this is silly, since you probably read this earlier in the thread, but pylint was updated 4 days ago, and only the new version flags this.

I'll throw a gist up with different indent errors and passes in the morning.

I didn't try backslash escaping, I was decently sure pylint would accept that- even if pep8 says you shouldn't. Instead I specifically disabled C0330 on all 5 erroring indented lines. Gotta take a stand somewhere.

@myint
Copy link

myint commented May 5, 2014

@carlio, I agree with @shidarin, adding unnecessary backslashes is bad form.

By the way, I think the pep8 tool seems far superior to pylint for stylistic issues.

@shidarin
Copy link
Author

shidarin commented May 5, 2014

Created this gist to have a nice example file.

This triggers the following errors for me in pylint 0.2.1:

C: 28, 0: Wrong hanging indentation.
             "despite it's pleasing looks and lack of superfluous slashes."
        |    ^ (bad-continuation)
C: 34, 0: Wrong hanging indentation.
            "like this."
        |   ^ (bad-continuation)
C:  1, 0: Missing module docstring (missing-docstring)
C:  4, 0: Missing function docstring (missing-docstring

@myint
Copy link

myint commented Jul 25, 2014

This has been fixed in pylint's default branch.

https://bitbucket.org/logilab/pylint/commits/e3ecc895733cdf6ea3c3822abcb58cf08feb7184

@carlio
Copy link
Member

carlio commented Jul 26, 2014

@myint Ah great! I'll update Landscape once that hits PyPI :)

@myint
Copy link

myint commented Jul 29, 2014

This particular issue should be fixed in pylint 1.3 now. Though, I found other related instances, which I've reported.

@carlio
Copy link
Member

carlio commented Nov 11, 2014

Landscape has been using pylint 1.3 for a while now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants