CocoaPods/Core

View on GitHub
lib/cocoapods-core/specification/linter.rb

Summary

Maintainability
D
2 days
Test Coverage

File linter.rb has 399 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'cocoapods-core/specification/linter/result'
require 'cocoapods-core/specification/linter/analyzer'

module Pod
  class Specification
Severity: Minor
Found in lib/cocoapods-core/specification/linter.rb - About 5 hrs to fix

    Class Linter has 38 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Linter
          # @return [Specification] the specification to lint.
          #
          attr_reader :spec
    
    
    Severity: Minor
    Found in lib/cocoapods-core/specification/linter.rb - About 5 hrs to fix

      Method _validate_scheme has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

            def _validate_scheme(s)
              unless s.empty?
                if consumer.spec.subspec? && consumer.spec.library_specification?
                  results.add_error('scheme', 'Scheme configuration is not currently supported for subspecs.')
                  return
      Severity: Minor
      Found in lib/cocoapods-core/specification/linter.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 _validate_source has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def _validate_source(s)
              return unless s.is_a?(Hash)
              if git = s[:git]
                tag, commit = s.values_at(:tag, :commit)
                version = spec.version.to_s
      Severity: Minor
      Found in lib/cocoapods-core/specification/linter.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 run_validation_hooks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def run_validation_hooks(attributes, target)
              attributes.each do |attr|
                validation_hook = "_validate_#{attr.name}"
                next unless respond_to?(validation_hook, true)
                begin
      Severity: Minor
      Found in lib/cocoapods-core/specification/linter.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 _validate_script_phases has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def _validate_script_phases(s)
              s.each do |script_phase|
                keys = script_phase.keys
                unrecognized_keys = keys - Specification::ALL_SCRIPT_PHASE_KEYS
                unless unrecognized_keys.empty?
      Severity: Minor
      Found in lib/cocoapods-core/specification/linter.rb - About 55 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 perform_github_source_checks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def perform_github_source_checks(s)
              require 'uri'
      
              if git = s[:git]
                return unless git =~ /^#{URI.regexp}$/
      Severity: Minor
      Found in lib/cocoapods-core/specification/linter.rb - About 55 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_required_attributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def check_required_attributes
              attributes = DSL.attributes.values.select(&:required?)
              attributes.each do |attr|
                begin
                  value = spec.send(attr.name)
      Severity: Minor
      Found in lib/cocoapods-core/specification/linter.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 _validate_libraries has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def _validate_libraries(libs)
              libs.each do |lib|
                lib = lib.downcase
                if lib.end_with?('.a') || lib.end_with?('.dylib')
                  results.add_error('libraries', 'Libraries should not include the' \
      Severity: Minor
      Found in lib/cocoapods-core/specification/linter.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