codeforsanjose/codeforsanjose

View on GitHub
test/integration/meetup_event_consumption_test.rb

Summary

Maintainability
A
45 mins
Test Coverage

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

describe MeetupEvent do
  before do
    DatabaseCleaner.strategy = :truncation, {only: %w( meetup_events )}

    meetup_client = MeetupWrapper.new(

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.

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

        event = MeetupEvent.new(
          name: event,
          event_url: event_attributes['event_url'],
          address: event_attributes['venue']['address_1'],
          address_name: event_attributes['venue']['name'],
Severity: Minor
Found in test/integration/meetup_event_consumption_test.rb and 1 other location - About 45 mins to fix
app/jobs/meetup_poll_job.rb on lines 15..24

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

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

Space inside } missing.
Open

    DatabaseCleaner.strategy = :truncation, {only: %w( meetup_events )}

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

(...) interpreted as grouped expression.
Open

        event.event_url.must_match ('http')

Checks for space between the name of a called method and a left parenthesis.

Example:

# bad

puts (x + y)

Example:

# good

puts(x + y)

Space inside { missing.
Open

    DatabaseCleaner.strategy = :truncation, {only: %w( meetup_events )}

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Do not use spaces inside percent literal delimiters.
Open

    DatabaseCleaner.strategy = :truncation, {only: %w( meetup_events )}

Checks for unnecessary additional spaces inside the delimiters of %i/%w/%x literals.

Example:

# good
%i(foo bar baz)

# bad
%w( foo bar baz )

# bad
%x(  ls -l )

Don't use parentheses around a literal.
Open

        event.event_url.must_match ('http')

This cop checks for redundant parentheses.

Example:

# bad
(x) if ((y.z).nil?)

# good
x if y.z.nil?

Do not use spaces inside percent literal delimiters.
Open

    DatabaseCleaner.strategy = :truncation, {only: %w( meetup_events )}

Checks for unnecessary additional spaces inside the delimiters of %i/%w/%x literals.

Example:

# good
%i(foo bar baz)

# bad
%w( foo bar baz )

# bad
%x(  ls -l )

There are no issues that match your filters.

Category
Status