DrupalCon New Orleans 2016
By Joseph D. Purcell
@josephdpurcell
Questions, comments, concerns, objections,
are all welcome!
Anything you know without executing code.
i.e. code smells...
If it stinks, change it.
- Grandma Beck, "Refactoring"
An open source static analysis platform.
Find problems before you merge code.
Search for existing problems.
function wp_ajax_delete_tag() { $tag_id = (int) $_POST['tag_ID']; check_ajax_referer( "delete-tag_$tag_id" ); $taxonomy = !empty($_POST['taxonomy']) ? $_POST['taxonomy'] : 'post_tag'; ...Source: codeclimate.com/repos/5730fdf0d132d84858004be5/issues?category=security...
protected function doLoadMultiple(array $names, $immutable = TRUE) { ... if (isset($GLOBALS['config'][$name])) { $this->cache[$cache_key]->setSettingsOverride($GLOBALS['config'][$name]); ...Source: codeclimate.com/repos/5730f2e8d132d85e94000b46/issues?category=security...
function hook_tokens_alter(array &$replacements, array $context, \Drupal\Core\Render\BubbleableMetadata $bubbleable_metadata) { $options = $context['options']; if (isset($options['langcode'])) { $url_options['language'] = \Drupal::languageManager()->getLanguage($options['langcode']); $langcode = $options['langcode']; } else { $langcode = NULL; } if ($context['type'] == 'node' && !empty($context['data']['node'])) { $node = $context['data']['node']; if (isset($context['tokens']['title'])) { $title = $node->field_title->view('default'); $replacements[$context['tokens']['title']] = drupal_render($title); } } }Source: codeclimate.com/repos...core/lib/Drupal/Core/Utility/token.api.php
Inspect quality of code before using it.
Questions, comments, concerns, objections,
are all welcome!