app/workers/synchros/v1/data_element_groups.rb

Summary

Maintainability
C
1 day
Test Coverage
B
88%

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

  def create_dataset(package, state, data_element_ids)
    ds_code = "ORBF-#{state.code}-#{package.name}"[0..49]
    ds_name = "ORBF - #{state.name.pluralize.humanize} - #{package.name}"
    ds = [
      { name:                ds_name,

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. [31/10]
Open

  def create_data_element_group(package, state, data_element_ids)
    created_deg = nil
    begin
      deg_code = "ORBF-#{state.code}-#{package.name}"[0..49]
      deg_name = "ORBF - #{state.name.pluralize.humanize} - #{package.name}"

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 create_dataset has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

  def create_dataset(package, state, data_element_ids)
    ds_code = "ORBF-#{state.code}-#{package.name}"[0..49]
    ds_name = "ORBF - #{state.name.pluralize.humanize} - #{package.name}"
    ds = [
      { name:                ds_name,
Severity: Minor
Found in app/workers/synchros/v1/data_element_groups.rb - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

  def synchronize(package)
    Rails.logger.info "********** Synchronizing #{package.name} (#{package.id}) - activities #{package.activities.size}"
    @indicators ||= package.project.dhis2_connection.indicators.list(fields: ":all", page_size: 50_000)
    package.package_states.each do |package_state|
      state = package_state.state

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 create_dataset has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create_dataset(package, state, data_element_ids)
    ds_code = "ORBF-#{state.code}-#{package.name}"[0..49]
    ds_name = "ORBF - #{state.name.pluralize.humanize} - #{package.name}"
    ds = [
      { name:                ds_name,
Severity: Major
Found in app/workers/synchros/v1/data_element_groups.rb - About 2 hrs to fix

    Cyclomatic complexity for create_dataset is too high. [10/6]
    Open

      def create_dataset(package, state, data_element_ids)
        ds_code = "ORBF-#{state.code}-#{package.name}"[0..49]
        ds_name = "ORBF - #{state.name.pluralize.humanize} - #{package.name}"
        ds = [
          { name:                ds_name,

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Perceived complexity for create_dataset is too high. [10/7]
    Open

      def create_dataset(package, state, data_element_ids)
        ds_code = "ORBF-#{state.code}-#{package.name}"[0..49]
        ds_name = "ORBF - #{state.name.pluralize.humanize} - #{package.name}"
        ds = [
          { name:                ds_name,

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Method create_data_element_group has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create_data_element_group(package, state, data_element_ids)
        created_deg = nil
        begin
          deg_code = "ORBF-#{state.code}-#{package.name}"[0..49]
          deg_name = "ORBF - #{state.name.pluralize.humanize} - #{package.name}"
    Severity: Minor
    Found in app/workers/synchros/v1/data_element_groups.rb - About 1 hr to fix

      Method synchronize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def synchronize(package)
          Rails.logger.info "********** Synchronizing #{package.name} (#{package.id}) - activities #{package.activities.size}"
          @indicators ||= package.project.dhis2_connection.indicators.list(fields: ":all", page_size: 50_000)
          package.package_states.each do |package_state|
            state = package_state.state
      Severity: Minor
      Found in app/workers/synchros/v1/data_element_groups.rb - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Do not write to stdout. Use Rails's logger if you want to log.
      Open

            puts deg.to_json

      This cop checks for the use of output calls like puts and print

      Example:

      # bad
      puts 'A debug message'
      pp 'A debug message'
      print 'A debug message'
      
      # good
      Rails.logger.debug 'A debug message'

      Do not write to stdout. Use Rails's logger if you want to log.
      Open

            puts "**************************************** #{deg_id}"

      This cop checks for the use of output calls like puts and print

      Example:

      # bad
      puts 'A debug message'
      pp 'A debug message'
      print 'A debug message'
      
      # good
      Rails.logger.debug 'A debug message'

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          rescue RestClient::Exception => e
            puts deg.to_json
            Rails.logger.warn("failed create_data_element_group " + e.message + "\n" +
                               e&.response&.body + "\n" + +e&.response&.request&.payload.inspect)
      
      
      Severity: Minor
      Found in app/workers/synchros/v1/data_element_groups.rb and 1 other location - About 30 mins to fix
      app/workers/synchros/v2/data_element_groups.rb on lines 61..67

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 33.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Line is too long. [108/100]
      Open

          raise "Failed to create dataset #{ds} #{e.message} with #{package.project.dhis2_url} #{e.response.body}"

      Align the elements of a hash literal if they span more than one line.
      Open

            { name:                ds_name,

      Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:

      - key (left align keys, one space before hash rockets and values)
      - separator (align hash rockets and colons, right align keys)
      - table (left align keys, hash rockets, and values)

      The treatment of hashes passed as the last argument to a method call can also be configured. The options are:

      - always_inspect
      - always_ignore
      - ignore_implicit (without curly braces)

      Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.

      Example: EnforcedHashRocketStyle: key (default)

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
        :ba => baz
      }

      Example: EnforcedHashRocketStyle: separator

      # bad
      {
        :foo => bar,
        :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
         :ba => baz
      }

      Example: EnforcedHashRocketStyle: table

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      
      # good
      {
        :foo => bar,
        :ba  => baz
      }

      Example: EnforcedColonStyle: key (default)

      # bad
      {
        foo: bar,
         ba: baz
      }
      {
        foo: bar,
        ba:  baz
      }
      
      # good
      {
        foo: bar,
        ba: baz
      }

      Example: EnforcedColonStyle: separator

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
         ba: baz
      }

      Example: EnforcedColonStyle: table

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
        ba:  baz
      }

      Example: EnforcedLastArgumentHashStyle: always_inspect (default)

      # Inspect both implicit and explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
                   bar: 2)
      
      # good
      do_something(
        foo: 1,
        bar: 2
      )
      
      # good
      do_something({foo: 1,
                    bar: 2})
      
      # good
      do_something({
        foo: 1,
        bar: 2
      })

      Example: EnforcedLastArgumentHashStyle: always_ignore

      # Ignore both implicit and explicit hashes.
      
      # good
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Example: EnforcedLastArgumentHashStyle: ignore_implicit

      # Ignore only implicit hashes.
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
        bar: 2)

      Example: EnforcedLastArgumentHashStyle: ignore_explicit

      # Ignore only explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Align the elements of a hash literal if they span more than one line.
      Open

                display_name:  deg_name,

      Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:

      - key (left align keys, one space before hash rockets and values)
      - separator (align hash rockets and colons, right align keys)
      - table (left align keys, hash rockets, and values)

      The treatment of hashes passed as the last argument to a method call can also be configured. The options are:

      - always_inspect
      - always_ignore
      - ignore_implicit (without curly braces)

      Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.

      Example: EnforcedHashRocketStyle: key (default)

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
        :ba => baz
      }

      Example: EnforcedHashRocketStyle: separator

      # bad
      {
        :foo => bar,
        :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
         :ba => baz
      }

      Example: EnforcedHashRocketStyle: table

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      
      # good
      {
        :foo => bar,
        :ba  => baz
      }

      Example: EnforcedColonStyle: key (default)

      # bad
      {
        foo: bar,
         ba: baz
      }
      {
        foo: bar,
        ba:  baz
      }
      
      # good
      {
        foo: bar,
        ba: baz
      }

      Example: EnforcedColonStyle: separator

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
         ba: baz
      }

      Example: EnforcedColonStyle: table

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
        ba:  baz
      }

      Example: EnforcedLastArgumentHashStyle: always_inspect (default)

      # Inspect both implicit and explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
                   bar: 2)
      
      # good
      do_something(
        foo: 1,
        bar: 2
      )
      
      # good
      do_something({foo: 1,
                    bar: 2})
      
      # good
      do_something({
        foo: 1,
        bar: 2
      })

      Example: EnforcedLastArgumentHashStyle: always_ignore

      # Ignore both implicit and explicit hashes.
      
      # good
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Example: EnforcedLastArgumentHashStyle: ignore_implicit

      # Ignore only implicit hashes.
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
        bar: 2)

      Example: EnforcedLastArgumentHashStyle: ignore_explicit

      # Ignore only explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Line is too long. [103/100]
      Open

          @indicators ||= package.project.dhis2_connection.indicators.list(fields: ":all", page_size: 50_000)

      Align the elements of a hash literal if they span more than one line.
      Open

              short_name:          ds_code,

      Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:

      - key (left align keys, one space before hash rockets and values)
      - separator (align hash rockets and colons, right align keys)
      - table (left align keys, hash rockets, and values)

      The treatment of hashes passed as the last argument to a method call can also be configured. The options are:

      - always_inspect
      - always_ignore
      - ignore_implicit (without curly braces)

      Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.

      Example: EnforcedHashRocketStyle: key (default)

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
        :ba => baz
      }

      Example: EnforcedHashRocketStyle: separator

      # bad
      {
        :foo => bar,
        :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
         :ba => baz
      }

      Example: EnforcedHashRocketStyle: table

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      
      # good
      {
        :foo => bar,
        :ba  => baz
      }

      Example: EnforcedColonStyle: key (default)

      # bad
      {
        foo: bar,
         ba: baz
      }
      {
        foo: bar,
        ba:  baz
      }
      
      # good
      {
        foo: bar,
        ba: baz
      }

      Example: EnforcedColonStyle: separator

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
         ba: baz
      }

      Example: EnforcedColonStyle: table

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
        ba:  baz
      }

      Example: EnforcedLastArgumentHashStyle: always_inspect (default)

      # Inspect both implicit and explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
                   bar: 2)
      
      # good
      do_something(
        foo: 1,
        bar: 2
      )
      
      # good
      do_something({foo: 1,
                    bar: 2})
      
      # good
      do_something({
        foo: 1,
        bar: 2
      })

      Example: EnforcedLastArgumentHashStyle: always_ignore

      # Ignore both implicit and explicit hashes.
      
      # good
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Example: EnforcedLastArgumentHashStyle: ignore_implicit

      # Ignore only implicit hashes.
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
        bar: 2)

      Example: EnforcedLastArgumentHashStyle: ignore_explicit

      # Ignore only explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Align the elements of a hash literal if they span more than one line.
      Open

              code:                ds_code,

      Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:

      - key (left align keys, one space before hash rockets and values)
      - separator (align hash rockets and colons, right align keys)
      - table (left align keys, hash rockets, and values)

      The treatment of hashes passed as the last argument to a method call can also be configured. The options are:

      - always_inspect
      - always_ignore
      - ignore_implicit (without curly braces)

      Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.

      Example: EnforcedHashRocketStyle: key (default)

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
        :ba => baz
      }

      Example: EnforcedHashRocketStyle: separator

      # bad
      {
        :foo => bar,
        :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
         :ba => baz
      }

      Example: EnforcedHashRocketStyle: table

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      
      # good
      {
        :foo => bar,
        :ba  => baz
      }

      Example: EnforcedColonStyle: key (default)

      # bad
      {
        foo: bar,
         ba: baz
      }
      {
        foo: bar,
        ba:  baz
      }
      
      # good
      {
        foo: bar,
        ba: baz
      }

      Example: EnforcedColonStyle: separator

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
         ba: baz
      }

      Example: EnforcedColonStyle: table

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
        ba:  baz
      }

      Example: EnforcedLastArgumentHashStyle: always_inspect (default)

      # Inspect both implicit and explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
                   bar: 2)
      
      # good
      do_something(
        foo: 1,
        bar: 2
      )
      
      # good
      do_something({foo: 1,
                    bar: 2})
      
      # good
      do_something({
        foo: 1,
        bar: 2
      })

      Example: EnforcedLastArgumentHashStyle: always_ignore

      # Ignore both implicit and explicit hashes.
      
      # good
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Example: EnforcedLastArgumentHashStyle: ignore_implicit

      # Ignore only implicit hashes.
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
        bar: 2)

      Example: EnforcedLastArgumentHashStyle: ignore_explicit

      # Ignore only explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Line is too long. [120/100]
      Open

          Rails.logger.info "********** Synchronizing #{package.name} (#{package.id}) - activities #{package.activities.size}"

      Line is too long. [102/100]
      Open

                Rails.logger.info "adding element #{data_element_id} to #{created_ds.id} #{created_ds.name}"

      Use nested module/class definitions instead of compact style.
      Open

      class Synchros::V1::DataElementGroups < Synchros::Base

      This cop checks the style of children definitions at classes and modules. Basically there are two different styles:

      Example: EnforcedStyle: nested (default)

      # good
      # have each child on its own line
      class Foo
        class Bar
        end
      end

      Example: EnforcedStyle: compact

      # good
      # combine definitions as much as possible
      class Foo::Bar
      end

      The compact style is only forced for classes/modules with one child.

      Align the elements of a hash literal if they span more than one line.
      Open

                short_name:    deg_code,

      Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:

      - key (left align keys, one space before hash rockets and values)
      - separator (align hash rockets and colons, right align keys)
      - table (left align keys, hash rockets, and values)

      The treatment of hashes passed as the last argument to a method call can also be configured. The options are:

      - always_inspect
      - always_ignore
      - ignore_implicit (without curly braces)

      Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.

      Example: EnforcedHashRocketStyle: key (default)

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
        :ba => baz
      }

      Example: EnforcedHashRocketStyle: separator

      # bad
      {
        :foo => bar,
        :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
         :ba => baz
      }

      Example: EnforcedHashRocketStyle: table

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      
      # good
      {
        :foo => bar,
        :ba  => baz
      }

      Example: EnforcedColonStyle: key (default)

      # bad
      {
        foo: bar,
         ba: baz
      }
      {
        foo: bar,
        ba:  baz
      }
      
      # good
      {
        foo: bar,
        ba: baz
      }

      Example: EnforcedColonStyle: separator

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
         ba: baz
      }

      Example: EnforcedColonStyle: table

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
        ba:  baz
      }

      Example: EnforcedLastArgumentHashStyle: always_inspect (default)

      # Inspect both implicit and explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
                   bar: 2)
      
      # good
      do_something(
        foo: 1,
        bar: 2
      )
      
      # good
      do_something({foo: 1,
                    bar: 2})
      
      # good
      do_something({
        foo: 1,
        bar: 2
      })

      Example: EnforcedLastArgumentHashStyle: always_ignore

      # Ignore both implicit and explicit hashes.
      
      # good
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Example: EnforcedLastArgumentHashStyle: ignore_implicit

      # Ignore only implicit hashes.
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
        bar: 2)

      Example: EnforcedLastArgumentHashStyle: ignore_explicit

      # Ignore only explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Align the elements of a hash literal if they span more than one line.
      Open

              { name:          deg_name,

      Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:

      - key (left align keys, one space before hash rockets and values)
      - separator (align hash rockets and colons, right align keys)
      - table (left align keys, hash rockets, and values)

      The treatment of hashes passed as the last argument to a method call can also be configured. The options are:

      - always_inspect
      - always_ignore
      - ignore_implicit (without curly braces)

      Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.

      Example: EnforcedHashRocketStyle: key (default)

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
        :ba => baz
      }

      Example: EnforcedHashRocketStyle: separator

      # bad
      {
        :foo => bar,
        :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
         :ba => baz
      }

      Example: EnforcedHashRocketStyle: table

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      
      # good
      {
        :foo => bar,
        :ba  => baz
      }

      Example: EnforcedColonStyle: key (default)

      # bad
      {
        foo: bar,
         ba: baz
      }
      {
        foo: bar,
        ba:  baz
      }
      
      # good
      {
        foo: bar,
        ba: baz
      }

      Example: EnforcedColonStyle: separator

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
         ba: baz
      }

      Example: EnforcedColonStyle: table

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
        ba:  baz
      }

      Example: EnforcedLastArgumentHashStyle: always_inspect (default)

      # Inspect both implicit and explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
                   bar: 2)
      
      # good
      do_something(
        foo: 1,
        bar: 2
      )
      
      # good
      do_something({foo: 1,
                    bar: 2})
      
      # good
      do_something({
        foo: 1,
        bar: 2
      })

      Example: EnforcedLastArgumentHashStyle: always_ignore

      # Ignore both implicit and explicit hashes.
      
      # good
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Example: EnforcedLastArgumentHashStyle: ignore_implicit

      # Ignore only implicit hashes.
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
        bar: 2)

      Example: EnforcedLastArgumentHashStyle: ignore_explicit

      # Ignore only explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Align the elements of a hash literal if they span more than one line.
      Open

              display_name:        ds_name,

      Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:

      - key (left align keys, one space before hash rockets and values)
      - separator (align hash rockets and colons, right align keys)
      - table (left align keys, hash rockets, and values)

      The treatment of hashes passed as the last argument to a method call can also be configured. The options are:

      - always_inspect
      - always_ignore
      - ignore_implicit (without curly braces)

      Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.

      Example: EnforcedHashRocketStyle: key (default)

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
        :ba => baz
      }

      Example: EnforcedHashRocketStyle: separator

      # bad
      {
        :foo => bar,
        :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
         :ba => baz
      }

      Example: EnforcedHashRocketStyle: table

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      
      # good
      {
        :foo => bar,
        :ba  => baz
      }

      Example: EnforcedColonStyle: key (default)

      # bad
      {
        foo: bar,
         ba: baz
      }
      {
        foo: bar,
        ba:  baz
      }
      
      # good
      {
        foo: bar,
        ba: baz
      }

      Example: EnforcedColonStyle: separator

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
         ba: baz
      }

      Example: EnforcedColonStyle: table

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
        ba:  baz
      }

      Example: EnforcedLastArgumentHashStyle: always_inspect (default)

      # Inspect both implicit and explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
                   bar: 2)
      
      # good
      do_something(
        foo: 1,
        bar: 2
      )
      
      # good
      do_something({foo: 1,
                    bar: 2})
      
      # good
      do_something({
        foo: 1,
        bar: 2
      })

      Example: EnforcedLastArgumentHashStyle: always_ignore

      # Ignore both implicit and explicit hashes.
      
      # good
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Example: EnforcedLastArgumentHashStyle: ignore_implicit

      # Ignore only implicit hashes.
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
        bar: 2)

      Example: EnforcedLastArgumentHashStyle: ignore_explicit

      # Ignore only explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Line is too long. [104/100]
      Open

            raise "data element group not created #{deg_name} : #{deg} : #{status.inspect}" unless created_deg

      Align the elements of a hash literal if they span more than one line.
      Open

                code:          deg_code,

      Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:

      - key (left align keys, one space before hash rockets and values)
      - separator (align hash rockets and colons, right align keys)
      - table (left align keys, hash rockets, and values)

      The treatment of hashes passed as the last argument to a method call can also be configured. The options are:

      - always_inspect
      - always_ignore
      - ignore_implicit (without curly braces)

      Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.

      Example: EnforcedHashRocketStyle: key (default)

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
        :ba => baz
      }

      Example: EnforcedHashRocketStyle: separator

      # bad
      {
        :foo => bar,
        :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
         :ba => baz
      }

      Example: EnforcedHashRocketStyle: table

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      
      # good
      {
        :foo => bar,
        :ba  => baz
      }

      Example: EnforcedColonStyle: key (default)

      # bad
      {
        foo: bar,
         ba: baz
      }
      {
        foo: bar,
        ba:  baz
      }
      
      # good
      {
        foo: bar,
        ba: baz
      }

      Example: EnforcedColonStyle: separator

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
         ba: baz
      }

      Example: EnforcedColonStyle: table

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
        ba:  baz
      }

      Example: EnforcedLastArgumentHashStyle: always_inspect (default)

      # Inspect both implicit and explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
                   bar: 2)
      
      # good
      do_something(
        foo: 1,
        bar: 2
      )
      
      # good
      do_something({foo: 1,
                    bar: 2})
      
      # good
      do_something({
        foo: 1,
        bar: 2
      })

      Example: EnforcedLastArgumentHashStyle: always_ignore

      # Ignore both implicit and explicit hashes.
      
      # good
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Example: EnforcedLastArgumentHashStyle: ignore_implicit

      # Ignore only implicit hashes.
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
        bar: 2)

      Example: EnforcedLastArgumentHashStyle: ignore_explicit

      # Ignore only explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Align the elements of a hash literal if they span more than one line.
      Open

              data_elements:       data_element_ids.map do |data_element_id|
                { id: data_element_id }
              end }

      Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:

      - key (left align keys, one space before hash rockets and values)
      - separator (align hash rockets and colons, right align keys)
      - table (left align keys, hash rockets, and values)

      The treatment of hashes passed as the last argument to a method call can also be configured. The options are:

      - always_inspect
      - always_ignore
      - ignore_implicit (without curly braces)

      Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.

      Example: EnforcedHashRocketStyle: key (default)

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
        :ba => baz
      }

      Example: EnforcedHashRocketStyle: separator

      # bad
      {
        :foo => bar,
        :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
         :ba => baz
      }

      Example: EnforcedHashRocketStyle: table

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      
      # good
      {
        :foo => bar,
        :ba  => baz
      }

      Example: EnforcedColonStyle: key (default)

      # bad
      {
        foo: bar,
         ba: baz
      }
      {
        foo: bar,
        ba:  baz
      }
      
      # good
      {
        foo: bar,
        ba: baz
      }

      Example: EnforcedColonStyle: separator

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
         ba: baz
      }

      Example: EnforcedColonStyle: table

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
        ba:  baz
      }

      Example: EnforcedLastArgumentHashStyle: always_inspect (default)

      # Inspect both implicit and explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
                   bar: 2)
      
      # good
      do_something(
        foo: 1,
        bar: 2
      )
      
      # good
      do_something({foo: 1,
                    bar: 2})
      
      # good
      do_something({
        foo: 1,
        bar: 2
      })

      Example: EnforcedLastArgumentHashStyle: always_ignore

      # Ignore both implicit and explicit hashes.
      
      # good
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Example: EnforcedLastArgumentHashStyle: ignore_implicit

      # Ignore only implicit hashes.
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
        bar: 2)

      Example: EnforcedLastArgumentHashStyle: ignore_explicit

      # Ignore only explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Align the elements of a hash literal if they span more than one line.
      Open

              period_type:         package.frequency.capitalize,

      Check that the keys, separators, and values of a multi-line hash literal are aligned according to configuration. The configuration options are:

      - key (left align keys, one space before hash rockets and values)
      - separator (align hash rockets and colons, right align keys)
      - table (left align keys, hash rockets, and values)

      The treatment of hashes passed as the last argument to a method call can also be configured. The options are:

      - always_inspect
      - always_ignore
      - ignore_implicit (without curly braces)

      Alternatively you can specify multiple allowed styles. That's done by passing a list of styles to EnforcedStyles.

      Example: EnforcedHashRocketStyle: key (default)

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
        :ba => baz
      }

      Example: EnforcedHashRocketStyle: separator

      # bad
      {
        :foo => bar,
        :ba => baz
      }
      {
        :foo => bar,
        :ba  => baz
      }
      
      # good
      {
        :foo => bar,
         :ba => baz
      }

      Example: EnforcedHashRocketStyle: table

      # bad
      {
        :foo => bar,
         :ba => baz
      }
      
      # good
      {
        :foo => bar,
        :ba  => baz
      }

      Example: EnforcedColonStyle: key (default)

      # bad
      {
        foo: bar,
         ba: baz
      }
      {
        foo: bar,
        ba:  baz
      }
      
      # good
      {
        foo: bar,
        ba: baz
      }

      Example: EnforcedColonStyle: separator

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
         ba: baz
      }

      Example: EnforcedColonStyle: table

      # bad
      {
        foo: bar,
        ba: baz
      }
      
      # good
      {
        foo: bar,
        ba:  baz
      }

      Example: EnforcedLastArgumentHashStyle: always_inspect (default)

      # Inspect both implicit and explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
                   bar: 2)
      
      # good
      do_something(
        foo: 1,
        bar: 2
      )
      
      # good
      do_something({foo: 1,
                    bar: 2})
      
      # good
      do_something({
        foo: 1,
        bar: 2
      })

      Example: EnforcedLastArgumentHashStyle: always_ignore

      # Ignore both implicit and explicit hashes.
      
      # good
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Example: EnforcedLastArgumentHashStyle: ignore_implicit

      # Ignore only implicit hashes.
      
      # bad
      do_something({foo: 1,
        bar: 2})
      
      # good
      do_something(foo: 1,
        bar: 2)

      Example: EnforcedLastArgumentHashStyle: ignore_explicit

      # Ignore only explicit hashes.
      
      # bad
      do_something(foo: 1,
        bar: 2)
      
      # good
      do_something({foo: 1,
        bar: 2})

      Variable package used in void context.
      Open

            package

      This cop checks for operators, variables, literals, and nonmutating methods used in void context.

      Example:

      # bad
      
      def some_method
        some_num * 10
        do_something
      end

      Example:

      # bad
      
      def some_method(some_var)
        some_var
        do_something
      end

      Example:

      # bad, when CheckForMethodsWithNoSideEffects is set true
      
      def some_method(some_array)
        some_array.sort
        do_something(some_array)
      end

      Example:

      # good
      
      def some_method
        do_something
        some_num * 10
      end

      Example:

      # good
      
      def some_method(some_var)
        do_something
        some_var
      end

      Example:

      # good, when CheckForMethodsWithNoSideEffects is set true
      
      def some_method(some_array)
        some_array.sort!
        do_something(some_array)
      end

      There are no issues that match your filters.

      Category
      Status