Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Line Lengths in Pull Requests #738

Open
elsmorian opened this issue Aug 9, 2016 · 8 comments
Open

Line Lengths in Pull Requests #738

elsmorian opened this issue Aug 9, 2016 · 8 comments

Comments

@elsmorian
Copy link

I’m a Python dev, and line lengths can be pretty strict ( https://www.python.org/dev/peps/pep-0008/#maximum-line-length ) - it would be awesome to have a (toggle-able) line marker in Pull Requests to see lines that go over these guides - Maybe MVP it could just be a Col: ## label at the bottom of the screen showing the column the cursor is currently highlighted over?

@cirosantilli cirosantilli changed the title Feature Request: Line Lengths in Pull Requests Line Lengths in Pull Requests Aug 11, 2016
@Mottie
Copy link

Mottie commented Aug 24, 2016

Are you referring to the PR commit changes message? If so, we have a Stylus theme that adds a customizable background color showing text limits.

@elsmorian
Copy link
Author

elsmorian commented Aug 25, 2016

@Mottie Aha! that isn't quite what I was after but a great solution!

I was wanting something similar, but for code line lengths in Pull Requests - I have in fact adapted your idea though into the following stylish css style which does roughly what I want!

span.blob-code-inner {
   background: linear-gradient(to right, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 80ch, rgba(255, 157, 53, 0.5) 80ch) !important;
}
textarea[name='comment[body]'] { 
       background: linear-gradient(to right, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 80ch, rgba(255, 157, 53, 0.5) 80ch) !important;
}

@Mottie
Copy link

Mottie commented Aug 25, 2016

Oh, you're applying the limit to all textareas and code, or is there a specific PR page it should be applied to?

@elsmorian
Copy link
Author

Well, what I really wanted was a quick way to see in Pull Requests when a line is over 80chars, and also when suggesting code in the line comments on PRs. We use PRs as Code Review and its just handy to check the code your are checking and what you are suggesting etc isn't going to breach the 80chars or whatever.

Ideally I guess this would be able to be set per file type, so you could say only files with .py extension should have the 80 limit guide, but the above stylish snippet works well enough for now!

@Mottie
Copy link

Mottie commented Aug 26, 2016

By the way, I noticed you're using 80ch. If you set the css to use 81ch, the red block start after 80 characters. With 80ch you're actually setting the boundary at 80 so only 79 characters can be seen to the left.

Copy the text below into a textarea and you'll see what I mean.

         1         2         3         4         5         6         7         8
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345

@elsmorian
Copy link
Author

@Mottie Good spot! The Python Style Guidelines actually specify 79 as the max line length so 80ch works ok. I had no idea you could specify widths in characters though - you learn something new everyday!

@Mottie
Copy link

Mottie commented Aug 30, 2016

I ended up making a userscript to add guidelines.

https://github.com/Mottie/GitHub-userscripts/wiki/GitHub-code-guides

It adds a narrow line instead of a big block and allows adding more than one.

I also included diff pages, but it does some weird stepping due to <pre> and/or <code> padding changes, and won't be accurate in those cases.

2016-08-30 07_24_53-core_ expose noconflict in amd mode jquery_jquery 52e2447

@jtojnar
Copy link

jtojnar commented Sep 18, 2019

Is not this better handled by running pep8 or pylint on CI, rather than flagging this manually?

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

No branches or pull requests

4 participants