SebastianCarroll/jekyll-rakefile

View on GitHub

Showing 319 of 319 total issues

Line is too long. [82/80]
Open

    # Must have cd and cd .. in same sh command as sh wont maintain dir over calls
Severity: Minor
Found in lib/tools.rb by rubocop

Prefer the use of the nil? predicate.
Open

      if title == nil then
Severity: Minor
Found in lib/jekyll_rake/post.rb by rubocop

This cop checks for comparison of something with nil using ==.

Example:

# bad
if x == nil
end

# good
if x.nil?
end

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

  puts "Commiting draft version"
Severity: Minor
Found in lib/tools.rb by rubocop

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"

Use && instead of and.
Open

  $git_check and git_repo? and git_remote_diffs(branch)
Severity: Minor
Found in lib/tools.rb by rubocop

This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

Example: EnforcedStyle: always (default)

# bad
foo.save and return

# bad
if foo and bar
end

# good
foo.save && return

# good
if foo && bar
end

Example: EnforcedStyle: conditionals

# bad
if foo and bar
end

# good
foo.save && return

# good
foo.save and return

# good
if foo && bar
end

Prefer the use of the nil? predicate.
Open

          date.match(/[0-9]+-[0-9]+-[0-9]+/) == nil) then
Severity: Minor
Found in lib/jekyll_rake/post.rb by rubocop

This cop checks for comparison of something with nil using ==.

Example:

# bad
if x == nil
end

# good
if x.nil?
end

Do not prefix reader method names with get_.
Open

    def  get_unique_filename()
Severity: Minor
Found in lib/jekyll_rake/post.rb by rubocop

This cop makes sure that accessor methods are named properly.

Example:

# bad
def set_attribute(value)
end

# good
def attribute=(value)
end

# bad
def get_attribute
end

# good
def attribute
end

Use backticks around command string.
Open

  %x{git rev-parse #{branch}} != %x{git rev-parse origin/#{branch}}
Severity: Minor
Found in lib/tools.rb by rubocop

This cop enforces using `` or %x around command literals.

Example: EnforcedStyle: backticks (default)

# bad
folders = %x(find . -type d).split

# bad
%x(
  ln -s foo.example.yml foo.example
  ln -s bar.example.yml bar.example
)

# good
folders = `find . -type d`.split

# good
`
  ln -s foo.example.yml foo.example
  ln -s bar.example.yml bar.example
`

Example: EnforcedStyle: mixed

# bad
folders = %x(find . -type d).split

# bad
`
  ln -s foo.example.yml foo.example
  ln -s bar.example.yml bar.example
`

# good
folders = `find . -type d`.split

# good
%x(
  ln -s foo.example.yml foo.example
  ln -s bar.example.yml bar.example
)

Example: EnforcedStyle: percent_x

# bad
folders = `find . -type d`.split

# bad
`
  ln -s foo.example.yml foo.example
  ln -s bar.example.yml bar.example
`

# good
folders = %x(find . -type d).split

# good
%x(
  ln -s foo.example.yml foo.example
  ln -s bar.example.yml bar.example
)

Example: AllowInnerBackticks: false (default)

# If `false`, the cop will always recommend using `%x` if one or more
# backticks are found in the command string.

# bad
`echo \`ls\``

# good
%x(echo `ls`)

Example: AllowInnerBackticks: true

# good
`echo \`ls\``

Do not use then for multi-line if.
Open

      if title == nil then
Severity: Minor
Found in lib/jekyll_rake/post.rb by rubocop

Checks for uses of the then keyword in multi-line if statements.

Example:

# bad
# This is considered bad practice.
if cond then
end

# good
# If statements can contain `then` on the same line.
if cond then a
elsif cond then b
end

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

      (date != "" and date != "nil" and not date.nil?) ? date : Time.new.strftime("%Y-%m-%d %H:%M:%S %Z")
Severity: Minor
Found in lib/jekyll_rake/post.rb by rubocop

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"

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

  if dir.downcase.include? 'drafts'
Severity: Minor
Found in lib/tools.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

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

  pubs = filenames_in "_posts/*"
Severity: Minor
Found in lib/tools.rb by rubocop

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"

Line is too long. [81/80]
Open

# TODO: Is this a good idea? Seems like I just don't uderstand ruby class loading
Severity: Minor
Found in lib/jekyll_rake.rb by rubocop

Omit the parentheses in defs when the method doesn't accept any arguments.
Open

    def prompt_for_name()
Severity: Minor
Found in lib/jekyll_rake.rb by rubocop

This cop checks for parentheses in the definition of a method, that does not take any arguments. Both instance and class/singleton methods are checked.

Example:

# bad
def foo()
  # does a thing
end

# good
def foo
  # does a thing
end

# also good
def foo() does_a_thing end

Example:

# bad
def Baz.foo()
  # does a thing
end

# good
def Baz.foo
  # does a thing
end

Missing space after #.
Open

      #if (date.nil? ||
Severity: Minor
Found in lib/jekyll_rake/post.rb by rubocop

This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

Example:

# bad
#Some comment

# good
# Some comment

Align the operands of an expression in an assignment spanning multiple lines.
Open

          File.basename(JekyllRake::Utils.slugify(@title)) + "-" + i.to_s +
Severity: Minor
Found in lib/jekyll_rake/post.rb by rubocop

This cop checks the indentation of the right hand side operand in binary operations that span more than one line.

Example:

# bad
if a +
b
  something
end

# good
if a +
   b
  something
end

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

      while File.exists?(@post_dir + filename) do
Severity: Minor
Found in lib/jekyll_rake/post.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)

Line is too long. [81/80]
Open

        puts "DATE is in the form: YYYY-MM-DD; use nil or empty for today's date"
Severity: Minor
Found in lib/jekyll_rake/post.rb by rubocop

Line is too long. [105/80]
Open

      (date != "" and date != "nil" and not date.nil?) ? date : Time.new.strftime("%Y-%m-%d %H:%M:%S %Z")
Severity: Minor
Found in lib/jekyll_rake/post.rb by rubocop

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

        puts "Error! title is empty"
Severity: Minor
Found in lib/jekyll_rake/post.rb by rubocop

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"

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

        puts "Error: Date not understood"
Severity: Minor
Found in lib/jekyll_rake/post.rb by rubocop

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"
Severity
Category
Status
Source
Language