-
Notifications
You must be signed in to change notification settings - Fork 130
Line Lengths in Pull Requests #738
Comments
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. |
@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;
} |
Oh, you're applying the limit to all textareas and code, or is there a specific PR page it should be applied to? |
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! |
By the way, I noticed you're using Copy the text below into a textarea and you'll see what I mean.
|
@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! |
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 |
Is not this better handled by running pep8 or pylint on CI, rather than flagging this manually? |
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?
The text was updated successfully, but these errors were encountered: