Showing 7,504 of 7,504 total issues
Function bind
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
bind: function( elem, value ) {
// todo: revise if alternative tooltip is needed for mobile devices
if (Galleria.TOUCH) {
return;
Function backdrop
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Modal.prototype.backdrop = function (callback) {
var that = this
var animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
Function raise
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Galleria.raise = function( msg, fatal ) {
var type = fatal ? 'Fatal error' : 'Error',
css = {
Function show
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Modal.prototype.show = function (_relatedTarget) {
var that = this
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
this.$element.trigger(e)
Method media_upload_image
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function media_upload_image() {
$errors = array();
$id = 0;
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
Method fs_connect
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fs_connect( $directories = array() ) {
global $wp_filesystem;
if ( false === ($credentials = $this->skin->request_filesystem_credentials()) )
return false;
Method import_post
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function import_post( $entry ) {
global $importing_blog;
// The old permalink is all Blogger gives us to link comments to their posts.
if ( isset( $entry->draft ) )
Method do_core_upgrade
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function do_core_upgrade( $reinstall = false ) {
global $wp_filesystem;
if ( $reinstall )
$url = 'update-core.php?action=do-core-reinstall';
Method step3
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function step3() {
global $wpdb;
set_time_limit( 0 );
update_option( 'ljapi_step', 3 );
Method twentythirteen_header_style
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function twentythirteen_header_style() {
$header_image = get_header_image();
$text_color = get_header_textcolor();
// If no custom options for text are set, let's bail.
Method date_w3cdtf
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function date_w3cdtf($date)
{
static $pcre;
if (!$pcre)
{
Method autodiscovery
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function autodiscovery()
{
$links = array_merge(SimplePie_Misc::get_element('link', $this->file->body), SimplePie_Misc::get_element('a', $this->file->body), SimplePie_Misc::get_element('area', $this->file->body));
$done = array();
$feeds = array();
Method get_id
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_id($hash = false)
{
if (!$hash)
{
if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id'))
Method date_w3cdtf
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function date_w3cdtf($date)
{
static $pcre;
if (!$pcre)
{
Method get_channel_tags
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_channel_tags($namespace, $tag)
{
$type = $this->get_type();
if ($type & SIMPLEPIE_TYPE_ATOM_ALL)
{
Method rewrite_rules
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function rewrite_rules() {
$rewrite = array();
if (empty($this->permalink_structure)) {
return $rewrite;
Method comments_template
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function comments_template( $file = '/comments.php', $separate_comments = false ) {
global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage;
if ( !(is_single() || is_page() || $withcomments) || empty($post) )
return;
Method BuildTables
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void BuildTables()
{
using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
{
con.Open();
Method SaveEventsFor
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void SaveEventsFor<TAggregate>(Guid? id, int eventsLoaded, ArrayList newEvents)
{
// Establish the aggregate ID to save the events under and ensure they
// all have the correct ID.
if (newEvents.Count == 0)
Identical blocks of code found in 3 locations. Consider refactoring. Open
for(i=0;i<Language.syntax.length;i++)
x = x.replace(Language.syntax[i].input,Language.syntax[i].output);
- 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 66.
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