Dalphi/dalphi

View on GitHub
app/validators/website_components_validator.rb

Summary

Maintainability
A
0 mins
Test Coverage

Assignment Branch Condition size for validate_stylesheet is too high. [19.42/15]
Open

  def self.validate_stylesheet(record)
    return if record.stylesheet.path.nil?

    container_class = Rails.configuration.x.dalphi['annotation-interface']['container-class-name']
    stylesheet_contents = Paperclip.io_adapters.for(record.stylesheet).read

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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

  def self.validate_stylesheet(record)
    return if record.stylesheet.path.nil?

    container_class = Rails.configuration.x.dalphi['annotation-interface']['container-class-name']
    stylesheet_contents = Paperclip.io_adapters.for(record.stylesheet).read

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.

Extra empty line detected at class body beginning.
Open


  def initialize(_model)

This cops checks if empty lines around the bodies of classes match the configuration.

Example: EnforcedStyle: empty_lines

# good

class Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

class Foo
  class Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
class Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

class Foo
  def bar
    # ...
  end
end

Missing top-level class documentation comment.
Open

class WebsiteComponentsValidator < ActiveModel::Validator

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

Extra empty line detected before the rescue.
Open


  rescue Sass::SyntaxError

This cops checks if empty lines exist around the bodies of begin sections. This cop doesn't check empty lines at begin body beginning/end and around method definition body. Style/EmptyLinesAroundBeginBody or Style/EmptyLinesAroundMethodBody can be used for this purpose.

Example:

# good

begin
  do_something
rescue
  do_something2
else
  do_something3
ensure
  do_something4
end

# good

def foo
  do_something
rescue
  do_something2
end

# bad

begin
  do_something

rescue

  do_something2

else

  do_something3

ensure

  do_something4
end

# bad

def foo
  do_something

rescue

  do_something2
end

Line is too long. [88/80]
Open

    compilate = CoffeeScript.compile(Paperclip.io_adapters.for(record.java_script).read)

Line is too long. [98/80]
Open

    container_class = Rails.configuration.x.dalphi['annotation-interface']['container-class-name']

Put empty method definitions on a single line.
Open

  def initialize(_model)
  end

This cop checks for the formatting of empty method definitions. By default it enforces empty method definitions to go on a single line (compact style), but it can be configured to enforce the end to go on its own line (expanded style).

Note: A method definition is not considered empty if it contains comments.

Example: EnforcedStyle: compact (default)

# bad
def foo(bar)
end

def self.foo(bar)
end

# good
def foo(bar); end

def foo(bar)
  # baz
end

def self.foo(bar); end

Example: EnforcedStyle: expanded

# bad
def foo(bar); end

def self.foo(bar); end

# good
def foo(bar)
end

def self.foo(bar)
end

Extra empty line detected before the rescue.
Open


  rescue ExecJS::RuntimeError

This cops checks if empty lines exist around the bodies of begin sections. This cop doesn't check empty lines at begin body beginning/end and around method definition body. Style/EmptyLinesAroundBeginBody or Style/EmptyLinesAroundMethodBody can be used for this purpose.

Example:

# good

begin
  do_something
rescue
  do_something2
else
  do_something3
ensure
  do_something4
end

# good

def foo
  do_something
rescue
  do_something2
end

# bad

begin
  do_something

rescue

  do_something2

else

  do_something3

ensure

  do_something4
end

# bad

def foo
  do_something

rescue

  do_something2
end

There are no issues that match your filters.

Category
Status