This is a drupal-7 module which retrieves data from the Guardian newspaper api.
Check the api at http://explorer.content.guardianapis.com/?api-key=test

The information fetched by guardian are optionally rendered in a block using angular.js.

Clone:
git clone --branch 7.x-1.x http://git.drupal.org/sandbox/ichionid/2569457.git guardian_news

Project page:
https://www.drupal.org/sandbox/ichionid/2569457

PAreview:
http://pareview.sh/pareview/httpsgitdrupalorgsandboxichionid2569457git

You can check the project flow from the git commits here:
https://github.com/ichionid/Guardian-news

Comments

ichionid created an issue. See original summary.

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxichionid2569457git

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.

ichionid’s picture

I know that this is a bot :p
Fyi when running drush coder-review --minor --release guardian_news

The response that I get is:
Severity minor, Drupal Coding Standards

sites/all/modules/guardian_news/guardian_news.module:
+252: [minor] There should be no trailing spaces

It's a minor fix that I can make. I guess the idea with the comment from the bot is that I should go in and code review other projects :-)

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.

ichionid’s picture

Status: Closed (won't fix) » Fixed

There is only an indentation warning coming up. ESlint requires 6 lines while another checker requires 8. This is minor issue and I believe that the issue should be considered fix :-)

klausi’s picture

Status: Fixed » Needs review

This application is not fixed, did you mean to set it to "needs review"? See the workflow: https://www.drupal.org/node/532400

ichionid’s picture

Yes @klausi you are correct :-)

skullhole’s picture

Automated Review

http://pareview.sh/pareview/httpgitdrupalorgsandboxichionid2569457git shows the below issues:

ESLint has found some issues with your code (please check the JavaScript coding standards).

js/guardian_news.js: line 35, col 10, Error - Expected indentation of 6 characters but found 8. (indent)

Note that perfect adherence to Drupal Coding Standard is NOT a reason to block an application, except for total disregard of them. However, modules should follow them as closely as possible.

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
README.txt/README.md
Yes: Follows the guidelines for in-project documentation and/or the README Template.
However, README.md lacks the most of the sections suggested in the README Template.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements.
Coding style & Drupal API usage
  1. (+) In guardian_news.tpl.php "More" link does not have the href attribute.
  2. (*) In guardian_news.tpl.php $articles variable can be FALSE and using it in foreach will end up in notices.
  3. (*) Use drupal_http_request() instead of file_get_contents().
  4. Function _guardian_news_admin_get_api_key() is used only once and it is just variable_get(). Its use should be replaced with variable_get()
  5. _guardian_news_admin_form() uses custom functions to save variables, replace with system_settings_form()
  6. Consider adding angularjs library dependence to the module instead of loading it from external or at least add the option to choose where to load the library from

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

This review uses the Project Application Review Template.

skullhole’s picture

Status: Needs review » Needs work
PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.

ichionid’s picture

