Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

for specific file pylint works but linter-pylint doesn't -- Column start greater than line length #235

Open
mbdevpl opened this issue Oct 28, 2017 · 14 comments
Labels

Comments

@mbdevpl
Copy link

mbdevpl commented Oct 28, 2017

The issue I'm having recently is that for a file: https://github.com/mbdevpl/version-query/blob/master/version_query/version.py linter-pylint is always failing, since I installed it not so long ago.

For latest as of now revision https://github.com/mbdevpl/version-query/blob/8289045e7b818aa36a447202cdb3b46d6207c9a1/version_query/version.py the error message reads:

[Linter] Error running Pylint Error: Column start (31) greater than line length (14) for line 37
    at Object.generateRange (/Users/mateusz/.atom/packages/linter-pylint/node_modules/atom-linter/lib/index.js:181)
    at /Users/mateusz/.atom/packages/linter-pylint/node_modules/lazy-req/index.js:22
    at Object.<anonymous> (main.js [sm]:148)
    at Generator.next (<anonymous>)
    at step (/Users/mateusz/.atom/packages/linter-pylint/lib/main.js:7)
    at process._tickCallback (internal/process/next_tick.js:103)
(anonymous) @ linter-registry.js [sm]:137
_tickCallback @ internal/process/next_tick.js:103

However pylint itself works (e.g. on my MacBook):

mbMac:version-query mateusz$ pylint --version
No config file found, using default configuration
pylint 1.7.4, 
astroid 1.5.3
Python 3.6.3 (default, Oct 18 2017, 23:31:34) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.38)]
mbMac:version-query mateusz$ pylint --msg-template='{line},{column},{category},{msg_id}: {msg}' --reports=n version_query/version.py
No config file found, using default configuration
************* Module version_query.version
260,0,convention,C0326: No space allowed around keyword argument assignment
                t.Tuple[t.Optional[str], t.Optional[str], t.Optional[int]]] = None,
                                                                            ^
38,0,refactor,R0902: Too many instance attributes (8/7)
193,4,convention,C0111: Missing method docstring
197,4,convention,C0111: Missing method docstring
205,18,warning,W0212: Access to a protected member _version of a client class
254,4,convention,C0111: Missing method docstring
277,15,convention,C1801: Do not use `len(SEQUENCE)` as condition value
293,23,convention,C1801: Do not use `len(SEQUENCE)` as condition value
274,8,refactor,R1702: Too many nested blocks (6/5)
257,4,refactor,R0912: Too many branches (22/12)
257,4,refactor,R0915: Too many statements (52/50)
328,4,convention,C0111: Missing method docstring
368,4,convention,C0111: Missing method docstring
385,11,convention,C1801: Do not use `len(SEQUENCE)` as condition value
375,4,refactor,R0912: Too many branches (14/12)
427,4,convention,C0111: Missing method docstring
431,4,convention,C0111: Missing method docstring
462,4,convention,C0111: Missing method docstring
465,4,refactor,R0912: Too many branches (21/12)
540,4,convention,C0111: Missing method docstring
546,4,convention,C0111: Missing method docstring
551,4,convention,C0111: Missing method docstring
555,4,convention,C0111: Missing method docstring
560,4,convention,C0111: Missing method docstring
574,4,convention,C0111: Missing method docstring
580,4,convention,C0111: Missing method docstring
584,4,convention,C0111: Missing method docstring
587,4,convention,C0111: Missing method docstring
590,4,convention,C0111: Missing method docstring
38,31,refactor,R0904: Too many public methods (24/20)

------------------------------------------------------------------
Your code has been rated at 9.24/10 (previous run: 9.24/10, +0.00)

... and further logs showing that pylint works for that file can be found on TravisCI, e.g Python 3.6 on Linux: https://travis-ci.org/mbdevpl/version-query/jobs/294048400#L1154

Similar issues in the past were #2 and #165 - it seems this might not be related to any of them though.

Error always happens for me with linter-pylint 2.1.0 (latest, no updates available) on Mac and Linux.

And BTW, linter-pylint works great for all my other files, I think it's a really useful and good tool overall. What can I do to help fix this one annoying error?

@djsly
Copy link

djsly commented Dec 21, 2017

similar error, affecting all my files

[Linter] Error running Pylint Error: Using config file /Users/sylvain_boily/github/k8s-infrastructure-installer/installer/.pylintrc
    at Object.<anonymous> (/Users/sylvain_boily/.atom/packages/linter-pylint/lib/main.js:161:17)
    at Generator.next (<anonymous>)
    at step (/Users/sylvain_boily/.atom/packages/linter-pylint/lib/main.js:7:273)
    at process._tickCallback (internal/process/next_tick.js:103:7)

