openSUSE/open-build-service

View on GitHub

Showing 326 of 426 total issues

Method create has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
Open

  def create
    params[:project][:name] = "#{params[:namespace]}:#{params[:project][:name]}" if params[:namespace]

    @project = Project.new(project_params)
    authorize(@project, :create?)
Severity: Minor
Found in src/api/app/controllers/webui/project_controller.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 project_or_package_link has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
Open

  def project_or_package_link(opts)
    defaults = { package: nil, rev: nil, short: false, trim_to: 40 }
    opts = defaults.merge(opts)

    # only care for database entries
Severity: Minor
Found in src/api/app/helpers/webui/webui_helper.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 buildinfo has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
Open

  def buildinfo
    required_parameters :project, :repository, :arch, :package
    # just for permission checking
    if request.post? && Package.striping_multibuild_suffix(params[:package]) == '_repository'
      # for osc local package build in this repository
Severity: Minor
Found in src/api/app/controllers/build_controller.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 import_from_package has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
Open

      def import_from_package
        package = Package.find(params[:package_id])

        kiwi_file = package.kiwi_image_file

Severity: Minor
Found in src/api/app/controllers/webui/kiwi/images_controller.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 add_schema_mapping has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
Open

      def add_schema_mapping(controller, action, opt)
        raise "missing (or wrong) parameters, #{opt.inspect}" unless opt.key?(:request) || opt.key?(:response)

        # logger.debug "add validation mapping: #{controller.inspect}, #{action.inspect} => #{opt.inspect}"

Severity: Minor
Found in src/api/app/lib/suse/validator.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 check_extracted_user has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
Open

  def check_extracted_user
    unless @http_user
      if @login.blank?
        return true if check_for_anonymous_user

Severity: Minor
Found in src/api/app/lib/authenticator.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