uptech/togls

View on GitHub
lib/togls/feature_toggle_registry_manager.rb

Summary

Maintainability
A
0 mins
Test Coverage

Method has too many lines. [13/10]
Open

      def test_toggle_registry
        feature_repository_drivers =
          [Togls::FeatureRepositoryDrivers::InMemoryDriver.new]
        test_feature_repository = Togls::FeatureRepository.new(
          feature_repository_drivers)

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [11/10]
Open

      def release_toggle_registry
        if @release_toggle_registry.nil?

          toggle_repository_drivers = [
            Togls::ToggleRepositoryDrivers::InMemoryDriver.new,

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.
Open

            toggle_repository_drivers, feature_repository)

This cop checks that the closing brace in a method call is either on the same line as the last method argument, or a new line.

When using the symmetrical (default) style:

If a method call's opening brace is on the same line as the first argument of the call, then the closing brace should be on the same line as the last argument of the call.

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

When using the new_line style:

The closing brace of a multi-line method call must be on the line after the last argument of the call.

When using the same_line style:

The closing brace of a multi-line method call must be on the same line as the last argument of the call.

Example:

# symmetrical: bad
  # new_line: good
  # same_line: bad
  foo(a,
    b
  )

  # symmetrical: bad
  # new_line: bad
  # same_line: good
  foo(
    a,
    b)

  # symmetrical: good
  # new_line: bad
  # same_line: good
  foo(a,
    b)

  # symmetrical: good
  # new_line: good
  # same_line: bad
  foo(
    a,
    b
  )

Redundant return detected.
Open

        return tr

This cop checks for redundant return expressions.

Example:

def test
  return something
end

def test
  one
  two
  three
  return something
end

It should be extended to handle methods whose body is if/else or a case expression with a default branch.

Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.
Open

          feature_repository_drivers)

This cop checks that the closing brace in a method call is either on the same line as the last method argument, or a new line.

When using the symmetrical (default) style:

If a method call's opening brace is on the same line as the first argument of the call, then the closing brace should be on the same line as the last argument of the call.

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

When using the new_line style:

The closing brace of a multi-line method call must be on the line after the last argument of the call.

When using the same_line style:

The closing brace of a multi-line method call must be on the same line as the last argument of the call.

Example:

# symmetrical: bad
  # new_line: good
  # same_line: bad
  foo(a,
    b
  )

  # symmetrical: bad
  # new_line: bad
  # same_line: good
  foo(
    a,
    b)

  # symmetrical: good
  # new_line: bad
  # same_line: good
  foo(a,
    b)

  # symmetrical: good
  # new_line: good
  # same_line: bad
  foo(
    a,
    b
  )

Line is too long. [92/80]
Open

          feature_repository_drivers = [Togls::FeatureRepositoryDrivers::InMemoryDriver.new]

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

          Togls::ToggleRepositoryDrivers::InMemoryDriver.new]

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 ]

Line is too long. [121/80]
Open

        Toggler.new(release_toggle_registry.instance_variable_get(:@toggle_repository), release_toggle_registry.get(key))

Missing magic comment # frozen_string_literal: true.
Open

module Togls

This cop is designed to help upgrade to Ruby 3.0. It will add the comment # frozen_string_literal: true to the top of files to enable frozen string literals. Frozen string literals may be default in Ruby 3.0. The comment will be added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+.

Example: EnforcedStyle: when_needed (default)

# The `when_needed` style will add the frozen string literal comment
# to files only when the `TargetRubyVersion` is set to 2.3+.
# bad
module Foo
  # ...
end

# good
# frozen_string_literal: true

module Foo
  # ...
end

Example: EnforcedStyle: always

# The `always` style will always add the frozen string literal comment
# to a file, regardless of the Ruby version or if `freeze` or `<<` are
# called on a string literal.
# bad
module Bar
  # ...
end

# good
# frozen_string_literal: true

module Bar
  # ...
end

Example: EnforcedStyle: never

# The `never` will enforce that the frozen string literal comment does
# not exist in a file.
# bad
# frozen_string_literal: true

module Baz
  # ...
end

# good
module Baz
  # ...
end

Line is too long. [88/80]
Open

          @feature_repository = Togls::FeatureRepository.new(feature_repository_drivers)

Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument.
Open

          toggle_repository_drivers, test_feature_repository)

This cop checks that the closing brace in a method call is either on the same line as the last method argument, or a new line.

When using the symmetrical (default) style:

If a method call's opening brace is on the same line as the first argument of the call, then the closing brace should be on the same line as the last argument of the call.

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

When using the new_line style:

The closing brace of a multi-line method call must be on the line after the last argument of the call.

When using the same_line style:

The closing brace of a multi-line method call must be on the same line as the last argument of the call.

Example:

# symmetrical: bad
  # new_line: good
  # same_line: bad
  foo(a,
    b
  )

  # symmetrical: bad
  # new_line: bad
  # same_line: good
  foo(
    a,
    b)

  # symmetrical: good
  # new_line: bad
  # same_line: good
  foo(a,
    b)

  # symmetrical: good
  # new_line: good
  # same_line: bad
  foo(
    a,
    b
  )

There are no issues that match your filters.

Category
Status