Dalphi/dalphi

View on GitHub
spec/requests/api/v1/statistics_spec.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Block has too many lines. [339/25]
Open

RSpec.describe 'Statistics API', type: :request do
  before(:each) do
    @auth_token = ApplicationController.generate_auth_token
  end

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Block has too many lines. [156/25]
Open

  describe 'bulk creation' do
    it 'creates no statistics for an empty list' do
      expect(Statistic.count).to eq(0)

      post api_v1_statistics_path(auth_token: @auth_token),

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

File statistics_spec.rb has 342 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rails_helper'

RSpec.describe 'Statistics API', type: :request do
  before(:each) do
    @auth_token = ApplicationController.generate_auth_token
Severity: Minor
Found in spec/requests/api/v1/statistics_spec.rb - About 4 hrs to fix

    Block has too many lines. [45/25]
    Open

        it 'associates every statistic with the right project from raw_data ids' do
          raw_datum = FactoryGirl.create(:raw_datum)
          project = raw_datum.project
          statistic_1 = FactoryGirl.build(:statistic, key: 'compliance', project: project)
          statistic_2 = FactoryGirl.build(:statistic, key: 'precision', project: project)

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [44/25]
    Open

        it 'creates multiple statistics for a list of valid statistics' do
          project = FactoryGirl.create(:project)
          statistic_1 = FactoryGirl.build(:statistic, key: 'compliance', project: project)
          statistic_2 = FactoryGirl.build(:statistic, key: 'precision', project: project)
          expect(Statistic.count).to eq(0)

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [29/25]
    Open

        it 'creates one statistic for a singleton' do
          project = FactoryGirl.create(:project)
          statistic = FactoryGirl.build(:statistic, project: project)
          expect(Statistic.count).to eq(0)
    
    

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [28/25]
    Open

      it 'patches a JSON stringify encoded statistic' do
        project = FactoryGirl.create(:project)
        statistic = FactoryGirl.create(:statistic, project: project)
        expect(Statistic.count).to eq(1)
    
    

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [28/25]
    Open

      it 'creates a JSON stringify encoded statistic' do
        project = FactoryGirl.create(:project)
        statistic = FactoryGirl.build(:statistic, project: project)
        expect(Statistic.count).to eq(0)
    
    

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [27/25]
    Open

      it 'patches a statistic' do
        project = FactoryGirl.create(:project)
        statistic = FactoryGirl.create(:statistic, project: project)
        expect(Statistic.count).to eq(1)
    
    

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Block has too many lines. [26/25]
    Open

      it 'associates newly created statistic with the right project from raw_data ids' do
        raw_datum = FactoryGirl.create(:raw_datum)
        project = raw_datum.project
        statistic = FactoryGirl.build(:statistic, project: project)
        expect(Statistic.count).to eq(0)

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

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

          expect(json).to eq(
            [
              {
                'id' => statistic_1.id,
                'key' => statistic_1.key,
    Severity: Minor
    Found in spec/requests/api/v1/statistics_spec.rb and 1 other location - About 40 mins to fix
    spec/requests/api/v1/statistics_spec.rb on lines 274..290

    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 37.

    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

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

          expect(json).to eq(
            [
              {
                'id' => statistic_1.id,
                'key' => statistic_1.key,
    Severity: Minor
    Found in spec/requests/api/v1/statistics_spec.rb and 1 other location - About 40 mins to fix
    spec/requests/api/v1/statistics_spec.rb on lines 196..212

    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 37.

    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

    Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is.
    Open

                'key' => statistic.key,

    This cops checks the indentation of the first key in a hash literal where the opening brace and the first key are on separate lines. The other keys' indentations are handled by the AlignHash cop.

    By default, Hash literals that are arguments in a method call with parentheses, and where the opening curly brace of the hash is on the same line as the opening parenthesis of the method call, shall have their first key indented one step (two spaces) more than the position inside the opening parenthesis.

    Other hash literals shall have their first key indented one step more than the start of the line where the opening curly brace is.

    This default style is called 'specialinsideparentheses'. Alternative styles are 'consistent' and 'align_braces'. Here are examples:

    Example: EnforcedStyle: specialinsideparentheses (default)

    # The `special_inside_parentheses` style enforces that the first key
    # in a hash literal where the opening brace and the first key are on
    # separate lines is indented one step (two spaces) more than the
    # position inside the opening parentheses.
    
    # bad
    hash = {
      key: :value
    }
    and_in_a_method_call({
      no: :difference
                         })
    
    # good
    special_inside_parentheses
    hash = {
      key: :value
    }
    but_in_a_method_call({
                           its_like: :this
                         })

    Example: EnforcedStyle: consistent

    # The `consistent` style enforces that the first key in a hash
    # literal where the opening brace and the first key are on
    # seprate lines is indented the same as a hash literal which is not
    # defined inside a method call.
    
    # bad
    hash = {
      key: :value
    }
    but_in_a_method_call({
                           its_like: :this
                          })
    
    # good
    hash = {
      key: :value
    }
    and_in_a_method_call({
      no: :difference
    })

    Example: EnforcedStyle: align_braces

    # The `align_brackets` style enforces that the opening and closing
    # braces are indented to the same position.
    
    # bad
    and_now_for_something = {
                              completely: :different
    }
    
    # good
    and_now_for_something = {
                              completely: :different
                            }

    Line is too long. [85/80]
    Open

          statistic_2 = FactoryGirl.build(:statistic, key: 'precision', project: project)

    Use normalcase for variable numbers.
    Open

          statistic_2 = FactoryGirl.build(:statistic, key: 'precision', project: project)

    This cop makes sure that all numbered variables use the configured style, snakecase, normalcase or noninteger, for their numbering.

    Example: EnforcedStyle: snake_case

    # bad
    
    variable1 = 1
    
    # good
    
    variable_1 = 1

    Example: EnforcedStyle: normalcase (default)

    # bad
    
    variable_1 = 1
    
    # good
    
    variable1 = 1

    Example: EnforcedStyle: non_integer

    # bad
    
    variable1 = 1
    
    variable_1 = 1
    
    # good
    
    variableone = 1
    
    variable_one = 1

    Line is too long. [85/80]
    Open

          statistic_2 = FactoryGirl.build(:statistic, key: 'precision', project: project)

    Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Open

                      "}"

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Line is too long. [85/80]
    Open

      it 'associates newly created statistic with the right project from raw_data ids' do

    Use normalcase for variable numbers.
    Open

          statistic_1 = Statistic.first

    This cop makes sure that all numbered variables use the configured style, snakecase, normalcase or noninteger, for their numbering.

    Example: EnforcedStyle: snake_case

    # bad
    
    variable1 = 1
    
    # good
    
    variable_1 = 1

    Example: EnforcedStyle: normalcase (default)

    # bad
    
    variable_1 = 1
    
    # good
    
    variable1 = 1

    Example: EnforcedStyle: non_integer

    # bad
    
    variable1 = 1
    
    variable_1 = 1
    
    # good
    
    variableone = 1
    
    variable_one = 1

    Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Open

        json_string = "{\"statistic\":{" \

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Open

        json_string = "{\"statistic\":" \

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Use normalcase for variable numbers.
    Open

          statistic_2 = Statistic.second

    This cop makes sure that all numbered variables use the configured style, snakecase, normalcase or noninteger, for their numbering.

    Example: EnforcedStyle: snake_case

    # bad
    
    variable1 = 1
    
    # good
    
    variable_1 = 1

    Example: EnforcedStyle: normalcase (default)

    # bad
    
    variable_1 = 1
    
    # good
    
    variable1 = 1

    Example: EnforcedStyle: non_integer

    # bad
    
    variable1 = 1
    
    variable_1 = 1
    
    # good
    
    variableone = 1
    
    variable_one = 1

    Use normalcase for variable numbers.
    Open

          statistic_2 = Statistic.second

    This cop makes sure that all numbered variables use the configured style, snakecase, normalcase or noninteger, for their numbering.

    Example: EnforcedStyle: snake_case

    # bad
    
    variable1 = 1
    
    # good
    
    variable_1 = 1

    Example: EnforcedStyle: normalcase (default)

    # bad
    
    variable_1 = 1
    
    # good
    
    variable1 = 1

    Example: EnforcedStyle: non_integer

    # bad
    
    variable1 = 1
    
    variable_1 = 1
    
    # good
    
    variableone = 1
    
    variable_one = 1

    Redundant curly braces around a hash parameter.
    Open

          {
            'id' => statistic.id,
            'key' => statistic.key,
            'value' => statistic.value,
            'iteration_index' => statistic.iteration_index,

    This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

    Example: EnforcedStyle: braces

    # The `braces` style enforces braces around all method
    # parameters that are hashes.
    
    # bad
    some_method(x, y, a: 1, b: 2)
    
    # good
    some_method(x, y, {a: 1, b: 2})

    Example: EnforcedStyle: no_braces (default)

    # The `no_braces` style checks that the last parameter doesn't
    # have braces around it.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    
    # good
    some_method(x, y, a: 1, b: 2)

    Example: EnforcedStyle: context_dependent

    # The `context_dependent` style checks that the last parameter
    # doesn't have braces around it, but requires braces if the
    # second to last parameter is also a hash literal.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)
    
    # good
    some_method(x, y, a: 1, b: 2)
    some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

    Avoid comma after the last item of an array.
    Open

              },

    This cop checks for trailing comma in array and hash literals.

    Example: EnforcedStyleForMultiline: consistent_comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1, 2,
      3,
    ]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: no_comma (default)

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2
    ]

    Line is too long. [86/80]
    Open

          statistic_1 = FactoryGirl.build(:statistic, key: 'compliance', project: project)

    Redundant curly braces around a hash parameter.
    Open

          {
            'id' => statistic.id,
            'key' => statistic.key,
            'value' => statistic.value,
            'iteration_index' => statistic.iteration_index,

    This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

    Example: EnforcedStyle: braces

    # The `braces` style enforces braces around all method
    # parameters that are hashes.
    
    # bad
    some_method(x, y, a: 1, b: 2)
    
    # good
    some_method(x, y, {a: 1, b: 2})

    Example: EnforcedStyle: no_braces (default)

    # The `no_braces` style checks that the last parameter doesn't
    # have braces around it.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    
    # good
    some_method(x, y, a: 1, b: 2)

    Example: EnforcedStyle: context_dependent

    # The `context_dependent` style checks that the last parameter
    # doesn't have braces around it, but requires braces if the
    # second to last parameter is also a hash literal.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)
    
    # good
    some_method(x, y, a: 1, b: 2)
    some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

    Avoid comma after the last item of an array.
    Open

              },

    This cop checks for trailing comma in array and hash literals.

    Example: EnforcedStyleForMultiline: consistent_comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1, 2,
      3,
    ]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: comma

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2,
    ]

    Example: EnforcedStyleForMultiline: no_comma (default)

    # bad
    a = [1, 2,]
    
    # good
    a = [
      1,
      2
    ]

    Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is.
    Open

                'key' => statistic.key,

    This cops checks the indentation of the first key in a hash literal where the opening brace and the first key are on separate lines. The other keys' indentations are handled by the AlignHash cop.

    By default, Hash literals that are arguments in a method call with parentheses, and where the opening curly brace of the hash is on the same line as the opening parenthesis of the method call, shall have their first key indented one step (two spaces) more than the position inside the opening parenthesis.

    Other hash literals shall have their first key indented one step more than the start of the line where the opening curly brace is.

    This default style is called 'specialinsideparentheses'. Alternative styles are 'consistent' and 'align_braces'. Here are examples:

    Example: EnforcedStyle: specialinsideparentheses (default)

    # The `special_inside_parentheses` style enforces that the first key
    # in a hash literal where the opening brace and the first key are on
    # separate lines is indented one step (two spaces) more than the
    # position inside the opening parentheses.
    
    # bad
    hash = {
      key: :value
    }
    and_in_a_method_call({
      no: :difference
                         })
    
    # good
    special_inside_parentheses
    hash = {
      key: :value
    }
    but_in_a_method_call({
                           its_like: :this
                         })

    Example: EnforcedStyle: consistent

    # The `consistent` style enforces that the first key in a hash
    # literal where the opening brace and the first key are on
    # seprate lines is indented the same as a hash literal which is not
    # defined inside a method call.
    
    # bad
    hash = {
      key: :value
    }
    but_in_a_method_call({
                           its_like: :this
                          })
    
    # good
    hash = {
      key: :value
    }
    and_in_a_method_call({
      no: :difference
    })

    Example: EnforcedStyle: align_braces

    # The `align_brackets` style enforces that the opening and closing
    # braces are indented to the same position.
    
    # bad
    and_now_for_something = {
                              completely: :different
    }
    
    # good
    and_now_for_something = {
                              completely: :different
                            }

    Use normalcase for variable numbers.
    Open

          statistic_1 = Statistic.first

    This cop makes sure that all numbered variables use the configured style, snakecase, normalcase or noninteger, for their numbering.

    Example: EnforcedStyle: snake_case

    # bad
    
    variable1 = 1
    
    # good
    
    variable_1 = 1

    Example: EnforcedStyle: normalcase (default)

    # bad
    
    variable_1 = 1
    
    # good
    
    variable1 = 1

    Example: EnforcedStyle: non_integer

    # bad
    
    variable1 = 1
    
    variable_1 = 1
    
    # good
    
    variableone = 1
    
    variable_one = 1

    Redundant curly braces around a hash parameter.
    Open

          {
            'id' => statistic.id,
            'key' => statistic.key,
            'value' => statistic.value,
            'iteration_index' => statistic.iteration_index,

    This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

    Example: EnforcedStyle: braces

    # The `braces` style enforces braces around all method
    # parameters that are hashes.
    
    # bad
    some_method(x, y, a: 1, b: 2)
    
    # good
    some_method(x, y, {a: 1, b: 2})

    Example: EnforcedStyle: no_braces (default)

    # The `no_braces` style checks that the last parameter doesn't
    # have braces around it.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    
    # good
    some_method(x, y, a: 1, b: 2)

    Example: EnforcedStyle: context_dependent

    # The `context_dependent` style checks that the last parameter
    # doesn't have braces around it, but requires braces if the
    # second to last parameter is also a hash literal.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)
    
    # good
    some_method(x, y, a: 1, b: 2)
    some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

    Line is too long. [86/80]
    Open

          statistic_1 = FactoryGirl.build(:statistic, key: 'compliance', project: project)

    Use normalcase for variable numbers.
    Open

          statistic_1 = FactoryGirl.build(:statistic, key: 'compliance', project: project)

    This cop makes sure that all numbered variables use the configured style, snakecase, normalcase or noninteger, for their numbering.

    Example: EnforcedStyle: snake_case

    # bad
    
    variable1 = 1
    
    # good
    
    variable_1 = 1

    Example: EnforcedStyle: normalcase (default)

    # bad
    
    variable_1 = 1
    
    # good
    
    variable1 = 1

    Example: EnforcedStyle: non_integer

    # bad
    
    variable1 = 1
    
    variable_1 = 1
    
    # good
    
    variableone = 1
    
    variable_one = 1

    Redundant curly braces around a hash parameter.
    Open

          {
            'id' => statistic.id,
            'key' => 'new_key',
            'value' => '0.987654321',
            'iteration_index' => 23,

    This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

    Example: EnforcedStyle: braces

    # The `braces` style enforces braces around all method
    # parameters that are hashes.
    
    # bad
    some_method(x, y, a: 1, b: 2)
    
    # good
    some_method(x, y, {a: 1, b: 2})

    Example: EnforcedStyle: no_braces (default)

    # The `no_braces` style checks that the last parameter doesn't
    # have braces around it.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    
    # good
    some_method(x, y, a: 1, b: 2)

    Example: EnforcedStyle: context_dependent

    # The `context_dependent` style checks that the last parameter
    # doesn't have braces around it, but requires braces if the
    # second to last parameter is also a hash literal.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)
    
    # good
    some_method(x, y, a: 1, b: 2)
    some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

    Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is.
    Open

                    'key' => statistic_1.key,

    This cops checks the indentation of the first key in a hash literal where the opening brace and the first key are on separate lines. The other keys' indentations are handled by the AlignHash cop.

    By default, Hash literals that are arguments in a method call with parentheses, and where the opening curly brace of the hash is on the same line as the opening parenthesis of the method call, shall have their first key indented one step (two spaces) more than the position inside the opening parenthesis.

    Other hash literals shall have their first key indented one step more than the start of the line where the opening curly brace is.

    This default style is called 'specialinsideparentheses'. Alternative styles are 'consistent' and 'align_braces'. Here are examples:

    Example: EnforcedStyle: specialinsideparentheses (default)

    # The `special_inside_parentheses` style enforces that the first key
    # in a hash literal where the opening brace and the first key are on
    # separate lines is indented one step (two spaces) more than the
    # position inside the opening parentheses.
    
    # bad
    hash = {
      key: :value
    }
    and_in_a_method_call({
      no: :difference
                         })
    
    # good
    special_inside_parentheses
    hash = {
      key: :value
    }
    but_in_a_method_call({
                           its_like: :this
                         })

    Example: EnforcedStyle: consistent

    # The `consistent` style enforces that the first key in a hash
    # literal where the opening brace and the first key are on
    # seprate lines is indented the same as a hash literal which is not
    # defined inside a method call.
    
    # bad
    hash = {
      key: :value
    }
    but_in_a_method_call({
                           its_like: :this
                          })
    
    # good
    hash = {
      key: :value
    }
    and_in_a_method_call({
      no: :difference
    })

    Example: EnforcedStyle: align_braces

    # The `align_brackets` style enforces that the opening and closing
    # braces are indented to the same position.
    
    # bad
    and_now_for_something = {
                              completely: :different
    }
    
    # good
    and_now_for_something = {
                              completely: :different
                            }

    Use 2 spaces for indentation in a hash, relative to the start of the line where the left curly brace is.
    Open

                    'key' => statistic_2.key,

    This cops checks the indentation of the first key in a hash literal where the opening brace and the first key are on separate lines. The other keys' indentations are handled by the AlignHash cop.

    By default, Hash literals that are arguments in a method call with parentheses, and where the opening curly brace of the hash is on the same line as the opening parenthesis of the method call, shall have their first key indented one step (two spaces) more than the position inside the opening parenthesis.

    Other hash literals shall have their first key indented one step more than the start of the line where the opening curly brace is.

    This default style is called 'specialinsideparentheses'. Alternative styles are 'consistent' and 'align_braces'. Here are examples:

    Example: EnforcedStyle: specialinsideparentheses (default)

    # The `special_inside_parentheses` style enforces that the first key
    # in a hash literal where the opening brace and the first key are on
    # separate lines is indented one step (two spaces) more than the
    # position inside the opening parentheses.
    
    # bad
    hash = {
      key: :value
    }
    and_in_a_method_call({
      no: :difference
                         })
    
    # good
    special_inside_parentheses
    hash = {
      key: :value
    }
    but_in_a_method_call({
                           its_like: :this
                         })

    Example: EnforcedStyle: consistent

    # The `consistent` style enforces that the first key in a hash
    # literal where the opening brace and the first key are on
    # seprate lines is indented the same as a hash literal which is not
    # defined inside a method call.
    
    # bad
    hash = {
      key: :value
    }
    but_in_a_method_call({
                           its_like: :this
                          })
    
    # good
    hash = {
      key: :value
    }
    and_in_a_method_call({
      no: :difference
    })

    Example: EnforcedStyle: align_braces

    # The `align_brackets` style enforces that the opening and closing
    # braces are indented to the same position.
    
    # bad
    and_now_for_something = {
                              completely: :different
    }
    
    # good
    and_now_for_something = {
                              completely: :different
                            }

    Use normalcase for variable numbers.
    Open

          statistic_2 = FactoryGirl.build(:statistic, key: 'precision', project: project)

    This cop makes sure that all numbered variables use the configured style, snakecase, normalcase or noninteger, for their numbering.

    Example: EnforcedStyle: snake_case

    # bad
    
    variable1 = 1
    
    # good
    
    variable_1 = 1

    Example: EnforcedStyle: normalcase (default)

    # bad
    
    variable_1 = 1
    
    # good
    
    variable1 = 1

    Example: EnforcedStyle: non_integer

    # bad
    
    variable1 = 1
    
    variable_1 = 1
    
    # good
    
    variableone = 1
    
    variable_one = 1

    Redundant curly braces around a hash parameter.
    Open

          {
            'id' => statistic.id,
            'key' => statistic.key,
            'value' => statistic.value,
            'iteration_index' => statistic.iteration_index,

    This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

    Example: EnforcedStyle: braces

    # The `braces` style enforces braces around all method
    # parameters that are hashes.
    
    # bad
    some_method(x, y, a: 1, b: 2)
    
    # good
    some_method(x, y, {a: 1, b: 2})

    Example: EnforcedStyle: no_braces (default)

    # The `no_braces` style checks that the last parameter doesn't
    # have braces around it.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    
    # good
    some_method(x, y, a: 1, b: 2)

    Example: EnforcedStyle: context_dependent

    # The `context_dependent` style checks that the last parameter
    # doesn't have braces around it, but requires braces if the
    # second to last parameter is also a hash literal.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)
    
    # good
    some_method(x, y, a: 1, b: 2)
    some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

    Line is too long. [85/80]
    Open

          statistic_2 = FactoryGirl.build(:statistic, key: 'precision', project: project)

    Use normalcase for variable numbers.
    Open

          statistic_1 = FactoryGirl.build(:statistic, key: 'compliance', project: project)

    This cop makes sure that all numbered variables use the configured style, snakecase, normalcase or noninteger, for their numbering.

    Example: EnforcedStyle: snake_case

    # bad
    
    variable1 = 1
    
    # good
    
    variable_1 = 1

    Example: EnforcedStyle: normalcase (default)

    # bad
    
    variable_1 = 1
    
    # good
    
    variable1 = 1

    Example: EnforcedStyle: non_integer

    # bad
    
    variable1 = 1
    
    variable_1 = 1
    
    # good
    
    variableone = 1
    
    variable_one = 1

    Line is too long. [86/80]
    Open

          statistic_1 = FactoryGirl.build(:statistic, key: 'compliance', project: project)

    Use normalcase for variable numbers.
    Open

          statistic_1 = FactoryGirl.build(:statistic, key: 'compliance', project: project)

    This cop makes sure that all numbered variables use the configured style, snakecase, normalcase or noninteger, for their numbering.

    Example: EnforcedStyle: snake_case

    # bad
    
    variable1 = 1
    
    # good
    
    variable_1 = 1

    Example: EnforcedStyle: normalcase (default)

    # bad
    
    variable_1 = 1
    
    # good
    
    variable1 = 1

    Example: EnforcedStyle: non_integer

    # bad
    
    variable1 = 1
    
    variable_1 = 1
    
    # good
    
    variableone = 1
    
    variable_one = 1

    Use normalcase for variable numbers.
    Open

          statistic_2 = FactoryGirl.build(:statistic, key: 'precision', project: project)

    This cop makes sure that all numbered variables use the configured style, snakecase, normalcase or noninteger, for their numbering.

    Example: EnforcedStyle: snake_case

    # bad
    
    variable1 = 1
    
    # good
    
    variable_1 = 1

    Example: EnforcedStyle: normalcase (default)

    # bad
    
    variable_1 = 1
    
    # good
    
    variable1 = 1

    Example: EnforcedStyle: non_integer

    # bad
    
    variable1 = 1
    
    variable_1 = 1
    
    # good
    
    variableone = 1
    
    variable_one = 1

    Redundant curly braces around a hash parameter.
    Open

          {
            'id' => statistic.id,
            'key' => statistic.key,
            'value' => statistic.value,
            'iteration_index' => statistic.iteration_index,

    This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

    Example: EnforcedStyle: braces

    # The `braces` style enforces braces around all method
    # parameters that are hashes.
    
    # bad
    some_method(x, y, a: 1, b: 2)
    
    # good
    some_method(x, y, {a: 1, b: 2})

    Example: EnforcedStyle: no_braces (default)

    # The `no_braces` style checks that the last parameter doesn't
    # have braces around it.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    
    # good
    some_method(x, y, a: 1, b: 2)

    Example: EnforcedStyle: context_dependent

    # The `context_dependent` style checks that the last parameter
    # doesn't have braces around it, but requires braces if the
    # second to last parameter is also a hash literal.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)
    
    # good
    some_method(x, y, a: 1, b: 2)
    some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

    Redundant curly braces around a hash parameter.
    Open

          {
            'id' => statistic.id,
            'key' => statistic.key,
            'value' => statistic.value,
            'iteration_index' => statistic.iteration_index,

    This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

    Example: EnforcedStyle: braces

    # The `braces` style enforces braces around all method
    # parameters that are hashes.
    
    # bad
    some_method(x, y, a: 1, b: 2)
    
    # good
    some_method(x, y, {a: 1, b: 2})

    Example: EnforcedStyle: no_braces (default)

    # The `no_braces` style checks that the last parameter doesn't
    # have braces around it.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    
    # good
    some_method(x, y, a: 1, b: 2)

    Example: EnforcedStyle: context_dependent

    # The `context_dependent` style checks that the last parameter
    # doesn't have braces around it, but requires braces if the
    # second to last parameter is also a hash literal.
    
    # bad
    some_method(x, y, {a: 1, b: 2})
    some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)
    
    # good
    some_method(x, y, a: 1, b: 2)
    some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

    There are no issues that match your filters.

    Category
    Status