rubinius/rubinius

View on GitHub
library/rubygems/package/tar_test_case.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method assert_headers_equal has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def assert_headers_equal(expected, actual)
    expected = expected.to_s unless String === expected
    actual = actual.to_s unless String === actual

    fields = %w[
Severity: Minor
Found in library/rubygems/package/tar_test_case.rb - About 1 hr to fix

    Method header has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def header(type, fname, dname, length, mode, mtime, checksum = nil, linkname = "")
        checksum ||= " " * 8
    
        arr = [                  # struct tarfile_entry_posix
          ASCIIZ(fname, 100),    # char name[100];     ASCII + (Z unless filled)
    Severity: Minor
    Found in library/rubygems/package/tar_test_case.rb - About 1 hr to fix

      Method header has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def header(type, fname, dname, length, mode, mtime, checksum = nil, linkname = "")
      Severity: Major
      Found in library/rubygems/package/tar_test_case.rb - About 1 hr to fix

        Method assert_headers_equal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def assert_headers_equal(expected, actual)
            expected = expected.to_s unless String === expected
            actual = actual.to_s unless String === actual
        
            fields = %w[
        Severity: Minor
        Found in library/rubygems/package/tar_test_case.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 tar_symlink_header has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def tar_symlink_header(fname, prefix, mode, mtime, linkname)
        Severity: Minor
        Found in library/rubygems/package/tar_test_case.rb - About 35 mins to fix

          Method tar_file_header has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def tar_file_header(fname, dname, mode, length, mtime)
          Severity: Minor
          Found in library/rubygems/package/tar_test_case.rb - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status