@ddaanet
Copy link
Contributor

ddaanet commented Jan 9, 2018

@djsly Yours is a different problem, a duplicate of #236, which is fixed.

@ddaanet
Copy link
Contributor

ddaanet commented Jan 9, 2018

@mbdevpl That looks like a pylint issue. Can you reproduce it using the latest pylint (1.8.1) ?

@djsly
Copy link

djsly commented Jan 9, 2018

@ddaanet thanks, I did apply the PR manually and it fixed my issue.

@mbdevpl
Copy link
Author

mbdevpl commented Jan 10, 2018

Well, with pylint 1.8.1 and my configuration I initially get a different error - as reported by @djsly . After I temporarily rename my .pylintrc, the issue reported earlier comes back.

E.g. on latest revision mbdevpl/version-query@7ebfe39, with the same file version.py:

linter-registry.js [sm]:137 [Linter] Error running Pylint Error: Column start (31) greater than line length (14) for line 34
    at Object.generateRange (/home/mateusz/.atom/packages/linter-pylint/node_modules/atom-linter/lib/index.js:181)
    at /home/mateusz/.atom/packages/linter-pylint/node_modules/lazy-req/index.js:22
    at Object.<anonymous> (main.js [sm]:148)
    at Generator.next (<anonymous>)
    at step (/home/mateusz/.atom/packages/linter-pylint/lib/main.js:7)
$ pylint --reports=n version_query/version.py
No config file found, using default configuration
************* Module version_query.version
C:257, 0: No space allowed around keyword argument assignment
                t.Tuple[t.Optional[str], t.Optional[str], t.Optional[int]]] = None,
                                                                            ^ (bad-whitespace)
R: 35, 0: Too many instance attributes (8/7) (too-many-instance-attributes)
C:190, 4: Missing method docstring (missing-docstring)
C:194, 4: Missing method docstring (missing-docstring)
W:202,18: Access to a protected member _version of a client class (protected-access)
C:251, 4: Missing method docstring (missing-docstring)
W:254, 4: Keyword argument before variable positional arguments list in the definition of __init__ function (keyword-arg-before-vararg)
C:274,15: Do not use `len(SEQUENCE)` to determine if a sequence is empty (len-as-condition)
C:290,23: Do not use `len(SEQUENCE)` to determine if a sequence is empty (len-as-condition)
R:271, 8: Too many nested blocks (6/5) (too-many-nested-blocks)
R:254, 4: Too many branches (22/12) (too-many-branches)
R:254, 4: Too many statements (52/50) (too-many-statements)
C:325, 4: Missing method docstring (missing-docstring)
C:365, 4: Missing method docstring (missing-docstring)
C:382,11: Do not use `len(SEQUENCE)` to determine if a sequence is empty (len-as-condition)
R:372, 4: Too many branches (14/12) (too-many-branches)
C:424, 4: Missing method docstring (missing-docstring)
C:428, 4: Missing method docstring (missing-docstring)
C:459, 4: Missing method docstring (missing-docstring)
R:462, 4: Too many branches (26/12) (too-many-branches)
R:462, 4: Too many statements (52/50) (too-many-statements)
C:562, 4: Missing method docstring (missing-docstring)
C:568, 4: Missing method docstring (missing-docstring)
C:573, 4: Missing method docstring (missing-docstring)
C:577, 4: Missing method docstring (missing-docstring)
C:582, 4: Missing method docstring (missing-docstring)
C:596, 4: Missing method docstring (missing-docstring)
C:602, 4: Missing method docstring (missing-docstring)
C:606, 4: Missing method docstring (missing-docstring)
C:609, 4: Missing method docstring (missing-docstring)
C:612, 4: Missing method docstring (missing-docstring)
R: 35,31: Too many public methods (25/20) (too-many-public-methods)

------------------------------------------------------------------
Your code has been rated at 9.22/10 (previous run: 9.22/10, +0.00)
$ pylint --version
No config file found, using default configuration
pylint 1.8.1, 
astroid 1.6.0
Python 3.6.1 (default, May 26 2017, 19:35:58) 
[GCC 5.4.0 20160609]

@mbdevpl
Copy link
Author

mbdevpl commented Jan 10, 2018

Sorry, I didn't mention you above - @ddaanet .

That looks like a pylint issue.

For me this being a pylint issue is highly unlikely, because as I wrote pylint by itself runs ok.

@ddaanet
Copy link
Contributor

ddaanet commented Jan 11, 2018

@mbdevpl as mentioned by @djsly, the error he reported has a fix merged

