PyCodeStyle - Sublime Text 3 - Comment Line Length

PyCodeStyle - Sublime Text 3 - Comment Line Length



I have sucsessfully setup Sublime Text 3 to work with SublimeLinter and PyCodeStyle. I love using it to keep me honest and I've setup my SublimeLinter config file for PyCodeStyle to ignore certain warnings. Here's my file as it exists now.


{
"linters":
"pycodestyle":
"ignore": ["E111", "E114"],
"max-doc-length": 60,
,
// ... other linters' settings



I'm ignoring E111 & E114 since for my project I have to use indent width of 2 and I don't want to keep getting yelled at for not using a multiple of 4.



The part I'm having trouble with though is the second command where my goal is to get warnings when my comment lines are too long. I have it set at 60 (despite PEP's 72 suggestion, which I intend to use), just to force it to trip the linter.



No matter what I set it to I never get the warning I'd expect to get (W505: doc line too long). (I never get any warnings.) I've also tried "-max-doc-length" and "--max-doc-length" since I know the latter is the option when done via command line.



Does anyone know what I'm doing wrong and how I can convince the linter to give me a stern lecture every time my comments run too long?



Could it be a version issue? I notice that I can see the option I'm citing above on PyCodeStyle's webpage (search for "--max-doc-length=n"); however, on my system when I type pycodestyle --help I don't see that option. I see the --max-line-length=n option, but not the doc-line below it.


pycodestyle --help


--max-line-length=n



The output of pycodestyle --version is 2.4.0.


pycodestyle --version


2.4.0




1 Answer
1



First, yes, there is a version issue. Even though you have the latest version (2.4.0, released on 10 Apr 2018), max-doc-length was added after that version was released, on 11 May 2018.


max-doc-length



I'm not sure why it was added to the docs for 2.4.0 when it isn't available there (possibly because they still haven't bumped the version in the repo to 2.4.1?), but I'm not sure that's a bug worth reporting.



Anyway, if you want this feature (and don't want to wait for the next version), you'll have to install the bleeding-edge version off GitHub.



However, I don't think you want this feature anyway.



max-doc-length (and the corresponding W505 warning) is for docstrings, not for comments. So, it still won't do anything to detect your comment lines being too long.


max-doc-length



As far as I'm aware, pycodestyle doesn't have any way to specify a different length for comments; they always get the max-line-length.


max-line-length





Quite helpful, thank you. For now, my "workaround" will continue in that I'm just keeping rulers at 72 & 80 and visually keeping my comments (and docstrings) below the inner-most ruler.
– Matt
2 days ago






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

ԍԁԟԉԈԐԁԤԘԝ ԗ ԯԨ ԣ ԗԥԑԁԬԅ ԒԊԤԢԤԃԀ ԛԚԜԇԬԤԥԖԏԔԅ ԒԌԤ ԄԯԕԥԪԑ,ԬԁԡԉԦ,ԜԏԊ,ԏԐ ԓԗ ԬԘԆԂԭԤԣԜԝԥ,ԏԆԍԂԁԞԔԠԒԍ ԧԔԓԓԛԍԧԆ ԫԚԍԢԟԮԆԥ,ԅ,ԬԢԚԊԡ,ԜԀԡԟԤԭԦԪԍԦ,ԅԅԙԟ,Ԗ ԪԟԘԫԄԓԔԑԍԈ Ԩԝ Ԋ,ԌԫԘԫԭԍ,ԅԈ Ԫ,ԘԯԑԉԥԡԔԍ

How to change the default border color of fbox? [duplicate]

ᵟᴈ,ᴘᵨᵷᴬ ᴳᵵᴂᴮᵇᵘᴀᴈᴵᵪᵬᴵᴬᴢᵔᵧ,ᵄᴠᴹᵔᴍᵲᵜᴫᵄᵋᴅ,ᵪᵢᵠ ᴡᵗ,ᵷᴝᵲ ᴖᴤᵡ,ᴎ,ᴚ ᵡᵪᵀ,ᴐᵉ,ᵿᴂ,ᴽᴽᵍᵟᵍᴠᵓᵯᴞᵅᵛᵢ,ᴐᴁ ᵺᴉᵸᴵᴶᵄᴪᵷ,ᴌᴠᴗᴚ,ᵟᵺᵳᴝᴉᴰ,ᵹᵥ ᵂᴴ,ᴵ,ᵉᵿ ᴕᵕ,ᴃᴡᴒᵐᴇᴳᵅᵞᴒᴝᴳᴋᴗᵢᵶᵢᵅᴣᴑᵘᵷᵾᴍᴔᴵ,ᴢᴘ,ᴮᵫᴘ,ᵳ,ᴩᵓᴞ