ManageIQ/manageiq-smartstate

View on GitHub
lib/fs/xfs/superblock.rb

Summary

Maintainability
D
2 days
Test Coverage
F
42%

Class Superblock has 57 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Superblock
    #
    # Block I/O parameterization. A basic block (BB) is the lowest size of
    # filesystem allocation, and must equal 512.  Length units given to bio
    # routines are in BB's.
Severity: Major
Found in lib/fs/xfs/superblock.rb - About 1 day to fix

File superblock.rb has 434 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'binary_struct'
require 'uuidtools'
require 'stringio'
require 'memory_buffer'
require 'fs/xfs/allocation_group'
Severity: Minor
Found in lib/fs/xfs/superblock.rb - About 6 hrs to fix

Method dump has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def dump
      out = "\#<#{self.class}:0x#{format('%08x', object_id)}>\n"
      out << "Magic number            : #{format('%0x', @sb['magic_num'])}\n"
      out << "Block size              : #{@sb['block_size']} (#{@block_size} bytes)\n"
      out << "Number of blocks        : #{@sb['data_blocks']}\n"
Severity: Major
Found in lib/fs/xfs/superblock.rb - About 2 hrs to fix

Wrap expressions with varying precedence with parentheses to avoid ambiguity.
Open

      agno << @sb['ag_blocks_log'] | agbno
Severity: Minor
Found in lib/fs/xfs/superblock.rb by rubocop

Looks for expressions containing multiple binary operators where precedence is ambiguous due to lack of parentheses. For example, in 1 + 2 * 3, the multiplication will happen before the addition, but lexically it appears that the addition will happen first.

The cop does not consider unary operators (ie. !a or -b) or comparison operators (ie. a =~ b) because those are not ambiguous.

NOTE: Ranges are handled by Lint/AmbiguousRange.

Example:

# bad
a + b * c
a || b && c
a ** b + c

# good (different precedence)
a + (b * c)
a || (b && c)
(a ** b) + c

# good (same precedence)
a + b + c
a * b / c % d

Wrap expressions with varying precedence with parentheses to avoid ambiguity.
Open

      fsb_to_bb(agno * @allocation_group_blocks + agbno)
Severity: Minor
Found in lib/fs/xfs/superblock.rb by rubocop

Looks for expressions containing multiple binary operators where precedence is ambiguous due to lack of parentheses. For example, in 1 + 2 * 3, the multiplication will happen before the addition, but lexically it appears that the addition will happen first.

The cop does not consider unary operators (ie. !a or -b) or comparison operators (ie. a =~ b) because those are not ambiguous.

NOTE: Ranges are handled by Lint/AmbiguousRange.

Example:

# bad
a + b * c
a || b && c
a ** b + c

# good (different precedence)
a + (b * c)
a || (b && c)
(a ** b) + c

# good (same precedence)
a + b + c
a * b / c % d

Wrap expressions with varying precedence with parentheses to avoid ambiguity.
Open

      agno * @allocation_group_blocks + agbno
Severity: Minor
Found in lib/fs/xfs/superblock.rb by rubocop

Looks for expressions containing multiple binary operators where precedence is ambiguous due to lack of parentheses. For example, in 1 + 2 * 3, the multiplication will happen before the addition, but lexically it appears that the addition will happen first.

The cop does not consider unary operators (ie. !a or -b) or comparison operators (ie. a =~ b) because those are not ambiguous.

NOTE: Ranges are handled by Lint/AmbiguousRange.

Example:

# bad
a + b * c
a || b && c
a ** b + c

# good (different precedence)
a + (b * c)
a || (b && c)
(a ** b) + c

# good (same precedence)
a + b + c
a * b / c % d

Wrap expressions with varying precedence with parentheses to avoid ambiguity.
Open

      inode >> ino_offset_bits & ino_mask(ino_agbno_bits)
Severity: Minor
Found in lib/fs/xfs/superblock.rb by rubocop

Looks for expressions containing multiple binary operators where precedence is ambiguous due to lack of parentheses. For example, in 1 + 2 * 3, the multiplication will happen before the addition, but lexically it appears that the addition will happen first.

The cop does not consider unary operators (ie. !a or -b) or comparison operators (ie. a =~ b) because those are not ambiguous.

NOTE: Ranges are handled by Lint/AmbiguousRange.

Example:

# bad
a + b * c
a || b && c
a ** b + c

# good (different precedence)
a + (b * c)
a || (b && c)
(a ** b) + c

# good (same precedence)
a + b + c
a * b / c % d

Wrap expressions with varying precedence with parentheses to avoid ambiguity.
Open

         @sb['inode_alignment'] >> b_to_fsbt(XFS_INODE_BIG_CLUSTER_SIZE)
Severity: Minor
Found in lib/fs/xfs/superblock.rb by rubocop

Looks for expressions containing multiple binary operators where precedence is ambiguous due to lack of parentheses. For example, in 1 + 2 * 3, the multiplication will happen before the addition, but lexically it appears that the addition will happen first.

The cop does not consider unary operators (ie. !a or -b) or comparison operators (ie. a =~ b) because those are not ambiguous.

NOTE: Ranges are handled by Lint/AmbiguousRange.

Example:

# bad
a + b * c
a || b && c
a ** b + c

# good (different precedence)
a + (b * c)
a || (b && c)
(a ** b) + c

# good (same precedence)
a + b + c
a * b / c % d

Wrap expressions with varying precedence with parentheses to avoid ambiguity.
Open

      agno << ino_agino_bits | inode
Severity: Minor
Found in lib/fs/xfs/superblock.rb by rubocop

Looks for expressions containing multiple binary operators where precedence is ambiguous due to lack of parentheses. For example, in 1 + 2 * 3, the multiplication will happen before the addition, but lexically it appears that the addition will happen first.

The cop does not consider unary operators (ie. !a or -b) or comparison operators (ie. a =~ b) because those are not ambiguous.

NOTE: Ranges are handled by Lint/AmbiguousRange.

Example:

# bad
a + b * c
a || b && c
a ** b + c

# good (different precedence)
a + (b * c)
a || (b && c)
(a ** b) + c

# good (same precedence)
a + b + c
a * b / c % d

Method XFS::Superblock#inode_size is defined at both lib/fs/xfs/superblock.rb:154 and lib/fs/xfs/superblock.rb:252.
Open

    def inode_size
Severity: Minor
Found in lib/fs/xfs/superblock.rb by rubocop

Checks for duplicated instance (or singleton) method definitions.

Example:

# bad

def foo
  1
end

def foo
  2
end

Example:

# bad

def foo
  1
end

alias foo bar

Example:

# good

def foo
  1
end

def bar
  2
end

Example:

# good

def foo
  1
end

alias bar foo

There are no issues that match your filters.

Category
Status