CVS edit link for kubala.webdesign

I wrote a google weather module which allows to get an information about the weather from Google and displays it in a block. I am aware that there is a lot of weather modules like mine , however only Google weather can give an information about the weather in small cities and villages. I would like to share my code with the other users.

Current snapshot avalible on http://github.com/mkubala/drupal-google-weather/downloads

Comments

kubala.webdesign’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new2.59 KB
avpaderno’s picture

Issue tags: +Module review

Hello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review the code, pointing out what it needs to be changed.

As the other weather modules are not using the service provided by Google, the proposed module should be considered a duplicate of existing projects; if that would be the case, then any Ubercart payment modules should be considered duplicates of each other.

kubala.webdesign’s picture

StatusFileSize
new2.51 KB

I'm forgot about english in t() functions as basement for translations - attached version support english by default.

kubala.webdesign’s picture

StatusFileSize
new4.37 KB

+ many custom blocks support (feature based on menu_block)
+ cleaning variables when uninstalling

avpaderno’s picture

Status: Needs review » Needs work
  • The points reported in this review are not in order or importance / relevance.
  • Most of the times I report the code that present an issue. In such cases, the same error can be present in other parts of the code; the fact I don't report the same issue more than once doesn't mean the same issue is not present in different places.
  • Not all the reported points are application blockers; some of the points I report are simple suggestions to who applies for a CVS account. For a list of what is considered a blocker for the application approval, see CVS applications review, what to expect. Keep in mind the list is still under construction, and can be changed to adapt it to what has been found out during code review, or to make the list clearer to who applies for a CVS account.
  1. See http://drupal.org/coding-standards to understand how a module should be written. In particular, see how Drupal variables, global variables, constants, and functions defined from the module should be named; how the code should be formatted.
  2.   db_query("DELETE FROM {blocks} WHERE module = 'menu_block'");
      db_query("DELETE FROM {blocks_roles} WHERE module = 'menu_block'");
      
      cache_clear_all();
    
    

    As far as I can see, no modules delete any reference to the blocks it implements from Drupal core tables.
    The call to cache_clear_all() is not necessary.

  3. Hook implementation comments should be like the following one:
    /**
     * Implements hook_menu().
     */
    
  4. function google_weather_install() {
      // No-op.
    }
    
    

    If a hook is not necessary, it is not defined.

  5. Menu descriptions and titles, schema descriptions are not passed to t().
  6.   $ch = @curl_init();
    	curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_TIMEOUT, variable_get('gw_timeout', 20));
      $data = @curl_exec($ch);
      $encoding = array_pop(explode('charset=', curl_getinfo($ch, CURLINFO_CONTENT_TYPE)));
      curl_close($ch);
    
    

    Why isn't the code using drupal_http_request()?

  7. function google_weather_get_title($delta = 0) {
      $config = google_weather_get_config($delta);
      return t("Weather for ") . $config['gw_location'];
    }
    
    

    Use t()-placeholders, instead of concatenating strings.

  8.     '#title' => t("How long forecast do you want?"),
    
    

    The title of a form field should not be a question.

kubala.webdesign’s picture

Hi Kiamlaluno,
Thanks for review my code!
I'll fix those issues as soon as possible.

Greetings from Poland

kubala.webdesign’s picture

Status: Needs work » Needs review
StatusFileSize
new10.54 KB

Ad 6)
With drupal_http_request() I don't get XML data from google (headers, code etc. are returned, but data field contain NULL value). I think that will be related to http://drupal.org/node/294270

New version (I hope the last to review for CVS application ;) ) of module in attachment.

avpaderno’s picture

Status: Needs review » Needs work
  • The points reported in this review are not in order of importance / relevance.
  • Most of the times I report the code that present an issue. In such cases, the same error can be present in other parts of the code; the fact I don't report the same issue more than once doesn't mean the same issue is not present in different places.
  • Not all the reported points are application blockers; some of the points I report are simple suggestions to who applies for a CVS account. For a list of what is considered a blocker for the application approval, see CVS applications review, what to expect. Keep in mind the list is still under construction, and can be changed to adapt it to what has been found out during code review, or to make the list clearer to who applies for a CVS account.
  1. License files cannot be committed in Drupal.org repository. Projects committed in Drupal.org repository have the same license used by Drupal.
  2. See http://drupal.org/coding-standards to understand how a module should be written. In particular, see how Drupal variables, global variables, constants, and functions defined from the module should be named.
  3.   $ch = @curl_init();
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
      curl_setopt($ch, CURLOPT_TIMEOUT, variable_get('gw_timeout', 20));
    

    Why isn't the code using drupal_http_request()?

  4. The module depends from a PHP5 function, but it doesn't declare its dependency from that version of PHP.
kubala.webdesign’s picture

Status: Needs work » Needs review
StatusFileSize
new5.33 KB

Why isn't the code using drupal_http_request()?

See #7 - Because drupal_http_reqest() isn't getting any xml data (needed to get weather forecast from google).

Thanks for review.

kubala.webdesign’s picture

StatusFileSize
new5.33 KB

Sorry, I forgot to change variable names in *.install file.

avpaderno’s picture

Status: Needs review » Fixed

All the points I reported have been fixed.

Thank you for your contribution!
I am going to update your account so you can opt into security advisory coverage now.
These are some recommended readings to help with excellent maintainership:

You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, 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.

I thank all the dedicated reviewers as well.

avpaderno’s picture

Assigned: Unassigned » avpaderno

Status: Fixed » Closed (fixed)
Issue tags: -Module review

Automatically closed -- issue fixed for 2 weeks with no activity.

avpaderno’s picture

Component: Miscellaneous » new project application
Issue summary: View changes