Commerce Postmaster is a module that works with Drupal Commerce and the Postmaster service to provide easy integration with USPS, UPS and FedEx carrier services.
This module allows the user to optionally set packaging options across all products, on individual products and / or on specific orders*. The module allows the user to create a new package with the selected carrier and have the tracking id returned and attached to the order. Address validation is performed during creation of the package; it can also be performed separately.
There are no modules available to work with the Commerce Postmaster API.
The project page is here
https://drupal.org/sandbox/kafmil/2088841
git clone --branch 7.x-1.x-alpha1 http://git.drupal.org/sandbox/kafmil/2088841.git commerce_postmaster
I have reviewed another module here:
https://drupal.org/comment/8200643#comment-8200643
| Comment | File | Size | Author |
|---|---|---|---|
| #31 | findings.txt | 8.65 KB | heddn |
Comments
Comment #1
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxkafmil2088841git
We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)
Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).
I'm a robot and this is an automated message from Project Applications Scraper.
Comment #2
kurtfoster commentedI have already used pareview.sh, the remaining errors are just warnings and I would prefer not to change them.
Comment #3
balagan commentedI guess on your version control page you have to unselect maintainer, then copy the git instructions and paste it here.
Comment #4
balagan commentedYou are not using the t() function as you are supposed to. For example the translation of your strings will be really difficult, since many of them are broken into substrings. Translator might see no context, and in different languages different word order might be required. I suggest you fix the following pareview warnings:
Comment #5
rosk0Comment #6
kurtfoster commentedComment #7
kurtfoster commentedThanks balagan, I have fixed the git clone link above. I'll take a look at the t()'s.
Comment #8
kurtfoster commentedI've updated the t() functions to use placeholders.
Comment #9
cellar door commentedTook a manual look over the code and ran it through the coder module with some errors coming up. The recurring one is on the drupal_set_message not having the $message variable run through check_plain() or filter_xss() for cleaning up before display. This throws a security error which you'll likely want to fix and should be fairly simple to do.
Also, I saw that in the prepareShipment function (line 270) you're referencing a phone field which is not standard in commerce installs and which the user would have to create according to the same machine name you have in order for it to work. I would recommend having that field be added automatically or configured by the user in order to run into issues in the future.
Other than that the coder module just had some minor errors with formatting arrays etc. you may want to clean up and the readme has a few typos but that doesn't stop anything from being approved (just me being overly attentive I guess).
Functionally looks great though and looks like it is a very useful module!
Comment #10
kurtfoster commentedThanks Cellar Door. I'd love to get this approved. I am a co-maintainer on eventbrite_api but I don't show up, I think this is because I have had a project approved yet. I also plan to extend this module out to include a number of other postal services, I also have a few usability improvements in mind.
I'll clean those issues up in the coming week.
Comment #11
kurtfoster commentedOK, I've made all of the updates that have been requested.
Comment #12
kurtfoster commentedThis has been on Normal priority for 2 weeks, I am moving it to Major inline with the What to expect doc
Comment #13
neetu morwani commented@kafmil
I have been testing your module on pareview.sh and found some issues like :
For detailed view of the issues see http://pareview.sh/pareview/httpgitdrupalorgsandboxkafmil2088841git
Comment #14
yashsharma01 commentedHi Kafmil,
I have reviewed this module, Please use get_t() instead of use t() in .install file.
Thanks,
Yash
Comment #15
kurtfoster commentedI've made the changes in the latest comments. For some reason I can't change the status of this issue and I need it to go back to needs review.
Comment #16
mister.koz commentedSetting to needs review on request of OP
Comment #17
gobinathmPAReview is still finding issue with the code, please have them addressed.
Comment #18
kurtfoster commentedgobnathm, I do believe the documentation for getting approved says to use those modules as a guide and also use your own brain. There is nothing in there that should prevent this module from being approved. It may be a good idea to have a bit of a look in here. https://groups.drupal.org/node/139754. Does the community care about getting good programmers to contribute or an extra space in some code. Committing to drupal is voluntary, I work full time and I'm trying to help out with patches to other modules and co contributing. This process is really becoming a bit ridiculous!
769 | WARNING | Avoid backslash escaping in translatable strings when
| | possible, use "" quotes instead
I don't want a double quote I want a single quote, there are no variables in this line so there is no reason to use double quotes around the whole thing and have php parse it looking for vars that aren't there.
Comment #19
kurtfoster commentedComment #20
gobinathm@kafmil, apologizes. Looks like you got offended with my previous comment. However its always good to follow coding standard. Thou its not an application blocker. There are very few people like Alex who don't have a day job & have dedicated their entire time to Drupal Community. Not just you, but more than 90% of the community people have a day job & they contribute to drupal out of their love for drupal. Since you have pointed me to the module contribution guide page, i would like to point out another item here. Application review bonus gets priority in this queue & administrators expect applications to perform a full manual review to be done at-least for 3 projects, which is missing this application. That might be a reason why this application is open for a long time.
1. Unused Variables : everyone (including you) will agree to the fact that unused variable declaration are good in any program. i believe now you have removed that
2. as you have organized most of you ADMIN form in to a separate inc file its good idea to move commerce_postmaster_admin_form() also to that inc. [This is a suggestion, but not a blocker]
3. Commented code can be removed [Again this is also a suggestion, not a blocker]
Comment #21
kurtfoster commentedNo problem @gobinathm, sorry for the whinge, had a really bad day yesterday, my bus arrived 5 mins early and I missed it, mysql corrupted on my local, and it kept on going... Not getting approved again was the proverbial straw. It would be good to get this approved at some point soon however.
1. I don't think there are any unused vars anymore.
2. good pickup
3. I obviously misread the standards, I thought I had to use commented code to help people understand what was going on in my module, or maybe I'm misunderstanding you.
Comment #22
kurtfoster commentedI think I must be misunderstanding the process. This has been set to "reviewed and tested by the community", but I still can't promote the module, there is no Promote link. What do I need to do next to be able to promote my module?
Comment #23
heddn@kafmil, you need to wait for a git approver to take the RTBCed issue and grant you access.
Comment #24
kurtfoster commentedI'm bumping up the status to critical inline with the What to expect doc
Comment #25
kurtfoster commentedI'm setting this back to needs review as I'm just wondering if there's anything else I can do to get git approval. If there's something else that I need to change or other steps that I can take I'm happy to do them. I've got a few sandbox modules that I'd like to make full projects.
Comment #26
joachim commentedWhat's the Postmaster service?
Are you aware of https://drupal.org/project/commerce_delivery?
Comment #27
kurtfoster commentedPostmaster is a web service that integrates with FedEx, UPS and USPS, the module isn't like commerce_delivery.
I have had this module set to reviewed and tested by the community, so it has already been accepted, the next step in the process as far as I am aware is for a git approver to give me access. I set this back to needs review because I'm not sure if I've misunderstood the process. Do I need to contact a git approver, or is there another queue or issue that I need to raise? It's been at the same status for 4 months, so I have been wondering if there is something else that I need to do?
Comment #28
joachim commentedYou should definitely leave it at RTBC so a git approver sees it!
Comment #29
kurtfoster commentedok, thanks joachim
Comment #30
heddnAutomated Review
Best practice issues identified by pareview.sh / drupalcs / coder. These problems should be addressed.
http://pareview.sh/pareview/httpgitdrupalorgsandboxkafmil2088841git
Additional automated review:
See findings.txt for numerous spelling issues (~150) and other coding best practices.
Manual Review
All function php doc simply copies the function name for the short description. This is not useful.
her
drupal_set_message(t('Please install the postmaster API library. Check the !readme for further information.', array('!readme' => l(t('read me'), 'admin/help/commerce_postmaster'))), 'error');. Try throwing that into a protected/private function so you can simply call $this->setError (or equivalent).The starred items (*) are fairly big issues and warrant going back to Needs Review. The rest of the comments in the code walkthrough are recommendations.
Comment #31
heddnMissed adding findings.txt
Comment #32
heddnComment #33
kurtfoster commentedComment #34
klausiPlease don't RTBC your own issues, see the workflow: https://www.drupal.org/node/532400
Comment #35
kurtfoster commentedThe issue was RTBC previously I was just putting it back after I changed it because I was confused about the process. It has been moved back to needs work due to some issues found in pareview.sh. The remaining issues pareview is bringing up are things I do not intend on fixing as they are issues like spelling mistakes in comments when I mention a variable name in the comment. Making the remaining changes to suit pareview.sh in my opinion diminishes rather than enhances the module. My understanding was that as pareview is just an automated tool, you use it to guide you towards issues but then think through whether or not the change is actually required? If that's not correct let me know and I'll make the changes to fit exactly with pareview.
Thx
Comment #36
heddn@kafmil, I moved it to Needs work after reviewing in #2145921-30: D7 Commerce Postmaster. The next phase after that is for you to fix things, which it looks like you did. Then the isues gets moved to needs review and we wait for someone to review it and then they will mark as RTBC.
I'll see if I have some time here soon to give it another check. For now, leaving as needs review.
Comment #37
kurtfoster commentedOK, thanks heddn, I misunderstood the process, but I think it's all cleared up now. Thanks for your help.
Comment #38
veso_83 commentedHi kafmil,
You’ve written a nice module, and here are my comments:
Automated Review
There are lots of issues related with the drupal codding standards,
Mainly you should add the “array” type for each arrays elements in the function’s declaration (see is issue_commerce_postmaster_1 picture).
Manual Review
Individual user account
Yes: Follows the guidelines for individual user accounts.
No multiple applications
Yes
No duplication
Yes
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements
3rd party code
Yes: Follows the guidelines for 3rd party code.
README.txt
Yes: Follows the guidelines for in-project documentation.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes. If "no", list security issues identified.
Coding style & Drupal API usage
You forgot to remove devel’s function dsm: commerce_postmaster_menu(): line 86. Otherwise the code looks nice.
Comment #39
klausiThe dsm() call will throw PHP fatal errors on sites on each cache clear, so this needs fixing.
Comment #40
kurtfoster commentedok, fixed.
Comment #41
heddnre #40: What is fixed? From my review in #30, 2 of the first bullets are addressed. I'll leave it to you to re-check feedback. Marking needs work for now.
Comment #42
kurtfoster commentedOK, so this is what I've changed and committed, I've done all of the (*) items except for the Physical module integration:
Automated Review
Best practice issues identified by pareview.sh / drupalcs / coder. These problems should be addressed.
http://pareview.sh/pareview/httpgitdrupalorgsandboxkafmil2088841git
- Fixed
Additional automated review:
See findings.txt for numerous spelling issues (~150) and other coding best practices.
- The only remaining ones are variable names
Manual Review
Coding style & Drupal API usage
Place code review here using this format:
Class CommercePostmasterAdmin
All function php doc simply copies the function name for the short description. This is not useful.
- comments have been cleaned up
delete .gitignore file. Use a machine level .gitignore if you need to ignore .DS_Store.
- removed
(*) shippingOptionsForm should use theme_table. This is repeated through the module for markup. Please use theme_table more often.
- I've used theme table in the admin form
Why can't countryGetList simply be a wrapper for the procedural call to country_get_list?
- Good point, I've changed it
(*) CommercePostmasterAdmin uses a lot of #markup without passing any of the data through t(). Please use t(), and concatenate the markup tags.
- Fixed
(*) In commerce_postmaster.inc, don't through Exception, use something more specific or create a new exception type. Exception is very hard to catch in a try/catch by other modules except by catching Exception, which is very bad form.
- changed to just a array
There's a lot of repeated copy/paste of drupal_set_message(t('Please install the postmaster API library. Check the !readme for further information.', array('!readme' => l(t('read me'), 'admin/help/commerce_postmaster'))), 'error');. Try throwing that into a protected/private function so you can simply call $this->setError (or equivalent).
- yep, good point, fixed
(*) There's a hidden dependency on entity, commerce_customer, and addressfield. A module should list all direct dependencies.
- Yep, done
There's inconsistent use of entity_metadata_wrapper. Sometimes it is used and sometimes it isn't. Look for all occurrences of LANGUAGE_NONE to see examples where it isn't used and where it could be used.
- I haven't had time for this but I'm getting onto it
(*) Why is this module using its own method to calculate size and weight. Many commerce sites will already have standardized on using Physical. It's OK to use this module's implementation if there is a good reason, but the ideal is to not duplicate module functionality.
- OK, this is something I'll work on fixing, it's not implemented yet
Doing a function_exists check is not necessary since libraries is already a dependency of this module. Also, this should run as a runtime phase check, otherwise the module can't be enabled until the library is downloaded.
- Still to do
No need to explain what a hook_menu does. That's what 'Implements hook_foo' does. This is repeated through the .module file.
- fixed
Its confusing the mechanism you are using to display the admin forms. Admin forms usually goes into module_name.admin.inc. However, with the use of a class for them (as you've done), they you (correctly) have them auto registered in the .info file. But then you don't need to list the file in the hook_menu. Or you could still use the file registration in the hook_menu, but then you'd need to consider that the file won't be autoloaded. Its confusing and non-Drupal like but I don't have a good suggestion for you to make it more Drupal like except to remove the nice classes. Which would be a pity.
- I kind of like this way, I know it's not completely drupalish, but it's not completely undrupalish either I think.
This should start with 'Implements hook_foo'.
/**
* Function commerce_postmaster_form_commerce_product_ui_product_form_alter.
- Fixed
Comment #43
heddn;;$field_type$formatsshouldn't be an array key. Potentially related issue on line 218.$fieldis never used.$bundleparameter is never used.t(). If someone translated them, then they wouldn't match. Example on line 326 and compare to getLabelFormatArray().Moving back to needs work on missing dependency.
Comment #44
heddnClarifying #43.17: This is in reference to the dimension input fields on the shipping options form.
Comment #45
kurtfoster commented1. Fixed
2. Fixed
3. This should've read string
4. Removed. This doesn't come up on PAReview, what tool do you use to find these issues so quickly?
5. Removed
6. Fixed
7. Fixed
8. Fixed
9. I've changed it so there is a disable flag in the settings that determines if it happens or not. It's also in the readme.
10. Changed
11. I don't get this one, there's only a type tableselect in the form api, which I don't want?
12. I like the idea, I might move to this in a later version
13. Fixed
14. Fixed
15. Fixed
16. I couldn't replicate this?
17. I changed this so that there is numeric validation on the fields.
Moving back to needs work on missing dependency.
Comment #46
heddnre #45
4) I use phpstorm and its code quality tools.
11) https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_ta...
Marking as RTBC.
Comment #47
heddnAssigning to mpdonadio to give this a second set of eyes.
Comment #48
mpdonadio(*) In commerce_postmaster_form_commerce_order_ui_order_form_alter() you should be using #access instead of visible states when you check permissions. The elements will still be there in the form, just invisible, so you are bypassing the access you have set up. If you fix these, I will approve the application.
Comment #49
mpdonadioOh, and the branch should be '7.x-1.x'. '7.x-1.x-alpha1' would be a tag that you create later.
Comment #50
kurtfoster commentedI've changed to using #access.
Comment #51
mpdonadioI will look at this tomorrow.
Comment #52
mpdonadioI am not seeing that change in the 7.x-1.x branch. There are still lots of places you are doing:
Make sure you are working in the proper branch, delete the unneeded branch in your local and the remote, and update the clone command above.
Comment #53
kurtfoster commentedok, sorry, I must not have pushed everything, I'll do it tonight.
Comment #54
kurtfoster commentedOK, sorry about that, I've pushed the changes now.
Comment #55
mpdonadioComment #56
valentine94Looks nice to me
Comment #57
mpdonadio@Valentine94, did you do a full review? We prefer people to use the Review Template.
Setting this back to Needs Review and assigning to myself as I have to verify #54.
Comment #58
mpdonadioAutomated Review
Review of the 7.x-1.x branch (commit d86921b):
This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.
Manual Review
commerce_postmaster_check_tracking_wrapper() has some untranslated strings, and $message gets overwritten in the foreach. Do another pass for untranslated strings at some point.
In CommercePostmasterAdmin::shippingOptionsForm(), it is best use use a render array rather than generating themed output and stuffing into #markup.
With links in translated strings, it is best to pass in the URL only, not the rendered link. See https://www.drupal.org/node/322774
This is a big, dense module to review. My blocking issue from #52 has been addressed.
Comment #59
mpdonadioThis was RTBC by an admin, and my blocker was addressed.
Thanks for your contribution, kafmil !
I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.
Here are some recommended readings to help with excellent maintainership:
You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!
Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
Thanks to the dedicated reviewer(s) as well.
Comment #60
kurtfoster commentedThanks so much heddn and mpdonadio,
I've learnt quite a bit through this process, which has been great. I'll check out those links. Is there anything else you think I should do to improve my drupal skills?
Thanks
Comment #61
heddnYou don't have to but I always recommend https://www.drupal.org/core-office-hours