Showing 7,504 of 7,504 total issues
Method parseWavPackHeader
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parseWavPackHeader($WavPackChunkData) {
// typedef struct {
// char ckID [4];
// long ckSize;
// short version;
Method wp_admin_bar_site_menu
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wp_admin_bar_site_menu( $wp_admin_bar ) {
// Don't show for logged out users.
if ( ! is_user_logged_in() )
return;
Method search_elements_by_tag
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function search_elements_by_tag($name, &$done, $feeds)
{
if ($this->dom === null)
{
throw new SimplePie_Exception('DOMDocument not found, unable to use locator');
Method get_sql_for_subquery
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_sql_for_subquery( $query ) {
global $wpdb;
// The sub-parts of a $where part
$where_parts = array();
Method merge_items
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function merge_items($urls, $start = 0, $end = 0, $limit = 0)
{
if (is_array($urls) && sizeof($urls) > 0)
{
$items = array();
Method get_comment_class
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
global $comment_alt, $comment_depth, $comment_thread_alt;
$comment = get_comment($comment_id);
Method _wp_specialchars
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
$string = (string) $string;
if ( 0 === strlen( $string ) ) {
return '';
Method EncodeHeader
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function EncodeHeader ($str, $position = 'text') {
$x = 0;
switch (strtolower($position)) {
case 'phrase':
Function ngOnInit
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit(): void {
this.route.params.subscribe(({ year, division }) => {
this.division = division;
this.tournamentsService.getTournament(year)
Method update_meta_cache
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function update_meta_cache($meta_type, $object_ids) {
if ( empty( $meta_type ) || empty( $object_ids ) )
return false;
if ( ! $table = _get_meta_table($meta_type) )
Consider simplifying this complex logical expression. Open
if (file &&
validate(scope, $parse, attr, file, null) &&
(!window.FileAPI || navigator.userAgent.indexOf('MSIE 8') === -1 || file.size < 20000) &&
(!window.FileAPI || navigator.userAgent.indexOf('MSIE 9') === -1 || file.size < 4000000)) {
$timeout(function() {
Consider simplifying this complex logical expression. Open
if (file &&
validate(scope, $parse, attr, file, null) &&
(!window.FileAPI || navigator.userAgent.indexOf('MSIE 8') === -1 || file.size < 20000) &&
(!window.FileAPI || navigator.userAgent.indexOf('MSIE 9') === -1 || file.size < 4000000)) {
$timeout(function() {
Consider simplifying this complex logical expression. Open
if ( typeof(jQuery) != 'undefined' ) {
if ( typeof(jQuery.fn.hoverIntent) == 'undefined' ) {
/* jshint ignore:start */
// hoverIntent r6 - Copy of wp-includes/js/hoverIntent.min.js
(function(a){a.fn.hoverIntent=function(m,d,h){var j={interval:100,sensitivity:7,timeout:0};if(typeof m==="object"){j=a.extend(j,m)}else{if(a.isFunction(d)){j=a.extend(j,{over:m,out:d,selector:h})}else{j=a.extend(j,{over:m,out:m,selector:d})}}var l,k,g,f;var e=function(n){l=n.pageX;k=n.pageY};var c=function(o,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);if((Math.abs(g-l)+Math.abs(f-k))<j.sensitivity){a(n).off("mousemove.hoverIntent",e);n.hoverIntent_s=1;return j.over.apply(n,[o])}else{g=l;f=k;n.hoverIntent_t=setTimeout(function(){c(o,n)},j.interval)}};var i=function(o,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);n.hoverIntent_s=0;return j.out.apply(n,[o])};var b=function(p){var o=jQuery.extend({},p);var n=this;if(n.hoverIntent_t){n.hoverIntent_t=clearTimeout(n.hoverIntent_t)}if(p.type=="mouseenter"){g=o.pageX;f=o.pageY;a(n).on("mousemove.hoverIntent",e);if(n.hoverIntent_s!=1){n.hoverIntent_t=setTimeout(function(){c(o,n)},j.interval)}}else{a(n).off("mousemove.hoverIntent",e);if(n.hoverIntent_s==1){n.hoverIntent_t=setTimeout(function(){i(o,n)},j.timeout)}}};return this.on({"mouseenter.hoverIntent":b,"mouseleave.hoverIntent":b},j.selector)}})(jQuery);
Consider simplifying this complex logical expression. Open
if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS || ( isset($_POST) && count($_POST) ) || is_preview() || is_robots() )
return;
Consider simplifying this complex logical expression. Open
if ( !empty($this->query_vars['withcomments'])
|| false !== strpos( $this->query_vars['feed'], 'comments-' )
|| ( empty($this->query_vars['withoutcomments'])
&& ( !empty($this->query_vars['p'])
|| !empty($this->query_vars['name'])
Consider simplifying this complex logical expression. Open
if (strpos($struct, '%postname%') !== false || strpos($struct, '%post_id%') !== false
|| strpos($struct, '%pagename%') !== false
|| (strpos($struct, '%year%') !== false && strpos($struct, '%monthnum%') !== false && strpos($struct, '%day%') !== false && strpos($struct, '%hour%') !== false && strpos($struct, '%minute%') !== false && strpos($struct, '%second%') !== false)) {
$post = true;
if (strpos($struct, '%pagename%') !== false)
Consider simplifying this complex logical expression. Open
if ( ('' != $qv['attachment']) || !empty($qv['attachment_id']) ) {
$this->is_single = true;
$this->is_attachment = true;
} elseif ( '' != $qv['name'] ) {
$this->is_single = true;
Consider simplifying this complex logical expression. Open
if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup || $this->is_robots ) )
$this->is_home = true;
Consider simplifying this complex logical expression. Open
if (agg.Package == null
|| agg.Package.ManitobaDinner != command.Package.ManitobaDinner
|| agg.Package.ManitobaDance != command.Package.ManitobaDance
|| agg.Package.FinalBanquet != command.Package.FinalBanquet
|| agg.Package.Transportation != command.Package.Transportation
Similar blocks of code found in 2 locations. Consider refactoring. Open
function get_post_field( $field, $post, $context = 'display' ) {
$post = (int) $post;
$post = get_post( $post );
if ( is_wp_error($post) )
- 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 114.
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