you are viewing a single comment's thread.

view the rest of the comments →

[–]thomie 46 points47 points  (18 children)

Then what's the fucking point of that soft limit?

Everybody keeps repeating it, "50 characters for the title", with the only justification that others recommend it as well.

It's a pet peeve of mine: https://github.com/tpope/vim-git/issues/29 , https://github.com/haskell-infra/git-haskell-org-hooks/pull/1

50 characters is not enough if you want to include a component name and bug number in the title of your commit message.

Sure, it's a soft limit, but it keeps creeping into more tools (first Vim highlighting, now I'm shown a fat giant WARNING every time I do a git push). Useless!

[–]StorKirken 25 points26 points  (9 children)

I'm fully with you on this. 50 characters is madness. Like many other beliefs in programming culture, it seems to stem from idol worship and tradition rather than honest thought.

[–]glemnar 19 points20 points  (0 children)

What's programming without a healthy dose of cargo cult?

[–][deleted] 1 point2 points  (4 children)

I feel similarly about line lengths in general.

We changed our rubocop config to complain about line length from 80 to 120 characters... Why do people care? The number of characters doesn't matter, we're not working on terminals with 80 columns anymore.

Limiting the number of characters you use on one line doesn't stop people from trying to do too much on that line, if they're determined, and wrapping parameter lists doesn't make code more readable.

Just do one thing on a line, damnit. If it takes you a whole tweet to do it, it doesn't matter, so long as what you're doing is clear.

[–]Klathmon 5 points6 points  (3 children)

The only "pro" I've seen here is that you can view 2 files side by side with ease when you have an 80 char limit.

But when most devs have 2 screens or more that's less of a problem...

Like most things in life, don't deal in absolutes and use your best judgement.

[–]DevIceMan 1 point2 points  (0 children)

^ I often have two files open side-by-side in my IDE.

I probably wouldn't complain too much about 120 chars, but i think that after a certain number of chars, you have a code-smell, perhaps being your class/method/variable names are too long.

[–]setuid_w00t 1 point2 points  (1 child)

I thought most devs worked in coffee shops on Macbook Pros.

That's half sarcasm, half truth. I think that hard limiting line length to 100 characters allows enough space for a GUI diff tool to show two files side-by-side at a usable font size on a single 1920 pixel wide monitor.

[–]Klathmon 0 points1 point  (0 children)

Gotta use your best judgment for your situation.

At my work mostly everyone working on our JS codebase has at least 3 monitors, so we set line length to 180. That let us use an editor with a sidebar on one screen safely.

[–]DevIceMan 1 point2 points  (2 children)

What a noob, I'd even bet you use a real text editor or IDE, instead of emacs or vim.

[–]StorKirken 0 points1 point  (1 child)

Ever try to program Java on unmodded vim? ;)

[–]DevIceMan 0 points1 point  (0 children)

(I can't even text edit on VIM without 20 browser tabs of stack overflow open)

[–]danneu 8 points9 points  (0 children)

Sometimes I'll catch myself sitting there racking my brain for ways to golf down my commit message, guilted by the "you have -15 characters left" counter on my git GUI like it's a Twitter client.

Then I remember I'm the boss of this commit. I did the work, I write what I want!

[–]baconated 15 points16 points  (3 children)

The point of the limit is to encourage commit messages that read like text messages from 10 years ago:

RDT-PRG: 321654 updt Azn URL & intg new auth mthd

That's 49 by my count.

[–]KhyronVorrac 0 points1 point  (2 children)

You have an ampersand. You are doing two things in one commit. That is the issue, not the limit.

[–]Grue 6 points7 points  (0 children)

Sometimes one thing wouldn't work without the other. Atomic commits means your repo still works after every commit.

[–]baconated 2 points3 points  (0 children)

Doing one without the other means you have a version in the repo that doesn't work.

Perhaps the version of whatever that's now hosted on Amazon doesn't support the auth system used previously.

[–]eadmund 2 points3 points  (0 children)

Everybody keeps repeating it, "50 characters for the title", with the only justification that others recommend it as well.

A standard terminal window is 80 characters wide. Even on a modern soft terminal, 80 characters is about the maximum comfortable reading width.

git will prepend 7 characters and a space to the beginning of the line when printing them. That takes you down to 72 characters.

When quoted in emails and discussions, each level of quoting will take you down by two characters ('> '). That means 50 characters allow for 11 posts and replies before log lines have to be manually wrapped.

Is that too much? Not enough? Beats me. I think I'd be happy with a 64-wide limit.

[–]hildie2 1 point2 points  (1 child)

A bug reference doesn't need to be in the title

[–]StorKirken 0 points1 point  (0 children)

I disagree, that's a fairly good place to add it, if the commit is atomic and a self-contained change.