Closed (fixed)
Project:
Drupal.org CVS applications
Component:
new project application
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
20 Aug 2009 at 15:08 UTC
Updated:
7 Oct 2019 at 13:34 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
avpadernoYou need to upload here the module you want to add in the CVS repository.
Comment #2
toby.batch commentedHere is tracrss. It is a module that allows tickets from trac servers to be displayed in drupal. I need to write release documents/descriptions for it.
Comment #3
avpadernoComment #4
dave reidWhy do we need to tag issues with "CVS module review" when we're in an issue queue specifically for CVS applications? Feels the same if I were to tag all issues in the XML sitemap issue queue with "XML sitemap"
Comment #5
avpadernoIt serves to distinguish a module review from a theme review; as AjK already used the tags you see, I just kept using the same tags.
It is possible to rename the tags in the taxonomy settings page, but who uses the tags must know that "module review", and "theme review" are now used.
"module review" is perfectly fine with me; maybe AjK had a reason to use "CVS module review". I will check if there is already a "module review" used for another reason, and I will report here.
Comment #6
avpadernoI don't find any taxonomy term "module review"; I guess we could use that, and "theme review".
Comment #7
dave reidOk cool. I was just wondering why. Didn't see that AjK was already using it. I'll use module review and theme review if I get to process any new applications. Thanks Kiam!
Comment #8
avpadernoAs AjK uses , it is better to use all the same tag, otherwise there would be just confusion.
Ok; now we can return to handle this report. I forgot to change the status of this report. :-)
Comment #9
avpadernoSee the Drupal coding standards to understand how a module code should be written.
Comment #10
avpadernoComment #11
avpadernoThere have not been replies from the OP in the past 7 days. I am marking this report as .
Comment #12
toby.batch commentedSorry, I've been on paternity leave for a fortnight, 3 kids under 3 meant I wasn't focusing on this.
I change the code but is there a phpcs standard for this?
Comment #13
avpadernoI reported the link to the Drupal coding standards on my previous comment.
Comment #14
toby.batch commentedSure, I saw your comment. I was just asking a question about standard tool chains used outside your drupal world.
I use PHP_CodeSniffer to check my coding and documentation standards. It's a PEAR maintinained php module and I can really recommend you try it out. It supports the following standards:
Squiz
PHPCS
PEAR
MySource
My question was whether the coding standards for Drupal where the same as any of these. If not where should I suggest a project to create a Drupal set of rules for PHP Code Sniffer.
And I'll get onto reformatting the code.
Comment #15
avpadernoIf you want to verify if your code is compliants to the standards used by Drupal, there is http://drupal.org/project/coder. Bear in mind it is not able to tell you if you are using the correct name for the functions, in example.
Comment #16
toby.batch commentedI've made the code changes to come into line with drupal standards
I still get a few errors but they are part of the PHP core platform so I suppose you can overlook them?
Comment #17
avpadernoMethods defined from an object that is defined from a PHP extension needs indeed to be called as they are defined from the class.
falseshould be written asFALSE, anyway.Comment #18
toby.batch commentedI've change false to FALSE and true to TRUE. Should I file a bug against code-style.pl? It seemed to miss those.
Comment #19
toby.batch commentedBump. Any more I need to do?
Comment #20
avpadernoAvoid escaping the quotes inside a translatable string.
The first argument of
t()needs to be a literal string, not a concatenation of strings, nor a constant.The text used for the link should be something more descriptive.
Debug code should be removed.
A module needs to declare only its own permissions; one of those permissions is already declared by a Drupal core module.
The module should use Drupal Unicode functions.
I have already reported about this kind of error; which one is it?
The code is creating a translatable string by concatenating strings; it is possible to use a better way.
It would better to write
$config = tracrss_userconfig_get($user->uid).Comment #21
toby.batch commentedExcellent feedback.
1. I used template files because the designer I work with always wants to add classes and styles, or change layout but I don't want him in the PHP. I decided to supply this simple template to allow the separation of code and design. To that end I feel it is justified.
2. I've fixed the occurrences of this. I've done this linguistically. Is that acceptable or should I have used double quotes instead? I avoided that as the processing overhead for double is far higher that single quotes.
3. and 8. I've now constructed a string that is passed to the t function. I hope that's OK. I wanted to provide more feed back that a static message.
4. In this case the link itself provided the information in the admin screen as to where the trac server is located. By hyper linking that text it is easy for an admin to to check the link is correct. While I could just hyper link the server name I deliberately chose to present the information that is there. If this breaks a Drupal code I can of course change it but it's a design choice.
5. All debug removed
6. Removed the drupal core permission
7. That's not a unicode issue. It's not the encoding I'm concerned about. I'm creating a directory name to store cached data in so I needed to remove the non file system safe characters from the directory name. If there is a better way of doing this please point me in it's direction.
9. I'm constructing a line of text that is LINK TEXT LINK which is then passed through a theming function. How do you suggest I better create that code chunk. I could write a theming function for that line i suppose and pass it an array but it seems a little unnecessary in this case.
10. Actually either way is just as efficient in an interpreted language as you can never tell how the php platform has been implemented. In high level languages, such as php (or java, pyhton etc) you can never tell how the code stack will be implemented. I accept it should be the same everywhere so I have changed it in the one place it was different.
Comment #22
toby.batch commentedBump, What next?
Comment #23
Michael Zetterberg fd. Lopez commentedI stumbled upon this issue by mistake. But I thought I'd clarify that KiamLaLuno most likely means you should use functions like drupal_substr that are multibyte safe.
Comment #24
toby.batch commentedThanks Michael Lopez. I've replace the whole code block with an MD5 of the base url. All I needed was a unique name.
Comment #25
avpadernoThe first argument of
l()is already passed tocheck_plain()byl(), as it is evident in the function code.The first argument of
t()needs to be a literal string, not a variable; differently, the value passed to the function will not be translated.That is not the correct syntax.
The code is not using a Drupal Unicode function.
See the Drupal coding standards to understand how a module code should be written. The coding standards say to write a constant all in uppercase characters.
The string passed to the function should be translatable.
Rather than concatenating translatable strings, it would be better to use the
t()placeholders, and use a single string.$form_state['#redirect']used as it is used by the code is set to a string.Comment #26
avpadernoRemember to change the status, when you upload new code, or who reviews the code doesn't know there is new code to review.
Comment #27
toby.batch commentedI've fixed all the issues listed except point 7, see lines 29 to 38 in tracrss.tickets.inc
I have to embed a t() inside the l() function in the substitution. This results in the link be escaped. Advice would be appreciated. I could send it out to a theming function but it seem a little over the top for such a simple thing.
With your vastly superior drupal knowledge can you help please?
Comment #28
avpadernol()is not used togethert(); that is reported in the documentation page fort(), which reports the following text:Also, there is still a concatenation of two strings, which could still be avoided.
Comment #29
avpadernoAs I reported, that code is not correct; the script that extracts the translatable strings just parses the code, and it looks for any strings that are arguments of
t(); in the case you write code liket($msg), that script just reports you an error because it doesn't find a literal string as argument fort()(literal string means that a variable is not accepted).In this case, the solution is just to write
drupal_set_message(t('Cache updated')).hook_cron()is not supposed to return anything.Comment #30
toby.batch commentedThank you for some excellent mentoring. There is so much drupal to learn it can be daunting. I wish I knew as much as you.
I have fixed both the issues.
Comment #31
avpadernol()is not used togethert(); that is reported in the documentation page fort(), which reports the following text:Comment #34
avpaderno