Showing 49 of 49 total issues
Fenced code blocks should be surrounded by blank lines Open
```ruby
- Read upRead up
- Exclude checks
MD031 - Fenced code blocks should be surrounded by blank lines
Tags: code, blank_lines
Aliases: blanks-around-fences
This rule is triggered when fenced code blocks are either not preceded or not followed by a blank line:
Some text
```
Code block
```
```
Another code block
```
Some more text
To fix this, ensure that all fenced code blocks have a blank line both before and after (except where the block is at the beginning or end of the document):
Some text
```
Code block
```
```
Another code block
```
Some more text
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse fenced code blocks that don't have blank lines before and after them.
HTML
is not aligned with text: <<-HTML
. Open
HTML
- Read upRead up
- Exclude checks
Checks the indentation of here document closings.
Example:
# bad
class Foo
def bar
<<~SQL
'Hi'
SQL
end
end
# good
class Foo
def bar
<<~SQL
'Hi'
SQL
end
end
# bad
# heredoc contents is before closing heredoc.
foo arg,
<<~EOS
Hi
EOS
# good
foo arg,
<<~EOS
Hi
EOS
# good
foo arg,
<<~EOS
Hi
EOS
Line is too long. [169/150] Open
raise ImportError, t('metadata_not_found', default: I18n.t('actions.spree.inventory.providers.default_variant_provider.metadata_not_found')) if metadata.blank?
- Read upRead up
- Exclude checks
This cop checks the length of lines in the source code.
The maximum length is configurable.
The tab size is configured in the IndentationWidth
of the Layout/Tab
cop.
Use //
comments everywhere Open
/*
- Exclude checks
HTML
is not aligned with text: <<-HTML
. Open
HTML
- Read upRead up
- Exclude checks
Checks the indentation of here document closings.
Example:
# bad
class Foo
def bar
<<~SQL
'Hi'
SQL
end
end
# good
class Foo
def bar
<<~SQL
'Hi'
SQL
end
end
# bad
# heredoc contents is before closing heredoc.
foo arg,
<<~EOS
Hi
EOS
# good
foo arg,
<<~EOS
Hi
EOS
# good
foo arg,
<<~EOS
Hi
EOS
Align the parameters of a method call if they span more than one line. Open
index: item.index,
messages: error_message))
- Read upRead up
- Exclude checks
Here we check if the parameters on a multi-line method call or definition are aligned.
Example: EnforcedStyle: withfirstparameter (default)
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Example: EnforcedStyle: withfixedindentation
# good
foo :bar,
:baz
# bad
foo :bar,
:baz
Avoid using update_all
because it skips validations. Open
.update_all(upload_id: upload_id, upload_index: upload_index)
- Read upRead up
- Exclude checks
This cop checks for the use of methods which skip validations which are listed in http://guides.rubyonrails.org/active_record_validations.html#skipping-validations
Example:
# bad
Article.first.decrement!(:view_count)
DiscussionBoard.decrement_counter(:post_count, 5)
Article.first.increment!(:view_count)
DiscussionBoard.increment_counter(:post_count, 5)
person.toggle :active
product.touch
Billing.update_all("category = 'authorized', author = 'David'")
user.update_attribute(:website, 'example.com')
user.update_columns(last_request_at: Time.current)
Post.update_counters 5, comment_count: -1, action_count: 1
# good
user.update(website: 'example.com')
FileUtils.touch('file')
Line is too long. [161/150] Open
raise Spree::ImportError, I18n.t('workers.spree.import_inventory_item_worker.unsupported_variant_provider', product_type: product_type, provider: provider)
- Read upRead up
- Exclude checks
This cop checks the length of lines in the source code.
The maximum length is configurable.
The tab size is configured in the IndentationWidth
of the Layout/Tab
cop.
Do not use a block to set a static value to an attribute. Open
metadata do
{
file_path: './spec/fixtures/inventory.csv',
format: 'csv',
product_type: 'fake'
- Exclude checks