[RFC|Accepted] Coding Guideline Modifications

These requests for comments/change have lead to an implemented feature that has been successfully merged into the 3.1/Ascraeus branch. Everything listed in this forum will be available in phpBB 3.1.
Post Reply
User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC|Accepted] Coding Guideline Modifications

Post by callumacrae »

Well yeah, they're parentheses to mark an object, not a block of code. Objects always want the parentheses on the same line, as this wouldn't make sense:

Code: Select all

fn(
{
    a: 'foo',
    b:
    {
        c: 'bar'
    }
})
Made by developers, for developers!
My blog

wGEric
Registered User
Posts: 521
Joined: Wed Jun 11, 2003 2:07 am
Contact:

Re: [RFC|Accepted] Coding Guideline Modifications

Post by wGEric »

callumacrae wrote:Well yeah, they're parentheses to mark an object, not a block of code. Objects always want the parentheses on the same line, as this wouldn't make sense:

Code: Select all

fn(
{
    a: 'foo',
    b:
    {
        c: 'bar'
    }
})
Objects don't always want the curly brackets on the same line. Your code is valid and you will get the result that you expect. Are you proposing to put the curly bracket on the same line for objects?

Here is some test code:

Code: Select all

<script>
var test =
	{
		a: 'foo',
		b:
		{
			c: 'bar'
		}
	};
	
console.log(test);

var fn = function() {
	return
	{
		a: 'foo'
	}
};

console.log(fn()); // undefined
</script>
Eric

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC|Accepted] Coding Guideline Modifications

Post by callumacrae »

Definitely, or it looks stupid.
Made by developers, for developers!
My blog

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Accepted] Coding Guideline Modifications

Post by Oleg »

Having read some diffs recently I am now firmly in the camp of always specifying @return. Without @return I am never sure if the function returns nothing or the return value is undocumented, and I end up scouring the code to find out, which defeats the purpose of having documentation.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Accepted] Coding Guideline Modifications

Post by Oleg »

How about requiring all sentences in commit messages to begin with a capital letter (unless the first word is a variable or otherwise something that normally begins with lowercase)?

User avatar
A_Jelly_Doughnut
Registered User
Posts: 1780
Joined: Wed Jun 04, 2003 4:23 pm

Re: [RFC|Accepted] Coding Guideline Modifications

Post by A_Jelly_Doughnut »

Seems a little pedantic to me?
A_Jelly_Doughnut

User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: [RFC|Accepted] Coding Guideline Modifications

Post by naderman »

Indeed, I think it's common sense to use proper capitalisation, and if there's an occasional exception that's ok, too.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: [RFC|Accepted] Coding Guideline Modifications

Post by callumacrae »

Oleg wrote:How about requiring all sentences in commit messages to begin with a capital letter (unless the first word is a variable or otherwise something that normally begins with lowercase)?
I've always worked with first letter capital and ending with a full stop wherever possible.
Made by developers, for developers!
My blog

User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: [RFC|Accepted] Coding Guideline Modifications

Post by imkingdavid »

callumacrae wrote:
Oleg wrote:How about requiring all sentences in commit messages to begin with a capital letter (unless the first word is a variable or otherwise something that normally begins with lowercase)?
I've always worked with first letter capital and ending with a full stop wherever possible.
I suppose that requiring proper English grammar is a good idea for uniformity, although sometimes I have used a lowercase letter in the summary (e.g. [branch] fixed X error in Y.php) since that didn't look too bad. The purpose of the hard stop and capital letter is to indicate the end of one sentence and the beginning of another. However, in a summary like the one able, neither is needed, imo, since there is only the one sentence.
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.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: [RFC|Accepted] Coding Guideline Modifications

Post by Oleg »

I don't care for capitalization that strongly. I do however think that we should document that we don't require any particular capitalization if this is what is decided, or possibly that we suggest proper capitalization but do not require it.

Post Reply