Showing 463 of 531 total issues

Avoid too many return statements within this function.
Open

                                return it('(color)', t);
Severity: Major
Found in tools/jslint/fulljslint.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                                return it('(punctuator)', t);
    Severity: Major
    Found in tools/jslint/fulljslint.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return match;
      Severity: Major
      Found in tools/jslint/fulljslint.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                                    return it('(number)', t);
        Severity: Major
        Found in tools/jslint/fulljslint.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                                          return it('(regexp)', c);
          Severity: Major
          Found in tools/jslint/fulljslint.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                                    return it('(regexp)', c);
            Severity: Major
            Found in tools/jslint/fulljslint.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                                          return it('(punctuator)', t);
              Severity: Major
              Found in tools/jslint/fulljslint.js - About 30 mins to fix

                Method set_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def set_content(path, content)
                    check_path(path)
                    expand_tree(path)
                    object = @git.root[path]
                    if object && object.type == :tree
                Severity: Minor
                Found in plugins/repositories/gitrb_repository.rb - 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

                Method initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def initialize
                    if (`gm -version` rescue '').include?('GraphicsMagick')
                      @prefix = 'gm'
                    elsif !(`convert -version` rescue '').include?('ImageMagick')
                      raise 'GraphicsMagick or ImageMagick not found'
                Severity: Minor
                Found in plugins/utils/image_magick.rb - 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

                Method post_upload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def post_upload
                      raise 'No file' if !params[:file]
                      page.content = params[:file][:tempfile].read
                      check do |errors|
                        errors << :version_conflict.t if !page.new? && page.version.to_s != params[:version]
                Severity: Minor
                Found in lib/olelo/application.rb - 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

                Method string has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                      def string(name, values = nil, &block)
                        @group.children[name.to_s] = if values || block
                                                       Attribute::Suggestions.new(@group, name, block ? block : values)
                                                     else
                                                       Attribute::String.new(@group, name)
                Severity: Minor
                Found in lib/olelo/attributes.rb - 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

                Method expand_tree has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def expand_tree(path)
                    names = path.split('/')
                    names.pop
                    parent = @git.root
                    names.each do |name|
                Severity: Minor
                Found in plugins/repositories/gitrb_repository.rb - 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

                Method captcha_valid? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def captcha_valid?
                    if Time.now.to_i < session[:olelo_recaptcha_timeout].to_i
                      true
                    elsif params[:recaptcha_challenge_field] && params[:recaptcha_response_field]
                      response = Net::HTTP.post_form(URI.parse('http://api-verify.recaptcha.net/verify'),
                Severity: Minor
                Found in plugins/editor/recaptcha.rb - 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

                Method change_password has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def change_password(user, oldpassword, password)
                    @store.transaction do |store|
                      check do |errors|
                        errors << 'User not found' if !store[user.name]
                        errors << :wrong_password.t if crypt(oldpassword) != store[user.name]['password']
                Severity: Minor
                Found in plugins/authentication/yamlfile.rb - 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

                Method values has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                        def values
                          if Proc === @values
                            @values = @values.call
                            raise 'Values must be Hash or Array' unless Hash === @values || Array === @values
                          end
                Severity: Minor
                Found in lib/olelo/attributes.rb - 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

                Method expand_tree has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def expand_tree(path)
                    names = path.split('/')
                    names.pop
                    parent = work_tree
                    names.each do |name|
                Severity: Minor
                Found in plugins/repositories/rugged_repository.rb - 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

                Method set_content has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def set_content(path, content)
                    check_path(path)
                    expand_tree(path)
                    object = work_tree[path]
                    if object && object.type == :tree
                Severity: Minor
                Found in plugins/repositories/rugged_repository.rb - 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

                Method post_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def post_attributes
                      page.update_attributes(params)
                      redirect build_path(page.path) if @close && !page.modified?
                      check do |errors|
                        errors << :version_conflict.t if !page.new? && page.version.to_s != params[:version]
                Severity: Minor
                Found in lib/olelo/application.rb - 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

                Method get_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def get_version(version = nil)
                    if version
                      commit = @git.rev_parse(version.to_s) rescue nil
                      commit_to_version(commit)
                    else
                Severity: Minor
                Found in plugins/repositories/rugged_repository.rb - 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

                Method etag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def etag
                      unless new?
                        @etag ||= repository.path_etag(path, tree_version)
                        "#{Olelo::VERSION}-#{head? ? 1 : 0}-#{@etag}"
                      end
                Severity: Minor
                Found in lib/olelo/page.rb - 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