gitlabhq/gitlabhq

View on GitHub

Showing 1,405 of 2,015 total issues

Avoid too many return statements within this method.
Open

        return unless receiver(namespace_expr) == project_expr
Severity: Major
Found in rubocop/cop/project_path_helper.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

        return unless result
    Severity: Major
    Found in app/models/concerns/diff_positionable_note.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

          return false if @type != :mention && unsubscribed?
      Severity: Major
      Found in app/models/notification_recipient.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return false if last_diff_sha != diff_head_sha
        Severity: Major
        Found in app/models/merge_request.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              return false unless skip_discussions_check || mergeable_discussions_state?
          Severity: Major
          Found in app/models/merge_request.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                return false if diff_refs && diff_refs != noteable.diff_refs
            Severity: Major
            Found in app/models/legacy_diff_note.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    return VALID
              Severity: Major
              Found in app/services/access_token_validation_service.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                      return 4 if @condition.scope == DeclarativePolicy.preferred_scope
                Severity: Major
                Found in lib/declarative_policy/condition.rb - About 30 mins to fix

                  Function unresolvedDiscussionsIdsByDiff has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const unresolvedDiscussionsIdsByDiff = (state, getters) =>
                    getters.allResolvableDiscussions
                      .filter(d => !d.resolved && d.active)
                      .sort((a, b) => {
                        if (!a.diff_file || !b.diff_file) {
                  Severity: Minor
                  Found in app/assets/javascripts/notes/stores/getters.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function types.TOGGLE_LOADING has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    [types.TOGGLE_LOADING](state, { entry, forceValue = undefined }) {
                      if (entry.path) {
                        Object.assign(state.entries[entry.path], {
                          loading: forceValue !== undefined ? forceValue : !state.entries[entry.path].loading,
                        });
                  Severity: Minor
                  Found in app/assets/javascripts/ide/stores/mutations.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function setSearchedGroups has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    setSearchedGroups(rawGroups) {
                      const formatGroups = groups =>
                        groups.map(group => {
                          const formattedGroup = this.formatGroupItem(group);
                          if (formattedGroup.children && formattedGroup.children.length) {
                  Severity: Minor
                  Found in app/assets/javascripts/groups/store/groups_store.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function types.ADD_NEW_NOTE has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    [types.ADD_NEW_NOTE](state, data) {
                      const note = data.discussion ? data.discussion.notes[0] : data;
                      const { discussion_id, type } = note;
                      const [exists] = state.discussions.filter(n => n.id === note.discussion_id);
                      const isDiscussion = type === constants.DISCUSSION_NOTE || type === constants.DIFF_NOTE;
                  Severity: Minor
                  Found in app/assets/javascripts/notes/stores/mutations.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function toggleCollapsed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function toggleCollapsed(event) {
                    const toggleButtonEl = event.currentTarget;
                    const discussionNotesEl = toggleButtonEl.closest('.discussion-notes');
                    const formEl = discussionNotesEl.querySelector('.discussion-form');
                    const isCollapsed = discussionNotesEl.classList.contains('collapsed');
                  Severity: Minor
                  Found in app/assets/javascripts/image_diff/helpers/dom_helper.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function types.SET_FILE_RAW_DATA has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    [types.SET_FILE_RAW_DATA](state, { file, raw }) {
                      const openPendingFile = state.openFiles.find(
                        f => f.path === file.path && f.pending && !(f.tempFile && !f.prevPath),
                      );
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/ide/stores/mutations/file.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function jumpToDiscussion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      jumpToDiscussion(id) {
                        if (id) {
                          const activeTab = window.mrTabs.currentAction;
                  
                          if (activeTab === 'diffs') {
                  Severity: Minor
                  Found in app/assets/javascripts/notes/mixins/discussion_navigation.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    constructor(options = {}) {
                      this.selector = options.selector;
                      this.dataType = options.dataType;
                      this.fieldName = options.fieldName;
                      this.lockVersion = options.lockVersion;
                  Severity: Minor
                  Found in app/assets/javascripts/task_list.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function toggleScrollButtons has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const toggleScrollButtons = ({ dispatch }) => {
                    if (canScroll()) {
                      if (isScrolledToMiddle()) {
                        dispatch('enableScrollTop');
                        dispatch('enableScrollBottom');
                  Severity: Minor
                  Found in app/assets/javascripts/jobs/store/actions.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function onOptionClick has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    onOptionClick(e) {
                      e.preventDefault();
                  
                      const queryData = {};
                  
                  
                  Severity: Minor
                  Found in app/assets/javascripts/groups/groups_filterable_list.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function startRenderDiffsQueue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const startRenderDiffsQueue = ({ state, commit }) => {
                    const checkItem = () =>
                      new Promise(resolve => {
                        const nextFile = state.diffFiles.find(
                          file =>
                  Severity: Minor
                  Found in app/assets/javascripts/diffs/store/actions.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Function keydown has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    keydown: function(e) {
                      if (this.destroyed) return;
                  
                      var hiddenCount = 0;
                      var dataHiddenCount = 0;
                  Severity: Minor
                  Found in app/assets/javascripts/droplab/plugins/filter.js - About 25 mins to fix

                  Cognitive Complexity

                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                  A method's cognitive complexity is based on a few simple rules:

                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                  • Code is considered more complex for each "break in the linear flow of the code"
                  • Code is considered more complex when "flow breaking structures are nested"

                  Further reading

                  Severity
                  Category
                  Status
                  Source
                  Language