Showing 7,504 of 7,504 total issues
Function load
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Galleria.prototype.load = function() {
// pass if no data is provided or facebook option not found
if ( arguments.length || typeof this._options.facebook !== 'string' ) {
load.apply( this, Galleria.utils.array( arguments ) );
Method install_themes_dashboard
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function install_themes_dashboard() {
install_theme_search_form();
?>
<h4><?php _e('Feature Filter') ?></h4>
<form method="post" action="<?php echo admin_url( 'theme-install.php?tab=search' ); ?>">
Method choose_primary_blog
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function choose_primary_blog() {
?>
<table class="form-table">
<tr>
<?php /* translators: My sites label */ ?>
Method bulk_upgrade
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function bulk_upgrade($plugins) {
$this->init();
$this->bulk = true;
$this->upgrade_strings();
Method print_column_headers
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function print_column_headers( $with_id = true ) {
list( $columns, $hidden, $sortable ) = $this->get_column_info();
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = remove_query_arg( 'paged', $current_url );
Method create_post
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function create_post() {
global $blog_id, $user_ID;
$this->get_accepted_content_type($this->atom_content_types);
$parser = new AtomParser();
Method wp_unique_post_slug
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent) {
if ( in_array( $post_status, array( 'draft', 'pending' ) ) )
return $slug;
global $wpdb, $wp_rewrite;
Method sanitize_post_field
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function sanitize_post_field($field, $value, $post_id, $context) {
$int_fields = array('ID', 'post_parent', 'menu_order');
if ( in_array($field, $int_fields) )
$value = (int) $value;
Method remove_dot_segments
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function remove_dot_segments($input)
{
$output = '';
while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
{
Method remove_dot_segments
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function remove_dot_segments($input)
{
$output = '';
while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
{
Method remove_dot_segments
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function remove_dot_segments($input)
{
$output = '';
while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
{
Method get_allowed_on_site
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get_allowed_on_site( $blog_id = null ) {
static $allowed_themes = array();
if ( ! $blog_id || ! is_multisite() )
$blog_id = get_current_blog_id();
Method remove_user_from_blog
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function remove_user_from_blog($user_id, $blog_id = '', $reassign = '') {
global $wpdb;
switch_to_blog($blog_id);
$user_id = (int) $user_id;
/**
Method get_option
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_option( $option, $default = false ) {
global $wpdb;
$option = trim( $option );
if ( empty( $option ) )
Method RegisterBundles
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery-ui-{version}.js",
Method fill_query_vars
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fill_query_vars($array) {
$keys = array(
'error'
, 'm'
, 'p'
Method Handle
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public IEnumerable Handle(Func<Guid, ParticipantAggregate> al, CreateParticipant command)
{
var agg = al(command.Id);
if (agg.EventsLoaded > 0)
Method BuildMatchTableHtml
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public String BuildMatchTableHtml(Match match)
{
var scoreRows = "";
for (var i = 0; i < match.Home.Bowlers.Count; i++)
{
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ( type = jQuery('#type-of-' + id).val() )
jQuery('#' + type + '-counter').text( jQuery('#' + type + '-counter').text() - 1 );
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 71.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
String.prototype.gsub.prepareReplacement = function(replacement) {
if (Object.isFunction(replacement)) return replacement;
var template = new Template(replacement);
return function(match) { return template.evaluate(match) };
};
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 71.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76