Status: Closed (won't fix) » Active

Working actively on it.

ichionid’s picture

Status: Active » Needs review
bren001’s picture

Status: Needs review » Needs work
README.txt/README.md
No: Does not follow the guidelines for in-project documentation and/or the README Template.

The project page does not provide a helpful overview of the module. See Module documentation guidelines for guidance. I think you need to outline how to register for an API key with some info an a link to the Guardian API site.

The README file is equally brief and you should refer to the above page to rectify this.

You do not implement hook_help() for additional module help via the Drupal UI

Coding style & Drupal API usage
  • You are not validating the api string in the admin form and thus not providing helpful feedback for module users.
  • I think you might need to give users the option of using angular library locally via libraries module, or via a can which is what this module does by default.
  • (+) After enabling the module, registering for and entering an API key (which needs to be documented in the README), and setting some options, I see no articles. A quick check of the request string made to the guardian api shows this 400 response:
    {
      "response": {
        "status": "error",
        "message": "order-by parameter should be 'newest' (default), 'oldest' or 'relevance'"
      }
    }
PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.

ichionid’s picture

Status: Closed (won't fix) » Active
ichionid’s picture

Made fixes according to comments. Making the addition of angular more flexible is in the @todo list.

ichionid’s picture

Status: Active » Needs review
Theodoros_’s picture

Status: Needs review » Needs work

Dear ichionid I installed and tested your module.

I found a functionality issue. Articles sections selection doesn't work when AngularJS is enabled.
It doesn't display only articles from the selected sections as I checked on configuration page.
On the other hand everything looks as it must be when AngularJS is disabled.

Project Application Review template follows:

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes: Does not cause module duplication and/or fragmentation.
Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements.
3rd party assets/code
Yes: Follows the guidelines for 3rd party assets/code.
README.txt/README.md
No: Follows the guidelines for in-project documentation and/or the README Template.
configuration section doesn't exist.
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Meets the security requirements.
Coding style & Drupal API usage
1. Think to add configure property on info file (it's optional but really useful for the user -configuration link-)

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.
If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

This review uses the Project Application Review Template.

klausi’s picture

Status: Needs work » Needs review

Looks like the AngularJS issue can be a standard bug report but I think we should not consider that an application blocker. Anything else that you found or should this now be RTBC instead?

gisle’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +PAreview: security

(*) All text pulled from the web (i.e. the Guardian) is printed directly to the screen without any sanitization. This makes the site vulnerable to XSS exploits. While the Guardian is a well-respected newspaper, all text originating from outside sources must be sanitized before printed to the screen. Adding "PAReview: security" tag. Make sure you read Handle text in a secure fashion.

(*) Module does not delete its DB variables when being uninstalled - there is no hook_uninstall. This is very annoying and must IMHO be fixed before promotion.

(*) All user facing text must run through t() for translation. Please check all your strings. Here is one you missed:

'#markup' => '<p>Settings for the Guardian news block.</p>',

(*) The following line does not provide a valid default value:

'#default_value' => variable_get("guardian_news_sections"),

which results in the following warning:

Invalid argument supplied for foreach() in form_type_checkboxes_value()

when guardian_news_sections is undefined. Instead, it should be:

'#default_value' => variable_get("guardian_news_sections", array()),

(*) In Drupal, drupal_dirname is preferred over PHP dirname.

(*) In Drupal, drupal_json_decode is preferred over PHP json_decode.

(+) The application summary and README says: "Check the api at http://explorer.content.guardianapis.com/?api-key=test"
However, http://explorer.content.guardianapis.com/ no longer exists (it looks like it has changed to http://content.guardianapis.com/search.

(+) The API URL is now hardcoded into the module:
drupal_add_js(array('guardian_latest_news' => array('url' => 'http://content.guardianapis.com/search')), 'setting');
should it not be user configurable in case it changes again?

(+) There is a sub-directory named nbproject included in the Git repo that seems to contain materials that is not used by the project. It should be deleted (or its purpose documented - if it serves some purpose that has eluded me).

(+) Do not include .gitignore in the repo you push (make it ignore itself).

(+) The README.md does not display bullet points correctly when rendered by the Markdown filter. These lines:

There you will be allowed to:
 --Familiarise yourself with the API using our explorer
 --Get access by registering for a key and reviewing our terms and conditions

should be:

There you will be allowed to:

- Familiarise yourself with the API using our explorer
- Get access by registering for a key and reviewing our terms and conditions

(+) The README doesn't really explain how to get started viewing or searching for Guardian contrent on a Drupal site (only how to do this on Guardian's demo site). I was able to figure out (from reading the source) that the that the module creates 'Latest articles from The Guardian' block for the content pulled from the Guardian that you may configure to be visible. However, this step should have been explained in the README in the section about setting up the module.

( ) The markup (produced by guardian_news.tpl.php)looks like this:

<li>
<a href="--URL-TO-STORY--">
<h3>--HEADLINE--</h3>
</a>
<p>2016-06-21T09:25:09Z | Film</p>
</li>

Putting a H3 tag inside a HTML list item is unorthodox and will (without additional styling) show a single bullet followed by whitespace, and then the heading on a new line. My personal opinion is that this is very ugly. Since it is controlled by the template file, it is trivial to change it, but why not provide a more pretty look and feel "out of box"?

(+) Confirming the bug (found by Theodoros_ in #18) that articles sections selection doesn't work when AngularJS is enabled. It need to be working (or the angular option removed) before making a stable release.

(+) There is "Show more:" checkbox, but ticking it does not have any effect. It need to be working (or the "Show more"-option removed) before making a stable release.

The starred items (*) above are big issues and warrant the application going back to Needs Work. Items marked with a plus sign (+) should be addressed before a stable project release, but does not block the project from being promoted to a full project. The rest of the comments are only recommendations.

If added, please don't remove the security tag, we keep that for statistics and to show examples of security problems.

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

I'm a robot and this is an automated message from Project Applications Scraper.