SebastianCarroll/jekyll-rakefile

View on GitHub
lib/jekyll_rake/utils.rb

Summary

Maintainability
A
0 mins
Test Coverage

Use tr instead of gsub.
Open

      return title.downcase.strip.gsub(' ', '_').gsub(/[^\w-]/, '')
Severity: Minor
Found in lib/jekyll_rake/utils.rb by rubocop

This cop identifies places where gsub can be replaced by tr or delete.

Example:

# bad
'abc'.gsub('b', 'd')
'abc'.gsub('a', '')
'abc'.gsub(/a/, 'd')
'abc'.gsub!('a', 'd')

# good
'abc'.gsub(/.*/, 'a')
'abc'.gsub(/a+/, 'd')
'abc'.tr('b', 'd')
'a b c'.delete(' ')

Use tr instead of gsub.
Open

      return title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
Severity: Minor
Found in lib/jekyll_rake/utils.rb by rubocop

This cop identifies places where gsub can be replaced by tr or delete.

Example:

# bad
'abc'.gsub('b', 'd')
'abc'.gsub('a', '')
'abc'.gsub(/a/, 'd')
'abc'.gsub!('a', 'd')

# good
'abc'.gsub(/.*/, 'a')
'abc'.gsub(/a+/, 'd')
'abc'.tr('b', 'd')
'a b c'.delete(' ')

TODO found
Open

    # TODO: Migrate slugify from '-' to '_'. Need to write script to migrate filenames
Severity: Minor
Found in lib/jekyll_rake/utils.rb by fixme

Trailing whitespace detected.
Open

    
Severity: Minor
Found in lib/jekyll_rake/utils.rb by rubocop

Redundant return detected.
Open

      return title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
Severity: Minor
Found in lib/jekyll_rake/utils.rb by rubocop

This cop checks for redundant return expressions.

Example:

def test
  return something
end

def test
  one
  two
  three
  return something
end

It should be extended to handle methods whose body is if/else or a case expression with a default branch.

Line is too long. [81/80]
Open

      # strip characters and whitespace to create valid filenames, also lowercase
Severity: Minor
Found in lib/jekyll_rake/utils.rb by rubocop

Redundant return detected.
Open

      return title.downcase.strip.gsub(' ', '_').gsub(/[^\w-]/, '')
Severity: Minor
Found in lib/jekyll_rake/utils.rb by rubocop

This cop checks for redundant return expressions.

Example:

def test
  return something
end

def test
  one
  two
  three
  return something
end

It should be extended to handle methods whose body is if/else or a case expression with a default branch.

Line is too long. [81/80]
Open

      # strip characters and whitespace to create valid filenames, also lowercase
Severity: Minor
Found in lib/jekyll_rake/utils.rb by rubocop

Line is too long. [86/80]
Open

    # TODO: Migrate slugify from '-' to '_'. Need to write script to migrate filenames
Severity: Minor
Found in lib/jekyll_rake/utils.rb by rubocop

Missing top-level class documentation comment.
Open

  class Utils
Severity: Minor
Found in lib/jekyll_rake/utils.rb by rubocop

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