Showing 247 of 250 total issues
Replace class var @@all_users with a class instance var. Open
@@all_users ||= get_or_construct_user("all users")
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.
You have to be careful when setting a value for a class variable; if a class has been inherited, changing the value of a class variable also affects the inheriting classes. This means that it's almost always better to use a class instance variable instead.
Example:
# bad
class A
@@test = 10
end
class A
def self.test(name, value)
class_variable_set("@@#{name}", value)
end
end
class A; end
A.class_variable_set(:@@test, 10)
# good
class A
@test = 10
end
class A
def test
@@test # you can access class variable without offense
end
end
class A
def self.test(name)
class_variable_get("@@#{name}") # you can access without offense
end
end
Replace class var @@one_users with a class instance var. Open
@@all_users = @@one_users = @@reviewers = nil
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.
You have to be careful when setting a value for a class variable; if a class has been inherited, changing the value of a class variable also affects the inheriting classes. This means that it's almost always better to use a class instance variable instead.
Example:
# bad
class A
@@test = 10
end
class A
def self.test(name, value)
class_variable_set("@@#{name}", value)
end
end
class A; end
A.class_variable_set(:@@test, 10)
# good
class A
@test = 10
end
class A
def test
@@test # you can access class variable without offense
end
end
class A
def self.test(name)
class_variable_get("@@#{name}") # you can access without offense
end
end
Inline HTML Open
<summary>Examples</summary>
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD033 - Inline HTML
Tags: html
Aliases: no-inline-html
This rule is triggered whenever raw HTML is used in a markdown document:
Inline HTML header
To fix this, use 'pure' markdown instead of including raw HTML:
# Markdown header
Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.
Inline HTML Open
<summary>Examples</summary>
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD033 - Inline HTML
Tags: html
Aliases: no-inline-html
This rule is triggered whenever raw HTML is used in a markdown document:
Inline HTML header
To fix this, use 'pure' markdown instead of including raw HTML:
# Markdown header
Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.
Inline HTML Open
<details>
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD033 - Inline HTML
Tags: html
Aliases: no-inline-html
This rule is triggered whenever raw HTML is used in a markdown document:
Inline HTML header
To fix this, use 'pure' markdown instead of including raw HTML:
# Markdown header
Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.
Line length Open
sudo gcc script/jpegresize.c -I/opt/homebrew/include -L/opt/homebrew/lib -ljpeg -lm -O2 -o /usr/local/bin/jpegresize
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD013 - Line length
Tags: line_length
Aliases: line-length Parameters: linelength, codeblocks, tables (number; default 80, boolean; default true)
This rule is triggered when there are lines that are longer than the configured line length (default: 80 characters). To fix this, split the line up into multiple lines.
This rule has an exception where there is no whitespace beyond the configured line length. This allows you to still include items such as long URLs without being forced to break them in the middle.
You also have the option to exclude this rule for code blocks and tables. To
do this, set the code_blocks
and/or tables
parameters to false.
Code blocks are included in this rule by default since it is often a requirement for document readability, and tentatively compatible with code rules. Still, some languages do not lend themselves to short lines.
Ordered list item prefix Open
4. In the new terminal window, access MySQL as Root without a password:
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD029 - Ordered list item prefix
Tags: ol
Aliases: ol-prefix
Parameters: style ("one", "ordered"; default "one")
This rule is triggered on ordered lists that do not either start with '1.' or do not have a prefix that increases in numerical order (depending on the configured style, which defaults to 'one').
Example valid list if the style is configured as 'one':
1. Do this.
1. Do that.
1. Done.
Example valid list if the style is configured as 'ordered':
1. Do this.
2. Do that.
3. Done.
Bare URL used Open
* https://mushroomobserver.org/name_descriptions.csv
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD034 - Bare URL used
Tags: links, url
Aliases: no-bare-urls
This rule is triggered whenever a URL is given that isn't surrounded by angle brackets:
For more information, see http://www.example.com/.
To fix this, add angle brackets around the URL:
For more information, see <http:></http:>.
Rationale: Without angle brackets, the URL isn't converted into a link in many markdown parsers.
Note: if you do want a bare URL without it being converted into a link, enclose it in a code block, otherwise in some markdown parsers it will be converted:
`http://www.example.com`
Lists should be surrounded by blank lines Open
5. Inside the MySQL prompt (in the new terminal window), update the root password:
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD032 - Lists should be surrounded by blank lines
Tags: bullet, ul, ol, blank_lines
Aliases: blanks-around-lists
This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:
Some text
* Some
* List
1. Some
2. List
Some text
To fix this, ensure that all lists have a blank line both before and after (except where the block is at the beginning or end of the document):
Some text
* Some
* List
1. Some
2. List
Some text
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse lists that don't have blank lines before and after them.
Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:
* This is
not okay
* This is
okay
Replace class var @@location_format with a class instance var. Open
@@location_format = val ? val.location_format : "postal"
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.
You have to be careful when setting a value for a class variable; if a class has been inherited, changing the value of a class variable also affects the inheriting classes. This means that it's almost always better to use a class instance variable instead.
Example:
# bad
class A
@@test = 10
end
class A
def self.test(name, value)
class_variable_set("@@#{name}", value)
end
end
class A; end
A.class_variable_set(:@@test, 10)
# good
class A
@test = 10
end
class A
def test
@@test # you can access class variable without offense
end
end
class A
def self.test(name)
class_variable_get("@@#{name}") # you can access without offense
end
end
Bare URL used Open
* https://mushroomobserver.org/names.csv
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD034 - Bare URL used
Tags: links, url
Aliases: no-bare-urls
This rule is triggered whenever a URL is given that isn't surrounded by angle brackets:
For more information, see http://www.example.com/.
To fix this, add angle brackets around the URL:
For more information, see <http:></http:>.
Rationale: Without angle brackets, the URL isn't converted into a link in many markdown parsers.
Note: if you do want a bare URL without it being converted into a link, enclose it in a code block, otherwise in some markdown parsers it will be converted:
`http://www.example.com`
Inline HTML Open
<summary>Examples</summary>
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD033 - Inline HTML
Tags: html
Aliases: no-inline-html
This rule is triggered whenever raw HTML is used in a markdown document:
Inline HTML header
To fix this, use 'pure' markdown instead of including raw HTML:
# Markdown header
Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.
Inline HTML Open
<details>
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD033 - Inline HTML
Tags: html
Aliases: no-inline-html
This rule is triggered whenever raw HTML is used in a markdown document:
Inline HTML header
To fix this, use 'pure' markdown instead of including raw HTML:
# Markdown header
Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.
Inline HTML Open
<summary>Example having one definition</summary>
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD033 - Inline HTML
Tags: html
Aliases: no-inline-html
This rule is triggered whenever raw HTML is used in a markdown document:
Inline HTML header
To fix this, use 'pure' markdown instead of including raw HTML:
# Markdown header
Rationale: Raw HTML is allowed in markdown, but this rule is included for those who want their documents to only include "pure" markdown, or for those who are rendering markdown documents in something other than HTML.
Replace class var @@location_format with a class instance var. Open
@@location_format = "postal" unless defined?(@@location_format)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.
You have to be careful when setting a value for a class variable; if a class has been inherited, changing the value of a class variable also affects the inheriting classes. This means that it's almost always better to use a class instance variable instead.
Example:
# bad
class A
@@test = 10
end
class A
def self.test(name, value)
class_variable_set("@@#{name}", value)
end
end
class A; end
A.class_variable_set(:@@test, 10)
# good
class A
@test = 10
end
class A
def test
@@test # you can access class variable without offense
end
end
class A
def self.test(name)
class_variable_get("@@#{name}") # you can access without offense
end
end
Use anonymous positional arguments forwarding (*
). Open
def flash_warning(*strs)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
In Ruby 2.7, arguments forwarding has been added.
This cop identifies places where do_something(*args, &block)
can be replaced by do_something(...)
.
In Ruby 3.2, anonymous args/kwargs forwarding has been added.
This cop also identifies places where use_args(*args)
/use_kwargs(**kwargs)
can be
replaced by use_args(*)
/use_kwargs(**)
; if desired, this functionality can be disabled
by setting UseAnonymousForwarding: false.
Example:
# bad
def foo(*args, &block)
bar(*args, &block)
end
# bad
def foo(*args, **kwargs, &block)
bar(*args, **kwargs, &block)
end
# good
def foo(...)
bar(...)
end
Example: UseAnonymousForwarding: true (default, only relevant for Ruby >= 3.2)
# bad
def foo(*args, **kwargs)
args_only(*args)
kwargs_only(**kwargs)
end
# good
def foo(*, **)
args_only(*)
kwargs_only(**)
end
Example: UseAnonymousForwarding: false (only relevant for Ruby >= 3.2)
# good
def foo(*args, **kwargs)
args_only(*args)
kwargs_only(**kwargs)
end
Example: AllowOnlyRestArgument: true (default, only relevant for Ruby < 3.2)
# good
def foo(*args)
bar(*args)
end
def foo(**kwargs)
bar(**kwargs)
end
Example: AllowOnlyRestArgument: false (only relevant for Ruby < 3.2)
# bad
# The following code can replace the arguments with `...`,
# but it will change the behavior. Because `...` forwards block also.
def foo(*args)
bar(*args)
end
def foo(**kwargs)
bar(**kwargs)
end
Bare URL used Open
* https://mushroomobserver.org/images_observations.csv
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD034 - Bare URL used
Tags: links, url
Aliases: no-bare-urls
This rule is triggered whenever a URL is given that isn't surrounded by angle brackets:
For more information, see http://www.example.com/.
To fix this, add angle brackets around the URL:
For more information, see <http:></http:>.
Rationale: Without angle brackets, the URL isn't converted into a link in many markdown parsers.
Note: if you do want a bare URL without it being converted into a link, enclose it in a code block, otherwise in some markdown parsers it will be converted:
`http://www.example.com`
Bare URL used Open
* https://mushroomobserver.org/locations.csv
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD034 - Bare URL used
Tags: links, url
Aliases: no-bare-urls
This rule is triggered whenever a URL is given that isn't surrounded by angle brackets:
For more information, see http://www.example.com/.
To fix this, add angle brackets around the URL:
For more information, see <http:></http:>.
Rationale: Without angle brackets, the URL isn't converted into a link in many markdown parsers.
Note: if you do want a bare URL without it being converted into a link, enclose it in a code block, otherwise in some markdown parsers it will be converted:
`http://www.example.com`
Ordered list item prefix Open
2. Start MySQL in Safe Mode
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD029 - Ordered list item prefix
Tags: ol
Aliases: ol-prefix
Parameters: style ("one", "ordered"; default "one")
This rule is triggered on ordered lists that do not either start with '1.' or do not have a prefix that increases in numerical order (depending on the configured style, which defaults to 'one').
Example valid list if the style is configured as 'one':
1. Do this.
1. Do that.
1. Done.
Example valid list if the style is configured as 'ordered':
1. Do this.
2. Do that.
3. Done.
Lists should be surrounded by blank lines Open
7. Restart MySQL
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
MD032 - Lists should be surrounded by blank lines
Tags: bullet, ul, ol, blank_lines
Aliases: blanks-around-lists
This rule is triggered when lists (of any kind) are either not preceded or not followed by a blank line:
Some text
* Some
* List
1. Some
2. List
Some text
To fix this, ensure that all lists have a blank line both before and after (except where the block is at the beginning or end of the document):
Some text
* Some
* List
1. Some
2. List
Some text
Rationale: Aside from aesthetic reasons, some parsers, including kramdown, will not parse lists that don't have blank lines before and after them.
Note: List items without hanging indents are a violation of this rule; list items with hanging indents are okay:
* This is
not okay
* This is
okay