metaminded/tabulatr2

View on GitHub
lib/tabulatr/generators/tabulatr/table_generator.rb

Summary

Maintainability
A
0 mins
Test Coverage

Line is too long. [113/80]
Open

        template 'tabulatr_data.rb', File.join('app/tabulatr_data/', class_path, "#{file_name}_tabulatr_data.rb")

Line is too long. [87/80]
Open

        [:id] + attributes.select { |attr| !attr.reference? }.map { |a| a.name.to_sym }

Line is too long. [86/80]
Open

      argument :attributes, type: :array, default: [], banner: 'field:type field:type'

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

      desc "create TabulatrData Class"

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"

Pass &:reference? as an argument to select instead of a block.
Open

        attributes.select { |attr| attr.reference? }.map { |a| a.name.to_sym }

Use symbols as procs when possible.

Example:

# bad
something.map { |s| s.upcase }

# good
something.map(&:upcase)

Missing top-level class documentation comment.
Open

    class TableGenerator < Rails::Generators::NamedBase

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

There are no issues that match your filters.

Category
Status