ManageIQ/activerecord-id_regions

View on GitHub
lib/active_record/id_regions.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
91%

Extract this regexp into a constant, memoize it, or append an /o option to its options.
Open

      id.to_s =~ /^#{CID_OR_ID_MATCHER}$/
Severity: Minor
Found in lib/active_record/id_regions.rb by rubocop

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

      compressed_id.to_s =~ RE_COMPRESSED_ID ? ($1.to_i * rails_sequence_factor + $2.to_i) : compressed_id.to_i
Severity: Minor
Found in lib/active_record/id_regions.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

      region_number * rails_sequence_factor + id
Severity: Minor
Found in lib/active_record/id_regions.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