Few days ago, came across a project that had several coding standard issues (in general spacing (tab, line breaks) issues) that made the code hard to follow, so opened a feature request about it. The maintainer won't fixed it, stating that they did not believe in drupal coding standards, some others re-opened it, one included a patch, maintainer won't fixed it x2.
So, that brings me to ask, what are coding standard violations -- bugs, requirements, or just suggestions as far as code hosted in drupal contributions directory, and is there any other action that should be done other than leave it be?
All code should comply to the coding standards. Any patch that fails to do this will generally be ignored and treated as unfinished work.
http://drupalcode.org/viewvc/drupal/contributions/README.txt?view=markup
Comments
Comment #1
bojanz commentedI believe it's this issue
So, the question is what should be done when the maintainer is "unresponsive".
Last time it happened, chx assigned the person who filled the complaint as the co-maintainer, which solved the problem.
Comment #2
hefox commentedYes, that's the one.
Comment #3
gddI do not think that coding standards are something that should be actively enforced if a module maintainer chooses not to implement them. The fact is that right now, I would bet that no less than 90% of contrib contains coding standards violations of greater or lesser extent. I myself have committed modules that willfully ignore the stupid 'space, nospace' standard for string concatenation. I think hefox took the right approach by suggesting that they be fixed, and then offering a patch to do so is even better. Ultimately, however, attempting to enforce the issue is the wrong approach imo, and more than that simply impossible and any attempt to do so will look arbitrary and capricious because the victim will always be able to say 'Why are you picking on me and not ' There's no way down this road that isn't more trouble than its worth.
Comment #4
Crell commentedIt depends on how severely it violates them. For minor violations, I don't pay much attention. (Views has always used the "space on either side of the concatenation dot" convention, which wasn't the case for core until D7 for instance.) For major violations, well, I have actively refused to use a module before on those grounds. If the maintainer won't follow something as simple as coding standards I don't trust their ability to follow security standards. It also slows me down as I can't parse the code myself as easily.
Comment #5
Anonymous (not verified) commentedThe quoted language from the README.txt is full of weasel words. It's not clear if this is a requirement for the project maintainer or if this entitles a project maintainer to reject patches that don't meet coding standards?
Tim Plunkett asserts "The CVS Application specifically states that modules must follow the coding standards." When I tried to validate this myself, I couldn't. I can't see the CVS application because I already have a CVS account. I can't log out and see it because I have to have a d.o user account.
I can follow this up with a documentation issue if the policy is clarified.
Comment #6
gregglesI think we should have requirements and optional elements for code hosted on drupal.org
GPL V2 and later License? That's a requirement.
Respond within X amount of time to a security issue reported in your module? That's a requirement (though the exact length is still being decided).
Coding standards? Those should be optional but highly encouraged, in my opinion.
Comment #7
michelleAt the risk of introducing an unenforceable grey area, I think they should be encouraged but not forced unless the coding style is completely unreadable. If the code is so bad that the security team can't make heads nor tails of it, that's a problem. But tabs instead of spaces? That doesn't seem such a big deal in contrib.
There's only so much you can ask of volunteers before you end up with an "f that" and I'd rather see an actively maintained project with tabs in it than one with perfect coding standard following that's unsupported. We need to choose our battles and I don't think this is a good one to choose.
Michelle
Comment #8
kbahey commentedCode style is one of those things that are a matter of habit, and very hard to change. I struggled with Drupal's code style early on myself, because I was more used to braces being aligned on columns, not K&R C style, and other minutiae. Of course, now, after so long, it is second nature to me.
The point is: some people will be used to other coding styles, and feel too strongly about it (think vim vs. Emacs, KDE vs. Gnome, ...etc.). If they continue to contribute to Drupal, they may change their style after a while.
We should strongly recommend that they use the consistent style that core and the majority of contrib uses, for their own benefit (patches are easier for others, ...etc.)
Coding style alone should not be enforced, just prodded. If it is combined with other problems, sloppy programming, security issues, weak maintainership, then it is yet another sign of a questionable maintainer, whose module should be avoided. Alone, it is just what they are used to.
Comment #9
gerhard killesreiter commentedI am perfectly fine with people hosting their code elsewhere if they do not want to integrate with the community in such easy things as coding standards.
I flatly refuse to review code or patches that grossly deviate from the coding standards.
Comment #10
tim.plunkett@bangpound, here's a start: http://drupal.org/node/539608
@Crell, decide for yourself how bad this is:
As the one who submitted the patch, I can heartily attest that the current state of the code is almost unreadable.
I occasionally forget to put spaces on either side of concatenations, but this is deliberate.
Comment #11
hefox commentedThe grammar was really bothering me.
Perhaps should change it to "Documentation on how/if to handle violations of coding standards." or such, with emphasis on if.
On the specific module/maintainer, wasn't really the tabs that was the problem, but that spacing (excessive line breaks) makes it very hard foe me to follow the code, and the module did have one bug (*glares at how user_register handles $form['account']*) and one performance feature request.
The issue in this case is, when a module maintainer does not make it hard for others to help with the module, the other path, using/making another, could cause duplication, which is also discouraged, or stuffing code in a glue module, which means can't gain new features/bug fixes easily.
Comment #12
kbahey commentedAs I said, there are many code styles around, and having been immersed in one style for years, the new style looks foreign, unfathomable and a real obstacle.
Integrating with the community takes many forms, and adhering strictly to the code style should not be one of them.
You can open an issue, talk to the person via email or IRC, blog on it, refuse to use the code, ...etc. All that is fine.
But don't make this, alone, a reason to ban hosting of the code on d.o.
Comment #13
Crell commentedMayhaps this should be discussed at DrupalCon CPH: http://cph2010.drupal.org/sessions/rights-and-responsibilities-maintaine...
Comment #14
tim.plunkettDid this come up in CPH?
Related: #891044: Consistency in CVS guidelines.
Comment #15
tim.plunkettMaybe this should be discussed at DrupalCon Munich.
Comment #16
killes@www.drop.org commentedGuess nobody found it important to discuss this.