npolar/api.npolar.no

View on GitHub

Showing 206 of 227 total issues

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

    def before(request)

      before = config[:before]||[]
      if storage.respond_to? :model and storage.model.class.respond_to? :before
        before << storage.model.class.before
Severity: Minor
Found in lib/npolar/api/core.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 is_doi_metadata_changed? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def is_doi_metadata_changed? d,k
    if not k.respond_to? :xpath
      log.warn "No existing kernel provided for #{d.id}"
      return true
    end
Severity: Minor
Found in migration/dataset/dataset_doi.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 GeoJSON has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def GeoJSON(opts={ })

      features = parse

      features = features.select {|m|
Severity: Minor
Found in external/telonics.com/lib/telonics/telonics_condensed_csv_parser.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 accept_format has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def accept_format
        return "" if env['HTTP_ACCEPT'].nil?
  
        format = env['HTTP_ACCEPT'].scan(/[^;,\s]*\/[^;,\s]*/)[0].split("/")[1]
        
Severity: Minor
Found in lib/npolar/rack/request.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 force_schema has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def force_schema
    lambda {|d|
      d.schema = "http://api.npolar.no/schema/publication-1"
      if not d.topics?
        d.topics = ["other"]
Severity: Minor
Found in migration/publication/publication_migration5.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 find_user_by_mail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def find_user_by_mail(mail)
        user = {}
        i = 0
        search(:filter=> Net::LDAP::Filter.eq("mail", mail)) do |entry|
          # entry -> Net::LDAP::Entry
Severity: Minor
Found in lib/npolar/auth/ldap.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