Hello,
This module connects to an API at a Commerce as a Service Platform called SalesCloud. It is primarily intended to be used by other modules which are at the moment primarily under my development also but I am hopeful that others may use this module. The module contains simple functions to interact with the Rest API, like salescloud_index('entity'), and returns a standardized array.
Project page is here: https://www.drupal.org/sandbox/proton/2317483
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/proton/2317483.git salescloud
cd salescloud
Reviews:
https://www.drupal.org/node/2642870#comment-10719288
https://www.drupal.org/node/2649064#comment-10744616
https://www.drupal.org/node/2649336#comment-10744840
Best Regards,
Helgi.
Comments
Comment #2
PA robot commentedThere are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxproton2317483git
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 #3
Helgi Andri Jónsson commentedComment #4
Helgi Andri Jónsson commentedI spent the entire day reviewing the errors by the automated review tools and resolved them all. Learned alot about drupal coding standards, it was way more strict than I thought.
Comment #5
Helgi Andri Jónsson commentedComment #6
Helgi Andri Jónsson commentedComment #7
atul4drupal commentedHello Helgi Andri Jónsson,
I understand it takes great effort to make your code comply to drupal standards :)
One thing I noticed while manually reviewing your code :
FILE : salescloud.admin.inc
1) Add a blank line at end of salescloud_admin_form() function.
I think it will be good to run your module against the auto code sniffer at pareview.sh and iron out the very few standardization issues you may find there.
Comment #8
Helgi Andri Jónsson commentedHi atul4drupal,
Thanks for the comment. I already have run the repository through the auto code sniffer at pareview.sh and resolved the issues but it did not report the one you found.
Best Regards,
Helgi.
Comment #9
id.tarzanych commentedHello Helgi,
Coding standards in your code are followed in correct way.
But there are some things that I am concerned about.
I suppose that you used them to beautify your code. In my opinion more efficient way is to have a single function that returns static array variable with all values.
Thanks for your work!
Comment #10
Helgi Andri Jónsson commentedHi Serge,
Thank you for reviewing the module. :)
1. I admit its to beautify the code but also to retain the option of changing the way they are called and I would appreciate if I could keep those functions. I understand it would reduce lines to merge them into one.
2. I introduced a singleton pattern: SalesCloud::Instance(arguments); and made the __constructor private.
3. I added composer manager as dependency to the module.info file.
4. I added salescloud.api.inc as a files[] to the module info file and removed the require_once.
Best Regards from Iceland,
Helgi.
?>
Comment #11
Helgi Andri Jónsson commentedComment #12
Helgi Andri Jónsson commentedComment #13
Helgi Andri Jónsson commentedComment #14
mmowers commentedHi Helgi. Here's a manual code review, based on the Project Application Review Template.
Recommendations/Questions are in bold italics
Manual Review
Nothing big, I can't see any blockers. Good work!
Comment #15
Helgi Andri Jónsson commentedHi mmowevers,
The Oauth2 Guzzle plugin has a dependency by itself to Guzzle 5 and so composer will fetch it.
I want to specify php version in hook_requirements so that I can check the version continually in all phases of drupal.
Best Regards,
Helgi.
Comment #16
almaudoh commentedSome more reviews in addition to #9
A better approach would be to declare a class level instance, instead of the function/method level static you are using:
Also, nitpick, Drupal standards require method names to start with lowercase and use camelCase
Rather than hardcoding api paths, it would make sense to have them as settings (or at least constants) for more flexibility.
I also echo #9.1 about the use of variables namespace. It would be nicer if you bunched all of those into one 'salescloud_auth' setting or so. It's good practice to avoid overbloating the variables table. Consider if every module did the same thing?
Comment #17
Helgi Andri Jónsson commentedHi almaudoh,
Thanks for reviewing the code. I have to ask if these are truly any project application blockers because this is a fairly small and simple module and I have been getting the impression from other project applications that we might be overreaching our selves.
I am very happy to get your input and I will implement the changes you recommend.
Best Regards,
Helgi.
Comment #18
almaudoh commented@Helgi, these are not blockers, just recommendations.
Comment #19
klausi@almaudoh: anything else that you found or should this now be RTBC?
Comment #20
almaudoh commented@klausi, I think this should be RTBC, even though I didn't test the API all the way through since I have no salescloud account.
@Helgi, in the salescloud.api.inc, where http requests are made in the try block, the code in the catch block assumes that there is always a response. I had an instance where there wasn't a response, so I had to change the code to something like below to make it work.
Comment #21
almaudoh commentedComment #22
Helgi Andri Jónsson commentedHi almaudoh & klausi,
Thanks so much for the recommendations and I will implement them later today and comment back to confirm.
Best Regards,
Helgi.
Comment #23
Helgi Andri Jónsson commentedHi almaudoh & klausi,
I have implemented all the recommendations:
The camelCase of instance method.
Class level instance.
Merged variable_get & variable_set calls into one function.
Added if($e->getReponse()) in case there is no response from API.
Looking forward to your replies.
Best Regards,
Helgi.
Comment #24
klausiReview of the 7.x-1.x branch (commit 363f4d1):
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:
Otherwise looks good to me.
Thanks for your contribution, Helgi!
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 #25
Helgi Andri Jónsson commentedHi @klausi,
Thanks alot.
1. I completely forgot about those in hook_uninstall and will adjust it to the new variable_set.
2. Yeah I thought about that too. I will make a private function that handles the return array.
I will keep on making manual reviews from time to time. I have great respect for your contribution to the project application process.
Best Regards,
Helgi.