Showing 1,637 of 1,651 total issues
Replace class var @@_GTDB_API with a class instance var. Open
@@_GTDB_API = 'https://gtdb-api.ecogenomic.org/'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop 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.
Replace class var @@_EUTILS_BUILD with a class instance var. Open
@@_EUTILS_BUILD = lambda { |service, q|
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop 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.
Use snake_case for variable names. Open
@@EXCLUDE_NOMARKER_TASKS = %i[essential_genes ssu]
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop makes sure that all variables use the configured style, snake_case or camelCase, for their names.
Example: EnforcedStyle: snake_case (default)
# bad
fooBar = 1
# good
foo_bar = 1
Example: EnforcedStyle: camelCase
# bad
foo_bar = 1
# good
fooBar = 1
$/${} is unnecessary on arithmetic variables. Open
if [[ $C_LEN -gt $(($P_LEN * 11 / 10)) ]] ; then
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
$/${} is unnecessary on arithmetic variables.
Problematic code:
echo $(($n+1))
Correct code:
echo $((n+1))
Rationale:
The $
on regular variables in arithmetic contexts is unnecessary, and can even lead to subtle bugs. This is because the contents of $((..))
is first expanded into a string, and then evaluated as an expression:
$ a='1+1'
$ echo $(($a * 5)) # becomes 1+1*5
6
$ echo $((a * 5)) # evaluates as (1+1)*5
10
The $
is unavoidable for special variables like $1
vs 1
, $#
vs #
. It's also required when adding modifiers to parameters expansions, like ${#var}
or ${var%-}
. ShellCheck does not warn about these cases.
Notice
Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.
Use snake_case for variable names. Open
@@_EXCLUDE_NOMARKER_TASKS_H =
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop makes sure that all variables use the configured style, snake_case or camelCase, for their names.
Example: EnforcedStyle: snake_case (default)
# bad
fooBar = 1
# good
foo_bar = 1
Example: EnforcedStyle: camelCase
# bad
foo_bar = 1
# good
fooBar = 1
Replace class var @@EXCLUDE_NOREF_TASKS with a class instance var. Open
@@EXCLUDE_NOREF_TASKS = %i[mytaxa_scan taxonomy]
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop 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.
Avoid rescuing without specifying an error class. Open
rescue => e
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for rescuing StandardError
. There are two supported
styles implicit
and explicit
. This cop will not register an offense
if any error other than StandardError
is specified.
Example: EnforcedStyle: implicit
# `implicit` will enforce using `rescue` instead of
# `rescue StandardError`.
# bad
begin
foo
rescue StandardError
bar
end
# good
begin
foo
rescue
bar
end
# good
begin
foo
rescue OtherError
bar
end
# good
begin
foo
rescue StandardError, SecurityError
bar
end
Example: EnforcedStyle: explicit (default)
# `explicit` will enforce using `rescue StandardError`
# instead of `rescue`.
# bad
begin
foo
rescue
bar
end
# good
begin
foo
rescue StandardError
bar
end
# good
begin
foo
rescue OtherError
bar
end
# good
begin
foo
rescue StandardError, SecurityError
bar
end
Use snake_case for variable names. Open
@@_EBI_API = 'https://www.ebi.ac.uk/Tools/'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop makes sure that all variables use the configured style, snake_case or camelCase, for their names.
Example: EnforcedStyle: snake_case (default)
# bad
fooBar = 1
# good
foo_bar = 1
Example: EnforcedStyle: camelCase
# bad
foo_bar = 1
# good
fooBar = 1
Do not use ::
for method calls. Open
URI::join(*safe)
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).
Example:
# bad
Timeout::timeout(500) { do_something }
FileUtils::rmdir(dir)
Marshal::dump(obj)
# good
Timeout.timeout(500) { do_something }
FileUtils.rmdir(dir)
Marshal.dump(obj)
Missing magic comment # frozen_string_literal: true
. Open
require 'cgi'
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
This cop is designed to help upgrade to Ruby 3.0. It will add the
comment # frozen_string_literal: true
to the top of files to
enable frozen string literals. Frozen string literals may be default
in Ruby 3.0. The comment will be added below a shebang and encoding
comment. The frozen string literal comment is only valid in Ruby 2.3+.
Example: EnforcedStyle: when_needed (default)
# The `when_needed` style will add the frozen string literal comment
# to files only when the `TargetRubyVersion` is set to 2.3+.
# bad
module Foo
# ...
end
# good
# frozen_string_literal: true
module Foo
# ...
end
Example: EnforcedStyle: always
# The `always` style will always add the frozen string literal comment
# to a file, regardless of the Ruby version or if `freeze` or `<<` are
# called on a string literal.
# bad
module Bar
# ...
end
# good
# frozen_string_literal: true
module Bar
# ...
end
Example: EnforcedStyle: never
# The `never` will enforce that the frozen string literal comment does
# not exist in a file.
# bad
# frozen_string_literal: true
module Baz
# ...
end
# good
module Baz
# ...
end
Use ./*glob* or -- *glob* so names with dashes won't become options. Open
&& rm *.faa )
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Use ./*glob* or -- *glob* so names with dashes won't become options.
Problematic code:
rm *
Correct code:
rm ./*
or
rm -- *
Rationale
Since files and arguments are strings passed the same way, programs can't properly determine which is which, and rely on dashes to determine what's what.
A file named -f
(touch -- -f
) will not be deleted by the problematic code. It will instead be interpreted as a command line option, and rm
will even report success.
Using ./*
will instead cause the glob to be expanded into ./-f
, which no program will treat as an option.
Similarly, --
by convention indicates the end of options, and nothing after it will be treated like flags (except for some programs possibly still special casing -
as e.g. stdin).
Note that changing *
to ./*
in GNU Tar parameters will add ./
prefix to path names in the created archive. This may cause subtle problems (eg. to search for a specific file in archive, the ./
prefix must be specified as well). So using -- *
is a safer fix for GNU Tar commands.
For more information, see "Filenames and Pathnames in Shell: How to do it Correctly".
Notice
Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.
Can't follow non-constant source. Use a directive to specify location. Open
[[ -s "$MIGA_MOD" ]] && . "$MIGA_MOD"
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Can't follow non-constant source. Use a directive to specify location.
Problematic code:
. "$(find_install_dir)/lib.sh"
Correct code:
# shellcheck source=src/lib.sh
. "$(find_install_dir)/lib.sh"
Rationale:
ShellCheck is not able to include sourced files from paths that are determined at runtime. The file will not be read, potentially resulting in warnings about unassigned variables and similar.
Use a [[Directive]] to point shellcheck to a fixed location it can read instead.
Exceptions:
If you don't care that ShellCheck is unable to account for the file, specify # shellcheck source=/dev/null
.
Notice
Original content from the ShellCheck https://github.com/koalaman/shellcheck/wiki.
TODO found Open
# TODO: Find 95%ANI clusters with entries from different species
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
# TODO: Find AAI values too high or too low for each LCA rank
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
# TODO: Find different 95%ANI clusters with genomes from the same species
- Create a ticketCreate a ticket
- Exclude checks