rubinius/rubinius

View on GitHub
library/rubygems/security/policy.rb

Summary

Maintainability
C
1 day
Test Coverage

Method verify has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

  def verify chain, key = nil, digests = {}, signatures = {},
             full_name = '(unknown)'
    if signatures.empty? then
      if @only_signed then
        raise Gem::Security::Exception,
Severity: Minor
Found in library/rubygems/security/policy.rb - About 3 hrs 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 verify has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def verify chain, key = nil, digests = {}, signatures = {},
             full_name = '(unknown)'
    if signatures.empty? then
      if @only_signed then
        raise Gem::Security::Exception,
Severity: Minor
Found in library/rubygems/security/policy.rb - About 1 hr to fix

    Method check_trust has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def check_trust chain, digester, trust_dir
        raise Gem::Security::Exception, 'missing signing chain' unless chain
    
        root = chain.first
    
    
    Severity: Minor
    Found in library/rubygems/security/policy.rb - About 1 hr 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_key has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def check_key signer, key
        unless signer and key then
          return true unless @only_signed
    
          raise Gem::Security::Exception, 'missing key or signature'
    Severity: Minor
    Found in library/rubygems/security/policy.rb - About 45 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 verify has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def verify chain, key = nil, digests = {}, signatures = {},
                 full_name = '(unknown)'
    Severity: Minor
    Found in library/rubygems/security/policy.rb - About 35 mins to fix

      Method check_cert has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def check_cert signer, issuer, time
          raise Gem::Security::Exception, 'missing signing certificate' unless
            signer
      
          message = "certificate #{signer.subject}"
      Severity: Minor
      Found in library/rubygems/security/policy.rb - About 35 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

      There are no issues that match your filters.

      Category
      Status