ManageIQ/manageiq-smartstate

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

Summary

Maintainability
D
1 day
Test Coverage
F
35%

File inode.rb has 452 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'binary_struct'
require 'memory_buffer'
require 'more_core_extensions/all'
require 'fs/xfs/superblock'
require 'fs/xfs/bmap_btree_record'
Severity: Minor
Found in lib/fs/xfs/inode.rb - About 6 hrs to fix

Class Inode has 48 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Inode
    MAX_READ              = 4_294_967_296
    XFS_DINODE_MAGIC             = 0x494e

    # Bits 0 to 8 of file mode.
Severity: Minor
Found in lib/fs/xfs/inode.rb - About 6 hrs to fix

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

        start      = maximum_records * offset_size + (i - 1) * block_size
Severity: Minor
Found in lib/fs/xfs/inode.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

      1.upto(extent.block_count) { |i| block_pointers << extent.start_block + i - 1 }
Severity: Minor
Found in lib/fs/xfs/inode.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

        start      = maximum_records * offset_size + (i - 1) * block_size
Severity: Minor
Found in lib/fs/xfs/inode.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

      1.upto(record.block_count) { |i| block_pointers << record.start_block + i - 1 }
Severity: Minor
Found in lib/fs/xfs/inode.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

There are no issues that match your filters.

Category
Status