jjuliano/markdown-ui

View on GitHub
components/elements/markdown-ui-button/lib/button/animated.rb

Summary

Maintainability
A
15 mins
Test Coverage

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

      def render
        klass           = "ui #{@klass} animated button"
        _id             = @id
        visible_content = MarkdownUI::Content::Parser.new(@visible_content).parse
        hidden_content  = MarkdownUI::Content::Parser.new(@hidden_content).parse

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.

Assignment Branch Condition size for render is too high. [16.79/15]
Open

      def render
        klass           = "ui #{@klass} animated button"
        _id             = @id
        visible_content = MarkdownUI::Content::Parser.new(@visible_content).parse
        hidden_content  = MarkdownUI::Content::Parser.new(@hidden_content).parse

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

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

      def initialize(content, klass = nil, _id = nil)
        @content                          = content
        @klass                            = klass
        @id                               = _id
        @visible_content, @hidden_content = content.is_a?(Array) ? content : content.split(';')
Severity: Minor
Found in components/elements/markdown-ui-button/lib/button/animated.rb and 1 other location - About 15 mins to fix
components/elements/markdown-ui-button/lib/button/toggle.rb on lines 7..12

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

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. [81/80]
Open

        visible_content = MarkdownUI::Content::Parser.new(@visible_content).parse

Do not use prefix _ for a variable that is used.
Open

        _id             = @id

This cop checks for underscore-prefixed variables that are actually used.

Example:

# bad

[1, 2, 3].each do |_num|
  do_something(_num)
end

Example:

# good

[1, 2, 3].each do |num|
  do_something(num)
end

Example:

# good

[1, 2, 3].each do |_num|
  do_something # not using `_num`
end

Line is too long. [89/80]
Open

          content << MarkdownUI::StandardTag.new(hidden_content, 'hidden content').render

Line is too long. [91/80]
Open

          content << MarkdownUI::StandardTag.new(visible_content, 'visible content').render

Do not use prefix _ for a variable that is used.
Open

      def initialize(content, klass = nil, _id = nil)

This cop checks for underscore-prefixed variables that are actually used.

Example:

# bad

[1, 2, 3].each do |_num|
  do_something(_num)
end

Example:

# good

[1, 2, 3].each do |num|
  do_something(num)
end

Example:

# good

[1, 2, 3].each do |_num|
  do_something # not using `_num`
end

Unnecessary utf-8 encoding comment.
Open

# coding: UTF-8

Missing top-level class documentation comment.
Open

    class Animated

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

Line is too long. [95/80]
Open

        @visible_content, @hidden_content = content.is_a?(Array) ? content : content.split(';')

There are no issues that match your filters.

Category
Status