mhutter/teamdrive_api

View on GitHub
test/teamdrive_api/core_ext/array_test.rb

Summary

Maintainability
A
0 mins
Test Coverage

Closing array brace must be on the line after the last array element when opening brace is on a separate line from the first array element.
Open

    :baz]

This cop checks that the closing brace in an array literal is either on the same line as the last array element, or a new line.

When using the symmetrical (default) style:

If an array's opening brace is on the same line as the first element of the array, then the closing brace should be on the same line as the last element of the array.

If an array's opening brace is on the line above the first element of the array, then the closing brace should be on the line below the last element of the array.

When using the new_line style:

The closing brace of a multi-line array literal must be on the line after the last element of the array.

When using the same_line style:

The closing brace of a multi-line array literal must be on the same line as the last element of the array.

Example: EnforcedStyle: symmetrical (default)

# bad
  [ :a,
    :b
  ]

  # bad
  [
    :a,
    :b ]

  # good
  [ :a,
    :b ]

  # good
  [
    :a,
    :b
  ]

Example: EnforcedStyle: new_line

# bad
  [
    :a,
    :b ]

  # bad
  [ :a,
    :b ]

  # good
  [ :a,
    :b
  ]

  # good
  [
    :a,
    :b
  ]

Example: EnforcedStyle: same_line

# bad
  [ :a,
    :b
  ]

  # bad
  [
    :a,
    :b
  ]

  # good
  [
    :a,
    :b ]

  # good
  [ :a,
    :b ]

Closing array brace must be on the line after the last array element when opening brace is on a separate line from the first array element.
Open

    :baz]

This cop checks that the closing brace in an array literal is either on the same line as the last array element, or a new line.

When using the symmetrical (default) style:

If an array's opening brace is on the same line as the first element of the array, then the closing brace should be on the same line as the last element of the array.

If an array's opening brace is on the line above the first element of the array, then the closing brace should be on the line below the last element of the array.

When using the new_line style:

The closing brace of a multi-line array literal must be on the line after the last element of the array.

When using the same_line style:

The closing brace of a multi-line array literal must be on the same line as the last element of the array.

Example: EnforcedStyle: symmetrical (default)

# bad
  [ :a,
    :b
  ]

  # bad
  [
    :a,
    :b ]

  # good
  [ :a,
    :b ]

  # good
  [
    :a,
    :b
  ]

Example: EnforcedStyle: new_line

# bad
  [
    :a,
    :b ]

  # bad
  [ :a,
    :b ]

  # good
  [ :a,
    :b
  ]

  # good
  [
    :a,
    :b
  ]

Example: EnforcedStyle: same_line

# bad
  [ :a,
    :b
  ]

  # bad
  [
    :a,
    :b
  ]

  # good
  [
    :a,
    :b ]

  # good
  [ :a,
    :b ]

Freeze mutable objects assigned to constants.
Open

  BEFORE = [
    {
      'foo' => 'bar',
      'num' => {
        'first' => 1,

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

Freeze mutable objects assigned to constants.
Open

  EXPECTED = [
    {
      foo: 'bar',
      num: {
        first: 1,

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

There are no issues that match your filters.

Category
Status