The PA11Y Integration module acts as a client for a PA11Y web service, which provides scheduled accessibility reports for multiple URLs. It runs pa11y on a list of URLs, which you can update and query the results of via a JSON web-service.

pa11y itself is an automated accessibility testing tool, which runs HTML CodeSniffer from the command line for programmatic accessibility reporting.

Here at Nomensa we have been granted time in our schedule to work on contributing modules to the Drupal community. As we have accessibility at heart our first choice was to look into contributing modules that could raise the standard of accessibility across Drupal.

First step towards being able to improve a sites accessibility is to be able to validate your site content against the various standards. Although automated tools are not able to comprehensively test every aspect of Accessibility guidelines due to their very nature, they can act as a quick way to get an overview of general issues across the site.

As we are also working on creating a Continuous Integration environment we are particularly interested in tools that can be used to automate checks for use in CI tools such as Jenkins.

Contrary to the Accessibility module (https://drupal.org/project/accessibility) the PA11Y module does not require any dependencies to be installed locally on the web server.

Currently the basic functionality is as follows:

1. Test all the published content on a site;
2. View the test results for all the tests;
3. Re-run individual tests for those that have yet to complete.

Project page:
https://drupal.org/sandbox/michel_b/2145131

Clone repo here
git clone --branch 7.x-2.x git.drupal.org:sandbox/michel_b/2145131.git

I've added a zip file containing a vagrant and a bootstrap.sh file which'll set up a pa11y webservice VM for testing for those of you who are Vagrant users.

Reviews of other projects
https://drupal.org/comment/8283521#comment-8283521
https://drupal.org/comment/8292289#comment-8292289
https://drupal.org/comment/8292525#comment-8292525

https://drupal.org/comment/8359229#comment-8359229
https://drupal.org/comment/8361835#comment-8361835
https://drupal.org/comment/8358961#comment-8358961

CommentFileSizeAuthor
Vagrant.zip2.97 KBmichel_v

Comments

PA robot’s picture

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.

michel_v’s picture

Issue summary: View changes
andystone78’s picture

variable_get('pa11y_integration_url', 'http://192.168.2.195:3000')
The default url for the sebservice is http://192.168.2.195:3000, I would suggest this would not be a useful default in the majority of cases. Maybe localhost would be better or alternatively do not supply a default and have a hook_requirements error untill a url is entered?

curl_exec()
PA11YClient::curl() uses curl for http requests. Unless there is a good reason for using curl it may be preferable to override this in PA11YDrupalClient using the included function drupal_http_request().

PA11YDrupalClient::formatTask
This method contains a fair amount of html markup, it may be better to using a theme function here (possibly theme_item_list). Also strings such as 'Results not ready for task...' should be passed through t().

/admin/config/system/pa11y_integration
Most content validation modules seem to live at '/admin/config/content' rather than 'admin/config/system/'.

Invalid error message.
Upon clinking 'Start PA11Y test' with an invalid webservice url, the response was '2 items successfully processed. 0 documents successfully sent to PA11Y for testing.' This was an INFO message but should really be an ERROR message. The occurance of the error is really only present in watchdog. Also, could the message give a link to the results page? The request works in drupal_http_request (RC:202) but not in curl (RC:0).

If you could fix this I can review the remainder of the module?

Thanks

mattjennings’s picture

I noticed some problems in pa11y_integration.admin.css:

Line 5 - color is missing the '#'
line 12 - empty url()
line 53 - color is missing the '#'

michel_v’s picture

Thanks guys!

I shall get all those issues resolved asap.

Michel

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/httpgitdrupalorgsandboxmichel_b2145131git

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

michel_v’s picture

Status: Needs work » Needs review

I have resolved all the issues reported, so submitting it for review again.

Thank you

Michel

michel_v’s picture

Issue summary: View changes
michel_v’s picture

Issue summary: View changes
michel_v’s picture

Issue tags: +PAreview: review bonus

Adding PAReview: review bonus tag

alastc’s picture

Hi Michel

Thank you for your module, I have noted a few possible improvements:

In your settings form, pa11y_integration_admin_settings_form, you have a field called pa11y_integration_url. This field currently has no validation but some aspects of validation could easily be added (such as using parse_url() to check for a valid url).

Adding a 'configure' to your info file would help as this adds a link in on the modules page to your settings page.

In PA11YDrupalClient (being a Drupal client), shouldn't the formatTask() be a theme function?

Best of luck with your module,

- Alastair

michel_v’s picture

Status: Needs review » Needs work
michel_v’s picture

Status: Needs work » Needs review

Hi Alastair

Thanks for your review, I've resolved all the issues mentioned.

Michel

klausi’s picture

Status: Needs review » Needs work
Issue tags: -PAreview: review bonus +PAreview: security

manual review:

  1. PA11YClient.php: appears to be 3rd party code. 3rd party code is not generally allowed on Drupal.org and should be deleted. This policy is described in the getting involved handbook. It also appears in the terms and conditions you agreed to when you signed up for Git access, which you may want to re-read, to be sure you're not violating other terms. The Libraries API module is a recommended method for adding 3rd party dependencies without directly including the code on Drupal.org.
  2. pa11y_integration_install(): the check_plain() is wrong here since no user provided text is involved. Make sure to read https://drupal.org/node/28984 again.
  3. pa11y_integration_init(): why do you need hook_init()? This will run on every single page request, regardless if your module is relevant or not. You should only include libraries and CSS files when you actually need them, i.e. in page callbacks or similar.
  4. pa11y_integration_theme_task(): indentation errors for the doc block.
  5. pa11y_integration_theme_task(): HTML tags should be outside of t() calls where possible.
  6. pa11y_integration_get_results(): the output generated here should ideally be a render array, see https://drupal.org/node/930760 . Do not call drupal_render() or theme() yourself, Drupal will render a nested array automatically for you. And for all the custom tags you should use a proper theme function or template with hook_theme().
  7. pa11y_integration_batch_test_tasks(): do not set the PHP execution time in a module, this might not even work on some hosts.
  8. "watchdog('PA11Y delete operation failed', $e->getMessage(), NULL, WATCHDOG_ERROR);": usually the first argument to watchdog() should only be the module name and the message should elaborate.
  9. pa11y_integration_admin_settings_form_validate(): doc block should follow https://drupal.org/node/1354#forms
  10. pa11y_integration_get_content(): this will not scale for any site that has more than a couple of hundred nodes.
  11. pa11y_integration_get_content(): do not build the URLs yourself, just use the url() function which will give you correctly aliased absolute links.
  12. pa11y_integration_batch_test_tasks(): so instead of querying all nodes upfront you should probably just get a count of nodes that you want to test, and then creating the URL paths in each batch step for a limited amount of nodes.
  13. pa11y_integration_theme_task(): this is vulnerable to XSS exploits. If I'm no mistaken $task->name is an unsanitized node title, correct? That is user provided input and needs to be sanitized before printing. Make sure to read https://drupal.org/node/28984 again. And please don't remove the security tag, we keep that for statistics and to show examples of security problems.

Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

michel_v’s picture

Hi Klausi

Thanks for taking the time to review my module, and for your feedback.

I shall endeavor to correct the issues mentioned.

Just FYI, the PA11YClient Class is specifically written for this module and purposefully implemented as a non-Drupal abstraction with the intention of allowing it to be used for other frameworks.

However, as I can't see any of the exceptions mentioned in the guidelines applying to this, I shall remove the abstraction level from the Drupal class.

Thank you

Michel

michel_v’s picture

Status: Needs work » Needs review

Hi

I've resolved all the issue mentioned, converted the theme function to use a render array, and use a cron run to submit the run tasks to prevent scaling issues.

Thank you

Michel

michel_v’s picture

Issue summary: View changes
michel_v’s picture

Issue summary: View changes
michel_v’s picture

Issue summary: View changes
michel_v’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus
klausi’s picture

Assigned: Unassigned » chx
Status: Needs review » Reviewed & tested by the community

manual review:

  1. PA11YDrupalClient.class.inc: Oh, I thought that class was a straight copy from the Github repository, that's what we should not do. If you wrote the class specifically for the module and it is not hosted anywhere else that is fine, just mention that in the @file docblock like "inspired by the javascript implementation by author_xyz at github ..." or similar.
  2. pa11y_integration.info: should have a dependency on PHP 5.3 (Drupal 7 core only requires 5.2), since you are using PHP namespaces, see https://drupal.org/node/542202#php
  3. pa11y_integration_form_alter(): if you are only targeting one specific form you should use hook_form_FORM_ID_alter() instead.
  4. pa11y_integration_menu_breadcrumb_alter(): why do you need this? Please add a comment.
  5. pa11y_integration_theme_task(): the output generated here should ideally be a render array, see https://drupal.org/node/930760 . Do not call drupal_render() or theme() on nested elements yourself, Drupal will render a nested array automatically for you.
  6. pa11y_integration_theme_task(): if you have a render array at hand use #attached instead of drupal_add_css() and drupal_add_library(), see https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.h...

But otherwise looks RTBC to me.

Assigning to chx as he might have time to take a final look at this.

chx’s picture

Assigned: chx » Unassigned

Realistically, I need to pass. I don't have free time left in January.

michel_v’s picture

Hi Klausi,

Thanks for having another look, and for your feedback, I will try and resolve the issues you mentioned.

With regards to the abstracted class, it was more for future compatibility, as such I might just leave it as is, rather than abstracting it again.

Thank you

Michel

michel_v’s picture

Hi

Fixed the issues mentioned in https://drupal.org/comment/8366721#comment-8366721; i.e. fixed 2, removed 3 and 4, and fixed 5 and 6.

Thank you

Michel

klausi’s picture

Status: Reviewed & tested by the community » Fixed

no objections for more than a week, so ...

Thanks for your contribution, michel_v!

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.

michel_v’s picture

Thanks Klausi, much appreciated!

Status: Fixed » Closed (fixed)

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

mgifford’s picture

Great to see this get approved:
https://drupal.org/project/pa11y_integration

Is this the web service that it leverages?
http://pa11y.org/

I should just go ask this question there I suppose...