diff --git a/commitlog/commitlog.rules.inc b/commitlog/commitlog.rules.inc
index db7d6f4..81c88d0 100644
--- a/commitlog/commitlog.rules.inc
+++ b/commitlog/commitlog.rules.inc
@@ -55,6 +55,9 @@ function commitlog_rules_action_info() {
   );
 }
 
+/**
+ * Send a notification of the new commitlog addition.
+ */
 function commitlog_action_send_notification_mail($mailto, $operation, $operation_items) {
   // In order to keep privacy, each recipient only gets to see himself in
   // the "To:" header. So don't send the mail directly but just construct
@@ -76,6 +79,9 @@ function commitlog_action_send_notification_mail($mailto, $operation, $operation
   }
 }
 
+/**
+ * Rules callback for notifying a user of a new commit.
+ */
 function commitlog_action_send_user_notification_mail($account, $operation, $operation_items) {
   commitlog_user_notification_mail($account, $operation, $operation_items);
 }
diff --git a/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetGlobalCommitView.class.php b/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetGlobalCommitView.class.php
index 02081ff..cead0ba 100644
--- a/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetGlobalCommitView.class.php
+++ b/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetGlobalCommitView.class.php
@@ -1,7 +1,11 @@
 <?php
 
+/**
+ * @file
+ *   Defines the global commit view views set.
+ */
 class VersioncontrolViewsSetGlobalCommitView extends VersioncontrolViewsSetGlobalBase {
   protected $setName = 'global_commit_view';
 
   protected $baseView = 'commitlog_global_commits';
-}
\ No newline at end of file
+}
diff --git a/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetIndividualCommitView.class.php b/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetIndividualCommitView.class.php
index 4f23d18..1fb2a99 100644
--- a/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetIndividualCommitView.class.php
+++ b/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetIndividualCommitView.class.php
@@ -1,5 +1,8 @@
 <?php
-
+/**
+ * @file
+ *   Defines the individual commit view views set.
+ */
 class VersioncontrolViewsSetIndividualCommitView extends VersioncontrolViewsSetGlobalBase {
 
   protected $setName = 'individual_commit_view';
diff --git a/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetRepositoryCommitView.class.php b/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetRepositoryCommitView.class.php
index 8011e64..f4f56ef 100644
--- a/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetRepositoryCommitView.class.php
+++ b/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetRepositoryCommitView.class.php
@@ -1,8 +1,11 @@
 <?php
-
+/**
+ * @file
+ *   Defines the repository commit view views set.
+ */
 class VersioncontrolViewsSetRepositoryCommitView extends VersioncontrolViewsSetBase {
 
   protected $setName = 'repository_commit_view';
 
   protected $baseView = 'commitlog_repository_commits';
-}
\ No newline at end of file
+}
diff --git a/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetUserCommitView.class.php b/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetUserCommitView.class.php
index 0b7842e..16153b1 100644
--- a/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetUserCommitView.class.php
+++ b/commitlog/includes/plugins/views_sets/VersioncontrolViewsSetUserCommitView.class.php
@@ -1,8 +1,11 @@
 <?php
-
+/**
+ * @file
+ *   Defines the repository commit view views set.
+ */
 class VersioncontrolViewsSetUserCommitView extends VersioncontrolViewsSetGlobalBase {
 
   protected $setName = 'user_commit_view';
 
   protected $baseView = 'commitlog_user_commits';
-}
\ No newline at end of file
+}
diff --git a/commitlog/includes/plugins/views_sets/global_commit_view.inc b/commitlog/includes/plugins/views_sets/global_commit_view.inc
index ebc81ca..19d31a9 100644
--- a/commitlog/includes/plugins/views_sets/global_commit_view.inc
+++ b/commitlog/includes/plugins/views_sets/global_commit_view.inc
@@ -1,9 +1,12 @@
 <?php
-
-$plugin = array (
+/**
+ * @file
+ *  Provides ctools data for the Global commit log view.
+ */
+$plugin = array(
   'title' => t('Global commit log'),
   'description' => t('A log of all commits made in all repositories known to the system. Note that the backend-specific versions of this view will be used only if a single backend is enabled.'),
   'handler' => array(
     'class' => 'VersioncontrolViewsSetGlobalCommitView',
   ),
-);
\ No newline at end of file
+);
diff --git a/commitlog/includes/plugins/views_sets/individual_commit_view.inc b/commitlog/includes/plugins/views_sets/individual_commit_view.inc
index 4a248b9..a19b380 100644
--- a/commitlog/includes/plugins/views_sets/individual_commit_view.inc
+++ b/commitlog/includes/plugins/views_sets/individual_commit_view.inc
@@ -1,6 +1,9 @@
 <?php
