Showing 840 of 840 total issues
Use 2 (not 1) spaces for indentation. Open
directory_name = file[TEMPLATE_NAME_KEY].gsub(/^\/|\/$/, '')
- Read upRead up
- Exclude checks
This cops checks for indentation that doesn't use the specified number of spaces.
See also the IndentationConsistency cop which is the companion to this one.
Example:
# bad
class A
def test
puts 'hello'
end
end
# good
class A
def test
puts 'hello'
end
end
Example: IgnoredPatterns: ['^\s*module']
# bad
module A
class B
def test
puts 'hello'
end
end
end
# good
module A
class B
def test
puts 'hello'
end
end
end
Line is too long. [85/80] Open
# @param file_is_resource [TrueClass or FalseClass] If true then file is resource
- Exclude checks
Tab detected. Open
return
- Exclude checks
Line is too long. [91/80] Open
File.extname(resource_name) == '.xib' || File.extname(resource_name) == '.storyboard'
- Exclude checks
Tab detected. Open
directory_name = file[TEMPLATE_NAME_KEY].gsub(/^\/|\/$/, '')
- Exclude checks
Line is too long. [94/80] Open
error_description = "Cannot find a target with name #{target_name} in Xcode project".red
- Exclude checks
Tab detected. Open
root_path,
- Exclude checks
Redundant self
detected. Open
self.retrieve_group_or_create_if_needed(group_path, dir_path, directory_name, project, true, group_is_logical)
- Read upRead up
- Exclude checks
This cop checks for redundant uses of self
.
The usage of self
is only needed when:
Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.
Calling an attribute writer to prevent an local variable assignment.
Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.
Note we allow uses of self
with operators because it would be awkward
otherwise.
Example:
# bad
def foo(bar)
self.baz
end
# good
def foo(bar)
self.bar # Resolves name clash with the argument.
end
def foo
bar = 1
self.bar # Resolves name clash with the local variable.
end
def foo
%w[x y z].select do |bar|
self.bar == bar # Resolves name clash with argument of the block.
end
end
Redundant self
detected. Open
files_path = self.files_path_from_group(module_group, project)
- Read upRead up
- Exclude checks
This cop checks for redundant uses of self
.
The usage of self
is only needed when:
Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.
Calling an attribute writer to prevent an local variable assignment.
Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.
Note we allow uses of self
with operators because it would be awkward
otherwise.
Example:
# bad
def foo(bar)
self.baz
end
# good
def foo(bar)
self.bar # Resolves name clash with the argument.
end
def foo
bar = 1
self.bar # Resolves name clash with the local variable.
end
def foo
%w[x y z].select do |bar|
self.bar == bar # Resolves name clash with argument of the block.
end
end
Use files.count.zero?
instead of files.count == 0
. Open
if targets.count == 0 || files == nil || files.count == 0 || dir_path == nil || group_path == nil
- Read upRead up
- Exclude checks
This cop checks for usage of comparison operators (==
,
>
, <
) to test numbers as zero, positive, or negative.
These can be replaced by their respective predicate methods.
The cop can also be configured to do the reverse.
The cop disregards #nonzero?
as it its value is truthy or falsey,
but not true
and false
, and thus not always interchangeable with
!= 0
.
The cop ignores comparisons to global variables, since they are often
populated with objects which can be compared with integers, but are
not themselves Interger
polymorphic.
Example: EnforcedStyle: predicate (default)
# bad
foo == 0
0 > foo
bar.baz > 0
# good
foo.zero?
foo.negative?
bar.baz.positive?
Example: EnforcedStyle: comparison
# bad
foo.zero?
foo.negative?
bar.baz.positive?
# good
foo == 0
0 > foo
bar.baz > 0
Redundant self
detected. Open
module_group = self.retrieve_group_or_create_if_needed(group_path, nil, nil, project, false, group_is_logical)
- Read upRead up
- Exclude checks
This cop checks for redundant uses of self
.
The usage of self
is only needed when:
Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.
Calling an attribute writer to prevent an local variable assignment.
Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.
Note we allow uses of self
with operators because it would be awkward
otherwise.
Example:
# bad
def foo(bar)
self.baz
end
# good
def foo(bar)
self.bar # Resolves name clash with the argument.
end
def foo
bar = 1
self.bar # Resolves name clash with the local variable.
end
def foo
%w[x y z].select do |bar|
self.bar == bar # Resolves name clash with argument of the block.
end
end
Final newline missing. Open
end
- Exclude checks
Line is too long. [94/80] Open
params['Targets'] = code_module.project_targets.join(',') if code_module.project_targets
- Exclude checks
Line is too long. [91/80] Open
templates += catalog_template_list_helper.obtain_all_templates_from_a_catalog(path)
- Exclude checks
Prefer using YAML.safe_load
over YAML.load
. Open
preferences = file_contents.empty? ? {} : YAML.load(file_contents).to_hash
- Read upRead up
- Exclude checks
This cop checks for the use of YAML class methods which have potential security issues leading to remote code execution when loading from an untrusted source.
Example:
# bad
YAML.load("--- foo")
# good
YAML.safe_load("--- foo")
YAML.dump("foo")
Missing top-level class documentation comment. Open
class Template < Thor
- Read upRead up
- Exclude checks
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
Tab detected. Open
class Application < Thor
- Exclude checks
Tab detected. Open
Liquid::Template.file_system = Liquid::LocalFileSystem.new(template.template_path.join('snippets'), '%s.liquid')
- Exclude checks
Trailing whitespace detected. Open
- Exclude checks
Tab detected. Open
file_name = filename_template.render(scope)
- Exclude checks