phpBB

Development Discussion Board

phpBB's testing ground of bleeding edge code
Advanced search

Comment length

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The next feature release of phpBB 3 will be 3.1/Ascreaus followed by 3.2/Arsia.

Comment length

Postby Noxwizard » Mon Jul 09, 2012 2:01 am

Another one of the unwritten coding guidelines is that comments in code and other places should be limited to some fixed width. Depending on who asks you, the request will either be for 79 characters or 80 characters as that's the standard console width. The other reasoning is because we use Github which limits their page width to 800px, which makes someone have to scroll to read long sections of text.

Since this has been requested multiple times in various pull requests, the width requirement should reach some consensus and be added to the coding guidelines. It should also state when and where this should be used (i.e. only in README type files, if indented .php comments need to be 79 - 4x#tabs chars wide, etc...). Naderman has also suggested adapting the PSR-2 guidelines about this: https://github.com/php-fig/fig-standard ... d#23-lines
User avatar
Noxwizard
Support Team Leader
Support Team Leader
 
Posts: 115
Joined: Sun Dec 18, 2005 5:44 pm
Location: Texas

Re: Comment length

Postby Oleg » Mon Jul 09, 2012 4:49 am

My vote is for at most 79 chars in any comment or readme lien.

Yes, with 8 space tabs this does not leave many characters for the text itself at high nesting levels. Don't nest high.
Oleg
3.1 Release Manager
3.1 Release Manager
 
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am

Re: Comment length

Postby imkingdavid » Mon Jul 09, 2012 12:51 pm

I agree with Oleg for 79. Most modern code editors and IDE's will display the current character position within the line, so that makes it a bit easier to keep track.
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.
User avatar
imkingdavid
Development Team
Development Team
 
Posts: 900
Joined: Thu Jul 30, 2009 12:06 pm

Re: Comment length

Postby naderman » Mon Jul 09, 2012 11:16 pm

What's the reasoning for 79 vs. 80? +/- signs in diffs?
www.naderman.de
Move your forum to Forumatic - we'll take care of maintenance & spam
User avatar
naderman
Development Team Leader
Development Team Leader
 
Posts: 1649
Joined: Sun Jan 11, 2004 2:11 am
Location: Karlsruhe, Germany

Re: Comment length

Postby Oleg » Wed Jul 11, 2012 10:19 pm

80th char is for the scrollbar.

When placing a vertical line at 80 chars in a gui editor, lines that are 80 chars long have the last char overlapping the line.

There are probably others.
Oleg
3.1 Release Manager
3.1 Release Manager
 
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am

Re: Comment length

Postby naderman » Thu Jul 12, 2012 10:08 am

Huh what kind of editor does that? Typically the scrollbar starts after the 80 characters? :S
www.naderman.de
Move your forum to Forumatic - we'll take care of maintenance & spam
User avatar
naderman
Development Team Leader
Development Team Leader
 
Posts: 1649
Joined: Sun Jan 11, 2004 2:11 am
Location: Karlsruhe, Germany

Re: Comment length

Postby nickvergessen » Mon Jul 16, 2012 9:59 am

What about whitespaces that are in front of the // ?
cheers nickvergessen :geek:
Member of phpBB Development-Team
No Support via PM — My MODs for phpBB 3.0.x
User avatar
nickvergessen
Development Team
Development Team
 
Posts: 350
Joined: Sun Oct 07, 2007 11:54 am
Location: Esslingen, Germany

Re: Comment length

Postby naderman » Sat Jul 28, 2012 1:02 pm

They count. The purpose of this is to limit the width to the same everywhere. So anything that increases width, e.g. whitespace counts.
www.naderman.de
Move your forum to Forumatic - we'll take care of maintenance & spam
User avatar
naderman
Development Team Leader
Development Team Leader
 
Posts: 1649
Joined: Sun Jan 11, 2004 2:11 am
Location: Karlsruhe, Germany


Return to [3.x] Discussion

Who is online

Users browsing this forum: MSNbot and 8 guests