gitlabhq/gitlabhq

View on GitHub

Showing 2,845 of 2,845 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

const addNewDesignToStore = (store, designManagementUpload, query) => {
  const data = store.readQuery(query);

  const newDesigns = data.project.issue.designCollection.designs.edges.reduce((acc, design) => {
    if (!acc.find(d => d.filename === design.node.filename)) {
Severity: Major
Found in app/assets/javascripts/design_management/utils/cache_update.js and 1 other location - About 2 days to fix
app/assets/javascripts/design_management_new/utils/cache_update.js on lines 166..214

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 360.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

const addNewDesignToStore = (store, designManagementUpload, query) => {
  const data = store.readQuery(query);

  const newDesigns = data.project.issue.designCollection.designs.edges.reduce((acc, design) => {
    if (!acc.find(d => d.filename === design.node.filename)) {
app/assets/javascripts/design_management/utils/cache_update.js on lines 166..214

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 360.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

const addImageDiffNoteToStore = (store, createImageDiffNote, query, variables) => {
  const data = store.readQuery({
    query,
    variables,
  });
app/assets/javascripts/design_management/utils/cache_update.js on lines 89..137

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 351.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

const addImageDiffNoteToStore = (store, createImageDiffNote, query, variables) => {
  const data = store.readQuery({
    query,
    variables,
  });
app/assets/javascripts/design_management_new/utils/cache_update.js on lines 89..137

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 351.

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

Further Reading

File build.rb has 792 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Ci
  class Build < Ci::Processable
    include Ci::Metadatable
    include Ci::Contextable
    include TokenAuthenticatable
Severity: Major
Found in app/models/ci/build.rb - About 1 day to fix

    Function constructor has 375 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      constructor(els, options = {}) {
        const _this = this;
    
        let $els = $(els);
    
    
    Severity: Major
    Found in app/assets/javascripts/labels_select.js - About 1 day to fix

      File services_helpers.rb has 785 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module API
        module Helpers
          # Helpers module for API::Services
          #
          # The data structures inside this model are returned using class methods,
      Severity: Major
      Found in lib/api/helpers/services_helpers.rb - About 1 day to fix

        File pipeline.rb has 773 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Ci
          class Pipeline < ApplicationRecord
            extend Gitlab::Ci::Model
            include Ci::HasStatus
            include Importable
        Severity: Major
        Found in app/models/ci/pipeline.rb - About 1 day to fix

          File repository.rb has 759 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'tempfile'
          require 'forwardable'
          require "rubygems/package"
          
          module Gitlab
          Severity: Major
          Found in lib/gitlab/git/repository.rb - About 1 day to fix

            File gl_dropdown.js has 741 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* eslint-disable max-classes-per-file, one-var, consistent-return */
            
            import $ from 'jquery';
            import { escape } from 'lodash';
            import fuzzaldrinPlus from 'fuzzaldrin-plus';
            Severity: Major
            Found in app/assets/javascripts/gl_dropdown.js - About 1 day to fix

              File boards_store.js has 740 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /* eslint-disable no-shadow, no-param-reassign,consistent-return */
              /* global List */
              
              import $ from 'jquery';
              import { sortBy } from 'lodash';
              Severity: Major
              Found in app/assets/javascripts/boards/stores/boards_store.js - About 1 day to fix

                File users.rb has 734 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module API
                  class Users < Grape::API
                    include PaginationParams
                    include APIGuard
                    include Helpers::CustomAttributes
                Severity: Major
                Found in lib/api/users.rb - About 1 day to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  const memoizedLocale = () => {
                    const cache = [];
                  
                    const timeAgoLocale = [
                      () => [s__('Timeago|just now'), s__('Timeago|right now')],
                  Severity: Major
                  Found in app/assets/javascripts/lib/utils/datetime_utility.js and 1 other location - About 1 day to fix
                  app/assets/javascripts/lib/utils/datetime_utility.js on lines 111..138

                  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 298.

                  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

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  const memoizedLocaleRemaining = () => {
                    const cache = [];
                  
                    const timeAgoLocaleRemaining = [
                      () => [s__('Timeago|just now'), s__('Timeago|right now')],
                  Severity: Major
                  Found in app/assets/javascripts/lib/utils/datetime_utility.js and 1 other location - About 1 day to fix
                  app/assets/javascripts/lib/utils/datetime_utility.js on lines 140..167

                  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 298.

                  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

                  Further Reading

                  File migration_helpers.rb has 693 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module Gitlab
                    module Database
                      module MigrationHelpers
                        include Migrations::BackgroundMigrationHelpers
                  
                  
                  Severity: Major
                  Found in lib/gitlab/database/migration_helpers.rb - About 1 day to fix

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                    const addDiscussionCommentToStore = (store, createNote, query, queryVariables, discussionId) => {
                      const data = store.readQuery({
                        query,
                        variables: queryVariables,
                      });
                    app/assets/javascripts/design_management/utils/cache_update.js on lines 50..87

                    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 274.

                    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

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                    const addDiscussionCommentToStore = (store, createNote, query, queryVariables, discussionId) => {
                      const data = store.readQuery({
                        query,
                        variables: queryVariables,
                      });
                    app/assets/javascripts/design_management_new/utils/cache_update.js on lines 50..87

                    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 274.

                    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

                    Further Reading

                    File filtered_search_manager.js has 663 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { last } from 'lodash';
                    import recentSearchesStorageKeys from 'ee_else_ce/filtered_search/recent_searches_storage_keys';
                    import { getParameterByName, getUrlParamsArray } from '~/lib/utils/common_utils';
                    import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys';
                    import { visitUrl } from '../lib/utils/url_utility';
                    Severity: Major
                    Found in app/assets/javascripts/filtered_search/filtered_search_manager.js - About 1 day to fix

                      boardsStore has 77 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      const boardsStore = {
                        disabled: false,
                        timeTracking: {
                          limitToHours: false,
                        },
                      Severity: Major
                      Found in app/assets/javascripts/boards/stores/boards_store.js - About 1 day to fix

                        Class Converter has 77 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                              class Converter
                                def on_0(_) reset                              end
                        
                                def on_1(_) enable(STYLE_SWITCHES[:bold])      end
                        
                        
                        Severity: Major
                        Found in lib/gitlab/ci/ansi2html.rb - About 1 day to fix
                          Severity
                          Category
                          Status
                          Source
                          Language