-
-$plugin = array (
+/**
+ * @file
+ *   Defines the individual commit view views set.
+ */
+$plugin = array(
   'title' => t('Individual commit view'),
   'description' => t('A view of an individual commit.'),
   'handler' => array(
diff --git a/commitlog/includes/plugins/views_sets/repository_commit_view.inc b/commitlog/includes/plugins/views_sets/repository_commit_view.inc
index aaec4fd..2716731 100644
--- a/commitlog/includes/plugins/views_sets/repository_commit_view.inc
+++ b/commitlog/includes/plugins/views_sets/repository_commit_view.inc
@@ -1,9 +1,12 @@
 <?php
-
-$plugin = array (
+/**
+ * @file
+ *   Defines the single repository commit view views set.
+ */
+$plugin = array(
   'title' => t('Single repository commit log'),
   'description' => t('A log of all commits made to a single repository.'),
   'handler' => array(
     'class' => 'VersioncontrolViewsSetRepositoryCommitView',
   ),
-);
\ No newline at end of file
+);
diff --git a/commitlog/includes/plugins/views_sets/user_commit_view.inc b/commitlog/includes/plugins/views_sets/user_commit_view.inc
index 61d0d30..8c6d24c 100644
--- a/commitlog/includes/plugins/views_sets/user_commit_view.inc
+++ b/commitlog/includes/plugins/views_sets/user_commit_view.inc
@@ -1,9 +1,12 @@
 <?php
-
-$plugin = array (
+/**
+ * @file
+ *   Defines the per-user commit view views set.
+ */
+$plugin = array(
   'title' => t('Per-user commit log'),
   'description' => t('A log of all commits made by a specific user in all repositories known to the system. As with the global commit view, note that the backend-specific version will only be used if operating in single-backend mode.'),
   'handler' => array(
     'class' => 'VersioncontrolViewsSetUserCommitView',
   ),
-);
\ No newline at end of file
+);
diff --git a/commitlog/includes/views/commitlog.views_default.inc b/commitlog/includes/views/commitlog.views_default.inc
index 4e472c4..b51ea4b 100644
--- a/commitlog/includes/views/commitlog.views_default.inc
+++ b/commitlog/includes/views/commitlog.views_default.inc
@@ -10,14 +10,14 @@
  */
 function commitlog_views_default_views() {
   // Search the "default_views" subdirectory for files ending in .view.php.
-  $files = file_scan_directory(drupal_get_path('module', 'commitlog'). '/includes/views/default_views', '/view\.php$/');
+  $files = file_scan_directory(drupal_get_path('module', 'commitlog') . '/includes/views/default_views', '/view\.php$/');
   foreach ($files as $absolute => $file) {
     // This is not require_once because it's possible that
     // hook_views_default_views() gets called more than once.
     require $absolute;
     if (isset($view)) {
       // $file->name has the ".php" stripped off, but still has the ".view".
-      $view_name = substr($file->name, 0, strrpos($file->name, '.'));
+      $view_name = drupal_substr($file->name, 0, drupal_strrpos($file->name, '.'));
       $views[$view_name] = $view;
     }
   }
diff --git a/commitlog/includes/views/default_views/commitlog_commit_items.view.php b/commitlog/includes/views/default_views/commitlog_commit_items.view.php
index 38c1d86..2f4ef78 100644
--- a/commitlog/includes/views/default_views/commitlog_commit_items.view.php
+++ b/commitlog/includes/views/default_views/commitlog_commit_items.view.php
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ *   Default view export.
+ */
 
 $view = new view();
 $view->name = 'commitlog_commit_items';
diff --git a/commitlog/includes/views/default_views/commitlog_global_commits.view.php b/commitlog/includes/views/default_views/commitlog_global_commits.view.php
index c458de7..35e166b 100644
--- a/commitlog/includes/views/default_views/commitlog_global_commits.view.php
+++ b/commitlog/includes/views/default_views/commitlog_global_commits.view.php
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ *   Default view export.
+ */
 
 $view = new view();
 $view->name = 'commitlog_global_commits';
diff --git a/commitlog/includes/views/default_views/commitlog_individual_commit.view.php b/commitlog/includes/views/default_views/commitlog_individual_commit.view.php
index 77d0c23..9509c6e 100644
--- a/commitlog/includes/views/default_views/commitlog_individual_commit.view.php
+++ b/commitlog/includes/views/default_views/commitlog_individual_commit.view.php
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ *   Default view export.
+ */
 
 $view = new view();
 $view->name = 'commitlog_individual_commit';
diff --git a/commitlog/includes/views/default_views/commitlog_repository_commits.view.php b/commitlog/includes/views/default_views/commitlog_repository_commits.view.php
index c303410..3f6a502 100644
--- a/commitlog/includes/views/default_views/commitlog_repository_commits.view.php
+++ b/commitlog/includes/views/default_views/commitlog_repository_commits.view.php
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ *   Default view export.
+ */
 
 $view = new view();
 $view->name = 'commitlog_repository_commits';
diff --git a/commitlog/includes/views/default_views/commitlog_user_commits.view.php b/commitlog/includes/views/default_views/commitlog_user_commits.view.php
index a915fec..79bbd90 100644
--- a/commitlog/includes/views/default_views/commitlog_user_commits.view.php
+++ b/commitlog/includes/views/default_views/commitlog_user_commits.view.php
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ *   Default view export.
+ */
 
 $view = new view();
 $view->name = 'commitlog_user_commits';
diff --git a/includes/VersioncontrolBackend.php b/includes/VersioncontrolBackend.php
index 1a73ff7..2f11592 100644
--- a/includes/VersioncontrolBackend.php
+++ b/includes/VersioncontrolBackend.php
@@ -69,9 +69,11 @@ abstract class VersioncontrolBackend {
    * Restore controller caching defaults to their state prior to forcing them
    * all to no caching mode.
    *
-   * Convenience. @see VersioncontrolBackend::disableControllerCaching().
+   * Convenience.
    *
    * @var array
+   *
+   * @see VersioncontrolBackend::disableControllerCaching()
    */
   protected $controllerCachingDefaults = array();
 
@@ -106,6 +108,9 @@ abstract class VersioncontrolBackend {
     ),
   );
 
+  /**
+   * Configure the entities and controllers.
+   */
   public function __construct() {
     // Add defaults to $this->classes
     $this->classesControllers += array(
@@ -291,11 +296,13 @@ abstract class VersioncontrolBackend {
    *
    * Convenience function that helps simplify other code which is only
    * interested in loading a single object. All parameters pass straight through
-   * to @see VersioncontrolBackend::loadEntities(), with the exception of the
+   * to VersioncontrolBackend::loadEntities(), with the exception of the
    * $ids parameter, which is normalized to an array as an additional
    * convenience for callers.
    *
    * @return VersioncontrolEntity
+   *
+   * @see VersioncontrolBackend::loadEntities()
    */
   public function loadEntity($controller, $ids = array(), $conditions = array(), $options = array()) {
     // Normalize the $ids parameter to an array, further convenience for callers
diff --git a/includes/VersioncontrolBranch.php b/includes/VersioncontrolBranch.php
index cd2fe33..de10cbb 100644
--- a/includes/VersioncontrolBranch.php
+++ b/includes/VersioncontrolBranch.php
@@ -50,6 +50,9 @@ class VersioncontrolBranch extends VersioncontrolEntity {
     return $this->getBackend()->loadEntities('operation', $ids, $conditions, $options);
   }
 
+  /**
+   * Update the record in the database.
+   */
   public function update($options = array()) {
     if (empty($this->label_id)) {
       // This is supposed to be an existing branch, but has no label_id.
@@ -73,6 +76,9 @@ class VersioncontrolBranch extends VersioncontrolEntity {
     return $this;
   }
 
+  /**
+   * Insert the record in the database.
+   */
   public function insert($options = array()) {
     if (!empty($this->label_id)) {
       // This is supposed to be a new branch, but has a label_id already.
@@ -119,6 +125,9 @@ class VersioncontrolBranch extends VersioncontrolEntity {
     module_invoke_all('versioncontrol_entity_branch_delete', $this);
   }
 
+  /**
+   * Delete the commits related to this branch from the database.
+   */
   protected function deleteRelatedCommits($options) {
     $operation_controller = $this->getBackend()->getController('operation');
     // Retrieve related commits.
diff --git a/includes/VersioncontrolEvent.php b/includes/VersioncontrolEvent.php
index 334c465..324757d 100644
--- a/includes/VersioncontrolEvent.php
+++ b/includes/VersioncontrolEvent.php
@@ -42,6 +42,9 @@ abstract class VersioncontrolEvent extends VersioncontrolEntity {
    */
   public $repo_id;
 
+  /**
+   * Insert the record in the database.
+   */
   public function insert($options = array()) {
     if (!empty($this->elid)) {
       throw new Exception('Attempted to insert a Versioncontrol event which is already present in the database.', E_ERROR);
@@ -62,6 +65,9 @@ abstract class VersioncontrolEvent extends VersioncontrolEntity {
     return $this;
   }
 
+  /**
+   * Update the record in the database.
+   */
   public function update($options = array()) {
     if (empty($this->elid)) {
       throw new Exception('Attempted to update a Versioncontrol event which has not yet been inserted in the database.', E_ERROR);
@@ -82,6 +88,9 @@ abstract class VersioncontrolEvent extends VersioncontrolEntity {
     return $this;
   }
 
+  /**
+   * Delete the record in the database.
+   */
   public function delete($options = array()) {
     // Append default options.
     $options += $this->defaultCrudOptions['delete'];
diff --git a/includes/VersioncontrolItem.php b/includes/VersioncontrolItem.php
index e123037..63eaf8c 100644
--- a/includes/VersioncontrolItem.php
+++ b/includes/VersioncontrolItem.php
@@ -341,7 +341,7 @@ abstract class VersioncontrolItem extends VersioncontrolEntity {
     elseif ($this->path == $parent_path) {
       return $this;
     }
-    elseif ($parent_path == '/' || strpos($this->path .'/', $parent_path .'/') !== FALSE) {
+    elseif ($parent_path == '/' || strpos($this->path . '/', $parent_path . '/') !== FALSE) {
       $path = $parent_path;
     }
     else {
@@ -364,6 +364,9 @@ abstract class VersioncontrolItem extends VersioncontrolEntity {
     return $parent_item;
   }
 
+  /**
+   *
+   */
   public function getSourceItem() {
     if (!empty($this->sourceItem)) {
       if ($this->sourceItem instanceof VersioncontrolItem) {
@@ -372,10 +375,10 @@ abstract class VersioncontrolItem extends VersioncontrolEntity {
       }
       else {
         // Some invalid data got into $this->sourceItem - pop a warning.
-        throw new Exception ('VersioncontrolItem contains a non-VersioncontrolItem as its source item.', E_WARNING);
+        throw new Exception('VersioncontrolItem contains a non-VersioncontrolItem as its source item.', E_WARNING);
       }
     }
-    else if (!empty($this->source_item_revision_id)) {
+    elseif (!empty($this->source_item_revision_id)) {
       // Item isn't loaded, but should exist. Load it, save it, and return.
       return $this->sourceItem = $this->getBackend()->loadEntity('item', $this->source_item_revision_id);
     }
diff --git a/includes/VersioncontrolRepository.php b/includes/VersioncontrolRepository.php
index 7027887..8870eb0 100644
--- a/includes/VersioncontrolRepository.php
+++ b/includes/VersioncontrolRepository.php
@@ -132,7 +132,7 @@ abstract class VersioncontrolRepository implements VersioncontrolEntityInterface
     if ($backend instanceof VersioncontrolBackend) {
       $this->backend = $backend;
     }
-    else if (variable_get('versioncontrol_single_backend_mode', FALSE)) {
+    elseif (variable_get('versioncontrol_single_backend_mode', FALSE)) {
       $backends = versioncontrol_get_backends();
       $this->backend = reset($backends);
     }
@@ -808,7 +808,7 @@ abstract class VersioncontrolRepository implements VersioncontrolEntityInterface
    * @return string
    *   The raw version of the event as produced by the vcs backend hook.
    */
-   abstract public function generateRawData($event);
+  abstract public function generateRawData($event);
 
   /**
    * Take a raw event object and perform any necessary processing to get it into
diff --git a/includes/controllers.inc b/includes/controllers.inc
index 23a0bd2..6da3fa2 100644
--- a/includes/controllers.inc
+++ b/includes/controllers.inc
@@ -183,7 +183,7 @@ abstract class VersioncontrolEntityController {
     }
     // Or determine the backend for these entities in the query, unless query
     // options tell us not to.
-    else if ($this->options['determine backend'] === TRUE) {
+    elseif ($this->options['determine backend'] === TRUE) {
       $this->queryAlterGetBackendType($query);
     }
 
@@ -672,7 +672,7 @@ abstract class VersioncontrolEntity implements VersioncontrolEntityInterface {
     if ($backend instanceof VersioncontrolBackend) {
       $this->backend = $backend;
     }
-    else if (variable_get('versioncontrol_single_backend_mode', FALSE)) {
+    elseif (variable_get('versioncontrol_single_backend_mode', FALSE)) {
       $backends = versioncontrol_get_backends();
       $this->backend = reset($backends);
     }
diff --git a/includes/interfaces.inc b/includes/interfaces.inc
index 8c8f413..437448a 100644
--- a/includes/interfaces.inc
+++ b/includes/interfaces.inc
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ *   Contains the interfaces that must be implemented for each VCS entity controller.
+ */
 
 interface VersioncontrolEntityInterface {
   public function build($args = array());
diff --git a/includes/plugins/user_mapping_methods/none.inc b/includes/plugins/user_mapping_methods/none.inc
index b3233d2..3cf69f9 100644
--- a/includes/plugins/user_mapping_methods/none.inc
+++ b/includes/plugins/user_mapping_methods/none.inc
@@ -1,5 +1,8 @@
 <?php
-
+/**
+ * @file
+ *   Provides a "null" mapping to map vcs users to Drupal users.
+ */
 $plugin = array(
   'title' => t('None (no mapping)'),
   'mapper' => array(
diff --git a/includes/plugins/user_mapping_methods/simple_mail.inc b/includes/plugins/user_mapping_methods/simple_mail.inc
index c458ecb..357297b 100644
--- a/includes/plugins/user_mapping_methods/simple_mail.inc
+++ b/includes/plugins/user_mapping_methods/simple_mail.inc
@@ -1,5 +1,8 @@
 <?php
-
+/**
+ * @file
+ *   Defines the simple mail method of locating a user.
+ */
 $plugin = array(
   'title' => t('Map using Drupal user email'),
   'mapper' => array(
diff --git a/includes/plugins/vcs_auth/VersioncontrolAuthHandlerMappedAccounts.class.php b/includes/plugins/vcs_auth/VersioncontrolAuthHandlerMappedAccounts.class.php
index f3dee7e..31a6a61 100644
--- a/includes/plugins/vcs_auth/VersioncontrolAuthHandlerMappedAccounts.class.php
+++ b/includes/plugins/vcs_auth/VersioncontrolAuthHandlerMappedAccounts.class.php
@@ -196,7 +196,7 @@ class VersioncontrolAuthHandlerMappedAccounts implements VersioncontrolAuthHandl
       $this->errors[] = t('User does not have access to create branches on this repository.');
       return FALSE;
     }
-    else if ($base == self::ALL) {
+    elseif ($base == self::ALL) {
       // User has super cow powers, say yes.
       return TRUE;
     }
@@ -229,7 +229,7 @@ class VersioncontrolAuthHandlerMappedAccounts implements VersioncontrolAuthHandl
       $this->errors[] = t('User does not have access to create tags on this repository.');
       return FALSE;
     }
-    else if ($base == self::ALL) {
+    elseif ($base == self::ALL) {
       // User has super cow powers, say yes.
       return TRUE;
     }
diff --git a/includes/plugins/vcs_auth/account.inc b/includes/plugins/vcs_auth/account.inc
index 6fbe23e..8497a0c 100644
--- a/includes/plugins/vcs_auth/account.inc
+++ b/includes/plugins/vcs_auth/account.inc
@@ -1,5 +1,8 @@
 <?php
-
+/**
+ * @file
+ *   Defines account vcs_auth plugin.
+ */
 $plugin = array(
   'title' => t('Account (restricted write access)'),
   'handler' => array(
diff --git a/includes/plugins/vcs_auth/ffa.inc b/includes/plugins/vcs_auth/ffa.inc
index f31414b..b9e0f4a 100644
--- a/includes/plugins/vcs_auth/ffa.inc
+++ b/includes/plugins/vcs_auth/ffa.inc
@@ -1,8 +1,11 @@
 <?php
-
+/**
+ * @file
+ *   Defines the free for all unrestricted plugin.
+ */
 $plugin = array(
   'title' => t('Free For All (unrestricted write access)'),
   'handler' => array(
     'class' => 'VersioncontrolAuthHandlerFFA',
   ),
-);
\ No newline at end of file
+);
diff --git a/includes/plugins/views_sets/repositories_admin.inc b/includes/plugins/views_sets/repositories_admin.inc
index 1d60b07..07f09fe 100644
--- a/includes/plugins/views_sets/repositories_admin.inc
+++ b/includes/plugins/views_sets/repositories_admin.inc
@@ -1,8 +1,11 @@
 <?php
-
-$plugin = array (
+/**
+ * @file
+ *   Defines the admin repository listing view set.
+ */
+$plugin = array(
   'title' => t('Administrative repository listing'),
-  'description' => t('An administrative list of repositories, used in the VCAPI-provided repository management UI at !link', array('!link' => l('repository management UI', 'admin/content/versioncontrol-repositories'))),
+  'description' => t('An administrative list of repositories, used in the VCAPI-provided repository management UI at !link', array('!link' => l(t('repository management UI'), 'admin/content/versioncontrol-repositories'))),
   'handler' => array(
     'class' => 'VersioncontrolViewsSetRepositoriesAdmin',
   ),
diff --git a/includes/views/handlers/versioncontrol_handler_field_item_revision_action.inc b/includes/views/handlers/versioncontrol_handler_field_item_revision_action.inc
index 753c96e..5c07978 100644
--- a/includes/views/handlers/versioncontrol_handler_field_item_revision_action.inc
+++ b/includes/views/handlers/versioncontrol_handler_field_item_revision_action.inc
@@ -1,5 +1,8 @@
 <?php
-
+/**
+ * @file
+ *   Provides an "actions" field for item revisions in views.
+ */
 class versioncontrol_handler_field_item_revision_action extends views_handler_field {
 
   function render($values) {
diff --git a/includes/views/handlers/versioncontrol_handler_field_item_revision_lines_changed.inc b/includes/views/handlers/versioncontrol_handler_field_item_revision_lines_changed.inc
index 5116a5e..67ef0df 100644
--- a/includes/views/handlers/versioncontrol_handler_field_item_revision_lines_changed.inc
+++ b/includes/views/handlers/versioncontrol_handler_field_item_revision_lines_changed.inc
@@ -1,7 +1,7 @@
 <?php
-
 /**
- * Views Field handler to provide a combined output of lines added and deleted
+ * @file
+ *   Views Field handler to provide a combined output of lines added and deleted
  * from a file.
  */
 class versioncontrol_handler_field_item_revision_lines_changed extends views_handler_field {
diff --git a/includes/views/handlers/versioncontrol_handler_field_item_revision_path.inc b/includes/views/handlers/versioncontrol_handler_field_item_revision_path.inc
index b7f3f1d..1d20481 100644
--- a/includes/views/handlers/versioncontrol_handler_field_item_revision_path.inc
+++ b/includes/views/handlers/versioncontrol_handler_field_item_revision_path.inc
@@ -1,4 +1,9 @@
 <?php
+/**
+ * @file
+ *   Provides a field to dynamically provide a link from a revision item
+ *   to a vcs viewer.
+ */
 class versioncontrol_handler_field_item_revision_path extends views_handler_field {
   public $backends = NULL;
   public $repositories = array();
diff --git a/includes/views/handlers/versioncontrol_handler_field_item_revision_visual_diffstat.inc b/includes/views/handlers/versioncontrol_handler_field_item_revision_visual_diffstat.inc
index 4e8fb1a..ffbaf0f 100644
--- a/includes/views/handlers/versioncontrol_handler_field_item_revision_visual_diffstat.inc
+++ b/includes/views/handlers/versioncontrol_handler_field_item_revision_visual_diffstat.inc
@@ -1,8 +1,8 @@
 <?php
-
 /**
- * Views Field handler to provide visual diffstat representation of changes to
- * a specific file.
+ * @file
+ *   Views Field handler to provide visual diffstat representation of changes to
+ *   a specific file.
  */
 class versioncontrol_handler_field_item_revision_visual_diffstat extends views_handler_field {
   function construct() {
@@ -48,7 +48,8 @@ class versioncontrol_handler_field_item_revision_visual_diffstat extends views_h
     // to show than places, just display without using percentages.
     if ($single_operation || !$adjust_perentages) {
       $result = array('add' => $added, 'remove' => $removed);
-    } else {
+    }
+    else {
       // Adjust percentages so that if too close to 50%, they are rounded down
       $this->adjust_percentages($places, $add_percentage);
       $this->adjust_percentages($places, $remove_percentage);
diff --git a/includes/views/handlers/versioncontrol_handler_field_operation_attribution.inc b/includes/views/handlers/versioncontrol_handler_field_operation_attribution.inc
index 7493a24..2d71fdc 100644
--- a/includes/views/handlers/versioncontrol_handler_field_operation_attribution.inc
+++ b/includes/views/handlers/versioncontrol_handler_field_operation_attribution.inc
@@ -1,8 +1,8 @@
 <?php
-
 /**
- * Views Field handler to show an author mapped to a drupal user if
- * possible. It also shows the committer if it is different.
+ * @file
+ *   Views Field handler to show an author mapped to a drupal user if
+ *   possible. It also shows the committer if it is different.
  */
 class versioncontrol_handler_field_operation_attribution extends versioncontrol_handler_field_operation_person {
 
diff --git a/includes/views/handlers/versioncontrol_handler_field_operation_date.inc b/includes/views/handlers/versioncontrol_handler_field_operation_date.inc
index 81d21ff..22f3e0f 100644
--- a/includes/views/handlers/versioncontrol_handler_field_operation_date.inc
+++ b/includes/views/handlers/versioncontrol_handler_field_operation_date.inc
@@ -1,6 +1,7 @@
 <?php
 /**
- * A handler to provide date for operation with optional link to operation.
+ * @file
+ *   A handler to provide date for operation with optional link to operation.
  */
 class versioncontrol_handler_field_operation_date extends views_handler_field_date {
   function option_definition() {
diff --git a/includes/views/handlers/versioncontrol_handler_field_operation_labels.inc b/includes/views/handlers/versioncontrol_handler_field_operation_labels.inc
index 066d360..9b7b742 100755
--- a/includes/views/handlers/versioncontrol_handler_field_operation_labels.inc
+++ b/includes/views/handlers/versioncontrol_handler_field_operation_labels.inc
@@ -1,7 +1,7 @@
 <?php
-
 /**
- * Views Field handler to show the list of label names this operation is in.
+ * @file
+ *   Views Field handler to show the list of label names this operation is in.
  */
 class versioncontrol_handler_field_operation_labels extends views_handler_field {
   public $backends = array();
diff --git a/includes/views/handlers/versioncontrol_handler_field_operation_message.inc b/includes/views/handlers/versioncontrol_handler_field_operation_message.inc
index 6805352..542cbef 100644
--- a/includes/views/handlers/versioncontrol_handler_field_operation_message.inc
+++ b/includes/views/handlers/versioncontrol_handler_field_operation_message.inc
@@ -1,8 +1,8 @@
 <?php
-
 /**
- * Version Control API field handler to be able to generate bug tracker
- * links.
+ * @file
+ *   Version Control API field handler to be able to generate bug tracker
+ *   links.
  */
 class versioncontrol_handler_field_operation_message extends views_handler_field {
   function option_definition() {
@@ -26,10 +26,10 @@ class versioncontrol_handler_field_operation_message extends views_handler_field
     if (empty($this->options['issue_tracker_url'])) {
       return $message;
     }
-    return preg_replace('/#(\d+)\b/ie',
-      "strtr('<a href=\"!url\">#\\1</a>', array('!url' => strtr(\$this->options['issue_tracker_url'], array('%issue_id' => \\1))))",
-      htmlspecialchars($message)
-    );
+    $matches = array();
+    preg_match('/#(\d+)\b/i', $message, $matches);
+    $link = str_replace('%issue_id', $matches[1], $this->options['issue_tracker_url']);
+    return l($matches[0], $link);
   }
 
 }
diff --git a/includes/views/handlers/versioncontrol_handler_field_operation_person.inc b/includes/views/handlers/versioncontrol_handler_field_operation_person.inc
index bc160cb..884df15 100644
--- a/includes/views/handlers/versioncontrol_handler_field_operation_person.inc
+++ b/includes/views/handlers/versioncontrol_handler_field_operation_person.inc
@@ -1,8 +1,8 @@
 <?php
-
 /**
- * Views Field handler to show an author or committer, mapped to a
- * drupal user if possible.
+ * @file
+ *   Views Field handler to show an author or committer, mapped to a
+ *   drupal user if possible.
  */
 class versioncontrol_handler_field_operation_person extends views_handler_field {
 
diff --git a/includes/views/handlers/versioncontrol_handler_field_operation_revision.inc b/includes/views/handlers/versioncontrol_handler_field_operation_revision.inc
index 1bc0d0a..b268c35 100644
--- a/includes/views/handlers/versioncontrol_handler_field_operation_revision.inc
+++ b/includes/views/handlers/versioncontrol_handler_field_operation_revision.inc
@@ -1,8 +1,8 @@
 <?php
-
 /**
- * Version Control API field handler to output the right value of the
- * VersioncontrolOperation::revision.
+ * @file
+ *   Version Control API field handler to output the right value of the
+ *   VersioncontrolOperation::revision.
  */
 class versioncontrol_handler_field_operation_revision extends views_handler_field {
   public $backends = NULL;
diff --git a/includes/views/handlers/versioncontrol_handler_field_operation_type.inc b/includes/views/handlers/versioncontrol_handler_field_operation_type.inc
index ab7e7c6..a3d3199 100755
--- a/includes/views/handlers/versioncontrol_handler_field_operation_type.inc
+++ b/includes/views/handlers/versioncontrol_handler_field_operation_type.inc
@@ -1,8 +1,7 @@
 <?php
-
 /**
- * Views Field handler to convert the numeric type field into text
- *
+ * @file
+ *   Views Field handler to convert the numeric type field into text
  */
 class versioncontrol_handler_field_operation_type extends views_handler_field {
 
diff --git a/includes/views/handlers/versioncontrol_handler_field_repository_actions.inc b/includes/views/handlers/versioncontrol_handler_field_repository_actions.inc
index 2bbc9fe..66c2bf6 100644
--- a/includes/views/handlers/versioncontrol_handler_field_repository_actions.inc
+++ b/includes/views/handlers/versioncontrol_handler_field_repository_actions.inc
@@ -1,7 +1,7 @@
 <?php
-
 /**
- * Views Field handler to provide repository action links.
+ * @file
+ *   Views Field handler to provide repository action links.
  */
 class versioncontrol_handler_field_repository_actions extends views_handler_field {
 
@@ -20,11 +20,11 @@ class versioncontrol_handler_field_repository_actions extends views_handler_fiel
     $links = array(
       array(
         'title' => t('Edit'),
-        'href' => 'admin/content/versioncontrol-repositories/edit/'. $values->{$this->field_alias},
+        'href' => 'admin/content/versioncontrol-repositories/edit/' . $values->{$this->field_alias},
       ),
       array(
         'title' => t('Delete'),
-        'href' => 'admin/content/versioncontrol-repositories/delete/'. $values->{$this->field_alias},
+        'href' => 'admin/content/versioncontrol-repositories/delete/' . $values->{$this->field_alias},
       ),
     );
     return theme('links', array('links' => $links));
diff --git a/includes/views/handlers/versioncontrol_handler_field_repository_manual_fetch.inc b/includes/views/handlers/versioncontrol_handler_field_repository_manual_fetch.inc
index 76b232c..1050739 100644
--- a/includes/views/handlers/versioncontrol_handler_field_repository_manual_fetch.inc
+++ b/includes/views/handlers/versioncontrol_handler_field_repository_manual_fetch.inc
@@ -1,7 +1,7 @@
 <?php
-
 /**
- * Views Field handler to provide repository manual log fetching links.
+ * @file
+ *   Views Field handler to provide repository manual log fetching links.
  */
 class versioncontrol_handler_field_repository_manual_fetch extends views_handler_field {
 
diff --git a/includes/views/handlers/versioncontrol_handler_filter_operation_type.inc b/includes/views/handlers/versioncontrol_handler_filter_operation_type.inc
index fb969e8..f9681f4 100755
--- a/includes/views/handlers/versioncontrol_handler_filter_operation_type.inc
+++ b/includes/views/handlers/versioncontrol_handler_filter_operation_type.inc
@@ -1,15 +1,14 @@
 <?php
-
 /**
- * Views filter handler to allow filtering based on the type of operation
+ * @file
+ *   Views filter handler to allow filtering based on the type of operation
  *
  * Provides text select box rather than requiring the numeric ID
  */
-
 class versioncontrol_handler_filter_operation_type extends views_handler_filter_in_operator {
-  
+
   function get_value_options() {
     require_once drupal_get_path('module', 'versioncontrol') . '/includes/VersioncontrolOperation.php';
     $this->value_options = versioncontrol_operation_types();
-  } 
+  }
 }
diff --git a/includes/views/handlers/versioncontrol_handler_filter_operation_type_label.inc b/includes/views/handlers/versioncontrol_handler_filter_operation_type_label.inc
index 7b932f5..c8a668e 100755
--- a/includes/views/handlers/versioncontrol_handler_filter_operation_type_label.inc
+++ b/includes/views/handlers/versioncontrol_handler_filter_operation_type_label.inc
@@ -1,29 +1,27 @@
 <?php
-
 /**
- * Views filter handler to filter by label BUT also allows limitting based on type
+ * @file
+ *   Views filter handler to filter by label BUT also limitting based on type.
  *
  * Uses a standard string handler but adds the type to the options field
- * This is primarily to allow the exposed filter to have a link like tag= or branch=
- * and be able to filter properly. 
- * 
+ * This is primarily to allow the exposed filter to have a link like tag= or
+ * branch= and be able to filter properly.
  */
 class versioncontrol_handler_filter_operation_type_label extends views_handler_filter_string {
-  
+
   function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
-    
+
     $options = array(
       0 => t("All"),
     ) + versioncontrol_operation_types();
-    
+
     $form['operation_type'] = array(
       '#type' => 'radios',
       '#title' => t('Operation type'),
       '#default_value' => $this->options['operation_type'],
       '#options' => $options,
     );
-    
   }
 
   function query() {
@@ -33,6 +31,4 @@ class versioncontrol_handler_filter_operation_type_label extends views_handler_f
       $this->query->add_where($this->options['group'], $this->table_alias . ".type = %d", $type);
     }
   }
-  
-  
 }
diff --git a/includes/views/handlers/versioncontrol_handler_filter_repo_backend.inc b/includes/views/handlers/versioncontrol_handler_filter_repo_backend.inc
index 4e75e95..6bf5ba1 100755
--- a/includes/views/handlers/versioncontrol_handler_filter_repo_backend.inc
+++ b/includes/views/handlers/versioncontrol_handler_filter_repo_backend.inc
@@ -1,7 +1,7 @@
 <?php
-
 /**
- * Views filter handler that pulls the formatted name from the backend object.
+ * @file
+ *   Views filter handler that pulls the formatted name from the backend object.
  *
  * This is purely a useability enhancement.
  */
diff --git a/includes/views/handlers/versioncontrol_plugin_style_operations.inc b/includes/views/handlers/versioncontrol_plugin_style_operations.inc
index d3a8ab4..cea6d9b 100755
--- a/includes/views/handlers/versioncontrol_plugin_style_operations.inc
+++ b/includes/views/handlers/versioncontrol_plugin_style_operations.inc
@@ -1,7 +1,7 @@
 <?php
-
 /**
- * Views style plugin to display a date grouped list of items
+ * @file
+ *   Views style plugin to display a date grouped list of items
  *
  * The default handlers cannot group if the row plugin doesn't support fields
  * so the commit log is generated using this.
@@ -12,15 +12,15 @@ class versioncontrol_plugin_style_operations extends views_plugin_style {
   var $formatting = "M d, Y";
   function query() {
     parent::query();
-    
+
     $this->view->query->add_field('versioncontrol_operations', 'date');
   }
-  
+
   function render() {
     if (empty($this->row_plugin)) {
       vpr('versioncontrol_plugin_style_operations: Missing row plugin');
     }
-    
+
     $group_alias = '';
     foreach ($this->view->query->fields as $alias => $data) {
       if ($data['field'] == 'date') {
@@ -32,14 +32,14 @@ class versioncontrol_plugin_style_operations extends views_plugin_style {
 
     foreach ($this->view->result as $index => $row) {
       $date = format_date($row->{$group_alias}, 'custom', $this->formatting);
-      $groups[$date][] = array($this->row_plugin->render($row)); 
+      $groups[$date][] = array($this->row_plugin->render($row));
     }
-    
+
     foreach ($groups as $date => $rows) {
         $groups[$date] = theme('table', array(), $rows);
     }
-    
+
     return theme($this->theme_functions(), $this->view, $this->options, $groups, $title);
   }
-  
+
 }
diff --git a/includes/views/versioncontrol.views.inc b/includes/views/versioncontrol.views.inc
index 00cd63d..29470eb 100755
--- a/includes/views/versioncontrol.views.inc
+++ b/includes/views/versioncontrol.views.inc
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * @file
  *
diff --git a/includes/views/versioncontrol.views_default.inc b/includes/views/versioncontrol.views_default.inc
index 20d587b..e7837fe 100644
--- a/includes/views/versioncontrol.views_default.inc
+++ b/includes/views/versioncontrol.views_default.inc
@@ -1,4 +1,8 @@
 <?php
+/**
+ * @file
+ *   Provides default views for versioncontrol module.
+ */
 
 /**
  * Implements hook_views_default_views().
diff --git a/includes/worker.inc b/includes/worker.inc
index 06d922e..d18df50 100644
--- a/includes/worker.inc
+++ b/includes/worker.inc
@@ -23,7 +23,7 @@ function _versioncontrol_repomgr_run_worker($data) {
     watchdog('versioncontrol', $str, array(), WATCHDOG_ERROR);
     throw new Exception($str, E_ERROR);
   }
-  else if ($data['repository'] instanceof VersioncontrolRepository) {
+  elseif ($data['repository'] instanceof VersioncontrolRepository) {
     // Full object was serialized, no loading required
     $repo = $data['repository'];
   }
@@ -83,7 +83,7 @@ function _versioncontrol_reposync_run_worker($data) {
     watchdog('versioncontrol', $str, array(), WATCHDOG_ERROR);
     throw new Exception($str, E_ERROR);
   }
-  else if ($data['repository'] instanceof VersioncontrolRepository) {
+  elseif ($data['repository'] instanceof VersioncontrolRepository) {
     // Full object was serialized, no loading required
     $repository = $data['repository'];
   }
diff --git a/tests/VersioncontrolTestCase.test b/tests/VersioncontrolTestCase.test
index 19cd91b..3baee99 100644
--- a/tests/VersioncontrolTestCase.test
+++ b/tests/VersioncontrolTestCase.test
@@ -1,5 +1,8 @@
 <?php
-
+/**
+ * @file
+ *   The primary versioncontrol simpletest suite.
+ */
 abstract class VersioncontrolTestCase extends DrupalWebTestCase {
   const BACKENDS_TEST = 0x001;
   const BACKENDS_ENABLED = 0x002;
@@ -75,7 +78,7 @@ abstract class VersioncontrolTestCase extends DrupalWebTestCase {
 
     // Optionally disable controller caching during tests.
     if (TRUE === $this->disableControllerCaching) {
-      foreach($this->backends as $backend) {
+      foreach ($this->backends as $backend) {
         $backend->disableControllerCaching();
       }
     }
diff --git a/tests/plugins/reposync/exceptioner.inc b/tests/plugins/reposync/exceptioner.inc
index 2e4d364..8b7a0d4 100644
--- a/tests/plugins/reposync/exceptioner.inc
+++ b/tests/plugins/reposync/exceptioner.inc
@@ -1,5 +1,8 @@
 <?php
-
+/**
+ * @file
+ *   Defines a plugin synchronizer for use in tests.
+ */
 $plugin = array(
   'title' => t('Test synchronizer'),
   'worker' => array(
diff --git a/tests/versioncontrol_test.inc b/tests/versioncontrol_test.inc
index 01eb8d7..32796a2 100644
--- a/tests/versioncontrol_test.inc
+++ b/tests/versioncontrol_test.inc
@@ -26,7 +26,7 @@ class VersioncontrolTestBackend extends VersioncontrolBackend {
     );
 
     $this->classesControllers = array(
-      'event'	  => 'VersioncontrolTestEventController',
+      'event'     => 'VersioncontrolTestEventController',
     );
     parent::__construct();
   }
diff --git a/versioncontrol.admin.inc b/versioncontrol.admin.inc
index b7666e2..1c32195 100644
--- a/versioncontrol.admin.inc
+++ b/versioncontrol.admin.inc
@@ -185,7 +185,12 @@ function versioncontrol_admin_views_sets_edit($form, &$form_state) {
       }
 
       if (empty($base_options[$current_view])) {
-        drupal_set_message("Unknown view '$current_view' currently assigned for backend '$vcs' on set '$set_name'. Attempting to use this set will cause nasty errors.", 'error');
+        $args = array(
+          '@current_view' => $current_view,
+          '@vcs' => $vcs,
+          '@set_name' => $set_name,
+        );
+        drupal_set_message(t("Unknown view '@current_view' currently assigned for backend '@vcs' on set '@set_name'. Attempting to use this set will cause nasty errors.", $args), 'error');
       }
 
       $form[$set_name][$vcs] = array(
@@ -384,7 +389,7 @@ function versioncontrol_admin_repository_list($form, &$form_state) {
   foreach ($backends as $vcs => $backend) {
     $title = t('@vcs repositories', array('@vcs' => $backend->name));
     $form[$vcs] = array(
-      '#marup' => '<h4>'. $title .'</h4>',
+      '#marup' => '<h4>' . $title . '</h4>',
     );
     $form[$vcs . '_repositories'] = array(
       '#markup' => views_embed_view($set->getViewNameByBackend($backend), 'default', $vcs),
@@ -465,7 +470,7 @@ function versioncontrol_admin_repository_edit($form, &$form_state, $repository,
   $text = t('Versioncontrol can map commit activity in this repository to user accounts. These options allow you to select the logic that should be used to perform the mapping between Drupal users and raw VCS data.');
   $text .= '<br/><br/>';
   $text .= t('Versioncontrol internally allows for both "authors" and "committers" to be tracked on each commit, so you can choose distinct mapping logic for each.');
-  
+
   $form['user_mapping'] = array(
     '#type' => 'fieldset',
     '#title' => t('User mapping'),
@@ -474,7 +479,7 @@ function versioncontrol_admin_repository_edit($form, &$form_state, $repository,
     '#collapsed' => FALSE,
     '#weight' => 5,
   );
-  
+
   $form['user_mapping']['author_mapper'] = array(
     '#type' => 'radios',
     '#title' => t('Author mapping'),
@@ -482,7 +487,7 @@ function versioncontrol_admin_repository_edit($form, &$form_state, $repository,
     '#default_value' => $repository_exists ? $repository->plugins['author_mapper'] : variable_get('versioncontrol_repository_plugin_default_user_mapping_methods', 'none'),
     '#options' => versioncontrol_user_mapping_methods_get_names(),
   );
-  
+
   $form['user_mapping']['committer_mapper'] = array(
     '#type' => 'radios',
     '#title' => t('Committer mapping'),
@@ -490,7 +495,7 @@ function versioncontrol_admin_repository_edit($form, &$form_state, $repository,
     '#default_value' => $repository_exists ? $repository->plugins['committer_mapper'] : variable_get('versioncontrol_repository_plugin_default_user_mapping_methods', 'none'),
     '#options' => versioncontrol_user_mapping_methods_get_names(),
   );
-  
+
   $form['user_authentication'] = array(
     '#type' => 'fieldset',
     '#title' => t('User authentication'),
@@ -499,7 +504,7 @@ function versioncontrol_admin_repository_edit($form, &$form_state, $repository,
     '#collapsed' => FALSE,
     '#weight' => 5,
   );
-  
+
   $form['user_authentication']['auth_handler'] = array(
     '#type' => 'radios',
     '#title' => t('Authentication & access'),
@@ -531,7 +536,7 @@ function versioncontrol_admin_repository_edit($form, &$form_state, $repository,
     '#default_value' => $repository_exists ? $repository->plugins['webviewer_url_handler'] : variable_get('versioncontrol_repository_plugin_default_webviewer_url_handler', 'none'),
     '#options' => versioncontrol_webviewer_url_handlers_get_names($form['#vcs']),
   );
-  
+
   $form['submit'] = array(
     '#type' => 'submit',
     '#value' => t('Save repository'),
@@ -583,7 +588,7 @@ function versioncontrol_admin_repository_edit_submit($form, &$form_state) {
 
   // Let other modules alter the repository array.
   foreach (module_implements('versioncontrol_repository_submit') as $module) {
-    $function = $module .'_versioncontrol_repository_submit';
+    $function = $module . '_versioncontrol_repository_submit';
     $function($repository, $form, $form_state);
   }
 
diff --git a/versioncontrol.api.php b/versioncontrol.api.php
index f1cc207..59f6622 100644
--- a/versioncontrol.api.php
+++ b/versioncontrol.api.php
@@ -60,25 +60,25 @@ function hook_versioncontrol_backends() {
 /**
  * Take action before a resync is performed.
  *
- * @param VersioncontrolRepository $versioncontrolRepository
+ * @param VersioncontrolRepository $versioncontrol_repository
  *   The versioncontrol repository about to be synced.
  * @param Boolean $bypass
  *   Whether to bypass loading and then calling the delete method for each
  *   entity that needs to be deleted before resyncing.  Almost always true.
  */
-function hook_versioncontrol_repository_pre_resync($versioncontrolRepository, $bypass) {
+function hook_versioncontrol_repository_pre_resync(VersioncontrolRepository $versioncontrol_repository, $bypass) {
 }
 
 /**
  * Take action after a resync is performed.
  *
- * @param VersioncontrolRepository $versioncontrolRepository
+ * @param VersioncontrolRepository $versioncontrol_repository
  *   The versioncontrol repository about to be synced.
  * @param Boolean $bypass
  *   Whether to bypass loading and then calling the delete method for each
  *   entity that needs to be deleted before resyncing.  Almost always true.
  */
-function versioncontrol_repository_post_resync($versioncontrolRepository, $bypass) {
+function versioncontrol_repository_post_resync($versioncontrol_repository, $bypass) {
 }
 
 /**
@@ -90,10 +90,10 @@ function versioncontrol_repository_post_resync($versioncontrolRepository, $bypas
  * other modules to run cleanup operations that would normally run when delete()
  * is invoked.
  *
- * @param VersioncontrolRepository $versioncontrolRepository
+ * @param VersioncontrolRepository $versioncontrol_repository
  *   The versioncontrol repository about to be synced.
  */
-function hook_versioncontrol_repository_bypassing_purge($versioncontrolRepository) {
+function hook_versioncontrol_repository_bypassing_purge($versioncontrol_repository) {
 }
 
 
diff --git a/versioncontrol.drush.inc b/versioncontrol.drush.inc
index 3c5f2f4..572a4d2 100644
--- a/versioncontrol.drush.inc
+++ b/versioncontrol.drush.inc
@@ -167,7 +167,7 @@ function drush_versioncontrol_vcapi_map_operations() {
       if ($only_authors) {
         $conditions['author_uid'] = 0;
       }
-      else if ($only_committers) {
+      elseif ($only_committers) {
         $conditions['committer_uid'] = 0;
       }
     }
diff --git a/versioncontrol.install b/versioncontrol.install
index b9aadbf..1e72f91 100644
--- a/versioncontrol.install
+++ b/versioncontrol.install
@@ -776,7 +776,7 @@ function versioncontrol_update_6102() {
   // Write the $data array to the respective repositories.
   foreach ($repository_data as $repo_id => $data) {
     $ret[] = update_sql("UPDATE {versioncontrol_repositories}
-                          SET data = '". db_escape_string(serialize($data)) ."'
+                          SET data = '" . db_escape_string(serialize($data)) . "'
                           WHERE repo_id = ". $repo_id);
   }
 
@@ -1317,7 +1317,7 @@ function versioncontrol_update_6315() {
  */
 function versioncontrol_update_6316() {
   $ret = array();
-  db_add_index($ret, 'versioncontrol_item_revisions','vc_op_id', array('vc_op_id'));
+  db_add_index($ret, 'versioncontrol_item_revisions', 'vc_op_id', array('vc_op_id'));
   return $ret;
 }
 
diff --git a/versioncontrol.module b/versioncontrol.module
index 857dfae..324da71 100644
--- a/versioncontrol.module
+++ b/versioncontrol.module
@@ -170,7 +170,7 @@ function versioncontrol_menu() {
   ///       screwed up after activating a new backend in admin/build/modules.
   ///       Make sure this works now.
   foreach (versioncontrol_get_backends() as $vcs => $backend) {
-    $items['admin/content/versioncontrol-repositories/add-'. $vcs] = array(
+    $items['admin/content/versioncontrol-repositories/add-' . $vcs] = array(
       'title' => 'Add @vcs repository',
       'title arguments' => array('@vcs' => $backend->name),
       'page arguments' => array('versioncontrol_admin_repository_edit',
@@ -210,7 +210,7 @@ function versioncontrol_menu() {
  * Implements hook_module_implements_alter().
  */
 function versioncontrol_module_implements_alter(&$implementations, $hook) {
-  // The ctools implementation of hook_registry_files_alter() instantiates
+  // The ctools implementation of `hook_registry_files_alter` instantiates
   // our plugin classes on install before our includes/interfaces.inc has been
   // included causing fatal errors.  Here we ensure that our implementation
   // runs first so that we may always ensure that our interfaces exist
@@ -236,7 +236,7 @@ function versioncontrol_registry_files_alter(&$files, $modules) {
 function versioncontrol_views_api() {
   return array(
     'api' => 3,
-    'path' => drupal_get_path('module', 'versioncontrol'). '/includes/views',
+    'path' => drupal_get_path('module', 'versioncontrol') . '/includes/views',
   );
 }
 
@@ -251,6 +251,9 @@ function versioncontrol_operation_types() {
   );
 }
 
+/**
+ * General helper function to get an array of revision actions.
+ */
 function versioncontrol_revision_actions() {
   return array(
     VERSIONCONTROL_ACTION_ADDED => t('Added'),
@@ -431,6 +434,9 @@ function versioncontrol_get_backends($backend = '', $reset = FALSE) {
   }
 }
 
+/**
+ * Get the list of available views sets.
+ */
 function versioncontrol_get_views_sets() {
   $sets = &drupal_static('versioncontrol_views_sets_assembled', array());
   $db_set_data = &drupal_static('versioncontrol_views_sets_db_data', array());
@@ -484,6 +490,9 @@ function versioncontrol_get_views_sets() {
   return $sets;
 }
 
+/**
+ * Get a single views set by name.
+ */
 function versioncontrol_get_views_set($set) {
   $sets = versioncontrol_get_views_sets();
   if (!empty($sets[$set])) {
diff --git a/versioncontrol.theme.inc b/versioncontrol.theme.inc
index 16afb0b..be945a1 100644
--- a/versioncontrol.theme.inc
+++ b/versioncontrol.theme.inc
@@ -32,7 +32,7 @@ function theme_versioncontrol_diffstat($variables) {
     }
     $output .= '<span class="no-op"> </span>';
   }
-  return '<span class="versioncontrol-diffstat clear-block">'. $output .'</span>';
+  return '<span class="versioncontrol-diffstat clear-block">' . $output . '</span>';
 }
 
 /**
diff --git a/versioncontrol_fakevcs/includes/classes.inc b/versioncontrol_fakevcs/includes/classes.inc
index ec8ce70..f499d92 100644
--- a/versioncontrol_fakevcs/includes/classes.inc
+++ b/versioncontrol_fakevcs/includes/classes.inc
@@ -52,10 +52,10 @@ class VersioncontrolFakeRepository extends VersioncontrolRepository {
       // $revision == '30581e4ec3347d1294ec05a91eec1a8588e5993c'
       // Let's return only the first 12 characters of the revision identifier,
       // like Mercurial (including hgweb) does by default.
-      return substr($revision, 0, 12);
+      return drupal_substr($revision, 0, 12);
 
       // SVN also wants to format revisions in a slightly custom way:
-      return 'r'. $revision;
+      return 'r' . $revision;
     }
   }
 
