sparklemotion/nokogiri

View on GitHub
ext/nokogiri/extconf.rb

Summary

Maintainability
D
2 days
Test Coverage

File extconf.rb has 516 lines of code (exceeds 250 allowed). Consider refactoring.
Open

ENV['RC_ARCHS'] = '' if RUBY_PLATFORM =~ /darwin/

require 'mkmf'

ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
Severity: Major
Found in ext/nokogiri/extconf.rb - About 1 day to fix

    Method process_recipe has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    def process_recipe(name, version, static_p, cross_p)
      MiniPortile.new(name, version).tap do |recipe|
        recipe.target = File.join(ROOT, "ports")
        # Prefer host_alias over host in order to use i586-mingw32msvc as
        # correct compiler prefix for cross build, but use host if not set.
    Severity: Minor
    Found in ext/nokogiri/extconf.rb - About 4 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 process_recipe has 86 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def process_recipe(name, version, static_p, cross_p)
      MiniPortile.new(name, version).tap do |recipe|
        recipe.target = File.join(ROOT, "ports")
        # Prefer host_alias over host in order to use i586-mingw32msvc as
        # correct compiler prefix for cross build, but use host if not set.
    Severity: Major
    Found in ext/nokogiri/extconf.rb - About 3 hrs to fix

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

      def iconv_configure_flags
        # If --with-iconv-dir or --with-opt-dir is given, it should be
        # the first priority
        %w[iconv opt].each do |name|
          if (config = preserving_globals { dir_config(name) }).any? &&
      Severity: Minor
      Found in ext/nokogiri/extconf.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 iconv_configure_flags has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def iconv_configure_flags
        # If --with-iconv-dir or --with-opt-dir is given, it should be
        # the first priority
        %w[iconv opt].each do |name|
          if (config = preserving_globals { dir_config(name) }).any? &&
      Severity: Minor
      Found in ext/nokogiri/extconf.rb - About 1 hr to fix

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

        def have_iconv?(using = nil)
          checking_for(using ? "iconv using #{using}" : 'iconv') do
            ['', '-liconv'].any? do |opt|
              preserving_globals do
                yield if block_given?
        Severity: Minor
        Found in ext/nokogiri/extconf.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

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

        def package_config pkg, options={}
          package = pkg_config(pkg)
          return package if package
        
          begin
        Severity: Minor
        Found in ext/nokogiri/extconf.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 configure has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def configure
                  Dir.chdir work_path do
                    mk = File.read 'win32/Makefile.gcc'
                    File.open 'win32/Makefile.gcc', 'wb' do |f|
                      f.puts "BINARY_PATH = #{path}/bin"
        Severity: Minor
        Found in ext/nokogiri/extconf.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

        There are no issues that match your filters.

        Category
        Status