eiwi1101/yapfac

View on GitHub

Showing 12 of 12 total issues

Assignment Branch Condition size for to_s is too high. [21.68/20]
Open

  def to_s
    # TODO: Figure out a cleaner indentation method.

    out = Array.new
    tab = @parent.nil? ? "" : "\t"
Severity: Minor
Found in lib/yapfac/apache/scope.rb by rubocop

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 to_s has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def to_s
    # TODO: Figure out a cleaner indentation method.

    out = Array.new
    tab = @parent.nil? ? "" : "\t"
Severity: Minor
Found in lib/yapfac/apache/scope.rb - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File.exists? is deprecated in favor of File.exist?.
Open

    return nil unless File.exists? file
Severity: Minor
Found in lib/yapfac/apache.rb by rubocop

This cop checks for uses of the deprecated class method usages.

Example:

# bad

File.exists?(some_path)

Example:

# good

File.exist?(some_path)

Ambiguous regexp literal. Parenthesize the method arguments if it's surely a regexp literal, or add a whitespace to the right of the / if it should be a division.
Open

    name, params = name.split /\s+/, 2 if params.nil?
Severity: Minor
Found in lib/yapfac/apache/directive.rb by rubocop

This cop checks for ambiguous regexp literals in the first argument of a method invocation without parentheses.

Example:

# bad

# This is interpreted as a method invocation with a regexp literal,
# but it could possibly be `/` method invocations.
# (i.e. `do_something./(pattern)./(i)`)
do_something /pattern/i

Example:

# good

# With parentheses, there's no ambiguity.
do_something(/pattern/i)

Ambiguous block operator. Parenthesize the method arguments if it's surely a block operator, or add a whitespace to the right of the & if it should be a binary AND.
Open

    lines_a.reject! &:nil?
Severity: Minor
Found in lib/yapfac/apache/site.rb by rubocop

This cop checks for ambiguous operators in the first argument of a method invocation without parentheses.

Example:

# bad

# The `*` is interpreted as a splat operator but it could possibly be
# a `*` method invocation (i.e. `do_something.*(some_array)`).
do_something *some_array

Example:

# good

# With parentheses, there's no ambiguity.
do_something(*some_array)

Ambiguous regexp literal. Parenthesize the method arguments if it's surely a regexp literal, or add a whitespace to the right of the / if it should be a division.
Open

    lines_a.map     { |l| l.gsub! /\s+/, ' ' }
Severity: Minor
Found in lib/yapfac/apache/site.rb by rubocop

This cop checks for ambiguous regexp literals in the first argument of a method invocation without parentheses.

Example:

# bad

# This is interpreted as a method invocation with a regexp literal,
# but it could possibly be `/` method invocations.
# (i.e. `do_something./(pattern)./(i)`)
do_something /pattern/i

Example:

# good

# With parentheses, there's no ambiguity.
do_something(/pattern/i)

Useless private access modifier.
Open

private
Severity: Minor
Found in lib/yapfac/apache/directive.rb by rubocop

This cop checks for redundant access modifiers, including those with no code, those which are repeated, and leading public modifiers in a class or module body. Conditionally-defined methods are considered as always being defined, and thus access modifiers guarding such methods are not redundant.

Example:

class Foo
  public # this is redundant (default access is public)

  def method
  end

  private # this is not redundant (a method is defined)
  def method2
  end

  private # this is redundant (no following methods are defined)
end

Example:

class Foo
  # The following is not redundant (conditionally defined methods are
  # considered as always defining a method)
  private

  if condition?
    def method
    end
  end

  protected # this is not redundant (method is defined)

  define_method(:method2) do
  end

  protected # this is redundant (repeated from previous modifier)

  [1,2,3].each do |i|
    define_method("foo#{i}") do
    end
  end

  # The following is redundant (methods defined on the class'
  # singleton class are not affected by the public modifier)
  public

  def self.method3
  end
end

Example:

# Lint/UselessAccessModifier:
#   ContextCreatingMethods:
#     - concerning
require 'active_support/concern'
class Foo
  concerning :Bar do
    def some_public_method
    end

    private

    def some_private_method
    end
  end

  # this is not redundant because `concerning` created its own context
  private

  def some_other_private_method
  end
end

Example:

# Lint/UselessAccessModifier:
#   MethodCreatingMethods:
#     - delegate
require 'active_support/core_ext/module/delegation'
class Foo
  # this is not redundant because `delegate` creates methods
  private

  delegate :method_a, to: :method_b
end

TODO found
Open

                 (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
Severity: Minor
Found in .rubocop.yml by fixme

FIXME found
Open

                 (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
Severity: Minor
Found in .rubocop.yml by fixme

HACK found
Open

                 (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
Severity: Minor
Found in .rubocop.yml by fixme

TODO found
Open

Copyright (c) 2015 TODO: Write your name
Severity: Minor
Found in LICENSE.txt by fixme

TODO found
Open

    # TODO: Figure out a cleaner indentation method.
Severity: Minor
Found in lib/yapfac/apache/scope.rb by fixme
Severity
Category
Status
Source
Language