gitlabhq/gitlabhq

View on GitHub

Showing 1,662 of 1,662 total issues

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

  const monthNamesAbbr = [s__('Jan'), s__('Feb'), s__('Mar'), s__('Apr'), s__('May'), s__('Jun'), s__('Jul'), s__('Aug'), s__('Sep'), s__('Oct'), s__('Nov'), s__('Dec')];
Severity: Major
Found in app/assets/javascripts/lib/utils/datetime_utility.js and 1 other location - About 1 hr to fix
app/assets/javascripts/lib/utils/datetime_utility.js on lines 181..181

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

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

  resolveAll(mergeRequestId, discussionId) {
    const discussion = CommentsStore.state[discussionId];

    discussion.loading = true;

Severity: Major
Found in app/assets/javascripts/diff_notes/services/resolve.js and 1 other location - About 1 hr to fix
app/assets/javascripts/diff_notes/services/resolve.js on lines 64..73

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

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

    if (executedCommands && executedCommands.length) {
      if (executedCommands.length > 1) {
        tempFormContent = 'Applying multiple commands';
      } else {
        const commandDescription = executedCommands[0].description.toLowerCase();
Severity: Major
Found in app/assets/javascripts/notes.js and 1 other location - About 1 hr to fix
app/assets/javascripts/notes/stores/utils.js on lines 18..25

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

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

  if (executedCommands && executedCommands.length) {
    if (executedCommands.length > 1) {
      text = 'Applying multiple commands';
    } else {
      const commandDescription = executedCommands[0].description.toLowerCase();
Severity: Major
Found in app/assets/javascripts/notes/stores/utils.js and 1 other location - About 1 hr to fix
app/assets/javascripts/notes.js on lines 1637..1646

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

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 monthNames = [s__('January'), s__('February'), s__('March'), s__('April'), s__('May'), s__('June'), s__('July'), s__('August'), s__('September'), s__('October'), s__('November'), s__('December')];
Severity: Major
Found in app/assets/javascripts/lib/utils/datetime_utility.js and 1 other location - About 1 hr to fix
app/assets/javascripts/lib/utils/datetime_utility.js on lines 182..182

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

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

Function data has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        data: function(term, callback) {
          axios.get(labelUrl)
            .then((res) => {
              let data = _.chain(res.data).groupBy(function(label) {
                return label.title;
Severity: Minor
Found in app/assets/javascripts/labels_select.js - About 1 hr to fix

    Method unpack has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def unpack
          Dir.chdir(backup_path) do
            # check for existing backups in the backup dir
            if backup_file_list.empty?
              $progress.puts "No backups found in #{backup_path}"
    Severity: Minor
    Found in lib/backup/manager.rb - About 1 hr to fix

      Method build_event_data has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def build_event_data(model, event)
          data = {
            event_name: build_event_name(model, event),
            created_at: model.created_at&.xmlschema,
            updated_at: model.updated_at&.xmlschema
      Severity: Minor
      Found in app/services/system_hooks_service.rb - About 1 hr to fix

        Method fabricate! has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def fabricate!
                  project.visit!
        
                  Factory::Repository::Push.fabricate! do |resource|
                    resource.project = project
        Severity: Minor
        Found in qa/qa/factory/resource/branch.rb - About 1 hr to fix

          Function GitLabDropdownFilter has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function GitLabDropdownFilter(input, options) {
              var $clearButton, $inputContainer, ref, timeout;
              this.input = input;
              this.options = options;
              this.filterInputBlur = (ref = this.options.filterInputBlur) != null ? ref : true;
          Severity: Minor
          Found in app/assets/javascripts/gl_dropdown.js - About 1 hr to fix

            Function getSearchQuery has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              static getSearchQuery(untilInput = false) {
                const container = FilteredSearchContainer.container;
                const tokens = [].slice.call(container.querySelectorAll('.tokens-container li'));
                const values = [];
            
            
            Severity: Minor
            Found in app/assets/javascripts/filtered_search/dropdown_utils.js - About 1 hr to fix

              Method execute has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def execute
                    if @params[:template_name]&.present?
                      return ::Projects::CreateFromTemplateService.new(current_user, params).execute
                    end
              
              
              Severity: Minor
              Found in app/services/projects/create_service.rb - About 1 hr to fix

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

                        formatResult: function() {
                          var args;
                          args = 1 <= arguments.length ? [].slice.call(arguments, 0) : [];
                          return _this.formatResult.apply(_this, args);
                        },
                Severity: Major
                Found in app/assets/javascripts/users_select.js and 2 other locations - About 1 hr to fix
                app/assets/javascripts/users_select.js on lines 605..609
                app/assets/javascripts/users_select.js on lines 615..619

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

                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 3 locations. Consider refactoring.
                Open

                        formatSelection: function() {
                          var args;
                          args = 1 <= arguments.length ? [].slice.call(arguments, 0) : [];
                          return _this.formatSelection.apply(_this, args);
                        },
                Severity: Major
                Found in app/assets/javascripts/users_select.js and 2 other locations - About 1 hr to fix
                app/assets/javascripts/users_select.js on lines 605..609
                app/assets/javascripts/users_select.js on lines 610..614

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

                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

                  start() {
                    return importU2FLibrary()
                      .then((utils) => {
                        this.u2fUtils = utils;
                        this.renderInProgress();
                Severity: Major
                Found in app/assets/javascripts/u2f/authenticate.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/u2f/register.js on lines 35..42

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

                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

                  start() {
                    return importU2FLibrary()
                      .then((utils) => {
                        this.u2fUtils = utils;
                        this.renderSetup();
                Severity: Major
                Found in app/assets/javascripts/u2f/register.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/u2f/authenticate.js on lines 52..59

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

                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 3 locations. Consider refactoring.
                Open

                        initSelection: function() {
                          var args;
                          args = 1 <= arguments.length ? [].slice.call(arguments, 0) : [];
                          return _this.initSelection.apply(_this, args);
                        },
                Severity: Major
                Found in app/assets/javascripts/users_select.js and 2 other locations - About 1 hr to fix
                app/assets/javascripts/users_select.js on lines 610..614
                app/assets/javascripts/users_select.js on lines 615..619

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

                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

                  updateInputValue({ selectedObj, e }) {
                    e.preventDefault();
                
                    this.$input.val(selectedObj.name);
                    gl.pipelineScheduleFieldErrors.updateFormValidityState();
                app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/timezone_dropdown.js on lines 63..67

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

                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

                    this.input
                      .on('keydown', function (e) {
                        var keyCode = e.which;
                        if (keyCode === 13 && !options.elIsInput) {
                          e.preventDefault();
                Severity: Major
                Found in app/assets/javascripts/gl_dropdown.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/gl_dropdown.js on lines 31..47

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

                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

                  updateInputValue({ selectedObj, e }) {
                    e.preventDefault();
                    this.$input.val(selectedObj.identifier);
                    gl.pipelineScheduleFieldErrors.updateFormValidityState();
                  }
                app/assets/javascripts/pages/projects/pipeline_schedules/shared/components/target_branch_dropdown.js on lines 48..53

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

                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

                Severity
                Category
                Status
                Source
                Language