Regarding your specific problem: this is intriguing.

Googling for your error message quickly gives this:
AtomLinter/linter-stylelint#176 (comment)

So my guess is the problem comes from
R: 35,31: Too many public methods (25/20) (too-many-public-methods)
But Atom has only 14 chars on line 35.

Still looks like a pylint bug to me.

@Arcanemagus
Copy link
Member

@mbdevpl You can either determine where pylint is reporting the wrong line and report it to them yourself, or share a file that is exhibiting this and we can look into this and file it for you.

@mbdevpl
Copy link
Author

mbdevpl commented Jan 13, 2018

@Arcanemagus @ddaanet Indeed, I was in the wrong, pylint reports error location outside of existing code! I've created an issue pylint-dev/pylint#1839, hopefully it will be resolved. The examples for reproduction is posted there and already here too.

Strictly speaking pylint is reporting wrong column - line number is correct. When I modify code just a little bit (in an unrelated location) the reported column changes to the correct value. A very strange bug... If you're interested, please see details there.

In the meantime, since it happens from time to time that linting tools report invalid locations, wouldn't it be a good idea to either:

  • use the closest valid location instead, or to
  • discard that linting report entry

and issue some warning instead of just crashing?

@ddaanet
Copy link
Contributor

ddaanet commented Jan 15, 2018

I think the idea here is to inconvenience users so the linters get fixed, so in the end everyone get better linters.

I mean, now you have reported an issue to pylint. Which will probably be fixed soon. If linter-pylint were more lenient, would you have reported the issue? Probably not.

@Arcanemagus
Copy link
Member

linter-jshint has probably the best current handling of this issue... mainly because if you try to lint any file with tabs it breaks pretty much every rule. You're welcome to copy the implementation from there over to here if you want better handling here 😉.

Note that that:

  • Captures the errors and turns them into linter messages
  • Searches the current issues on that repo for one of the same title
  • Either links the user to an existing issue, or pre-fills a template for them to submit a new one

It's missing:

  • The ability to attempt to match the error to near where JSHint reported the error
  • Alternatively, to dedupe the (displayed) message, so the user only sees a violation for a rule once.

@wesinator
Copy link

I get a similar error sometimes when mirroring a file with "Split Right"

Linter] Error running Pylint Error: Column start (22) greater than line length (0) for line 313
    at Object.generateRange (/Users/w/.atom/packages/linter-pylint/node_modules/atom-linter/lib/index.js:181:11)
    at /Users/w/.atom/packages/linter-pylint/node_modules/lazy-req/index.js:22:26
    at Object.<anonymous> (/Users/w/.atom/packages/linter-pylint/lib/main.js:171:28)
    at Generator.next (<anonymous>)
    at step (/Users/w/.atom/packages/linter-pylint/lib/main.js:7:273)
    at <anonymous>

atom 1.34.0
linter-pylint 2.1.1
linter 2.3.0

@amroalfadil
Copy link

hi Gets

i got similar issue any advice please, keep scratching my head

/Users/amroalfadil/.atom/packages/linter/lib/linter-registry.js:154 [Linter] Error running Pylint Error: Column start (72) greater than line length (18) for line 1
at Object.generateRange (/Users/amroalfadil/.atom/packages/linter-pylint/node_modules/atom-linter/lib/index.js:181)
at /Users/amroalfadil/.atom/packages/linter-pylint/node_modules/lazy-req/index.js:22
at Object. (/Users/amroalfadil/.atom/packages/linter-pylint/lib/main.js:171)
at Generator.next ()
at step (/Users/amroalfadil/.atom/packages/linter-pylint/lib/main.js:7)
at process._tickCallback (internal/process/next_tick.js:68)


/Users/a/.atom/packages/linter/lib/linter-registry.js:154 [Linter] Error running Pylint Error: Column start (8) greater than line length (7) for line 0
at Object.generateRange (/Users/a/.atom/packages/linter-pylint/node_modules/atom-linter/lib/index.js:181)
at /Users/a/.atom/packages/linter-pylint/node_modules/lazy-req/index.js:22
at Object. (/Users/a/.atom/packages/linter-pylint/lib/main.js:171)
at Generator.next ()
at step (/Users/a/.atom/packages/linter-pylint/lib/main.js:7)
at process._tickCallback (internal/process/next_tick.js:68)

@tfrokt
Copy link

tfrokt commented Sep 29, 2021

Still having the issue. Cannot find a pattern when it happens.

Screen Shot 2021-09-29 at 1 27 34 pm

atom 1.58.0
linter-pylint 2.1.1
pylint 2.10.2
Python 3.9.6

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

No branches or pull requests

7 participants