Diff of the two buildlogs: -- --- b1/build.log 2024-03-28 02:59:47.710766578 +0000 +++ b2/build.log 2024-03-28 03:02:39.119454646 +0000 @@ -1,6 +1,6 @@ I: pbuilder: network access will be disabled during build -I: Current time: Wed Mar 27 14:52:32 -12 2024 -I: pbuilder-time-stamp: 1711594352 +I: Current time: Wed Apr 30 23:22:49 +14 2025 +I: pbuilder-time-stamp: 1746004969 I: Building the build Environment I: extracting base tarball [/var/cache/pbuilder/unstable-reproducible-base.tgz] I: copying local configuration @@ -31,54 +31,86 @@ dpkg-source: info: applying 07-skip-tests-requiring-rubocop-performance.diff I: Not using root during the build. I: Installing the build-deps -I: user script /srv/workspace/pbuilder/27771/tmp/hooks/D02_print_environment starting +I: user script /srv/workspace/pbuilder/32494/tmp/hooks/D01_modify_environment starting +debug: Running on ionos16-i386. +I: Changing host+domainname to test build reproducibility +I: Adding a custom variable just for the fun of it... +I: Changing /bin/sh to bash +'/bin/sh' -> '/bin/bash' +lrwxrwxrwx 1 root root 9 Apr 30 09:22 /bin/sh -> /bin/bash +I: Setting pbuilder2's login shell to /bin/bash +I: Setting pbuilder2's GECOS to second user,second room,second work-phone,second home-phone,second other +I: user script /srv/workspace/pbuilder/32494/tmp/hooks/D01_modify_environment finished +I: user script /srv/workspace/pbuilder/32494/tmp/hooks/D02_print_environment starting I: set - BUILDDIR='/build/reproducible-path' - BUILDUSERGECOS='first user,first room,first work-phone,first home-phone,first other' - BUILDUSERNAME='pbuilder1' - BUILD_ARCH='i386' - DEBIAN_FRONTEND='noninteractive' - DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=11 ' - DISTRIBUTION='unstable' - HOME='/root' - HOST_ARCH='i386' + BASH=/bin/sh + BASHOPTS=checkwinsize:cmdhist:complete_fullquote:extquote:force_fignore:globasciiranges:globskipdots:hostcomplete:interactive_comments:patsub_replacement:progcomp:promptvars:sourcepath + BASH_ALIASES=() + BASH_ARGC=() + BASH_ARGV=() + BASH_CMDS=() + BASH_LINENO=([0]="12" [1]="0") + BASH_LOADABLES_PATH=/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:. + BASH_SOURCE=([0]="/tmp/hooks/D02_print_environment" [1]="/tmp/hooks/D02_print_environment") + BASH_VERSINFO=([0]="5" [1]="2" [2]="21" [3]="1" [4]="release" [5]="i686-pc-linux-gnu") + BASH_VERSION='5.2.21(1)-release' + BUILDDIR=/build/reproducible-path + BUILDUSERGECOS='second user,second room,second work-phone,second home-phone,second other' + BUILDUSERNAME=pbuilder2 + BUILD_ARCH=i386 + DEBIAN_FRONTEND=noninteractive + DEB_BUILD_OPTIONS='buildinfo=+all reproducible=+all parallel=21 ' + DIRSTACK=() + DISTRIBUTION=unstable + EUID=0 + FUNCNAME=([0]="Echo" [1]="main") + GROUPS=() + HOME=/root + HOSTNAME=i-capture-the-hostname + HOSTTYPE=i686 + HOST_ARCH=i386 IFS=' ' - INVOCATION_ID='63e2037f0ebf40c391822dd9494937a9' - LANG='C' - LANGUAGE='en_US:en' - LC_ALL='C' - LD_LIBRARY_PATH='/usr/lib/libeatmydata' - LD_PRELOAD='libeatmydata.so' - MAIL='/var/mail/root' - OPTIND='1' - PATH='/usr/sbin:/usr/bin:/sbin:/bin:/usr/games' - PBCURRENTCOMMANDLINEOPERATION='build' - PBUILDER_OPERATION='build' - PBUILDER_PKGDATADIR='/usr/share/pbuilder' - PBUILDER_PKGLIBDIR='/usr/lib/pbuilder' - PBUILDER_SYSCONFDIR='/etc' - PPID='27771' - PS1='# ' - PS2='> ' + INVOCATION_ID=ada79696d77c40fbb580df3cc5c4698d + LANG=C + LANGUAGE=de_CH:de + LC_ALL=C + LD_LIBRARY_PATH=/usr/lib/libeatmydata + LD_PRELOAD=libeatmydata.so + MACHTYPE=i686-pc-linux-gnu + MAIL=/var/mail/root + OPTERR=1 + OPTIND=1 + OSTYPE=linux-gnu + PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path + PBCURRENTCOMMANDLINEOPERATION=build + PBUILDER_OPERATION=build + PBUILDER_PKGDATADIR=/usr/share/pbuilder + PBUILDER_PKGLIBDIR=/usr/lib/pbuilder + PBUILDER_SYSCONFDIR=/etc + PIPESTATUS=([0]="0") + POSIXLY_CORRECT=y + PPID=32494 PS4='+ ' - PWD='/' - SHELL='/bin/bash' - SHLVL='2' - SUDO_COMMAND='/usr/bin/timeout -k 18.1h 18h /usr/bin/ionice -c 3 /usr/bin/nice /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.7tTPo1At/pbuilderrc_5crs --distribution unstable --hookdir /etc/pbuilder/first-build-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/unstable-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.7tTPo1At/b1 --logfile b1/build.log rubocop_1.39.0+dfsg-1.dsc' - SUDO_GID='112' - SUDO_UID='107' - SUDO_USER='jenkins' - TERM='unknown' - TZ='/usr/share/zoneinfo/Etc/GMT+12' - USER='root' - _='/usr/bin/systemd-run' - http_proxy='http://78.137.99.97:3128' + PWD=/ + SHELL=/bin/bash + SHELLOPTS=braceexpand:errexit:hashall:interactive-comments:posix + SHLVL=3 + SUDO_COMMAND='/usr/bin/timeout -k 24.1h 24h /usr/bin/ionice -c 3 /usr/bin/nice -n 11 /usr/bin/unshare --uts -- /usr/sbin/pbuilder --build --configfile /srv/reproducible-results/rbuild-debian/r-b-build.7tTPo1At/pbuilderrc_tiOy --distribution unstable --hookdir /etc/pbuilder/rebuild-hooks --debbuildopts -b --basetgz /var/cache/pbuilder/unstable-reproducible-base.tgz --buildresult /srv/reproducible-results/rbuild-debian/r-b-build.7tTPo1At/b2 --logfile b2/build.log rubocop_1.39.0+dfsg-1.dsc' + SUDO_GID=112 + SUDO_UID=107 + SUDO_USER=jenkins + TERM=unknown + TZ=/usr/share/zoneinfo/Etc/GMT-14 + UID=0 + USER=root + _='I: set' + http_proxy=http://85.184.249.68:3128 I: uname -a - Linux ionos12-i386 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux + Linux i-capture-the-hostname 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux I: ls -l /bin - lrwxrwxrwx 1 root root 7 Mar 27 07:43 /bin -> usr/bin -I: user script /srv/workspace/pbuilder/27771/tmp/hooks/D02_print_environment finished + lrwxrwxrwx 1 root root 7 Apr 28 14:05 /bin -> usr/bin +I: user script /srv/workspace/pbuilder/32494/tmp/hooks/D02_print_environment finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy @@ -304,7 +336,7 @@ Get: 154 http://deb.debian.org/debian unstable/main i386 ruby-simplecov all 0.22.0-1 [45.1 kB] Get: 155 http://deb.debian.org/debian unstable/main i386 ruby-unicode-display-width all 1.6.1-1 [10.3 kB] Get: 156 http://deb.debian.org/debian unstable/main i386 ruby-webmock all 3.18.1-2 [66.2 kB] -Fetched 49.9 MB in 2s (25.6 MB/s) +Fetched 49.9 MB in 1s (82.3 MB/s) debconf: delaying package configuration, since apt-utils is not installed Selecting previously unselected package libpython3.11-minimal:i386. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 19644 files and directories currently installed.) @@ -820,8 +852,8 @@ Setting up tzdata (2024a-1) ... Current default time zone: 'Etc/UTC' -Local time is now: Thu Mar 28 02:53:18 UTC 2024. -Universal Time is now: Thu Mar 28 02:53:18 UTC 2024. +Local time is now: Wed Apr 30 09:23:10 UTC 2025. +Universal Time is now: Wed Apr 30 09:23:10 UTC 2025. Run 'dpkg-reconfigure tzdata' if you wish to change it. Setting up ruby-method-source (1.0.0-2) ... @@ -962,7 +994,11 @@ Building tag database... -> Finished parsing the build-deps I: Building the package -I: Running cd /build/reproducible-path/rubocop-1.39.0+dfsg/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" HOME="/nonexistent/first-build" dpkg-genchanges -S > ../rubocop_1.39.0+dfsg-1_source.changes +I: user script /srv/workspace/pbuilder/32494/tmp/hooks/A99_set_merged_usr starting +Not re-configuring usrmerge for unstable +I: user script /srv/workspace/pbuilder/32494/tmp/hooks/A99_set_merged_usr finished +hostname: Name or service not known +I: Running cd /build/reproducible-path/rubocop-1.39.0+dfsg/ && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-buildpackage -us -uc -b && env PATH="/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/i/capture/the/path" HOME="/nonexistent/second-build" dpkg-genchanges -S > ../rubocop_1.39.0+dfsg-1_source.changes dpkg-buildpackage: info: source package rubocop dpkg-buildpackage: info: source version 1.39.0+dfsg-1 dpkg-buildpackage: info: source distribution unstable @@ -991,7 +1027,7 @@ dh_prep -O--buildsystem=ruby dh_auto_install --destdir=debian/rubocop/ -O--buildsystem=ruby dh_ruby --install /build/reproducible-path/rubocop-1.39.0\+dfsg/debian/rubocop -/usr/bin/ruby3.1 -S gem build --config-file /dev/null --verbose /tmp/d20240327-38168-lvif/gemspec +/usr/bin/ruby3.1 -S gem build --config-file /dev/null --verbose /tmp/d20250430-39290-94atam/gemspec Failed to load /dev/null because it doesn't contain valid YAML hash WARNING: open-ended dependency on parser (>= 3.1.2.1) is not recommended if parser is semantically versioned, use: @@ -1001,7 +1037,7 @@ Name: rubocop Version: 1.39.0 File: rubocop-1.39.0.gem -/usr/bin/ruby3.1 -S gem install --config-file /dev/null --verbose --local --verbose --no-document --ignore-dependencies --install-dir debian/rubocop/usr/share/rubygems-integration/all /tmp/d20240327-38168-lvif/rubocop-1.39.0.gem +/usr/bin/ruby3.1 -S gem install --config-file /dev/null --verbose --local --verbose --no-document --ignore-dependencies --install-dir debian/rubocop/usr/share/rubygems-integration/all /tmp/d20250430-39290-94atam/rubocop-1.39.0.gem Failed to load /dev/null because it doesn't contain valid YAML hash /build/reproducible-path/rubocop-1.39.0+dfsg/debian/rubocop/usr/share/rubygems-integration/all/gems/rubocop-1.39.0/assets/output.html.erb /build/reproducible-path/rubocop-1.39.0+dfsg/debian/rubocop/usr/share/rubygems-integration/all/gems/rubocop-1.39.0/config/default.yml @@ -1814,7245 +1850,3745 @@ RUBYLIB=. GEM_PATH=/build/reproducible-path/rubocop-1.39.0+dfsg/debian/rubocop/usr/share/rubygems-integration/all:/build/reproducible-path/rubocop-1.39.0+dfsg/debian/.debhelper/generated/_source/home/.local/share/gem/ruby/3.1.0:/var/lib/gems/3.1.0:/usr/local/lib/ruby/gems/3.1.0:/usr/lib/ruby/gems/3.1.0:/usr/lib/i386-linux-gnu/ruby/gems/3.1.0:/usr/share/rubygems-integration/3.1.0:/usr/share/rubygems-integration/all:/usr/lib/i386-linux-gnu/rubygems-integration/3.1.0 ruby3.1 -S rake --rakelibdir /gem2deb-nonexistent -f debian/ruby-tests.rake /usr/bin/ruby3.1 -I/usr/share/rubygems-integration/all/gems/rspec-support-3.13.1/lib:/usr/share/rubygems-integration/all/gems/rspec-core-3.13.0/lib /usr/share/rubygems-integration/all/gems/rspec-core-3.13.0/exe/rspec --pattern ./spec/\*\*/\*_spec.rb --exclude-pattern spec/rubocop/config_loader_spec.rb,spec/project_spec.rb,spec/rubocop/cli/options_spec.rb,spec/rubocop/cli/suggest_extensions_spec.rb,spec/rubocop/config_obsoletion_spec.rb,spec/rubocop/lockfile_spec.rb,spec/rubocop/server/rubocop_server_spec.rb,spec/rubocop/version_spec.rb --format documentation -Randomized with seed 5000 +Randomized with seed 31202 -RuboCop::Cop::Style::NumericLiterals - accepts short numbers without underscore - ignores non-decimal literals - does not count a leading minus sign as a digit - autocorrects numeric literal with exponent and dot - registers an offense for a float with a long undelimited integer part - autocorrects negative numbers - registers an offense for a long undelimited integer - autocorrects numeric literal with exponent (large E) and dot - autocorrects numbers with spaces between leading minus and numbers - registers an offense for an integer with misplaced underscore - accepts integers with less than three places at the end - autocorrects negative floating-point numbers - accepts long numbers with underscore - accepts a short integer without underscore - handles numeric literal with exponent - when `3000` is specified for `AllowedNumbers` - registers an offense - does not register an offense - AllowedPatterns - registers an offense for numbers that do not exactly match the pattern - corrects by inserting underscores every 3 digits - does not register an offense for numbers that exactly match the pattern - AllowedPatterns with repetition - does not register an offense for numbers that match the pattern - for --auto-gen-config - when the number is only digits - detects right value of MinDigits based on the longest number - sets the right value if one is disabled inline - with separators - disables the cop - does not disable the cop if the line is disabled - when `'3000'` is specified for `AllowedNumbers` - does not register an offense - registers an offense - strict - registers an offense for an integer with misplaced underscore - -RuboCop::Cop::Lint::MultipleComparison - accepts to use one compare operator - registers an offense for x <= y < z - registers an offense for x > y > z - registers an offense for x < y <= z - registers an offense for x < y < z - registers an offense for x <= y >= z - registers an offense for x < y > z - registers an offense for x > y < z - registers an offense for x >= y > z - accepts to use `^` operator - registers an offense for x < y >= z - accepts to use `|` operator - accepts to use `&` operator - registers an offense for x > y <= z - registers an offense for x >= y <= z - registers an offense for x > y >= z - registers an offense for x >= y >= z - registers an offense for x <= y <= z - registers an offense for x <= y > z - registers an offense for x >= y < z - -RuboCop::Cop::InternalAffairs::RedundantMethodDispatchNode - registers an offense when using `node.send_node.method_name` - does not register an offense when using `send_node.method_name` - does not register an offense when using `node.send_node.arguments?` - does not register an offense when using `node.method_name` - does not register an offense when using `node.receiver` - registers an offense when using `node.send_node.receiver` - -RuboCop::Cop::Style::EachWithObject - ignores inject and reduce passed in symbol - does not blow up for reduce with no arguments - ignores inject and reduce with passed in, but not returned hash - ignores inject and reduce with condition as body - ignores inject and reduce with empty body - finds inject and reduce with passed in and returned hash - correctly autocorrects with return value only - ignores inject/reduce with assignment to accumulator param in block - correctly autocorrects - when a simple literal is passed as initial value - ignores inject/reduce - Ruby 2.7 - finds inject and reduce with passed in and returned hash and numblock - -RuboCop::Cop::Lint::RedundantStringCoercion - registers an offense and corrects an implicit receiver - accepts #to_s with arguments in an interpolation - does not explode on empty interpolation - registers an offense and corrects `to_s` in interpolation - accepts interpolation without #to_s - registers an offense and corrects `to_s` in an interpolation with several expressions - -RuboCop::Cop::Style::SoleNestedConditional - registers an offense and corrects when using nested `if` within `unless foo == bar` - registers an offense and corrects for multiple nested conditionals with using method call outer condition by omitting parentheses - registers an offense and corrects for multiple nested conditionals - registers an offense and corrects when using nested `if` within `if` - registers an offense and corrects when there are outer and inline comments - registers an offense and corrects when using nested `unless` within `unless` - registers an offense and corrects when using nested `if` modifier conditional - registers an offense and corrects when using `unless` and `||` and parens in the outer condition and nested modifier condition - does not register an offense when using nested modifier on value assigned in multiple conditions - registers an offense and corrects when using nested conditional and branch contains a comment - registers an offense and corrects when using nested `unless` modifier conditional - registers an offense and corrects when using `unless` and method arguments with parentheses in the outer condition and nested modifier condition - does not register an offense when using nested conditional is not the whole body - registers an offense and corrects when using `unless` and method arguments without parentheses in the outer condition and nested modifier condition - does not register an offense when nested conditional has an `else` branch - registers an offense and corrects when using `unless` and `&&` without parens in the outer condition and nested modifier condition - registers an offense and corrects when using `unless` and multiple method arguments with parenthesesin the outer condition and nested modifier condition - does not register an offense when using nested modifier on value assigned in single condition - registers an offense and corrects when `if` foo do_something end `if` bar - registers an offense and corrects when using `unless` and `||` without parens in the outer condition and nested modifier condition - registers an offense and corrects when using `||` in the outer condition and nested modifier condition - registers an offense and corrects when using nested `unless` modifier multiple conditional - does not register an offense when no nested conditionals - registers an offense and corrects when `if` foo && bar do_something end `if` baz - does not register an offense when using nested ternary within conditional - registers an offense and corrects when using `||` in the outer condition - does not register an offense when using nested conditional within `elsif` - registers an offense and corrects when using nested `unless` within `if` - registers an offense and corrects when `unless` foo && bar do_something end `if` baz - registers an offense and corrects when `if` foo && bar do_something end `unless` baz - registers an offense and corrects when `if` foo do_something end `unless` bar && baz - registers an offense and corrects when `unless` foo do_something end `if` bar - does not register an offense for nested conditionals when outer conditional has an `else` branch - registers an offense and corrects when using guard conditional with outer comment - registers an offense and corrects when using nested `if` within `if foo = bar` - registers an offense and corrects when nested `||` operator modifier condition - registers an offense and corrects when using nested `if` within `unless` - registers an offense and corrects when `if` foo do_something end `if` bar && baz - registers an offense and corrects when nested `||` operator condition - registers an offense and corrects when using nested `unless` modifier with a single expression condition - registers an offense and corrects when `if` foo do_something end `unless` bar - when the inner condition has a send node without parens - in modifier style - registers an offense and corrects - with a block - registers an offense and corrects - with a `csend` node - registers an offense and corrects - in guard style - registers an offense and corrects - when the inner condition has a send node with parens - in guard style - registers an offense and corrects - in modifier style - registers an offense and corrects - when disabling `Style/IfUnlessModifier` - registers an offense and corrects when there are outer and inline comments - registers an offense and corrects when using nested conditional and branch contains a comment - when AllowModifier is true - does not register an offense when using nested modifier conditional - -RuboCop::Cop::Style::FloatDivision - EnforcedStyle is single_coerce - does not register offense for left coerce only - does not register offense for right coerce only - registers offense and corrects for left coerce with calculations - registers offense and corrects for both coerce - EnforcedStyle is fdiv - does not register offense on usage of fdiv - registers offense and corrects for left coerce - registers offense and corrects for both coerce - registers offense and corrects for right coerce - registers offense and corrects for left coerce with calculations - EnforcedStyle is right_coerce - registers offense and corrects for left coerce - registers offense and corrects for both coerce - does not register offense for right coerce - registers offense and corrects for left coerce with calculations - EnforcedStyle is left_coerce - does not register offense for left coerce - registers offense and corrects for right coerce - registers offense and corrects for both coerce - registers offense and corrects for right coerce with calculations - -RuboCop::Cop::Lint::NumberConversion - AllowedPatterns - does not register an offense for an allowed method - registers an offense for other methods - AllowedMethods - does not register an offense for an allowed method - registers an offense for other methods - IgnoredClasses - when using Time - when using DateTime - when using Time/DateTime with multiple method calls - registers an offense - when `#to_i` called on a hash value - when `#to_i` called on a variable on a hash - when using `#to_c` - when using `#to_r` - when using `#to_i` - when `#to_i` called on a variable on a array - when using `#to_i` for number literals - when using `#to_f` for number literals - when using `#to_r` for number literals - when using `#to_f` - when `#to_i` called on a variable - when using `#to_c` for number literals - to_method in symbol form - does not register an offense when using `Float` constructor - registers offense and autocorrects without parentheses - registers offense with send - registers offense with try - registers offense and autocorrects - does not register an offense when using `Complex` constructor - registers an offense when using nested number conversion methods - does not register an offense when using `Integer` constructor - does not register an offense - when using Float() - when `#to_i` called without a receiver - when using Complex() - when using Integer() with integer - when `:to_f` is one of multiple method arguments - -RuboCop::Cop::Layout::AssignmentIndentation - registers an offense for incorrectly indented rhs - ignores comparison operators - registers an offense for multi-lhs - registers an offense for incorrectly indented rhs when multiple assignment - registers an offense for incorrectly indented rhs whenmultiple assignment with line breaks on each line - allows a properly indented rhs with fullwidth characters - allows a properly indented rhs - allows assignments that do not start on a newline - when indentation width is overridden for this cop only - autocorrects indentation - allows a properly indented rhs +RuboCop::Cop::Metrics::ParameterLists + registers an offense when optargs count exceeds the maximum + does not register an offense when method has allowed amount of args with block arg + does not register an offense when method has no args + accepts a lambda with more than 4 parameters + does not register an offense when method has allowed amount of optargs + registers an offense for a method def with 5 parameters + accepts a method def with 4 parameters + accepts a proc with more than 4 parameters + When CountKeywordArgs is true + counts keyword arguments as well + When CountKeywordArgs is false + does not count keyword arguments + does not count keyword arguments without default values -RuboCop::Cop::Lint::UnexpectedBlockArity - registers multiple offenses - with a numblock - when given one parameter +RuboCop::Cop::Layout::DotPosition + Leading dots style + does not err on method call with no dots + does not err on method call on same line + accepts leading do in multi-line method call + registers an offense for only dot line + registers an offense for correct + opposite + registers an offense for trailing dot in multi-line call + does not err on method call without a method name + when there is an intervening blank line + does not register offense + when a method spans multiple lines registers an offense - when given no parameters + when using safe navigation operator + accepts leading do in multi-line method call + registers an offense for correct + opposite + when the receiver is a heredoc registers an offense - with no receiver - does not register an offense - when given three parameters - does not register an offense - when using enough parameters, but not all explicitly - does not register an offense - when given two parameters - does not register an offense - with a block - when destructuring - with arity 1 + with multiple offenses + registers all of them + when the receiver has a heredoc argument + as the last argument registers an offense - with arity 2 + with another method on the same line does not register an offense - with no receiver - does not register an offense - when given one parameter - registers an offense - when given a splat parameter - does not register an offense - with keyword args - registers an offense - when given three parameters - does not register an offense - with shadow args - registers an offense - when given no parameters - registers an offense - with a keyword splat + with a dynamic heredoc + registers an offense + as the first argument + registers an offense + with multiple heredocs + registers an offense + when there is an intervening line comment + does not register offense + Trailing dots style + does not err on method call with multi-line arguments + does not err on method call without a method name + registers an offense for leading dot in multi-line call + does not err on method call on same line + does not get confused by several lines of chained methods + accepts trailing dot in multi-line method call + does not err on method call with no dots + when using safe navigation operator + registers an offense for correct + opposite + accepts trailing dot in multi-line method call + when there is a heredoc with a following method + does not register an offense for a heredoc + when the receiver is a heredoc registers an offense - with optargs - with arity 1 + when the receiver has a heredoc argument + with a dynamic heredoc registers an offense - with arity 2 + as the last argument + registers an offense + with another method on the same line does not register an offense - when given two parameters - does not register an offense + as the first argument + registers an offense + with multiple heredocs + registers an offense -RuboCop::Cop::Style::EmptyLiteral - Empty Array - does not register an offense for Array.new(3) - registers an offense for Array.new - registers an offense for ::Array.new - registers an offense for Array.new() - does not register an offense for ::Array.new with block - does not register Array.new with block in other block - does not register an offense Array.new with block - autocorrects Array.new in block in block - Empty Hash - does not register an offense for ::Hash.new(3) - registers an offense for Hash.new() - does not register an offense for ::Hash.new { block } - registers an offense for Hash.new - autocorrects Hash.new to {} in various contexts - autocorrects Hash.new to {} and wraps it in parentheses when it is the only argument to super - autocorrects Hash.new in block - autocorrects Hash.new to {} as the first parameter to a method - does not register an offense for Hash.new(3) - registers an offense for ::Hash.new - autocorrects Hash.new to {} and wraps all arguments in parentheses when it is the first argument to super - does not register an offense for Hash.new { block } - autocorrects Hash.new to {} as the only parameter to a method - Ruby 2.7 - does not register an offense for Hash.new { _1[_2] = [] } - does not register an offense for ::Hash.new { _1[_2] = [] } - Empty String - does not register an offense for ::String.new("top") - does not register an offense for String.new("top") - registers an offense for String.new() - registers an offense for String.new - registers an offense for ::String.new - when frozen string literals is enabled - does not register an offense for String.new - when Style/FrozenStringLiteral is enabled - and there is a frozen_string_literal: false comment - registers an offense and corrects - and there is no magic comment - does not register an offense - when double-quoted string literals are preferred - registers an offense for String.new - registers an offense for ::String.new +RuboCop::Cop::Style::EndlessMethod + Ruby >= 3.0 + EnforcedStyle: disallow + registers an offense for an endless method + registers an offense for an endless method with arguments + EnforcedStyle: allow_always + does not register an offense for an endless method + does not register an offense for an endless method with arguments + does not register an offense for a multiline endless method with arguments + does not register an offense for a multiline endless method + does not register an offense for a multiline endless method with begin + EnforcedStyle: allow_single_line + does not register an offense for an endless method with arguments + does not register an offense for an endless method + registers an offense and corrects for a multiline endless method + registers an offense and corrects for a multiline endless method with begin + registers an offense and corrects for a multiline endless method with arguments -RuboCop::Cop::Layout::SpaceInsideArrayLiteralBrackets - does not register offense for any kind of reference brackets - with space inside empty brackets not allowed - registers an offense and corrects empty brackets with 1 space inside - registers an offense and corrects empty brackets with multiple spaces inside - accepts empty brackets with no space inside - registers an offense and corrects multiline spaces - when EnforcedStyle is space - does not register offense for valid 2-dimensional array - behaves like space inside arrays - registers an offense and corrects array brackets with no trailing whitespace - accepts square brackets as method name - does not register offense for valid multiline array - register an offense and corrects when 2 arrays are on one line - accepts space inside array brackets with comment - does not register offense when 2 arrays on one line - registers an offense and corrects multiline array on end bracket with trailing method - accepts square brackets called with method call syntax - registers an offense and corrects array brackets with no leading whitespace - does not register offense for arrays using ref brackets - does not register offense for array when brackets get their own line - does not register offense for arrays with spaces - registers an offense and corrects an array missing whitespace when there is more than one array on a line - registers an offense and corrects multiline array on end bracket - does not register offense for indented array when bottom bracket gets its own line & is misaligned - does not register offense when bottom bracket gets its own line & has trailing method +RuboCop::Cop::Layout::SpaceInsideBlockBraces + registers an offense and corrects left brace without inner space + registers an offense and corrects right brace without inner space + registers an offense and corrects both left and right brace without inner space after success + register offenses and correct both braces without inner space + accepts left brace without outer space + accepts braces surrounded by spaces + with invalid value for EnforcedStyleForEmptyBraces + fails with an error + configured with no_space + registers an offense and corrects right brace with inner space + registers an offense and corrects both left and right brace with inner space after success + accepts left brace without outer space + accepts braces without spaces inside + registers an offense and corrects left brace with inner space + with passed in parameters + and space before block parameters allowed + accepts left brace with inner space + registers an offense and corrects left brace without inner space + accepts new lambda syntax + and space before block parameters not allowed + registers an offense when braces are not aligned in multiline block with bracket + registers an offense and corrects left brace with inner space + accepts new lambda syntax + accepts when braces are aligned in multiline block with bracket + accepts when braces are aligned in multiline block + registers an offense when braces are not aligned in multiline block + with passed in parameters + accepts new lambda syntax + and space before block parameters not allowed + accepts new lambda syntax + accepts left brace without inner space + registers an offense and corrects left brace with inner space + for single-line blocks + accepts left brace with inner space + registers an offense and corrects left brace without inner space + for multi-line blocks + registers an offense and corrects left brace without inner space + accepts left brace with inner space + and BlockDelimiters cop enabled + registers an offense and corrects multi-line blocks + registers an offense and corrects for single-line blocks + with space inside empty braces not allowed + accepts multiline braces with content + registers an offense and corrects empty braces with space inside + accepts braces with something inside + accepts empty braces with line break inside + accepts empty braces with no space inside + accepts braces that are not empty + accepts empty braces with comment and line break inside with space inside empty braces allowed - accepts empty brackets with space inside - registers an offense and corrects empty brackets with no space inside - registers an offense and corrects empty brackets with more than one space inside - when EnforcedStyle is compact - does not register offense for valid 3-dimensional array - does not register offense for valid 2-dimensional array - registers an offense and corrects 2-dimensional array with extra spaces - does not register offense for valid 4-dimensional array - accepts multiline array - registers an offense and corrects space between 2 closing brackets - registers an offense and corrects 3-dimensional array with extra spaces - registers an offense and corrects space between 2 opening brackets - behaves like space inside arrays - accepts square brackets called with method call syntax - does not register offense for valid multiline array - registers an offense and corrects array brackets with no trailing whitespace - register an offense and corrects when 2 arrays are on one line - does not register offense when bottom bracket gets its own line & has trailing method - accepts space inside array brackets with comment - does not register offense for arrays with spaces - does not register offense for array when brackets get their own line - does not register offense for indented array when bottom bracket gets its own line & is misaligned - does not register offense for arrays using ref brackets - accepts square brackets as method name - registers an offense and corrects multiline array on end bracket with trailing method - does not register offense when 2 arrays on one line - registers an offense and corrects an array missing whitespace when there is more than one array on a line - registers an offense and corrects multiline array on end bracket - registers an offense and corrects array brackets with no leading whitespace - multiline, 2-dimensional array with spaces - registers an offense and corrects at the beginning of array - registers an offense and corrects at the end of array - multiline, 2-dimensional array with newlines - registers an offense and corrects at the beginning of array - registers an offense and corrects at the end of array - when EnforcedStyle is no_space - does not register offense for arrays with no spaces - does not register offense when 2 arrays on one line - registers an offense and corrects an array literal as an argument with trailing whitespace after a heredoc is started - does not register offense when contains an array literal as an argument after a heredoc is started - registers an offense and corrects multiline array on end bracket with trailing method - registers an offense and corrects an array when two on one line - does not register offense when bottom bracket gets its own line indented with tabs - accepts square brackets called with method call syntax - does not register offense for valid 2-dimensional array - accepts square brackets as method name - does not register offense for indented array when bottom bracket gets its own line & is misaligned - does not register offense for valid multiline array - accepts a multiline array with whitespace before end bracket - registers an offense and corrects 2 arrays on one line - does not register offense when bottom bracket gets its own line & has trailing method - does not register offense for arrays using ref brackets - registers an offense and corrects multiline array on end bracket - accepts space inside array brackets if with comment - registers an offense and corrects array brackets with leading whitespace - does not register offense for array when brackets get own line - registers an offense and corrects array brackets with trailing whitespace - -RuboCop::Cop::Style::StaticClass - does not register an offense when class is empty - registers an offense when class has `class << self` with class methods - does not register an offense when class has macro-like method - registers an offense when class extends a module - does not register an offense when class has a parent - does not register an offense when class has `class << self` with macro calls - does not register an offense when class includes/prepends a module - does not register an offense when class has instance method - registers an offense when class has only class method - registers an offense when class has assignments along with class methods - does not register an offense for modules - -RuboCop::Cop::VariableForce::Variable - #referenced? - when the variable has an assignment - and the variable is not yet referenced - is expected to be falsey - and the variable is referenced - is expected to be truthy - when the variable is not assigned - is expected to be falsey - and the variable is referenced - is expected to be truthy - .new - when non variable declaration node is passed - raises error - -RuboCop::Cop::Metrics::ModuleLength - accepts a module with 5 lines - reports the correct beginning and end lines - accepts empty modules - does not count blank lines - accepts a module with less than 5 lines - rejects a module with more than 5 lines - when CountComments is enabled - also counts commented lines - when a module has inner modules - does not count lines of inner modules - rejects a module with 6 lines that belong to the module directly - when `CountAsOne` is not empty - folds array into one line - when inspecting a class defined with ::Module.new - registers an offense - when a module has inner classes - rejects a module with 6 lines that belong to the module directly - does not count lines of inner classes - when inspecting a class defined with Module.new - registers an offense - when using numbered parameter - when inspecting a class defined with Module.new - registers an offense - when inspecting a class defined with ::Module.new - registers an offense - -RuboCop::Cop::Style::PercentQLiterals - when EnforcedStyle is lower_case_q - without interpolation - accepts single quotes - accepts %q - accepts double quotes - registers offense for %Q - with special characters - accepts %q - accepts %Q - with interpolation - accepts double quotes - accepts %q - accepts %Q - accepts single quotes - when EnforcedStyle is upper_case_q - without interpolation - registers offense for %q - accepts single quotes - accepts %Q - accepts double quotes - with special characters - accepts %q - accepts %Q - with interpolation - accepts double quotes - accepts single quotes - accepts %q - accepts %Q - -RuboCop::Cop::Style::GlobalStdStream - does not register an offense when using non std stream const - does not register an offense when assigning std stream const to std stream gvar - does not register an offense when assigning other const to std stream gvar - registers an offense and corrects when using std stream as const - -RuboCop::Cop::Lint::MixedRegexpCaptureTypes - does not register offense to a regexp with named capture only - does not register offense to a regexp with numbered capture only - registers an offense when both of named and numbered captures are used - does not register offense to a regexp with named capture and non-capturing group - does not register offense when using a Regexp cannot be processed by regexp_parser gem - when containing a non-regexp literal - does not register an offense when containing a ivar - does not register an offense when containing a gvar - does not register an offense when containing a constant - does not register an offense when containing a cvar - does not register an offense when containing a method - does not register an offense when containing a lvar - -RuboCop::TargetRuby - when TargetRubyVersion is set - does not read Gemfile.lock or gems.locked - does not read .ruby-version - uses TargetRubyVersion - when TargetRubyVersion is not set - when .ruby-version is present - does not read .tool-versions, Gemfile.lock or gems.locked - when .ruby-version contains a version prefixed by "ruby-" - correctly determines the target ruby version - when .ruby-version contains a JRuby version - uses the default target ruby version - when .ruby-version contains a Rbx version - uses the default target ruby version - when .ruby-version contains "system" version - uses the default target ruby version - when the MRI version contains multiple digits - reads it to determine the target ruby version - when .ruby-version contains an MRI version - reads it to determine the target ruby version - when .tool-versions is present - when .tool-versions does not contain a ruby version - uses the default ruby version - when .tool-versions contains a ruby version - reads it to determine the target ruby version - does not read Gemfile.lock, gems.locked - when .ruby-version is not in a parent directory - when gems.locked is in a parent directory - does - when Gemfile.lock is in a parent directory - does - when .ruby-version is not present - and Gemfile.lock exists - uses MRI Ruby version when it has multiple digits - uses the default Ruby when Ruby is not in Gemfile.lock - uses the default Ruby when rbx is in Gemfile.lock - uses MRI Ruby version when it is present in Gemfile.lock - uses the default Ruby when jruby is in Gemfile.lock - when bundler lock files are not present - uses the default target ruby version - and gems.locked exists - uses the default Ruby when Ruby is not in gems.locked - uses the default Ruby when jruby is in gems.locked - uses MRI Ruby version when it has multiple digits - uses MRI Ruby version when it is present in gems.locked - uses the default Ruby when rbx is in gems.locked - gemspec file - when file does not contain `required_ruby_version` - sets default target_ruby - when file contains `required_ruby_version` as a requirement - sets target_ruby from required_ruby_version from inclusive requirement range - sets first known ruby version that satisfies requirement - when file contains `required_ruby_version` as an array - sets target_ruby to the minimal version satisfying the requirements - sets target_ruby from required_ruby_version with many requirements - when file contains `required_ruby_version` as a string - sets target_ruby from exclusive range - sets target_ruby from approximate version - sets target_ruby from inclusive range - when .ruby-version is in a parent directory - reads it to determine the target ruby version - -RuboCop::Cop::Lint::Loop - registers an offense for begin/end/until - accepts loop/break unless - accepts loop/break if - registers an offense and corrects for begin/end/while - -RuboCop::Formatter::JSONFormatter - #hash_for_location - sets column value for :column key - sets length value for :length key - sets line value for :line key - when the location is pseudo - returns a valid hash - #started - sets target file count in summary - #hash_for_offense - sets Offense#corrected? value for :corrected key - sets Offense#cop_name value for :cop_name key - sets Offense#severity value for :severity key - sets Offense#message value for :message key - sets value of #hash_for_location for :location key - sets Offense#correctable? value for :correctable key - #finished - outputs #output_hash as JSON - sets inspected file count in summary - #file_finished - adds detected offense count in summary - adds value of #hash_for_file to #output_hash[:files] - #hash_for_file - sets an array of #hash_for_offense values for :offenses key - sets relative file path for :path key + registers an offense and corrects empty braces with no space inside + accepts empty braces with space inside + Ruby >= 2.7 + registers an offense for numblocks without inner space RuboCop::Cop::Lint::BooleanSymbol - registers an offense when using `:true` - does not register an offense when using `true` - does not register an offense when used inside percent-literal symbol array does not register an offense when using regular symbol - registers an offense when using `:false` does not register an offense when using `false` + registers an offense when using `:false` + does not register an offense when using `true` + does not register an offense when used inside percent-literal symbol array + registers an offense when using `:true` when using the new hash syntax + registers an offense when using `false:` registers an offense when using `key: :false` registers an offense when using `true:` - registers an offense when using `false:` -RuboCop::Cop::Lint::ConstantDefinitionInBlock - registers an offense for a class defined within a block - registers an offense for a class defined within a block followed by another statement - registers an offense for a constant defined within a block followed by another statement - does not register an offense for a top-level class followed by another statement - does not register an offense for a top-level module - registers an offense for a module defined within a block - does not register an offense for a constant with an explicit top-level scope - registers an offense for a constant defined within a block - does not register an offense for a constant with an explicit top-level scope followed by another statement - registers an offense for a module defined within a block followed by another statement - does not register an offense for a constant with an explicit self scope followed by another statement - does not register an offense for a top-level module followed by another statement - does not register an offense for a constant with an explicit self scope - does not register an offense for a top-level class - does not register an offense for a top-level constant - does not register an offense for a top-level constant followed by another statement - when `AllowedMethods: [enums]` - does not register an offense for a module defined within a block of `enums` method - does not register an offense for a casign used within a block of `enums` method - does not register an offense for a class defined within a block of `enums` method - when `AllowedMethods: []` - registers an offense for a module defined within a block of `enums` method - registers an offense for a casign used within a block of `enums` method - registers an offense for a class defined within a block of `enums` method +RuboCop::Cop::Style::OptionalBooleanParameter + registers an offense when defining class method with optional boolean arg + registers an offense when defining method with optional boolean arg that has no space + does not register an offense when defining method with keyword boolean arg + registers an offense when defining method with optional boolean arg + registers an offense when defining method with multiple optional boolean args + does not register an offense when defining method with optional non-boolean arg + does not register an offense when defining method without args + when AllowedMethods is not empty + does not register an offense -RuboCop::Cop::Layout::EmptyLineAfterGuardClause - does not register an offense when the clause ends with a semicolon but is followed by a newline - registers an offense and corrects a guard clause not followed by empty line when guard clause including heredoc - registers an offense and corrects a next guard clause not followed by empty line when guard clause is after heredoc including string interpolation - accepts a guard clause after a single line heredoc - registers an offense and corrects when using `and return` before guard condition - accepts using guard clause is after `raise` - accepts a guard clause when the next line is `elsif` - accepts a guard clause when the next line is `ensure` - accepts a guard clause followed by empty line when guard clause including heredoc - registers an offense when the clause ends with a semicolon but the next clause is on the next line - accepts using guard clause is after `rubocop:enable` comment - accepts a modifier if when the next line is `end` - accepts a guard clause when the next line is `rescue`-`else` - registers an offense and corrects using heredoc with `and return` before guard condition - registers an offense and corrects only the last guard clause - registers an offense and corrects when using `or return` before guard condition - registers an offense and corrects `next` guard clause not followed by empty line - does not register an offense when the clause is not followed by other code - accepts a guard clause that is after a multiline heredoc with chained calls - registers an offense and corrects a guard clause is before `begin` - accepts a `raise` guard clause not followed by empty line when guard clause is after condition without method invocation - registers an offense and corrects a method starting with end_ - registers and corrects when using guard clause is after `rubocop:enable` comment - accepts a guard clause that is after a multiline heredoc nested argument call - accepts a guard clause when the next line is `else` - accepts a guard clause followed by end - registers an offense and corrects a `raise` guard clause not followed by empty line when `unless` condition is after heredoc - accepts a guard clause inside oneliner block - registers an offense and corrects a guard clause not followed by empty line - accepts multiple guard clauses - registers an offense and corrects a `raise` guard clause not followed by empty line when guard clause is after method call with argument - registers and corrects when using guard clause is after `rubocop:disable` comment - registers an offense and corrects a guard clause that is a ternary operator - accepts a guard clause when the next line is `rescue` - accepts modifier if - does not register an offense when there are multiple clauses on the same line - registers no offenses using heredoc with `and return` before guard condition with empty line - registers an offense and corrects a `raise` guard clause not followed by empty line when `if` condition is after heredoc - accepts a guard clause that is after multiline heredoc +RuboCop::Cop::Style::MultilineMethodSignature + when arguments span a single line + when defining an class method + when arguments span a single line + registers an offense and corrects when closing paren is on the following line + when method signature is on a single line + does not register an offense for unparameterized method + does not register an offense for parameterized method + when defining an instance method + registers an offense and corrects when line break after opening parenthesis + registers an offense and corrects when closing paren is on the following line + when method signature is on a single line + does not register an offense for parameterized method + does not register an offense for unparameterized method + when arguments span multiple lines + when correction would exceed maximum line length + does not register an offense + when correction would not exceed maximum line length + registers an offense and corrects + when defining an instance method + registers an offense and corrects when `end` is on the same line with last argument + registers an offense and corrects when `end` is on the following line + registers an offense and corrects when `end` is on the same line with only closing parentheses + when defining an class method + registers an offense and corrects when `end` is on the same line with only closing parentheses + registers an offense and corrects when `end` is on the same line + registers an offense and corrects when `end` is on the following line + +RuboCop::MagicComment + returns nil for typed when comment is # encoding: ascii-8bit frozen_string_literal: true + returns nil for shareable_constant_value when comment is # incoding: utf-8 + returns nil for typed when comment is # vim: filetype=ruby,fileencoding=ascii-8bit + returns nil for shareable_constant_value when comment is #vim: filetype=ruby, fileencoding=ascii-8bit + returns nil for typed when comment is # frozen_string_literal: true + returns nil for frozen_string_literal when comment is # encoding: ascii-8bit frozen_string_literal: true + returns "invalid" for frozen_string_literal when comment is # frozen_string_literal: invalid + returns nil for typed when comment is # fRoZeN-sTrInG_lItErAl: true + returns "ascii-8bit" for encoding when comment is # coding: utf-8 -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- + returns nil for shareable_constant_value when comment is # frozen-string-literal: true + returns nil for typed when comment is # incoding: utf-8 + returns "strict" for typed when comment is #typed:strict + returns "ignore" for typed when comment is # typed: ignore + returns nil for shareable_constant_value when comment is # frozen_string_literal: true encoding: ascii-8bit + returns nil for shareable_constant_value when comment is # coding: utf-8 vim: filetype=ruby, fileencoding=ascii-8bit + returns nil for encoding when comment is # -*- frozen-string-literal: true -*- + returns nil for frozen_string_literal when comment is # typed: true + returns nil for shareable_constant_value when comment is # typed: false + returns nil for typed when comment is # -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- + returns nil for typed when comment is # encoding: utf-8 + returns nil for encoding when comment is # shareable_constant_value: none + returns "utf-8" for encoding when comment is # ENCODING: utf-8 + returns nil for shareable_constant_value when comment is # + returns nil for encoding when comment is # typed: false + returns nil for encoding when comment is # typed: true + returns nil for frozen_string_literal when comment is # shareable-constant-value: literal + returns "false" for typed when comment is # typed: false + returns nil for encoding when comment is # shareable_constant_value:literal + returns nil for typed when comment is # coding: utf-8 + returns nil for typed when comment is # vim: filetype=ruby, fileencoding=ascii-8bit + returns nil for typed when comment is # -*- encoding : ascii-8bit -*- + returns nil for shareable_constant_value when comment is # typed: strong + returns true for frozen_string_literal when comment is # frozen_string_literal: true + returns nil for frozen_string_literal when comment is # ENCODING: utf-8 + returns "stateless-iso-2022-jp-kddi" for encoding when comment is # encoding: stateless-iso-2022-jp-kddi + returns nil for frozen_string_literal when comment is #vim: filetype=ruby, fileencoding=ascii-8bit, typed=strict + returns nil for shareable_constant_value when comment is # -*- encoding : ascii-8bit -*- + returns nil for encoding when comment is # incoding: utf-8 + returns nil for encoding when comment is # shareable-constant-value: literal + returns nil for shareable_constant_value when comment is # frozen_string_literal: false + returns nil for typed when comment is # -*- coding: ASCII-8BIT; typed: strict -*- + returns nil for typed when comment is # SHAREABLE-CONSTANT-VALUE: literal + returns nil for typed when comment is # coding: utf-8 + returns nil for frozen_string_literal when comment is # encoding: utf-8 + returns nil for encoding when comment is # shareable_constant_value: experimental_everything + returns nil for typed when comment is # vim: filetype=python, fileencoding=ascii-8bit + returns nil for frozen_string_literal when comment is CSV.generate(encoding: Encoding::UTF_8) do |csv| + returns nil for encoding when comment is # @typed + returns nil for typed when comment is # coding: utf-8 vim: filetype=ruby, fileencoding=ascii-8bit + returns "literal" for shareable_constant_value when comment is # shareable-constant-value: literal + returns nil for encoding when comment is CSV.generate(encoding: Encoding::UTF_8) do |csv| + returns "ascii-8bit" for encoding when comment is # vim: filetype=ruby, fileencoding=ascii-8bit + returns nil for typed when comment is # FROZEN-STRING-LITERAL: true + returns nil for shareable_constant_value when comment is #vim: filetype=ruby, fileencoding=ascii-8bit, typed=strict + returns "literal" for shareable_constant_value when comment is # sHaReaBLE-CoNstANT-ValUE: literal + returns "experimental_copy" for shareable_constant_value when comment is # shareable_constant_value: experimental_copy + returns nil for frozen_string_literal when comment is # xyz shareable_constant_value: literal xyz + returns nil for frozen_string_literal when comment is # frozen_string_literal: true encoding: ascii-8bit + returns nil for typed when comment is CSV.generate(encoding: Encoding::UTF_8) do |csv| + returns "literal" for shareable_constant_value when comment is # SHAREABLE-CONSTANT-VALUE: literal + returns nil for frozen_string_literal when comment is # @typed + returns nil for encoding when comment is # frozen-string-literal: true + returns nil for shareable_constant_value when comment is # encoding: utf-8 + returns "utf-8" for encoding when comment is # coding: utf-8 + returns nil for shareable_constant_value when comment is # fRoZeN-sTrInG_lItErAl: true + returns "true" for typed when comment is # typed: true + returns "ascii-8bit" for encoding when comment is # frozen_string_literal: true encoding: ascii-8bit + returns nil for shareable_constant_value when comment is # frozen_string_literal: invalid + returns nil for typed when comment is # shareable_constant_value: experimental_copy + returns nil for typed when comment is # xyz shareable_constant_value: literal xyz + returns nil for typed when comment is # frozen_string_literal:true + returns nil for typed when comment is #vim: filetype=ruby, fileencoding=ascii-8bit, typed=strict + returns nil for shareable_constant_value when comment is # typed: strict + returns nil for frozen_string_literal when comment is # incoding: utf-8 + returns nil for encoding when comment is # typed: ignore + returns "ascii-8bit" for encoding when comment is #vim: filetype=ruby, fileencoding=ascii-8bit, typed=strict + returns nil for frozen_string_literal when comment is # SHAREABLE-CONSTANT-VALUE: literal + returns "ascii-8bit" for encoding when comment is #vim: filetype=ruby, fileencoding=ascii-8bit + returns nil for encoding when comment is # shareable_constant_value: literal + returns nil for typed when comment is # vim:fileencoding=utf-8 + returns nil for encoding when comment is # + returns nil for encoding when comment is # sHaReaBLE-CoNstANT-ValUE: literal + returns "utf-8" for encoding when comment is # coding: utf-8 vim: filetype=ruby, fileencoding=ascii-8bit + returns nil for typed when comment is # -*- frozen-string-literal: true -*- + returns "strict" for typed when comment is # typed:strict + returns nil for shareable_constant_value when comment is # typed: true + returns "utf-8" for encoding when comment is # coding: utf-8 + returns nil for frozen_string_literal when comment is # sHaReaBLE-CoNstANT-ValUE: literal + returns nil for shareable_constant_value when comment is # frozen_string_literal: true + returns nil for frozen_string_literal when comment is # -*- coding: ASCII-8BIT; typed: strict -*- + returns nil for encoding when comment is # xyz shareable_constant_value: literal xyz + returns true for frozen_string_literal when comment is # coding: utf-8 -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- + returns nil for frozen_string_literal when comment is # coding: utf-8 + returns nil for typed when comment is # @typed + returns nil for typed when comment is # sHaReaBLE-CoNstANT-ValUE: literal + returns nil for encoding when comment is # frozen_string_literal: true + returns nil for frozen_string_literal when comment is #typed:strict + returns "ascii-8bit" for encoding when comment is # -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- + returns nil for frozen_string_literal when comment is # coding: utf-8 vim: filetype=ruby, fileencoding=ascii-8bit + returns nil for encoding when comment is #typed:strict + returns "ascii-8bit" for encoding when comment is # -*- coding: ASCII-8BIT; typed: strict -*- + returns "strict" for typed when comment is # typed: strict + returns nil for frozen_string_literal when comment is # typed: false + returns "ascii-8bit" for encoding when comment is # vim: filetype=python, fileencoding=ascii-8bit + returns "ascii-8bit" for encoding when comment is # encoding: ascii-8bit frozen_string_literal: true + returns nil for encoding when comment is # fRoZeN-sTrInG_lItErAl: true + returns nil for typed when comment is # eNcOdInG: utf-8 + returns nil for shareable_constant_value when comment is CSV.generate(encoding: Encoding::UTF_8) do |csv| + returns nil for encoding when comment is # shareable_constant_value: experimental_copy + returns nil for shareable_constant_value when comment is # frozen_string_literal:true + returns nil for encoding when comment is # vim:fileencoding=utf-8 + returns nil for shareable_constant_value when comment is # typed:strict + returns nil for shareable_constant_value when comment is # xyz shareable_constant_value: literal + returns nil for shareable_constant_value when comment is # -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- + returns nil for shareable_constant_value when comment is # coding: utf-8 + returns nil for shareable_constant_value when comment is # ENCODING: utf-8 + returns nil for frozen_string_literal when comment is # vim: filetype=ruby, fileencoding=ascii-8bit + returns false for frozen_string_literal when comment is # frozen_string_literal: false + returns "utf-8" for encoding when comment is # encoding: utf-8 + returns true for frozen_string_literal when comment is # -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- + returns nil for shareable_constant_value when comment is # -*- frozen-string-literal: true -*- + returns "experimental_everything" for shareable_constant_value when comment is # shareable_constant_value: experimental_everything + returns nil for shareable_constant_value when comment is #typed:strict + returns nil for encoding when comment is # typed: strong + returns nil for typed when comment is # frozen_string_literal: false + returns true for frozen_string_literal when comment is # fRoZeN-sTrInG_lItErAl: true + returns nil for encoding when comment is # frozen_string_literal: invalid + returns true for frozen_string_literal when comment is # frozen-string-literal: true + returns nil for shareable_constant_value when comment is # vim: filetype=ruby, fileencoding=ascii-8bit + returns nil for shareable_constant_value when comment is # vim: filetype=ruby,fileencoding=ascii-8bit + returns nil for shareable_constant_value when comment is # vim:fileencoding=utf-8 + returns nil for encoding when comment is # FROZEN-STRING-LITERAL: true + returns nil for frozen_string_literal when comment is # vim:fileencoding=utf-8 + returns nil for shareable_constant_value when comment is # @typed + returns nil for typed when comment is # vim: filetype=ruby, fileencoding=ascii-8bit + returns "utf-8" for encoding when comment is # eNcOdInG: utf-8 + returns "ascii-8bit" for encoding when comment is # -*- encoding : ascii-8bit -*- + returns nil for typed when comment is # frozen_string_literal: true + returns nil for frozen_string_literal when comment is # vim: filetype=ruby,fileencoding=ascii-8bit + returns nil for typed when comment is # shareable_constant_value: literal + returns nil for typed when comment is # ENCODING: utf-8 + returns nil for encoding when comment is # frozen_string_literal: false + returns nil for typed when comment is # shareable-constant-value: literal + returns nil for encoding when comment is # frozen_string_literal: true + returns nil for encoding when comment is # frozen_string_literal:true + returns nil for frozen_string_literal when comment is # xyz shareable_constant_value: literal + returns true for frozen_string_literal when comment is # frozen_string_literal: true + returns nil for frozen_string_literal when comment is # shareable_constant_value: literal + returns nil for shareable_constant_value when comment is # encoding: ascii-8bit frozen_string_literal: true + returns nil for shareable_constant_value when comment is # vim: filetype=python, fileencoding=ascii-8bit + returns nil for shareable_constant_value when comment is # xyz shareable_constant_value: literal xyz + returns nil for typed when comment is # xyz shareable_constant_value: literal + returns nil for shareable_constant_value when comment is # frozen_string_literal: true + returns nil for frozen_string_literal when comment is # shareable_constant_value: experimental_copy + returns nil for frozen_string_literal when comment is # shareable_constant_value: experimental_everything + returns nil for shareable_constant_value when comment is # coding: utf-8 + returns nil for typed when comment is # coding: utf-8 -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- + returns nil for typed when comment is # frozen_string_literal: true encoding: ascii-8bit + returns nil for frozen_string_literal when comment is # vim: filetype=ruby, fileencoding=ascii-8bit + returns nil for typed when comment is # frozen-string-literal: true + returns nil for typed when comment is # encoding: stateless-iso-2022-jp-kddi + returns nil for shareable_constant_value when comment is # typed: ignore + returns nil for typed when comment is # + returns "literal" for shareable_constant_value when comment is # shareable_constant_value:literal + returns nil for shareable_constant_value when comment is # eNcOdInG: utf-8 + returns nil for typed when comment is # shareable_constant_value: experimental_everything + returns nil for typed when comment is #vim: filetype=ruby, fileencoding=ascii-8bit + returns nil for frozen_string_literal when comment is # typed: strong + returns "ascii-8bit" for encoding when comment is # vim: filetype=ruby, fileencoding=ascii-8bit + returns nil for encoding when comment is # SHAREABLE-CONSTANT-VALUE: literal + returns "strong" for typed when comment is # typed: strong + returns nil for frozen_string_literal when comment is # + returns nil for typed when comment is # shareable_constant_value:literal + returns nil for shareable_constant_value when comment is # FROZEN-STRING-LITERAL: true + returns nil for shareable_constant_value when comment is # vim: filetype=ruby, fileencoding=ascii-8bit + returns true for frozen_string_literal when comment is # frozen_string_literal:true + returns nil for frozen_string_literal when comment is # eNcOdInG: utf-8 + returns nil for typed when comment is # frozen_string_literal: invalid + returns nil for shareable_constant_value when comment is # -*- coding: ASCII-8BIT; typed: strict -*- + returns true for frozen_string_literal when comment is # FROZEN-STRING-LITERAL: true + returns nil for encoding when comment is # typed: strict + returns nil for frozen_string_literal when comment is # -*- encoding : ascii-8bit -*- + returns nil for frozen_string_literal when comment is # encoding: stateless-iso-2022-jp-kddi + returns true for frozen_string_literal when comment is # -*- frozen-string-literal: true -*- + returns nil for shareable_constant_value when comment is # coding: utf-8 -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- + returns nil for frozen_string_literal when comment is # shareable_constant_value: none + returns nil for frozen_string_literal when comment is # typed: ignore + returns nil for encoding when comment is # xyz shareable_constant_value: literal + returns nil for typed when comment is # shareable_constant_value: none + returns nil for frozen_string_literal when comment is # shareable_constant_value:literal + returns nil for frozen_string_literal when comment is # typed: strict + returns nil for encoding when comment is # typed:strict + returns nil for frozen_string_literal when comment is # vim: filetype=python, fileencoding=ascii-8bit + returns nil for frozen_string_literal when comment is #vim: filetype=ruby, fileencoding=ascii-8bit + returns nil for frozen_string_literal when comment is # coding: utf-8 + returns "none" for shareable_constant_value when comment is # shareable_constant_value: none + returns "literal" for shareable_constant_value when comment is # shareable_constant_value: literal + returns nil for encoding when comment is # vim: filetype=ruby,fileencoding=ascii-8bit + returns nil for shareable_constant_value when comment is # encoding: stateless-iso-2022-jp-kddi + returns nil for frozen_string_literal when comment is # typed:strict + #valid? + with a non magic comment + is expected to equal false + with an shareable constant value comment + is expected to equal true + with an empty string + is expected to equal false + with an encoding comment + is expected to equal true + with an frozen string literal comment + is expected to equal true + #valid_shareable_constant_value? + when given comment specified as `experimental_everything` + is expected to equal true + when given comment specified as `literal` + is expected to equal true + when given comment specified as `none` + is expected to equal true + when given comment specified as unknown value + is expected to equal false + when given comment specified as `experimental_copy` + is expected to equal true + when given comment is not specified + is expected to equal false + #without + simple format + when the comment contains a different magic value + is expected to eq "# frozen-string-literal: true" + when the entire comment is a single value + is expected to eq "" + emacs format + with one token + is expected to eq "" + with multiple tokens + is expected to eq "# -*- frozen_string_literal: true -*-" + vim format + when the comment has multiple tokens + is expected to eq "# vim: filetype=ruby" + +RuboCop::Cop::InternalAffairs::InheritDeprecatedCopClass + does not register an offense when using `Base` + registers an offense when using `RuboCop::Cop::Cop` + does not register an offense when not inherited super class + registers an offense when using `Cop` + +RuboCop::Cop::Style::MultilineMemoization + EnforcedStyle: keyword + with a multiline memoization + without a `begin` and `end` block + when the expression is wrapped in parentheses + registers an offense when expression starts on first line + registers an offense when expression starts on following line + registers an offense with multiline expression + with a multiline memoization + without a `begin` and `end` block + allows with a conditional on the first line + allows with another block on the first line + allows with another block on the following line + allows with a conditional on the following line + with a single line memoization + allows expression on first line + allows expression on the following line + EnforcedStyle: braces + with a single line memoization + allows expression on first line + allows expression on the following line + with a multiline memoization + without a `begin` and `end` block + allows with a conditional on the following line + allows with a conditional on the first line + allows with another block on the first line + allows with another block on the following line + with a multiline memoization + without braces + when the expression is wrapped in `begin` and `end` keywords + registers an offense for begin...end block on following line + registers an offense for begin...end block on first line + +RuboCop::Cop::Style::NumericLiteralPrefix + hex literals + does not register offense for lowercase prefix + registers an offense for uppercase prefix + binary literals + does not register offense for lowercase prefix + registers an offense for uppercase prefix + octal literals + when config is zero_with_o + does not register offense for lowercase prefix + registers an offense for prefixes `0` and `0O` + when config is zero_only + registers an offense for prefix `0O` and `0o` + does not register offense for prefix `0` + decimal literals + registers an offense for prefixes + does not register offense for no prefix + +RuboCop::Cop::Style::SwapValues + does not register an offense when assigning receiver object at `def` + does not register an offense when idiomatically swapping variables + does not register an offense when almost swapping variables + handles comments when correcting + behaves like verbosely swapping + registers an offense and corrects when verbosely swapping constant variables + behaves like verbosely swapping + registers an offense and corrects when verbosely swapping instance variables + behaves like verbosely swapping + registers an offense and corrects when verbosely swapping mixed variables + behaves like verbosely swapping + registers an offense and corrects when verbosely swapping constant with namespaces variables + behaves like verbosely swapping + registers an offense and corrects when verbosely swapping class variables + behaves like verbosely swapping + registers an offense and corrects when verbosely swapping local variables + behaves like verbosely swapping + registers an offense and corrects when verbosely swapping global variables RuboCop::Cop::Metrics::Utils::CodeLengthCalculator #calculate raises when unknown foldable type is passed when class - does not count lines of inner classes does not count blank lines counts comments if asked - folds arrays if asked - calculates class length - folds heredocs if asked + does not count lines of inner classes folds hashes if asked - when method - counts single line hash with other args correctly if asked folding - folds hashes without braces as the one of method args if asked + folds heredocs if asked + calculates class length folds arrays if asked - folds multiline hashes with line break before it as method args if asked - folds hashes as method kwargs if asked - does not count blank lines + when method + folds multiline hashes without braces as method args if asked folds hashes if asked - counts single line hash with line breaks correctly if asked folding - folds hashes as method args if asked - counts single line without parentheses correctly if asked folding folds multiline hashes with line break after it as method args if asked - calculates method length - folds heredocs if asked - folds multiline hashes without braces as method args if asked folds hashes with comment if asked + folds multiline hashes with line break before it as method args if asked + folds heredocs if asked counts comments if asked + calculates method length + folds hashes as method kwargs if asked + counts single line hash with line breaks correctly if asked folding + folds arrays if asked + counts single line hash with other args correctly if asked folding + does not count blank lines counts single line hash as the one of method args with safe navigation operator if asked folding + folds hashes without braces as the one of method args if asked + counts single line without parentheses correctly if asked folding counts single line hash as the one of method args if asked folding + folds hashes as method args if asked counts single line correctly if asked folding -RuboCop::Cop::Style::IfInsideElse - handles a nested `if...then...elsif...else...end` - ignores if inside unless - handles a nested `if...then...else...end` - handles a nested `if...then...end` - catches an if..else nested inside an else - catches a modifier if nested inside an else after elsif - isn't offended if there is a statement following the if node - isn't offended if there is a statement preceding the if node - handles a nested `if...then...elsif...end` - catches an `if..else` nested inside an `else` and nested inside `if` branch code is empty - ignores unless inside else - isn't offended by if..elsif..else - catches an if node nested inside an else - handles a nested multiline `if...then...elsif...else...end` - catches an if..elsif..else nested inside an else - ignores nested ternary expressions - ignores ternary inside if..else - when AllowIfModifier is true - accepts a modifier if nested inside an else - when AllowIfModifier is false - catches a modifier if nested inside an else - -RuboCop::Cop::Lint::EmptyFile - does not register an offense when the file contains comments - does not register an offense when the file contains code - registers an offense when the file is empty - when AllowComments is false - registers an offense when the file contains comments - -RuboCop::Cop::Style::TrailingCommaInHashLiteral - with single line list of values - when EnforcedStyleForMultiline is consistent_comma - accepts empty literal - accepts literal without trailing comma - accepts single element literal without trailing comma - registers an offense for trailing comma in a literal - when EnforcedStyleForMultiline is no_comma - accepts literal without trailing comma - accepts empty literal - registers an offense for trailing comma in a literal - accepts single element literal without trailing comma - when EnforcedStyleForMultiline is comma - accepts empty literal - accepts literal without trailing comma - registers an offense for trailing comma in a literal - accepts single element literal without trailing comma - with multi-line list of values - when EnforcedStyleForMultiline is consistent_comma - registers an offense for no trailing comma - accepts trailing comma - accepts a multiline hash with pairs on a single line andtrailing comma - accepts a multiline hash with a single pair and trailing comma - accepts trailing comma after a heredoc - when closing bracket is on same line as last value - registers an offense for literal with no trailing comma - when EnforcedStyleForMultiline is comma - registers an offense for trailing comma in a comment - accepts a multiline hash with a single pair and trailing comma - accepts trailing comma - registers an offense for no trailing comma - accepts trailing comma after a heredoc - when closing bracket is on same line as last value - accepts literal with no trailing comma - when EnforcedStyleForMultiline is no_comma - registers an offense for trailing comma in literal - accepts comma inside a heredoc parameters at the end - accepts comma in comment after last value item - accepts literal with no trailing comma - -RuboCop::Cop::Style::NilLambda - proc - registers an offense when returning nil with `break` - properly corrects single line - registers an offense when returning nil with `next` - registers an offense when returning nil with `return` - registers an offense when returning nil implicitly - does not register an offense when doing more than returning nil - does not register an offense when not returning nil - does not remove block params or change spacing - block lambda - does not register an offense when doing more than returning nil - registers an offense when returning nil implicitly - does not register an offense when not returning nil - properly corrects single line - registers an offense when returning nil with `next` - registers an offense when returning nil with `return` - registers an offense when returning nil with `break` - does not remove block params or change spacing - stabby lambda - registers an offense when returning nil with `return` - registers an offense when returning nil with `next` - does not register an offense when not returning nil - registers an offense when returning nil with `break` - registers an offense when returning nil implicitly - properly corrects multiline - does not register an offense when doing more than returning nil - Proc.new - properly corrects single line - does not register an offense when doing more than returning nil - registers an offense when returning nil with `break` - does not register an offense when not returning nil - does not remove block params or change spacing - registers an offense when returning nil with `next` - registers an offense when returning nil implicitly - registers an offense when returning nil with `return` - -RuboCop::Cop::Generator - #write_source - generates a helpful source file with the name filled in - refuses to overwrite existing files - #write_spec - generates a helpful starting spec file with the class filled in - refuses to overwrite existing files - #todo - provides a checklist for implementing the cop - .new - does not accept an unqualified cop - nested departments - generates source and spec files correctly namespaced within departments - #inject_config - when it is the last in alphabetical order - inserts the cop - with version provided - uses the provided version - when it is the middle in alphabetical order - inserts the cop - when it is the first in alphabetical order - inserts the cop - #snake_case - converts "RSpec/Foo" to snake_case - converts "FooBar" to snake_case - converts "RSpec" to snake_case - converts "Lint" to snake_case - converts "FooBar/Baz" to snake_case - converts "RSpecFoo/Bar" to snake_case - compliance with rubocop - generates a spec file that has no offense (PENDING: Temporarily skipped with xit) - generates a cop file that has no offense (PENDING: Temporarily skipped with xit) - -RuboCop::Cop::Style::RandomWithOffset - registers an offense when using rand(int).succ - registers an offense when using rand(erange).succ - does not register an offense when using rand(erange).pred with a non-integer range value - registers an offense when using rand(irange) + offset - registers an offense when using offset - rand(erange) - registers an offense when using Random.rand(int).succ - registers an offense when using ::Kernel.rand - does not register an offense when using rand(irange).succ with a non-integer range value - registers an offense when using rand(int) - offset - registers an offense when using Kernel.rand - registers an offense when using rand(irange).succ - registers an offense when using rand(int) + offset - registers an offense when using rand(irange) - offset - registers an offense when using Random.rand - does not register an offense when using range with double dots - registers an offense when using offset + Random.rand(int) - does not register an offense when using rand(irange) + offset with a non-integer range value - registers an offense when using rand(int).next - registers an offense when using offset - rand(int) - registers an offense when using ::Random.rand - registers an offense when using rand(erange) + offset - registers an offense when using offset - rand(irange) - registers an offense when using ::Random.rand(int).pred - registers an offense when using rand(int).pred - does not register an offense when using range with triple dots - registers an offense when using offset - ::Random.rand(int) - does not register an offense when using offset - rand(erange) with a non-integer range value - registers an offense when using offset + rand(int) - registers an offense when using rand(erange) - offset - -RuboCop::Cop::Layout::LineEndStringConcatenationIndentation - when EnforcedStyle is aligned - accepts single line string literal concatenation - accepts indented strings in ordinary statement - registers an offense for unaligned strings in hash literal values - accepts a heredoc string ... - registers an offense for aligned strings in an if/elsif/else statement - accepts indented strings in implicit return statement of a method definition after other statement - accepts string literal with line break concatenated with other string - accepts a multiline string literal - accepts a heredoc string with interpolation - accepts indented strings in implicit return statement of a method definition - accepts an empty heredoc string with interpolation - accepts indented strings in implicit return statement of a block - registers an offense for indented string - accepts aligned strings in method call - accepts indented strings in implicit return statement of a singleton method definition - registers an offense for third part of a string if it is aligned only with the first - for assignment with X = - accepts aligned strings - registers an offense for indented strings - for assignment with x += - registers an offense for indented strings - accepts aligned strings - for assignment with x = - accepts aligned strings - registers an offense for indented strings - for assignment with $x = - registers an offense for indented strings - accepts aligned strings - for assignment with x ||= - registers an offense for indented strings - accepts aligned strings - for assignment with @x = - accepts aligned strings - registers an offense for indented strings - when EnforcedStyle is indented - accepts indented strings in implicit return statement of a singleton method definition - accepts single line string literal concatenation - accepts a multiline string literal - registers an offense for unaligned third part of string - registers an offense for aligned string - accepts indented strings in implicit return statement of a block - accepts string literal with line break concatenated with other string - accepts a heredoc string ... - accepts indented strings - accepts a heredoc string with interpolation - accepts an empty heredoc string with interpolation - accepts indented strings in ordinary statement - accepts indented strings in implicit return statement of a method definition - accepts indented strings in implicit return statement of a method definition after other statement - registers an offense for aligned strings in an if/elsif/else statement - registers an offense for aligned strings in hash literal values - for assignment with X = - accepts indented strings - registers an offense for aligned strings - for assignment with @x = - accepts indented strings - registers an offense for aligned strings - for assignment with $x = - registers an offense for aligned strings - accepts indented strings - when IndentationWidth is 1 - accepts indented strings - for assignment with x ||= - registers an offense for aligned strings - accepts indented strings - for assignment with x = - accepts indented strings - registers an offense for aligned strings - for assignment with x += - registers an offense for aligned strings - accepts indented strings - -RuboCop::Cop::Lint::ReturnInVoidContext - with a setter method containing a return without a value - accepts - with a class method called initialize containing a return - accepts - with an initialize method containing a return with a value - registers an offense - with a setter method containing a return with a value - registers an offense - with an initialize method containing a return without a value - accepts - when return is in top scope - accepts - with a non initialize method containing a return - accepts - -RuboCop::Cop::Layout::EmptyLinesAroundExceptionHandlingKeywords - accepts empty begin - accepts `begin` and `rescue` are on the same line - registers an offense for rescue section starting with a blank - accepts `rescue` and `end` are on the same line - accepts no empty line - registers an offense for rescue section ending for method definition a blank - with complex method definition - registers many offenses - accepts empty lines around begin body - accepts last `rescue` and `end` are on the same line - registers an offense for above rescue keyword with a blank - accepts empty method definition - with complex begin-end - registers many offenses - registers an offense for rescue section ending with a blank - accepts `def` and `rescue` are on the same line - -RuboCop::Cop::Layout::ClassStructure - registers an offense and corrects when str heredoc constant is defined after public method - registers an offense and corrects when dstr heredoc constant is defined after public method - registers an offense and corrects when xstr heredoc constant is defined after public method - registers an offense and corrects when literal constant is after method definitions - registers an offense and corrects when there is a comment in the macro method - initializer is private and comes after attribute macro - registers an offense and autocorrects - with attribute macros before after validations - is expected to eq class Person - include AnotherModule - extend SomeModule - - CustomError = Cla...rivate :other_public_method - - private - - def some_private_method - end - end - when def modifier is used - registers an offense and corrects public method after private method marked by its name - registers an offense and corrects public method without modifier declared after private method with modifier - registers an offense and corrects public method with modifier declared after private method with modifier - with protected methods declared before private - is expected to eq class MyClass - def public_method - end - - private - - def first_private...ar before `private_methods`. - end - - def second_protected_method - end - end - simple example - is expected to eq "class Person\n include AnotherModule\n extend SomeModule\n CONST = 'wrong place'\nend\n" - with a complete ordered example - does not create offense - when the first line ends with a comment - reports an offense and swaps the lines - constant is not a literal - registers offense but does not autocorrect - -RuboCop::Cop::Style::EndBlock - reports an offense and corrects END block - does not report offenses for other blocks - -RuboCop::Cop::Layout::InitialIndentation - registers an offense and corrects indented assignment disregarding comment - accepts empty file - accepts unindented method definition - accepts unindented comment + assignment - registers an offense for indented method definition - for a file with byte order mark - registers an offense and corrects indented method call after comment - accepts unindented method call - registers an offense and corrects indented method call - -RuboCop::Cop::Style::Proc - registers an offense for a Proc.new call - accepts the ::Proc.new call without block - registers an offense for ::Proc.new - accepts the Proc.new call without block - Ruby 2.7 - registers an offense for a Proc.new call - -RuboCop::Cop::Style::RedundantSelf - does not report an offense when receiver and multiple assigned lvalue have the same name - does not report an offense when receiver and lvalue have the same name - reports an offense a self receiver on an rvalue - accepts a self receiver with the square bracket operator - does not report an offense when masgn name is used in `unless` - does not report an offense when self receiver in a method argument and lvalue have the same name - does not report an offense when lvasgn name is used in `unless` - does not report an offense when lvasgn name is nested below `if` - does not report an offense when lvasgn name is used in `while` - does not report an offense when lvasgn name is used in `until` - accepts a self receiver used to distinguish from argument of block - accepts a self receiver on an lvalue of an assignment - accepts a self receiver with the double less-than operator - accepts when nested receiver and lvalue have the name name - accepts a self receiver on an lvalue of an and-assignment - accepts a self receiver of methods also defined on `Kernel` - does not report an offense when self receiver in a method argument and multiple assigned lvalue have the same name - accepts a self receiver on an lvalue of an or-assignment - reports an offense when a different masgn name is used in `if` - does not report an offense when masgn name is used in `if` - does not report an offense when lvasgn name is used in `if` - accepts a self receiver used to distinguish from constant - accepts a self receiver for methods named like ruby keywords - reports an offense a self receiver of .call - does not report an offense when masgn name is used in `while` - accepts a self receiver on an lvalue of a parallel assignment - accepts a self receiver on an lvalue of mlhs arguments - reports an offense when a different lvasgn name is used in `if` - accepts a self receiver of .() - accepts a self receiver on an lvalue of a plus-assignment - does not report an offense when masgn name is used in `until` - Ruby 2.7 - registers offense for self usage in numblocks - instance methods - accepts a self receiver used to distinguish from an argument when an inner method is defined - accepts a self receiver used to distinguish from optional argument - accepts a self receiver used to distinguish from local variable - accepts a self receiver used to distinguish from an argument - accepts a self receiver used to distinguish from argument - accepts a self receiver used to distinguish from blockarg - class methods - accepts a self receiver used to distinguish from local variable - accepts a self receiver used to distinguish from optional argument - accepts a self receiver used to distinguish from argument - accepts a self receiver used to distinguish from blockarg - with ruby >= 2.7 - with pattern matching - accepts a self receiver with a `match-alt` - accepts a self receiver on a `array-pattern` - accepts a self receiver in a conditional pattern - accepts a self receiver on a `hash-pattern` - accepts a self receiver in a `if-guard` - registers an offense when using self with a different match var - accepts a self receiver on an `match-var` - accepts a self receiver in a nested pattern` - registers an offense when using a self receiver with a pin - -RuboCop::Cop::Style::TrailingBodyOnMethodDefinition - registers when body starts on def line & continues one more line - accepts a method with multiple lines of body - autocorrects with comment after body - accepts a method with one line of body - does not register offense with trailing body on method end - registers when body starts on def line & continues many more lines - registers an offense when body trails after method definition - autocorrects body with method definition with args not in parens - removes semicolon from method definition but not body when autocorrecting - when method is not on first line of processed_source - autocorrects offense - Ruby 3.0 or higher - does not register offense when endless method definition body is after newline in opening parenthesis - -RuboCop::Cop::Style::TrivialAccessors - registers an offense on one-liner reader - accepts writer using top level - accepts non-trivial reader - accepts expressions within reader - accepts writer nested within an instance_eval call - registers an offense on writer without braces - flags a reader inside a class, inside an instance_eval call - registers an offense on class reader - accepts writer with different ivar name - registers an offense on reader with braces - accepts splats - does not register an offense on DSL-style writer - accepts writer nested within a module - accepts non-trivial writer - accepts expressions within writer - registers an offense on reader with `private` - registers an offense on instance writer - accepts reader with different ivar name - accepts an initialize method looking like a writer - registers an offense on class writer - registers an offense on instance reader - accepts reader using top level - accepts reader nested within an instance_eval call - accepts blocks - accepts writer in a module - accepts reader nested within a module - registers an offense on one-liner writer - with DSL denied - registers an offense on DSL-style writer - disallow predicates - does not accept predicate-like reader - allow predicates - accepts predicate-like reader - exact name match disabled - registers an offense when names mismatch in writer - registers an offense when names mismatch in reader - ignore class methods - accepts class reader - accepts class writer - with allowed methods - accepts allowed writer - accepts allowed reader - with AllowPredicates: false - accepts allowed predicate - -RuboCop::Cop::Style::MethodDefParentheses - require_parentheses - auto-adds required parens for a defs - reports an offense for correct + opposite - reports an offense for class def with parameters but no parens - auto-adds required parens for a defs after a passing method - accepts def with no args and no parens - reports an offense for def with parameters but no parens - auto-adds required parens to argument lists on multiple lines - behaves like endless methods - endless methods - accepts parens with `forward-arg` - accepts parens with args - accepts parens for method calls inside an endless method - accepts parens without args - require_no_parentheses_except_multiline - when args span multiple lines - reports an offense for correct + opposite - auto-adds required parens to argument lists on multiple lines - when args are all on a single line - behaves like no parentheses - reports an offense for def with no args and parens - auto-removes the parens for defs - requires parens for anonymous block forwarding - accepts def with no args and no parens - reports an offense for def with parameters with parens - reports an offense for opposite + correct - reports an offense for class def with parameters with parens - accepts a def with parameters but no parens - accepts a class def with parameters with parens - requires parens for forwarding - behaves like endless methods - endless methods - accepts parens with `forward-arg` - accepts parens for method calls inside an endless method - accepts parens with args - accepts parens without args - require_no_parentheses - behaves like endless methods - endless methods - accepts parens for method calls inside an endless method - accepts parens with `forward-arg` - accepts parens without args - accepts parens with args - behaves like no parentheses - accepts a class def with parameters with parens - reports an offense for def with no args and parens - reports an offense for def with parameters with parens - requires parens for anonymous block forwarding - reports an offense for opposite + correct - requires parens for forwarding - accepts def with no args and no parens - accepts a def with parameters but no parens - reports an offense for class def with parameters with parens - auto-removes the parens for defs - -RuboCop::Cop::Style::VariableInterpolation - registers an offense for interpolated class variables - does not register an offense for variables in expressions - registers an offense for interpolated global variables in string - registers an offense for interpolated global variables in backticks - registers an offense for interpolated global variables in regexp - registers an offense for interpolated instance variables - registers an offense for interpolated regexp back references - registers an offense for interpolated regexp nth back references - registers an offense for interpolated global variables in symbol - -RuboCop::Cop::InternalAffairs::StyleDetectedApiUse - registers an offense when correct_style_detected is used in a conditional expression - does not register an offense when correct_style_detected and a no_acceptable_style! are both used - does not register an offense when correct_style_detected and a unrecognized_style_detected are both used - registers an offense when unexpected_style_detected is used without a correct_style_detected follow up - registers an offense when conflicting_styles_detected is used without a correct_style_detected follow up - does not register an offense when correct_style_detected and a conflicting_styles_detected are both used - registers an offense when no_acceptable_style! is used without a correct_style_detected follow up - does not register an offense when correct_style_detected and a ambiguous_style_detected are both used - registers an offense when ambiguous_style_detected is used without a correct_style_detected follow up - registers an offense when opposite_style_detected is used without a correct_style_detected follow up - registers an offense when no_acceptable_style! is used in a conditional expression - registers an offense when unrecognized_style_detected is used without a correct_style_detected follow up - registers an offense when conflicting_styles_detected is used in a conditional expression - registers an offense when opposite_style_detected is used in a conditional expression - does not register an offense when correct_style_detected and a unexpected_style_detected are both used - registers an offense when correct_style_detected is used without a negative *_style_detected follow up - registers an offense when ambiguous_style_detected is used in a conditional expression - registers an offense when unexpected_style_detected is used in a conditional expression - registers an offense when unrecognized_style_detected is used in a conditional expression - does not register an offense when correct_style_detected and a opposite_style_detected are both used - -RuboCop::Cop::Lint::Syntax - .offenses_from_processed_source - with a parser error - returns an offense - with --display-cop-names option - returns an offense with cop name - with a diagnostic error - returns an offense - with --autocorrect --disable-uncorrectable options - returns an offense - with --display-cop-names option - returns an offense with cop name - -RuboCop::Cop::Style::OptionHash - registers an offense - when passing options hash to super - does not register an offense - does not register an offense when call to super is in a nested block - does not register an offense when code exists before call to super - when the last argument is an options hash named something else - does not register an offense - when the argument name is in the list of suspicious names - registers an offense - when the last argument is a non-options-hash optional hash - does not register an offense - permitted list - ignores if the method is permitted - when there are no arguments - does not register an offense - -RuboCop::Cop::Lint::NextWithoutAccumulator - behaves like reduce/inject - given a inject block - registers an offense for a bare next - accepts next with a value - accepts next within a nested block - Ruby 2.7 - registers an offense for a bare next - behaves like reduce/inject - given a reduce block - accepts next within a nested block - accepts next with a value - registers an offense for a bare next - Ruby 2.7 - registers an offense for a bare next - given an unrelated block - accepts a bare next - accepts next with a value - -RuboCop::Cop::Style::RedundantFetchBlock - with SafeForConstants: true - does not register an offense when using `#fetch` with argument fallback - registers an offense and corrects when using `#fetch` with Integer in the block - registers an offense and corrects when using `#fetch` with Float in the block - registers an offense and corrects when using `#fetch` with Rational in the block - registers an offense and corrects when using `#fetch` with empty block - registers an offense and corrects when using `#fetch` with String in the block and strings are frozen - does not register an offense when using `#fetch` with String in the block and strings are not frozen - registers an offense and corrects when using `#fetch` with Complex in the block - registers an offense and corrects when using `#fetch` with constant in the block - does not register an offense when using `#fetch` with interpolated Symbol in the block - does not register an offense when using `#fetch` with `Rails.cache` - does not register an offense when using `#fetch` with an argument in the block - registers an offense and corrects when using `#fetch` with Symbol in the block - with SafeForConstants: false - does not register an offense when using `#fetch` with constant in the block - -RuboCop::Cop::Lint::Debugger - does not register an offense for a save_and_open_screenshot method - does not register an offense for a pry_remote method - does not register an offense for a remote_pry method - does not register an offense for a remote_pry in comments - does not register an offense for a debugger method - does not register an offense for a remote_byebug method - does not register an offense for a debugger in comments - does not register an offense for a pry_remote in comments - does not register an offense for a remote_byebug in comments - does not register an offense for a save_and_open_screenshot in comments - does not register an offense for a pry in comments - does not register an offense for a byebug method - does not register an offense for a console in comments - does not register an offense for a byebug in comments - does not register an offense for a save_and_open_page method - does not register an offense for a binding method that is not disallowed - does not register an offense for a console method - does not register an offense for a pry method - does not register an offense for a irb method - does not register an offense for a irb in comments - does not register an offense for a save_and_open_page in comments - web console - does not register an offense for `console` without a receiver - registers an offense for a `binding.console` call - pry - registers an offense for a pry binding call - registers an offense for a remote_pry binding call - registers an offense for a remote_pry binding with an argument call - registers an offense for a pry binding with an argument call - registers an offense for a pry_remote binding with an argument call - registers an offense for a binding.pry with Kernel call - registers an offense for a Pry.rescue call - does not register an offense for a `pry` call without binding - registers an offense for a pry_remote binding call - does not register an offense for a `rescue` call without Pry - rails - registers an offense for a debugger with an argument call - registers an offense for a debugger with Kernel call - registers an offense for a debugger call - registers an offense for a debugger with ::Kernel call - capybara - registers an offense for save_and_open_screenshot - registers an offense for save_and_open_page - with an argument - registers an offense for save_and_open_screenshot - registers an offense for save_and_open_page - RubyJard - registers an offense for a jard call - byebug - registers an offense for a byebug with an argument call - registers an offense for a Kernel.remote_byebug call - registers an offense for a remote_byebug call - registers an offense for a byebug call - registers an offense for a Kernel.byebug call - debug.rb - registers an offense for a `binding.break` with `Kernel` call - registers an offense for a `binding.b` with `Kernel` call - registers an offense for a `b` binding call - registers an offense for a `break` binding call - built-in methods - registers an offense for a binding.irb with Kernel call - registers an offense for a irb binding call - with the DebuggerMethods configuration - does not register an offense for a byebug call - registers an offense for a `custom_debugger` call - with a const chain - registers an offense for a `Foo::Bar::Baz.debug` call - with a method chain - registers an offense for a `debugger.foo.bar` call - nested custom configurations - registers an offense for a `custom_debugger call - with a const chain and a method chain - registers an offense for a `Foo::Bar::Baz.debug.this.code` call - when a method group is disabled with false - does not register an offense for a Pry debugger call - does register an offense for another group - when a method group is disabled with nil - does register an offense for another group - does not register an offense for a Pry debugger call - -RuboCop::Cop::Style::Attr - accepts attr when it has a receiver - registers an offense attr - registers offense for attr within module_eval - registers offense for attr within class_eval - does not register offense for custom `attr` method - accepts attr when it does not take arguments - autocorrects - attr :name, true to attr_accessor :name - attr, false to attr_reader - attr with multiple names to attr_reader - attr to attr_reader - -RuboCop::Cop::Style::GlobalVars - does not register an offense for built-in variable $-i - does not register an offense for built-in variable $LAST_PAREN_MATCH - does not register an offense for built-in variable $< - does not register an offense for built-in variable $: - does not register an offense for built-in variable $SAFE - does not register an offense for built-in variable $OUTPUT_FIELD_SEPARATOR - does not register an offense for built-in variable $CHILD_STATUS - does not register an offense for built-in variable $VERBOSE - does not register an offense for built-in variable $@ - does not register an offense for built-in variable $-F - does not register an offense for built-in variable $+ - does not register an offense for built-in variable $FILENAME - does not register an offense for built-in variable $$ - does not register an offense for built-in variable $INPUT_RECORD_SEPARATOR - does not register an offense for built-in variable $ERROR_INFO - does not register an offense for built-in variable $FIELD_SEPARATOR - does not register an offense for built-in variable $" - does not register an offense for built-in variable $. - does not register an offense for built-in variable $LAST_READ_LINE - does not register an offense for built-in variable $JRUBY_VERSION - does not register an offense for built-in variable $-l - allows user permitted variables - does not register an offense for built-in variable $DEFAULT_INPUT - does not register an offense for built-in variable $0 - does not register an offense for built-in variable $FS - does not register an offense for built-in variable $LOAD_PATH - does not register an offense for built-in variable $ARGV - does not register an offense for built-in variable $' - does not register an offense for built-in variable $` - does not register an offense for built-in variable $, - does not register an offense for built-in variable $/ - does not register an offense for built-in variable $LAST_MATCH_INFO - does not register an offense for built-in variable $_ - registers an offense for $custom - does not register an offense for built-in variable $OUTPUT_RECORD_SEPARATOR - does not register an offense for built-in variable $~ - does not register an offense for built-in variable $-I - does not register an offense for built-in variable $-w - does not register an offense for built-in variable $-v - does not register an offense for built-in variable $\ - does not register an offense for built-in variable $PROCESS_ID - does not register an offense for built-in variable $ORS - does not register an offense for built-in variable $-0 - does not register an offense for built-in variable $LOADED_FEATURES - does not register an offense for built-in variable $POSTMATCH - does not register an offense for built-in variable $PID - does not register an offense for built-in variable $ENV_JAVA - does not register an offense for built-in variable $stderr - does not register an offense for built-in variable $IGNORECASE - does not register an offense for built-in variable $= - does not register an offense for built-in variable $CLASSPATH - does not register an offense for built-in variable $& - does not register an offense for built-in variable $NR - does not register an offense for built-in variable $DEBUG - does not register an offense for built-in variable $INPUT_LINE_NUMBER - does not register an offense for built-in variable $OFS - does not register an offense for built-in variable $PROGRAM_NAME - does not register an offense for built-in variable $> - does not register an offense for built-in variable $-d - does not register an offense for built-in variable $ERROR_POSITION - does not register an offense for built-in variable $* - does not register an offense for built-in variable $; - does not register an offense for built-in variable $! - does not register an offense for built-in variable $JRUBY_REVISION - does not register an offense for built-in variable $? - does not register an offense for built-in variable $DEFAULT_OUTPUT - does not register an offense for built-in variable $stdin - does not register an offense for built-in variable $-a - does not register an offense for built-in variable $MATCH - does not register an offense for built-in variable $RS - does not register an offense for built-in variable $-p - does not register an offense for built-in variable $PREMATCH - does not register an offense for built-in variable $stdout - does not register an offense for backrefs like $1 - -RuboCop::Cop::Layout::ClosingHeredocIndentation - accepts correctly indented closing heredoc when heredoc contents is after closing heredoc - accepts correctly indented closing heredoc when heredoc contents is before closing heredoc - registers an offense for bad indentation of a closing heredoc - registers an offense for incorrectly indented empty heredocs - does not register an offense for a << heredoc - accepts correctly indented closing heredoc when aligned at the beginning of method definition and using `strip_indent` - accepts correctly indented closing heredoc when aligned at the beginning of method definition - accepts correctly indented closing heredoc when heredoc contents with blank line - accepts correctly indented closing heredoc when aligned at the beginning of method definition and content is empty - accepts correctly indented closing heredoc - does not register an offense for correctly indented empty heredocs - -RuboCop::Cop::Lint::EmptyInterpolation - registers an offense and corrects #{} in interpolation - finds interpolations in string-like contexts - accepts non-empty interpolation - registers an offense and corrects #{ } in interpolation - -RuboCop::Cop::Style::NestedTernaryOperator - registers an offense and corrects for a nested ternary operator expression - accepts a non-nested ternary operator within an if - registers an offense and corrects for a nested ternary operator expression with no parentheses on the outside - registers an offense and corrects for a nested ternary operator expression with block - can handle multiple nested ternaries - -RuboCop::Cop::Style::OneLineConditional - when AlwaysCorrectToMultiline is false - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator when one of the branches of if/then/else/end contains `next` keyword - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct for if-then-elsif-then-end - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator without adding parentheses for if/then/else/end that contains method calls with parenthesized arguments - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - does not register an offense for if/then/end - registers and corrects an offense with ternary operator for if/then/else/end - registers and corrects an offense with multi-line construct for if-then-elsif-then-else-end - registers and corrects an offense with ternary operator for unless/then/else/end - does not register an offense for if/then/else/end with empty else - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - does not register an offense for unless/then/end - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - does not register an offense for unless/then/else/end with empty else - registers and corrects an offense with multi-line construct for if-then-elsif-then-elsif-then-else-end - registers and corrects an offense with ternary operator and adding parentheses for if/then/else/end that contains method calls with unparenthesized arguments - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with ternary operator without adding parentheses for if/then/else/end that contains unparenthesized operator method calls - registers and corrects an offense with ternary operator for if/then/else/end when `then` without body - registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `puts 1` constructs inside inner branches - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `defined? :A` constructs inside inner branches - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `a = b` constructs inside inner branches - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `yield a` constructs inside inner branches - behaves like if/then/else/end with keyword - registers and corrects an offense with ternary operator when one of the branches of if/then/else/end contains `break` keyword - behaves like if/then/else/end with keyword - registers and corrects an offense with ternary operator when one of the branches of if/then/else/end contains `self` keyword - behaves like if/then/else/end with keyword - registers and corrects an offense with ternary operator when one of the branches of if/then/else/end contains `raise` keyword - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `not a` constructs inside inner branches - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `a or b` constructs inside inner branches - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `a and b` constructs inside inner branches - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `a ? b : c` constructs inside inner branches - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `super b` constructs inside inner branches - behaves like if/then/else/end with keyword - registers and corrects an offense with ternary operator when one of the branches of if/then/else/end contains `retry` keyword - when AlwaysCorrectToMultiline is true - registers and corrects an offense with multi-line construct for unless/then/else/end - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end that contains unparenthesized operator method calls - does not register an offense for if/then/end - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct for if/then/else/end - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - does not register an offense for unless/then/else/end with empty else - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - does not register an offense for unless/then/end - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - does not register an offense for if/then/else/end with empty else - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct for if-then-elsif-then-elsif-then-else-end - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct when one of the branches of if/then/else/end contains `next` keyword - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct for if-then-elsif-then-else-end - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct for if/then/else/end when `then` without body - registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end that contains method calls with unparenthesized arguments - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator - registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end that contains method calls with parenthesized arguments - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `a and b` constructs inside inner branches - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `a or b` constructs inside inner branches - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `puts 1` constructs inside inner branches - behaves like if/then/else/end with keyword - registers and corrects an offense with multi-line construct when one of the branches of if/then/else/end contains `retry` keyword - behaves like if/then/else/end with keyword - registers and corrects an offense with multi-line construct when one of the branches of if/then/else/end contains `self` keyword - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `a ? b : c` constructs inside inner branches - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `not a` constructs inside inner branches - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `yield a` constructs inside inner branches - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `super b` constructs inside inner branches - behaves like if/then/else/end with keyword - registers and corrects an offense with multi-line construct when one of the branches of if/then/else/end contains `break` keyword - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `a = b` constructs inside inner branches - behaves like if/then/else/end with keyword - registers and corrects an offense with multi-line construct when one of the branches of if/then/else/end contains `raise` keyword - when IndentationWidth differs from default - registers and corrects an offense with multi-line construct for if/then/else/end - behaves like if/then/else/end with constructs changing precedence - registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `defined? :A` constructs inside inner branches - -RuboCop::Cop::Style::InverseMethods - registers an offense for !foo.even? - registers an offense for not (foo == bar) - registers an offense for !(foo !~ bar) - registers an offense for calling !.any? inside parens - registers an offense for !(foo > bar) - registers an offense for not (foo =~ bar) - allows comparing camel case constants on the left - registers an offense for !foo.include? - allows comparing camel case constants on the right - registers an offense for !foo.none? - allows an inverse method when double negation is used - allows an inverse method with a block when double negation is used - registers an offense for not (foo !~ bar) - registers an offense for !foo.exclude? - registers an offense for calling !.none? with a block - registers an offense for not (foo != bar) - allows a method call without a not - registers an offense for !foo.present? - registers an offense for comparing snake case constants on the left - registers an offense for !foo.blank? - registers an offense for not (foo < bar) - registers an offense for calling !.none? with a symbol proc - allows an inverse method in a block with next - registers an offense for !foo.odd? - registers an offense for !foo.any? - registers an offense for not (foo > bar) - registers an offense for !(foo == bar) - registers an offense for comparing snake case constants on the right - registers an offense for !(foo =~ bar) - registers an offense for !(foo != bar) - registers an offense for !(foo < bar) - behaves like all variable types - registers an offense for calling !@@foo.none? - registers an offense for calling not @@foo.none? - behaves like all variable types - registers an offense for calling !FOO.none? - registers an offense for calling not FOO.none? - behaves like all variable types - registers an offense for calling not FOO::BAR.none? - registers an offense for calling !FOO::BAR.none? - behaves like all variable types - registers an offense for calling not foo["bar"].none? - registers an offense for calling !foo["bar"].none? - behaves like all variable types - registers an offense for calling !foo.bar.none? - registers an offense for calling not foo.bar.none? - inverse blocks - corrects a complex inverted method call - corrects an inverted method call when using `BasicObject#!` with spaces before the method call - registers an offense for foo.reject! { |e| !e } - registers an offense for a multiline method call where the last method is inverted - registers an offense for a multiline inverted equality block - registers an offense for a multiline inverted equality block - registers an offense for foo.select { |e| !e } - corrects a complex inverted method call - corrects an inverted method call - corrects an inverted method call when using `BasicObject#!` with spaces before the method call - corrects an inverted method call - corrects an inverted method call when using `BasicObject#!` - corrects an inverted do end method call - corrects an inverted method call when using `BasicObject#!` - corrects a complex inverted method call - corrects an inverted method call when using `BasicObject#!` with spaces before the method call - corrects an inverted method call when using `BasicObject#!` - corrects a complex inverted method call - registers an offense for an inverted equality block - corrects an inverted method call - corrects an inverted method call - corrects an inverted method call when using `BasicObject#!` with spaces before the method call - registers an offense for a multiline inverted equality block - registers a single offense for nested inverse method calls - registers a single offense for nested inverse method calls - registers an offense for foo.reject { |e| !e } - corrects an inverted do end method call - registers an offense for foo.select! { |e| !e } - corrects an inverted method call when using `BasicObject#!` - corrects an inverted do end method call - registers an offense for an inverted equality block - registers an offense for an inverted equality block - registers a single offense for nested inverse method calls - registers an offense for an inverted equality block - registers an offense for a multiline method call where the last method is inverted - registers an offense for a multiline inverted equality block - registers a single offense for nested inverse method calls - registers an offense for a multiline method call where the last method is inverted - corrects an inverted do end method call - registers an offense for a multiline method call where the last method is inverted - behaves like all variable types - registers an offense for calling not $foo.none? - registers an offense for calling !$foo.none? - behaves like all variable types - registers an offense for calling not foo.none? - registers an offense for calling !foo.none? - Ruby 2.7 - registers an offense for calling !.none? with a numblock - behaves like all variable types - registers an offense for calling not @foo.none? - registers an offense for calling !@foo.none? - -RuboCop::Cop::Style::EachForSimpleLoop - does not register offense for character range - does not register offense if range endpoint is not constant - does not register offense if range startpoint is not constant - when using an inclusive end range - autocorrects the source with inline block - autocorrects the range not starting with zero - autocorrects the source with multiline block - does not register offense for range not starting with zero and using param - with multiline block with parameters - autocorrects an offense - when using an exclusive end range - autocorrects the range not starting with zero - autocorrects the source with inline block - autocorrects the source with multiline block - does not register offense for range not starting with zero and using param - with inline block with parameters - autocorrects an offense - -RuboCop::Formatter::FileListFormatter - #file_finished - displays parsable text - -RuboCop::Cop::Layout::FirstArrayElementLineBreak - ignores properly formatted implicit arrays - ignores elements listed on a single line - elements listed on the first line - registers and corrects the offense - masgn implicit arrays - registers and corrects the offense - array nested in a method call - registers an corrects the offense - send implicit arrays - registers and corrects the offense - word arrays - registers and corrects the offense - -RuboCop::Cop::InternalAffairs::OffenseLocationKeyword - does not register an offense when the `loc` is on a child node - does not register an offense when the `loc` is on a different node - when `node.loc.selector` is passed - registers an offense if message argument is passed - registers an offense - -RuboCop::Cop::Naming::MethodParameterName - registers offense when parameter ends in number - registers offense when parameter contains uppercase characters - does not register offense for empty kwrestarg - does not register offense for empty restarg - registers offense for offensive default parameter - does not register offense for valid parameter names - can register multiple offenses in one method definition - does not register offense for valid keyword parameters - registers offense when parameter ends in number on class method - does not register for method without parameters - does not register offense for valid parameter names on self.method - registers offense when parameter with prefix is less than minimum length - registers offense for offensive keyword parameters - does not register offense for valid default parameters - registers offense when parameter is less than minimum length - with AllowedNames - accepts param names prefixed with underscore - registers unlisted offensive names - accepts specified block param names - accepts underscore param names - when using argument forwarding - does not register an offense - with AllowNamesEndingInNumbers - accept parameters that end in numbers - with ForbiddenNames - registers offense for parameter listed as forbidden - accepts parameter that uses a forbidden name's letters - -RuboCop::FeatureLoader - .load - with unexpected LoadError from require - raises LoadError - with dot-prefixed namespaced feature - loads it as namespaced feature - with normally loadable feature - loads it normally - with unloadable namespaced feature - raises LoadError with preferred message - with dot-prefixed loadable feature - loads it as relative path - with namespaced feature - loads it as namespaced feature - -RuboCop::Cop::Gemspec::RequireMFA - when the specification is blank - registers an offense and corrects - with rubygems_mfa_required: false - registers an offense and corrects - when the gemspec is blank - does not register an offense - when there are other metadata keys - and `rubygems_mfa_required` is included - does not register an offense - and `rubygems_mfa_required` is not included - registers an offense and corrects - when metadata is set by key assignment - and `rubygems_mfa_required` is not included - registers an offense - and `rubygems_mfa_required` is included - does not register an offense - with rubygems_mfa_required: false by key access - registers an offense and corrects - with rubygems_mfa_required: true - does not register an offense - when the specification has a metadata hash but no rubygems_mfa_required key - registers an offense and corrects - when the specification has an non-hash metadata - registers an offense but does not correct - -RuboCop::Cop::Layout::EndOfLine - when EnforcedStyle is native - registers an offense for an incorrect EOL - when EnforcedStyle is crlf - registers an offense for CR+LF - does not register offense for no CR at end of file - accepts an empty file - does not register offenses after __END__ - and the default external encoding is US_ASCII - can inspect non-UTF-8 encoded source with proper encoding comment - does not crash on UTF-8 encoded non-ascii characters - and there are many lines ending with LF - can inspect non-UTF-8 encoded source with proper encoding comment - registers only one offense - when EnforcedStyle is lf - registers an offense for CR+LF - does not register offenses after __END__ - accepts an empty file - registers an offense for CR at end of file - and the default external encoding is US_ASCII - can inspect non-UTF-8 encoded source with proper encoding comment - does not crash on UTF-8 encoded non-ascii characters - and there are many lines ending with CR+LF - registers only one offense - can inspect non-UTF-8 encoded source with proper encoding comment - -RuboCop::Cop::Style::ArrayJoin - autocorrects '*' to 'join' when there are no spaces - does not register an offense for ambiguous cases - registers an offense for an array followed by string - does not register an offense for numbers - autocorrects '*' to 'join' when setting to a variable - -RuboCop::Cop::Lint::UnusedBlockArgument +RuboCop::Cop::Lint::UnusedMethodArgument inspection - when a block have a block local variable - and the variable is used - does not register offense - and the variable is unused - registers an offense - with an empty block - when not configured to ignore empty blocks - registers an offense - when configured to ignore empty blocks - does not register an offense - when a block takes single argument - and the method call is `define_method` - registers an offense - and the argument is unused - registers an offense and suggests omitting that - when a block takes multiple arguments + when a method takes multiple arguments and an argument is unused + registers an offense and adds underscore-prefix + and arguments are swap-assigned + accepts + and one argument is assigned to another, whilst other's value is not used + registers an offense + and there is some whitespace around the unused argument + registers an offense and preserves whitespace + and all the arguments are unused + registers offenses and suggests the use of `*` and autocorrects to add underscore-prefix to all arguments + in a method calling `binding` with arguments + when a method argument is unused registers an offense - and one argument is assigned to another, whilst other's value is not used + when a method argument is used + accepts + when an argument with a default value is unused + registers an offense and preserves the default value + when a trailing block argument is unused + registers an offense and removes the unused block arg + when a splat argument is unused + registers an offense and preserves the splat + when an optional keyword argument is unused + registers an offense but does not suggest underscore-prefix + and AllowUnusedKeywordArguments set + does not care + in a method calling `super` with arguments + when a method argument is unused registers an offense - and an argument with default value is unused - registers an offense and preserves default value - and all the arguments are unused - registers offenses and suggests omitting them - and unused arguments span multiple lines - registers offenses and suggests omitting them - and all arguments are used - accepts - and a splat argument is unused - registers an offense and preserves splat - and arguments are swap-assigned - accepts + when a required keyword argument is unused + when a required keyword argument is unused + registers an offense but does not suggest underscore-prefix + when a block argument is unused + does not care + when an underscore-prefixed method argument is unused + accepts in a method calling `binding` without arguments accepts all arguments - inside a method definition + inside another method definition registers offenses - when a method argument is not used - does not care - when a variable is not used + when a singleton method argument is unused + registers an offense + when a variable is unused does not care - when an underscore-prefixed block argument is not used - accepts - when an optional keyword argument is unused - when the method call is `define_method` - registers an offense - when AllowUnusedKeywordArguments set - does not care - when the method call is not `define_method` - registers an offense - when AllowUnusedKeywordArguments set - does not care - in a method calling `binding` with arguments - when a method argument is unused - registers an offense - when a lambda block takes arguments - and all the arguments are unused - registers offenses and suggests using a proc - and an argument is unused - registers an offense - when IgnoreEmptyBlocks config parameter is set - registers an offense for a non-empty block with an unused parameter - accepts an empty block with multiple unused parameters - registers an offense for a non-empty block with multiple unused args - accepts an empty block with a single unused parameter - -RuboCop::Cop::Style::NilComparison - configured with predicate preferred - registers an offense for === nil - registers and corrects an offense when using `x == nil` as a guard condition - registers an offense for == nil - configured with comparison preferred - registers an offense for nil? - registers and corrects an offense for `!x.nil?` - -RuboCop::Cop::Layout::FirstArrayElementIndentation - when array is right hand side in assignment - accepts a first element on the same line as the left bracket - accepts correctly indented first element - registers an offense and corrects incorrectly indented first element - accepts several elements per line - accepts single line array - accepts multi-assignments with brackets - accepts multi-assignments with no brackets - accepts an empty array - when array is method argument - and argument are not surrounded by parentheses - accepts single line array with brackets - registers an offense for incorrectly indented multi-line array that is the value of a single pair hash - registers an offense for a multi-line array that is a value of a multi pairs hash when the indent of its elements is not based on the hash key - accepts indent based on the start of the line where the left bracket iswhen the right bracket and its following pair is on the same line - registers an offense and corrects incorrectly indented multi-line array with brackets - accepts a correctly indented multi-line array with brackets - accepts indent based on the left bracket when the outer hash key and the left bracket is not on the same line - accepts bracketless array - and arguments are surrounded by parentheses - and EnforcedStyle is consistent - accepts indent based on the start of the line where the left bracket iswhen the right bracket and its following pair is on the same line - accepts normal indentation for first argument - accepts indent based on the left brace when the outer hash key and the left bracket is not on the same line - accepts normal indentation for second argument - registers an offense for a multi-line array that is a value of a multi pairs hash when the indent of its elements is not based on the hash key - registers an offense and corrects incorrect indentation - registers an offense for incorrectly indented multi-line array that is the value of a single pair hash - and EnforcedStyle is special_inside_parentheses - accepts special indentation for first argument - registers an offense and corrects 'consistent' indentation - registers an offense and corrects 'align_brackets' indentation - registers an offense for a multi-line array that is a value of a multi pairs hash when the indent of its elements is not based on the hash key - registers an offense for incorrectly indented multi-line array that is the value of a single pair hash - accepts indent based on the left brace when the outer hash key and the left bracket is not on the same line - accepts special indentation for second argument - accepts normal indentation for array within array - accepts indent based on the preceding left parenthesis when the right bracket and its following pair is on the same line - when using safe navigation operator - registers an offense and corrects 'consistent' indentation - when array is operand - accepts correctly indented first element - registers an offense and corrects incorrectly indented ] - registers an offense and corrects incorrectly indented first element - when indentation width is overridden for this cop - registers an offense and corrects incorrectly indented 1st element - accepts correctly indented first element - when EnforcedStyle is align_brackets - accepts single line array - accepts a first element on the same line as the left bracket - accepts several elements per line - accepts multi-assignments with brackets - accepts multi-assignments with no brackets - accepts an empty array - accepts correctly indented first element - registers an offense and corrects incorrectly indented ] - when 'special_inside_parentheses' style is used - registers an offense and corrects incorrect indentation - when 'consistent' style is used - registers an offense and corrects incorrect indentation - registers an offense and corrects incorrectly indented 1st element - when indentation width is overridden for this cop - accepts correctly indented first element - registers an offense and corrects indentation that does not match IndentationWidth - when array is argument to setter - accepts correctly indented first element - registers an offense and corrects incorrectly indented first element - -RuboCop::Cop::Layout::AccessModifierIndentation - when EnforcedStyle is set to outdent - accepts private with argument indented to method depth in module defined with Module.new - accepts private def indented to method depth in module defined with Module.new - accepts private with argument indented to method depth in a class - registers offense and corrects private indented to method depth in a class - accepts module fn def indented to method depth in a module - accepts private def indented to method depth in class defined with Class.new - registers an offense and corrects private indented to method depth in a module - registers an offense and corrects misaligned access modifiers in nested classes - accepts private def indented to method depth in singleton class - accepts private indented to the containing class indent level - accepts module fn with argument indented to method depth in a module - registers an offense and corrects private indented to method depth in module defined with Module.new - accepts private def indented to method depth in a module - accepts private def indented to method depth in a class - registers an offense and corrects module_function indented to method depth in a module - accepts private with argument indented to method depth in singleton class - accepts private with argument indented to method depth in class defined with Class.new - registers an offense and corrects private indented to method depth in class defined with Class.new - accepts private with argument indented to method depth in a module - accepts protected indented to the containing class indent level - registers an offense and corrects private indented to method depth in singleton class - when EnforcedStyle is set to indent - accepts properly indented private in module defined with Module.new - accepts properly indented protected - accepts indented access modifiers with arguments in nested classes - registers an offense and corrects correct + opposite alignment - registers an offense and corrects opposite + correct alignment - registers an offense and corrects misaligned private in module defined with Module.new - accepts properly indented private - registers an offense and corrects access modifiers in arbitrary blocks - registers an offense and corrects misaligned access modifiers in nested classes - accepts an empty class - accepts methods with a body - registers an offense and corrects misaligned private in module - registers an offense and corrects misaligned private - registers an offense and corrects misaligned private in a singleton class - registers an offense and corrects misaligned private in class defined with Class.new - registers an offense and corrects misaligned protected - registers an offense and corrects misaligned module_function in module - when 4 spaces per indent level are used - accepts properly indented private - when indentation width is overridden for this cop only - accepts properly indented private + in a method calling `super` without arguments + when a method argument is not used explicitly + accepts since the arguments are guaranteed to be the same as superclass' ones and the user has no control on them + when IgnoreEmptyMethods config parameter is set + registers an offense for a non-empty method with multiple unused parameters + accepts an empty method with a single unused parameter + registers an offense for a non-empty method with a single unused parameter + accepts an empty singleton method with a single unused parameter + accepts an empty method with multiple unused parameters + when IgnoreNotImplementedMethods config parameter is set + registers an offense for a non-empty method with multiple unused parameters + accepts an empty singleton method with a single unused parameter &raise NotImplementedError + registers an offense for a non-empty method with a single unused parameter + accepts a method with a single unused parameter & fails with message + accepts an empty method with multiple unused parameters + accepts a method with a single unused parameter & raises NotImplementedError, message + accepts a method with a single unused parameter & raises ::NotImplementedError + accepts a method with a single unused parameter & raises NotImplementedError + accepts a method with a single unused parameter & fails without message -RuboCop::Cop::InternalAffairs::InheritDeprecatedCopClass - registers an offense when using `Cop` - does not register an offense when using `Base` - does not register an offense when not inherited super class - registers an offense when using `RuboCop::Cop::Cop` +RuboCop::Cop::Style::DocumentDynamicEvalDefinition + does not register an offense when using eval-type method with interpolated string that is not heredoc with comment doc + does not register an offense when using eval-type method with string interpolation with comment docs + registers an offense when using eval-type method with string interpolation without comment docs + does not register an offense when using eval-type method without string interpolation + registers an offense when using eval-type method with interpolated string that is not heredoc without comment doc + block comment in heredoc + does not register an offense for a matching block comment + does not evaluate comments if there is no interpolation + does not register an offense when using inline comments + does not register an offense when using multiple methods + does not register an offense when using other text + does not register an offense when using multiple methods with split comments + registers an offense if the comment does not match the method + block comment outside heredoc + does not register an offense for a matching block comment after the heredoc + does not register an offense when using other text + does not register an offense for a matching block comment before the heredoc + does not register an offense when using multiple methods + registers an offense if the comment does not match the method + does not register an offense when using inline comments -RuboCop::ConfigStore - .for - always uses config specified in command line - when no config specified in command line - searches for config path if not available in cache - gets config path and config from cache if available - when --force-default-config option is specified - uses default config without searching for config path +RuboCop::Cop::Lint::EmptyInPattern + when `AllowComments: false` + registers an offense for empty `in` body with a comment + when a `in` body is missing + registers an offense for a missing `in` body + registers an offense for missing `in` body with a comment + registers an offense for missing `in` body followed by `else` + registers an offense for missing `in` body with a comment followed by `else` + registers an offense for missing `in` ... `then` body + registers an offense for missing `in` ... then `body` followed by `else` + when `AllowComments: true` + accepts an empty `in` body with a comment + registers an offense for empty `in` when comment is in another branch + when a `in` body is present + accepts `case` with `in` bodies and `else` clause + accepts `case` with `in` ... `then` statements and else clause + accepts `case` with `in` ... `then` statements + accepts `case` with `in` bodies -RuboCop::Cop::VariableForce - #process_node - when processing an empty regex - does not raise an error - when processing a regex with regopt - does not raise an error - when processing lvar node - when the variable is not yet declared - does not raise error - when processing a regexp with a line break at the start of capture parenthesis - does not raise an error +RuboCop::Cop::Style::AutoResourceCleanup + does not register an offense for File.open with immediate close + does not register an offense for File.open with block-pass + registers an offense for File.open without block + does not register an offense for File.open with block -RuboCop::Cop::Lint::NonAtomicFileOperation - does not register an offense when using complex conditional with `||` - registers an offense when use `FileTest.exist?` before remove file - does not register an offense when use `FileTest.exist?` before creating file with an option `force: false` - does not register an offense when not checking for the existence - registers an offense when use `FileTest.exist?` before force remove file - registers an offense when use file existence checks `unless` by postfix before creating file - registers an offense when use `FileTest.exist?` before creating file with an option `force: true` - does not register an offense when use `FileTest.exist?` before remove recursive file - does not register an offense when using complex conditional with `&&` - does not register an offense when not an exist check - registers an offense when use `FileTest.exists?` before creating file - registers an offense when use `FileTest.exist?` before force creating file - registers an offense when use `FileTest.exist?` before force creating file - registers an offense when use `FileTest.exist?` before remove file - registers an offense when use `FileTest.exist?` before creating file with an option not `force` - registers an offense when use `FileTest.exist?` before remove file - does not register an offense when using `FileTest.exist?` with `if` condition that has `else` branch - registers an offense when use `FileTest.exist?` before remove file - does not register an offense when processing other than file operations - registers an offense when use `FileTest.exist?` before remove file - registers an offense when use file existence checks `if` by postfix before removing file - registers an offense when use `FileTest.exist?` before force remove file - registers an offense when use `FileTest.exist?` before force creating file - registers an offense when use `FileTest.exist?` before remove file - registers an offense when use `FileTest.exist?` before remove file - does not register an offense when checking for the existence of different files - registers an offense when use `FileTest.exist?` before remove file - does not register an offense when use `FileTest.exist?` before remove recursive file - registers an offense when use `FileTest.exist?` with negated `if` before creating file - registers an offense when use `FileTest.exist?` before creating file - registers an offense when use `FileTest.exist?` before remove file - does not register an offense when not a method of file operation - registers an offense when using `FileTest.exist?` as a condition for `elsif` - registers an offense when use `FileTest.exist?` before remove file +RuboCop::Cop::Layout::SpaceAroundOperators + accepts an assignment with a blank line + accepts operators with spaces + accepts the result of the ExtraSpacing Cop + accepts exponent operator without spaces + accepts argument default values without space + accepts an assignment with spaces + accepts an assignment with the same alignment margins + accepts some operators that are exceptions & don't need spaces + accepts operator surrounded by tabs + accepts an operator at the end of a line + accepts a unary + registers an offenses for exponent operator with spaces + accepts rational + accepts an assignment by `for` statement + accepts ranges + accepts an assignment followed by newline + accepts an operator at the beginning of a line + accepts operator symbols + accepts []= without space + accepts [] without space + accepts ::Kernel::raise + accepts scope operator + accepts an operator called with method syntax + accepts unary operators without space + registers an offense and corrects singleton class operator` + registers an offense and corrects exclamation point negation + accepts exclamation point definition + accepts splat operator + accepts def of operator + accepts [arg] without space + when Layout/ExtraSpacing has `ForceEqualSignAlignment` configured to true + allows variables to be aligned + allows constants to be aligned + >= Ruby 3.0 + registers an offenses for one-line pattern matching syntax (`=>`) + missing space around operators + registers an offense and corrects a setter call without spaces + registers an offense and corrects inheritance < without space + registers an offense and corrects match operators without space + registers an offense and corrects `-` without space with a negative lhs operand + registers an offense and corrects arguments to a method + registers an offense and corrects various assignments without space + registers an offense for operators without spaces + registers an offense and corrects equality operators without space + registers an offense and corrects hash rocket without space at rescue + registers an offense and corrects string concatenation without messing up new lines + registers an offense for binary operators that could be unary + registers an offense for assignment without space on both sides + doesn't register an offense for operators with newline on right + when a hash literal is on multiple lines + and Layout/HashAlignment:EnforcedHashRocketStyle is key + registers an offense and corrects a hash rocket without spaces + and Layout/HashAlignment:EnforcedHashRocketStyle is table + doesn't register an offense for a hash rocket without spaces + behaves like modifier with missing space + registers an offense in presence of modifier if statement + when a hash literal is on a single line + and Layout/HashAlignment:EnforcedHashRocketStyle is table + registers an offense and corrects a hash rocket without spaces + and Layout/HashAlignment:EnforcedHashRocketStyle is key + registers an offense and corrects a hash rocket without spaces + ternary operators + registers an offense and corrects operators with just a trailing space + registers an offense and corrects operators with no spaces + registers an offense and corrects operators with just a leading space + behaves like modifier with missing space + registers an offense in presence of modifier until statement + behaves like modifier with missing space + registers an offense in presence of modifier while statement + behaves like modifier with missing space + registers an offense in presence of modifier unless statement + >= Ruby 2.7 + does not register an offenses for one-line pattern matching syntax (`in`) + extra space around operators + registers an offense and corrects binary operators that could be unary + registers an offense and corrects hash rocket with too many spaces at rescue + registers an offense and corrects ternary operator with too many spaces + registers an offense and corrects inheritance < with too many spaces + registers an offense and corrects a hash rocket with too many spaces + does not register an offenses match operators between `+=` and `<<` + registers an offense and corrects `-` with too many spaces with negative lhs operand + registers an offense and corrects various assignments with too many spaces + does not register an offenses match operators between `<<` and `+=` + registers an offense and corrects assignment with too many spaces on either side + registers an offense and corrects equality operators with too many spaces + accepts for a hash rocket with an extra space for alignment on multiple line + registers an offense and corrects operators with too many spaces + registers an offense and corrects operators with too many spaces on the same line + registers an offense and corrects a setter call with too many spaces + registers an offense and corrects match operators with too many spaces + registers an offense and corrects arguments to a method + registers an offense and corrects a hash rocket with an extra spaceon multiple line + behaves like modifier with extra space + registers an offense in presence of modifier while statement + behaves like modifier with extra space + registers an offense in presence of modifier until statement + behaves like modifier with extra space + registers an offense in presence of modifier if statement + when does not allowed for alignment + registers an offense and corrects an extra space + behaves like modifier with extra space + registers an offense in presence of modifier unless statement + when EnforcedStyleForExponentOperator is space + registers an offenses for exponent operator without spaces -RuboCop::Cop::Style::DocumentationMethod - when declaring methods outside a class - when declaring methods in a class - without documentation comment - when method is private - does not register an offense with `end` on the same line - does not register an offense - does not register an offense with inline `private` - does not register an offense with inline `private` and `end` - when required for non-public methods - registers an offense with inline `private` and `end` - registers an offense with `end` on the same line - registers an offense with inline `private` - registers an offense - when method is public - registers an offense - registers an offense with `end` on the same line - with directive comment - registers an offense - with annotation comment - registers an offense - with documentation comment - when method is public - does not register an offense with `end` on the same line - does not register an offense - with both public and private methods - when required for non-public methods - registers an offense - when the public method has documentation - does not register an offense - when the public method has no documentation - registers an offense - with both public and private methods - when the public method has no documentation - registers an offense - when required for non-public methods +RuboCop::Cop::Style::NumericPredicate + when configured to enforce numeric predicate methods + when checking if a number is zero + allows comparing against a global variable + registers an offense + registers an offense with a complex expression + when comparing against a method argument variable + registers an offense with complex expression registers an offense - when the public method has documentation + when checking if a number is positive + when target ruby version is 2.2 or lower does not register an offense - with documentation comment - does not register an offense with `end` on the same line - does not register an offense - without documentation comment - when method is public - registers an offense when method is public, but there were private methods before + when target ruby version is 2.3 or higher + registers an offense in yoda condition registers an offense - registers an offense with `end` on the same line - when method is private - does not register an offense - does not register an offense with `end` on the same line - does not register an offense with inline `private` and `end` - does not register an offense with inline `private` - when required for non-public methods - registers an offense with inline `private` - registers an offense with `end` on the same line - registers an offense with inline `private` and `end` + with a complex expression registers an offense - when method is protected + registers an offense in yoda condition + when checking if a number is negative + when target ruby version is 2.2 or lower does not register an offense - does not register an offense with inline `protected` - when required for non-public methods - registers an offense - registers an offense with inline `protected` - when declaring methods in a module - with both public and private methods - when the public method has documentation - does not register an offense - when the public method has no documentation - registers an offense - when required for non-public methods - registers an offense - without documentation comment - when method is private - does not register an offense with inline `private` - does not register an offense - does not register an offense with inline `private` and `end` - does not register an offense with `end` on the same line - when required for non-public methods - registers an offense with inline `private` - registers an offense with inline `private` and `end` - registers an offense - registers an offense with `end` on the same line - when method is module_function - registers an offense for inline def - registers an offense for separate def - when method is public - registers an offense with `end` on the same line + when target ruby version is 2.3 or higher + registers an offense + registers an offense in yoda condition + with a complex expression registers an offense - with documentation comment - when method is public - does not register an offense with `end` on the same line - does not register an offense - when method is module_function - does not register an offense for separate def - does not register an offense for inline def - when declaring methods for class instance - with documentation comment - does not register an offense - does not register an offense with `end` on the same line - when method is private - does not register an offense - does not register an offense with `end` on the same line - does not register an offense with inline `private` and `end` - does not register an offense with inline `private` - when required for non-public methods - registers an offense with `end` on the same line - registers an offense - registers an offense with inline `private` and `end` - registers an offense with inline `private` - with both public and private methods - when required for non-public methods + registers an offense in yoda condition + with checking if a number is not zero + allows comparing against a variable + allows comparing against a complex expression + allows comparing against a global variable + when configured to enforce numeric comparison methods + registers an offense for checking if a number is zero + allows checking if a number is not zero + registers an offense for checking if a number is negative + registers an offense for checking if a number is positive + when there are allowed methods + simple method call + `EnforcedStyle` is `comparison` + allows checking if a number is zero + `EnforcedStyle` is `predicate` + allows checking if a number is zero + in argument + ignored method + with a regex + allows checking if a number is positive + allows checking if a number is negative + with a string + allows checking if a number is negative + allows checking if a number is positive + not ignored method + when checking if a number is negative + when target ruby version is 2.3 or higher registers an offense - when the public method has documentation + when target ruby version is 2.2 or lower does not register an offense - when the public method has no documentation + when checking if a number is positive + when target ruby version is 2.3 or higher registers an offense - without documentation comment - registers an offense - registers an offense with `end` on the same line - -RuboCop::Cop::Naming::VariableName - when configured for camelCase - registers an offense for rest arguments - registers an offense for keyword rest arguments - accepts assigning to camel case constant - accepts camel case in instance variable name - accepts local variables marked as unused - registers an offense for keyword arguments - registers an offense for block arguments - accepts camel case in local variable name - registers an offense for camel case when invoking method args - accepts screaming snake case constants - accepts assignment with indexing of self - accepts screaming snake case globals - registers an offense for default method arguments - accepts camel case in class variable name - registers an offense for snake case in local variable name - registers an offense for opposite + correct - registers an offense for snake case in method parameter - accepts camel case local variables marked as unused - accepts one symbol size local variables - accepts with non-ascii characters - when AllowedPatterns is set - does not register an offense for a class variable name that matches the allowed pattern - does not register an offense for a symbol that matches the allowed pattern - does not register an offense for a method name that matches the allowed pattern - does not register an offense for a instance variable name that matches the allowed pattern - does not register an offense for a local variable name that matches the allowed pattern - does not register an offense for a global variable name that matches the allowed pattern - when AllowedIdentifiers is set - does not register an offense for a method name that is allowed - does not register an offense for a class variable name that is allowed - does not register an offense for a local variable name that is allowed - does not register an offense for a global variable name that is allowed - does not register an offense for a instance variable name that is allowed - does not register an offense for a symbol that is allowed - when configured for snake_case - registers an offense for block arguments - accepts local variables marked as unused - accepts screaming snake case constants - registers an offense for camel case in instance variable name - registers an offense for camel case local variables marked as unused - registers an offense for camel case in local variable name - registers an offense for keyword arguments - registers an offense for method arguments - registers an offense for keyword rest arguments - accepts assignment with indexing of self - accepts assigning to camel case constant - registers an offense for default method arguments - registers an offense for correct + opposite - accepts screaming snake case globals - registers an offense for camel case when invoking method args - registers an offense for rest arguments - accepts one symbol size local variables - registers an offense for camel case in class variable name - when AllowedIdentifiers is set - does not register an offense for a method name that is allowed - does not register an offense for a symbol that is allowed - does not register an offense for a instance variable name that is allowed - does not register an offense for a local variable name that is allowed - does not register an offense for a global variable name that is allowed - does not register an offense for a class variable name that is allowed - when AllowedPatterns is set - does not register an offense for a class variable name that matches the allowed pattern - does not register an offense for a global variable name that matches the allowed pattern - does not register an offense for a local variable name that matches the allowed pattern - does not register an offense for a method name that matches the allowed pattern - does not register an offense for a instance variable name that matches the allowed pattern - does not register an offense for a symbol that matches the allowed pattern - -RuboCop::Cop::Badge - compares by value - exposes department name - exposes cop name - can be converted to a string with the Department/CopName format - #camel_case - converts "rspec" to CamelCase - converts "foo_bar" to CamelCase - converts "lint" to CamelCase - .for - parses cop class name - parses cop class name - parses cop class name - parses cop class name - parses cop class name - .new - assigns department - assigns department - assigns name - assigns department - assigns name - assigns department - assigns name - assigns name - .parse - parses identifier - parses identifier - parses identifier - parses identifier - parses identifier - parses identifier - #qualified? - says `CopName` is not qualified - says `Deep/Department/CopName` is qualified - says `Department/CopName` is qualified - -RuboCop::Cop::Style::MixinGrouping - when configured with grouped style - when using a mix of diffent methods - allows all different mixin methods - registers an offense with some duplicated mixin methods - when using `extend` - registers an offense for single mixins in separate calls - when using `prepend` - registers an offense for single mixins in separate calls - registers an offense when other mixins have receivers - registers an offense for single mixins in separate calls, interspersed - when using include - allows include with an explicit receiver - registers an offense for several mixins in separate calls - registers an offense for single mixins in separate calls - when configured with separated style - when using `include` - allows include call as an argument to another method - registers an offense for several mixins in separate calls - registers an offense for several mixins in one call - when using a mix of diffent methods - registers an offense for some calls having several mixins - when using `prepend` - registers an offense for several mixins in one call - when using `extend` - registers an offense for several mixins in one call - -RuboCop::Cop::Style::MagicCommentFormat - all issues at once - registers and corrects multiple issues - kebab case style - registers an offense for mixed case - accepts an empty source - accepts a source with no tokens - does not register an offense for dashes in other comments - does not register an offense for incorrect style in comments after the first statement - registers an offense for snake case - accepts a frozen string literal in snake case in emacs style - registers an offense for snake case in emacs style - accepts a magic comments in kebab case - DirectiveCapitalization - when not set - does not change the case of magic comment directives - when lowercase - registers an offense and corrects when the case does not match - when uppercase - registers an offense and corrects when the case does not match - invalid config - DirectiveCapitalization - raises an error - ValueCapitalization - raises an error - ValueCapitalization - when lowercase - registers an offense and corrects when the case does not match - when uppercase - registers an offense and corrects when the case does not match - when not set - does not change the case of magic comment directives - snake case style - accepts a frozen string literal in snake case in emacs style - registers an offense for kebab case in emacs style - accepts a magic comments in snake case - registers an offense for mixed case - registers an offense for kebab case - does not register an offense for incorrect style in comments after the first statement - accepts a source with no tokens - does not register an offense for dashes in other comments - accepts an empty source - -RuboCop::Cop::InternalAffairs::RedundantMessageArgument - does not register an offense when formatted `MSG` is passed - does not register an offense when `#message` with another node is passed - when `MSG` is passed - registers an offense - when `#message` is passed - registers an offense - when `#message` with offending node is passed - when there are others keyword arguments - registers an offense - when message is the only keyword argument - registers an offense - -RuboCop::Cop::Style::RedundantConditional - registers an offense for if/else with negated boolean results - registers an offense for ternary with boolean results - registers an offense for if/elsif/else with boolean results - does not register an offense for if/else with non-boolean results - registers an offense for if/elsif/else with negated boolean results - does not register an offense for if/elsif/else with non-boolean results - registers an offense for ternary with negated boolean results - allows ternary with non-boolean results - registers an offense for if/else with boolean results - -RuboCop::Cop::Style::ArrayCoercion - does not register an offense when splatting multiple variables into array - does not register an offense when splat is not in array - registers an offense and corrects when converting variable into array with check - does not register an offense when converting variable into other named array variable with check - registers an offense and corrects when splatting variable into array - -RuboCop::Cop::Style::UnlessLogicalOperators - EnforcedStyle is `forbid_logical_operators` - registers an offense when using `&&` followed by || - does not register an offense when not used in unless - registers an offense when using only `||` - registers an offense when using only `or` - registers an offense when using only `&&` - does not register an offense when using if - registers an offense when using only `and` - does not register an offense when not using logical operator - EnforcedStyle is `forbid_mixed_logical_operators` - registers an offense when using `&&` and `or` - does not register an offense when using only `||`s - does not register an offense when using if - registers an offense when using `&&` and `||` - does not register an offense when using `||` operator and invoked method name includes "or" in the conditional branch - does not register an offense when using only `and`s - registers an offense when using parentheses - does not register an offense when using only `or`s - registers an offense when using `&&` and `and` - does not register an offense when not using logical operator - registers an offense when using `||` and `and` - does not register an offense when using `&&` operator and invoked method name includes "and" in the conditional branch - does not register an offense when using only `&&`s - registers an offense when using `||` and `or` - does not register an offense when not used in unless - -RuboCop::Cop::Layout::LineLength - highlights excessive characters - registers an offense for long line before __END__ but not after - accepts a line that's 80 characters wide - registers an offense for a line that's 81 characters wide - accepts the first line if it is a shebang line - when AllowHeredoc option is enabled - accepts long lines in heredocs - when the source has no AST - does not crash - and only certain heredoc delimiters are permitted - rejects long lines in heredocs with not permitted delimiters - autocorrection - semicolon - semicolon inside string literal - adds offense and autocorrects elsewhere - when over limit - adds offense and autocorrects it by breaking the semicolonbefore the hash - when under limit - does not add any offenses - semicolons inside string literal - adds offense and autocorrects elsewhere - when over limit and many semicolons - adds offense and autocorrects it by breaking the semicolonbefore the hash - when over limit and semicolon at end of line - adds offense and autocorrects it by breaking the first semicolonbefore the hash - when over limit and many spaces around semicolon - adds offense and autocorrects it by breaking the semicolonbefore the hash - when over limit and one semicolon at the end - adds offense and does not autocorrectbefore the hash - when over limit and many semicolons at the end - adds offense and does not autocorrectbefore the hash - method definition - when under limit - does not add any offenses - when over limit - adds an offense and autocorrects it - method call - when under limit - does not add any offenses - with long argument list - registers an offense and autocorrects it - when two method calls - adds an offense only to outer and autocorrects it - when unparenthesized - when there are multiple arguments - splits the line after the first element - when there is one argument - does not autocorrect - with a heredoc argument - does not break up the line when parentheses are omitted - does not break up the line - does not break up the line when a heredoc is used as the first element of an array - and the heredoc is after the line should split - can break up the line before the heredoc argument - and other arguments before the heredoc - can break up the line before the heredoc argument - with a hash with a too long first item - when the hash is parenthesized - corrects - when not parenthesized - when there is only one element - does not autocorrect - when on multiple lines - does not correct - when there are multiple elements - moves the 2nd element to a new line - when parenthesized - corrects - when nested method calls allows outer to get broken up first - adds offense and does not autocorrect - when call with hash on same line - adds an offense only to outer and autocorrects it - when over limit - adds an offense and autocorrects it - when two together - does not add any offenses - long blocks - no spaces - adds an offense and does correct it - braces - adds an offense and does correct it - do/end - adds an offense for block with arguments and does correct it - adds an offense for block without arguments and does correct it - let block - adds an offense and does correct it - Ruby 2.7 - adds an offense for {} block does correct it - adds an offense for do-end block and does correct it - lambda syntax - when argument is not enclosed in parentheses - registers an offense and corrects - when argument is enclosed in parentheses - registers an offense and corrects - multiple assignment - when over limit at right hand side - registers and corrects an offense - comments - when over limit with semicolon - adds offense and does not autocorrect - array - when over limit - adds an offense and autocorrects it - when has inside array - adds an offense only to outer and autocorrects it - when under limit - does not add any offenses - when two arrays on two lines allows outer to get broken first - adds an offense only to inner and does not autocorrect it - when already on two lines - does not add any offenses - hash - when over limit rocket - adds an offense and autocorrects it - when under limit - does not add any offenses - when over limit because of a comment - adds an offense and does not autocorrect - when nested hashes on same line - adds an offense only to outer and autocorrects it - when over limit and already on multiple lines long key - adds an offense and does not autocorrect - when over limit rocket symbol - adds an offense and autocorrects it - when over limit - adds an offense and autocorrects it - when hash in method call - adds an offense only to outer and autocorrects it - when over limit and keys already on multiple lines - adds an offense and does not autocorrect - no breakable collections - adds an offense and does not autocorrect it - HEREDOC - when over limit with semicolon - adds offense and does not autocorrect - when AllowURI option is enabled - and the excessive characters include part of a URL in double quotes - does not include the quote as part of the offense - and the excessive characters include part of a URL in braces and another word - registers an offense for the line - and the URI is assigned - does not register an offense - and an error other than URI::InvalidURIError is raised while validating a URI-ish string - does not crash - and the excessive characters include a complete URL - registers an offense for the line - and the excessive characters include part of a URL and trailing whitespace - registers an offense for the line - and the URL does not have a http(s) scheme - rejects the line - and the scheme has been configured - does not register an offense - and all the excessive characters are part of a URL - accepts the line - and the URL is wrapped in braces - accepts the line - and the URL is wrapped in single quotes - accepts the line - and the URL is wrapped in braces with title - accepts the line - and the URL is wrapped in double quotes - accepts the line - and the URL fits within the max allowed characters - registers an offense for the line - and the URI is an argument - does not register an offense - and the excessive characters include part of a URL and another word - registers an offense for the line - when AllowedPatterns option is set - only registers an offense for lines not matching the pattern - when IgnoreCopDirectives is enabled - and the Rubocop directive is excessively long - accepts the line - and the Rubocop directive causes an excessive line length - accepts the line - and has explanatory text - does not register an offense - and the source is too long - highlights only the non-directive part - and the source contains non-directive # as comment - highlights only the non-directive part - and the source contains non-directive #s as non-comment - registers an offense for the line - when line is indented with tabs - accepts a short line - registers an offense for a long line - affecting by IndentationWidth from Layout\Tab - with AllowURI option - accepts a line that's including URI and exceeds by 1 char - accepts a line that's including URI with text - accepts a line that's including URI - accepts a line that's including URI in quotes with text - behaves like with tabs indentation - accepts a line that's including 1 tab with size 2 and 28 other characters - registers an offense for a line that's including 2 tab with size 2 and 28 other characters - without AllowURI option - behaves like with tabs indentation - accepts a line that's including 1 tab with size 2 and 28 other characters - registers an offense for a line that's including 2 tab with size 2 and 28 other characters - when IgnoreCopDirectives is disabled - and the source is too long and has a trailing cop directive - highlights the excess source and cop directive - and the source is acceptable length - with an inline comment - highlights the excess comment - with a trailing RuboCop directive - registers an offense for the line - when AllowURI option is disabled - and all the excessive characters are part of a URL - registers an offense for the line + when target ruby version is 2.2 or lower + does not register an offense + in block + ignored method + with a regex + allows checking if a number is positive + allows checking if a number is negative + with a string + allows checking if a number is positive + allows checking if a number is negative + not ignored method + registers an offense for checking if a number is positive + registers an offense for checking if a number is negative -RuboCop::Cop::InternalAffairs::RedundantDescribedClassAsSubject - registers an offense when using `subject(:cop)` with no argument `described_class.new` and `:config` is specified - does not register an offense when using `subject(:cop)` with multiple arguments to `described_class.new` - registers an offense when using `subject(:cop)` and `:config` is already specified in `describe` - registers an offense when using `subject(:cop)` and `:config` is not specified in `describe` +RuboCop::Cop::Style::OpenStructUse + when not using OpenStruct + registers no offense + when using OpenStruct + for OpenStruct + when inheriting from it via < + registers an offense + when inheriting from it via Class.new + registers an offense + when used in assignments + registers an offense + for ::OpenStruct + when inheriting from it via < + registers an offense + when used in assignments + registers an offense + when inheriting from it via Class.new + registers an offense + when using custom namespaced OpenStruct + when used in assignments + registers no offense + when defined in custom namespace + when class + is expected to eq "module SomeNamespace\n class OpenStruct\n end\nend\n" + when module + is expected to eq "module SomeNamespace\n module OpenStruct\n end\nend\n" + when inheriting from it + is expected to eq "class A < SomeNamespace::OpenStruct; end" -RuboCop::Cop::Naming::BlockForwarding - when `EnforcedStyle: anonymous - Ruby >= 3.1 - registers and corrects an only explicit block forwarding when using multiple proc arguments - registers and corrects an offense when using explicit block forwarding without method body - does not register an offense when using anonymous block forwarding without method body - registers and corrects an offense when using `yield` in method body - does not register an offense when using anonymous block forwarding - does not register an offense when defining kwarg with block args method - does not register an offense when defining without block argument method - does not register an offense when assigning the block arg - registers and corrects an offense when using explicit block forwarding without method definition parentheses - does not register an offense when defining kwoptarg with block args method - registers and corrects an offense when using explicit block forwarding - registers and corrects an offense when using symbol proc argument in method body - registers and corrects an offense when using explicit block forwarding in singleton method - does not register an offense when using block argument as a variable - does not register an offense when defining no arguments method - Ruby < 3.0 - does not register an offense when not using anonymous block forwarding - when `EnforcedStyle: explicit - Ruby >= 3.1 - does not register an offense when using explicit block forwarding without method body - registers and corrects an offense when using anonymous block forwarding in singleton method - does not register an offense when defining without block argument method - does not register an offense when using explicit block forwarding - registers and corrects and corrects an offense when using anonymous block forwarding without method body - registers and corrects an offense when using anonymous block forwarding - registers and corrects an offense when using symbol proc argument in method body - registers and corrects an offense when using `yield` in method body - does not register an offense when assigning the block arg - when `BlockForwardingName: block` is already in use - registers and no corrects an offense when using anonymous block forwarding - when `BlockForwardingName: proc - registers and corrects an offense when using anonymous block forwarding +RuboCop::Cop::Layout::TrailingEmptyLines + when EnforcedStyle is final_newline + registers an offense for no final newline after block comment + accepts final blank lines if they come after __END__ + registers an offense for multiple trailing blank lines + accepts final blank lines if they come after __END__ in empty file + accepts an empty file + autocorrects even if some lines have space + accepts final newline + registers an offense for multiple blank lines in an empty file + registers an offense for no final newline after assignment + when EnforcedStyle is final_blank_line + accepts final blank line + registers an offense for final newline + autocorrects missing newline + autocorrects missing blank line + registers an offense for multiple trailing blank lines + registers an offense for multiple blank lines in an empty file + registers an offense for no final newline RuboCop::Cop::Style::TernaryParentheses configured for parentheses on complex and there are parens accepts condition including a range - with method call condition - registers an offense when calling method with a parameter - registers an offense when calling method on a receiver - registers an offense for defined check - without accessor in method call parameters - registers an offense for array include? with parens - registers an offense for array include? without parens - with accessor in method call parameters - registers an offense for array include? with multiple parameters without parens - registers an offense for array include? without parens - registers an offense for array include? with multiple parameters with parens with an assignment condition accepts equality check - accepts accepts safe multiple assignment accepts safe assignment as part of multiple assignment accepts safe assignment + accepts accepts safe multiple assignment behaves like safe assignment disabled - registers an offense for parens around inner assignment registers an offense for parens around assignment + registers an offense for parens around inner assignment registers an offense for parens around outer assignment - with a simple condition - registers an offense for save navigation - registers an offense with preceding boolean keyword expression - registers an offense for query method in condition - registers an offense for yield in condition - registers an offense for accessor in condition with a complex condition - registers an offense for defined with class method in condition accepts boolean expression using keywords + registers an offense for defined with variable in condition registers an offense when calling method on a receiver - registers an offense for defined with method chain in condition registers an offense for defined with nested constant in condition - registers an offense for defined with variable in condition + registers an offense for defined with class method in condition accepts boolean expression - when configured to enforce parentheses inclusion + registers an offense for defined with method chain in condition + with method call condition + registers an offense for defined check + registers an offense when calling method on a receiver + registers an offense when calling method with a parameter + without accessor in method call parameters + registers an offense for array include? without parens + registers an offense for array include? with parens + with accessor in method call parameters + registers an offense for array include? without parens + registers an offense for array include? with multiple parameters without parens + registers an offense for array include? with multiple parameters with parens with a simple condition + registers an offense with preceding boolean keyword expression registers an offense for query method in condition + registers an offense for save navigation registers an offense for accessor in condition registers an offense for yield in condition + configured for parentheses on complex and there are no parens + with complex condition + registers an offense for compound boolean expression + registers an offense for boolean expression + registers an offense for comparison with multiplication + registers an offense for addition expression + registers an offense comparison with exponentiation + registers an offense for arithmetic and equality check + registers an offense for boolean expression with inner parens + registers an offense for comparison + registers an offense for comparison with method call on receiver + registers an offense for subtraction expression with an assignment condition - registers an offense for triple assignment - registers an offense for double assignment with equality check in condition - registers an offense for double assignment - accepts safe assignment in condition - with a complex condition - registers an offense for boolean expression using keyword + accepts safe assignment registers an offense for equality check - registers an offense for negated condition - registers an offense for defined? with nested constant in condition - registers an offense when calling method on a receiver - registers an offense for defined? with variable in condition - registers an offense for boolean expression - registers an offense for defined? with class method in condition - registers an offense for boolean expression containing parens - registers an offense for arithmetic condition - registers an offense for defined? with method chain in condition when configured to enforce parentheses omission accepts condition including a range + with an unparenthesized method call condition + registers an offense for defined check + registers an offense when calling method with a parameter + when calling method on a receiver + registers an offense + when calling method with multiple arguments + registers an offense + when calling method on a literal receiver + registers an offense + when calling method on a constant receiver + registers an offense with one line pattern matching does not register an offense + with a simple condition + registers an offense for multi-line boolean expression + accepts multi-line boolean expression starting on following line + registers an offense for yield in condition + registers an offense for query method in condition + registers an offense for accessor in condition + with no space between the parentheses and question mark + registers an offense with a complex condition - registers an offense for defined with class method in condition - registers an offense for defined with nested constant in condition - registers an offense for defined with variable in condition - accepts parens around inner boolean expression registers an offense for boolean expression using keyword - registers an offense for defined with method chain in condition - registers an offense for boolean expression registers an offense for arithmetic expression - registers an offense for query method on object registers an offense for equality check + registers an offense for defined with method chain in condition + registers an offense for query method on object + registers an offense for defined with variable in condition + accepts parens around inner boolean expression + registers an offense for defined with class method in condition + registers an offense for defined with nested constant in condition + registers an offense for boolean expression registers an offense for negated condition - with no space between the parentheses and question mark - registers an offense + with one line pattern matching + does not register an offense with an assignment condition + accepts double safe assignment registers an offense for equality check - accepts safe assignment accepts safe assignment as part of multiple assignment - accepts double safe assignment + accepts safe assignment behaves like safe assignment disabled registers an offense for parens around inner assignment - registers an offense for parens around outer assignment registers an offense for parens around assignment - with one line pattern matching - does not register an offense + registers an offense for parens around outer assignment + when configured to enforce parentheses inclusion + with a complex condition + registers an offense for boolean expression containing parens + registers an offense for arithmetic condition + registers an offense for defined? with variable in condition + registers an offense for boolean expression + registers an offense for boolean expression using keyword + registers an offense for defined? with nested constant in condition + registers an offense for defined? with method chain in condition + registers an offense for defined? with class method in condition + registers an offense for equality check + registers an offense for negated condition + registers an offense when calling method on a receiver + with an assignment condition + registers an offense for double assignment + registers an offense for triple assignment + accepts safe assignment in condition + registers an offense for double assignment with equality check in condition with a simple condition - registers an offense for accessor in condition - registers an offense for multi-line boolean expression registers an offense for yield in condition registers an offense for query method in condition - accepts multi-line boolean expression starting on following line - with an unparenthesized method call condition - registers an offense for defined check - registers an offense when calling method with a parameter - when calling method on a literal receiver - registers an offense - when calling method on a receiver - registers an offense - when calling method on a constant receiver - registers an offense - when calling method with multiple arguments - registers an offense - configured for parentheses on complex and there are no parens - with complex condition - registers an offense for boolean expression with inner parens - registers an offense for addition expression - registers an offense for compound boolean expression - registers an offense for subtraction expression - registers an offense for comparison with multiplication - registers an offense for boolean expression - registers an offense for comparison - registers an offense for arithmetic and equality check - registers an offense comparison with exponentiation - registers an offense for comparison with method call on receiver - with an assignment condition - accepts safe assignment - registers an offense for equality check + registers an offense for accessor in condition -RuboCop::Cop::Style::NumberedParametersLimit - with Ruby >= 2.7 - does not register an offense for a normal block with too many parameters - does not register an offense for a numblock with fewer than `Max` parameters - sets Max properly for auto-gen-config - does not register an offense for a numblock with exactly `Max` parameters - when configuring Max - does not register an offense when there are not too many numbered params - when Max is 1 - uses the right offense message - when there are more than `Max` numbered parameters - registers an offense for a single line `numblock` - registers an offense for a multiline `numblock` +RuboCop::Cop::Style::InPatternThen + >= Ruby 2.7 + registers an offense for `in b;` + accepts `;` separating statements in the body of `in` + registers an offense for `in b, c, d;` (array pattern) + registers an offense for `in b, c | d;` + registers an offense for `in b | c | d;` (alternative pattern) + when inspecting a case statement with an empty branch + does not register an offense + +RuboCop::Cop::Lint::IneffectiveAccessModifier + when there is an intervening instance method + still registers an offense + when a `class << self` block is used + doesn't register an offense + when `private` is applied to a class method + registers an offense + when no access modifier is used + doesn't register an offense + when `private_class_method` is used + when `private_class_method` does not contain the method + registers an offense + when `private_class_method` contains all private method names + doesn't register an offense + when `protected` is applied to a class method + registers an offense + when there is `begin` before a method definition + does not register an offense RuboCop::Cop::Layout::EndAlignment - accepts matching unless ... end - registers an offense for mismatched puts 1; while test end and autocorrects - accepts matching puts 1; module ... end - registers an offense for mismatched puts 1; case a when b end and autocorrects - accepts matching class ... end - accepts matching class ... end - registers an offense for mismatched unless test end and autocorrects - accepts matching puts 1; if ... end - registers an offense for mismatched puts 1; unless test end and autocorrects + registers an offense for mismatched module Test end and autocorrects + accepts matching until ... end can handle ternary if - accepts matching module ... end - accepts matching if ... end - accepts matching puts 1; while ... end - accepts matching puts 1; case ... end - registers an offense for mismatched while test end and autocorrects + accepts matching puts 1; unless ... end registers an offense for mismatched module Test end and autocorrects - can handle modifier if registers an offense for mismatched puts 1; until test end and autocorrects - accepts matching until ... end - accepts matching while ... end - registers an offense for mismatched case a when b end and autocorrects registers an offense for mismatched if test end and autocorrects - registers an offense for mismatched until test end and autocorrects - accepts matching case ... end - registers an offense for mismatched puts 1; if test end and autocorrects - accepts matching puts 1; until ... end accepts matching puts 1; class ... end registers an offense for mismatched puts 1; class Test end and autocorrects - accepts matching puts 1; unless ... end + accepts matching case ... end + accepts matching module ... end registers an offense for mismatched puts 1; class Test end and autocorrects - registers an offense for mismatched module Test end and autocorrects - case as argument - when EnforcedStyleAlignWith is start_of_line - registers an offense for mismatched test case a when b end and autocorrects - accepts matching test case a when b ... end - when EnforcedStyleAlignWith is keyword - registers an offense for mismatched test case a when b end and autocorrects - accepts matching test case ... end - when EnforcedStyleAlignWith is variable - registers an offense for mismatched test case a when b end and autocorrects - accepts matching test case ... end - when end is preceded by something else than whitespace - does not register an offense - when EnforcedStyleAlignWith is variable - registers an offense for mismatched class Test end and autocorrects - registers an offense for mismatched puts 1; case a when b end and autocorrects - accepts matching unless ... end - registers an offense for mismatched puts 1; if test end and autocorrects - accepts matching puts 1; if ... end - accepts matching while ... end - register an offense when using `+` operator method and `end` is not aligned - accepts matching class ... end - registers an offense for mismatched if test end and autocorrects - register an offense when using `-` operator method and `end` is not aligned - accepts matching puts 1; module ... end - register an offense when using a conditional statement in a method argument and `end` is not aligned - registers an offense for mismatched puts 1; until test end and autocorrects - accepts matching puts 1; while ... end - accepts matching puts 1; class ... end - accepts matching case ... end - accepts matching puts 1; unless ... end - registers an offense for mismatched puts 1; module Test end and autocorrects - registers an offense for mismatched module Test end and autocorrects - registers an offense for mismatched unless test end and autocorrects - accepts matching if ... end - registers an offense for mismatched case a when b end and autocorrects - accepts matching until ... end - registers an offense for mismatched puts 1; unless test end and autocorrects - registers an offense for mismatched puts 1; class Test end and autocorrects - registers an offense for mismatched while test end and autocorrects - registers an offense for mismatched puts 1; while test end and autocorrects - accepts matching puts 1; until ... end - registers an offense for mismatched until test end and autocorrects - accepts matching puts 1; case ... end - accepts matching module ... end + accepts matching puts 1; case ... end + accepts matching class ... end + accepts matching puts 1; module ... end + accepts matching puts 1; until ... end + registers an offense for mismatched until test end and autocorrects + registers an offense for mismatched puts 1; if test end and autocorrects + registers an offense for mismatched puts 1; case a when b end and autocorrects + registers an offense for mismatched while test end and autocorrects + accepts matching puts 1; while ... end + accepts matching class ... end + registers an offense for mismatched puts 1; unless test end and autocorrects + accepts matching if ... end + registers an offense for mismatched unless test end and autocorrects + accepts matching puts 1; if ... end + can handle modifier if + registers an offense for mismatched case a when b end and autocorrects + registers an offense for mismatched puts 1; while test end and autocorrects + accepts matching while ... end + accepts matching unless ... end regarding assignment - when EnforcedStyleAlignWith is variable - accepts matching CNST = if ... end - registers an offense for mismatched var << if test end and autocorrects - registers an offense for mismatched var[x] = while test end and autocorrects + when EnforcedStyleAlignWith is keyword + accepts matching var = if ... end + registers an offense for mismatched var = if test end and autocorrects + registers an offense for mismatched var = until test end and autocorrects + accepts matching var[0] = case ... end accepts matching var = unless ... end - registers an offense for mismatched var = if test end and autocorrects - registers an offense for mismatched h[k] = if test end and autocorrects - accepts matching $var = if ... end - registers an offense for mismatched var << case a when b end and autocorrects accepts matching var = until ... end - registers an offense for mismatched var = until test do_something end and autocorrects - registers an offense for mismatched @var = if test end and autocorrects - registers an offense for mismatched @@var = if test end and autocorrects - accepts matching var ||= if ... end - accepts matching @var = if ... end - registers an offense for mismatched var = until test end and autocorrects - accepts matching var = if ... end registers an offense for mismatched var = while test end and autocorrects - registers an offense for mismatched var += if test end and autocorrects - registers an offense for mismatched var = case a when b end and autocorrects - accepts matching var = if ... end + registers an offense for mismatched var << until test end and autocorrects registers an offense for mismatched var = unless test end and autocorrects accepts matching var = while ... end - registers an offense for mismatched var = unless test end and autocorrects - accepts matching var = until ... end + accepts matching var = case ... end + when EnforcedStyleAlignWith is variable + registers an offense for mismatched $var = if test end and autocorrects + registers an offense for mismatched a, b = if test end and autocorrects + accepts matching var ||= if ... end + registers an offense for mismatched var = unless test end and autocorrects registers an offense for mismatched var << until test end and autocorrects - accepts matching h[k] = if ... end + registers an offense for mismatched var = if test end and autocorrects + registers an offense for mismatched var[x] = while test end and autocorrects + registers an offense for mismatched $var << if test end and autocorrects + accepts matching a, b = if ... end + registers an offense for mismatched @@var = if test end and autocorrects + accepts matching var = if ... end accepts matching var = until ... end - accepts matching var &&= if ... end - accepts matching @@var = if ... end - registers an offense for mismatched CNST << if test end and autocorrects - accepts matching var << if ... end + registers an offense for mismatched @@var << if test end and autocorrects + registers an offense for mismatched var = case a when b end and autocorrects accepts matching var += if ... end - registers an offense for mismatched a, b = if test end and autocorrects - registers an offense for mismatched h[k] << if test end and autocorrects + registers an offense for mismatched var << unless test end and autocorrects + registers an offense for mismatched @var = if test end and autocorrects + registers an offense for mismatched var << if test end and autocorrects + registers an offense for mismatched var = unless test end and autocorrects + registers an offense for mismatched var = if test end and autocorrects registers an offense for mismatched var &&= if test end and autocorrects + accepts matching var = until ... end + registers an offense for mismatched h[k] << if test end and autocorrects + accepts matching var = if ... end + registers an offense for mismatched CNST << if test end and autocorrects + accepts matching var << if ... end + accepts matching var &&= if ... end + accepts matching h[k] = if ... end + registers an offense for mismatched @var << if test end and autocorrects + registers an offense for mismatched var << case a when b end and autocorrects registers an offense for mismatched var = # comment while test end and autocorrects - registers an offense for mismatched var = if test end and autocorrects - registers an offense for mismatched $var = if test end and autocorrects - registers an offense for mismatched h.k = if test end and autocorrects - registers an offense for mismatched var ||= if test end and autocorrects accepts matching h.k = if ... end - registers an offense for mismatched $var << if test end and autocorrects - registers an offense for mismatched var << unless test end and autocorrects - accepts matching a, b = if ... end - registers an offense for mismatched @@var << if test end and autocorrects accepts matching var = case ... end - registers an offense for mismatched var = until test end.j and autocorrects - registers an offense for mismatched @var << if test end and autocorrects + accepts matching var = unless ... end registers an offense for mismatched CNST = if test end and autocorrects - when EnforcedStyleAlignWith is keyword - registers an offense for mismatched var = while test end and autocorrects - registers an offense for mismatched var << until test end and autocorrects - registers an offense for mismatched var = until test end and autocorrects + registers an offense for mismatched var = until test end.j and autocorrects + registers an offense for mismatched var ||= if test end and autocorrects + accepts matching $var = if ... end + accepts matching @@var = if ... end + registers an offense for mismatched var = until test do_something end and autocorrects + accepts matching CNST = if ... end accepts matching var = while ... end - accepts matching var = case ... end - accepts matching var = unless ... end - accepts matching var[0] = case ... end - accepts matching var = if ... end - registers an offense for mismatched var = if test end and autocorrects - registers an offense for mismatched var = unless test end and autocorrects + registers an offense for mismatched var = until test end and autocorrects + registers an offense for mismatched var += if test end and autocorrects + accepts matching @var = if ... end + registers an offense for mismatched var = while test end and autocorrects + registers an offense for mismatched h[k] = if test end and autocorrects accepts matching var = until ... end + registers an offense for mismatched h.k = if test end and autocorrects correct + opposite registers an offense and corrects when EnforcedStyleAlignWith is start_of_line + accepts matching var = until ... end + accepts matching var = while ... end + registers an offense for mismatched puts 1; if test end and autocorrects + registers an offense for mismatched puts 1; unless test end and autocorrects + registers an offense for mismatched case a when b end and autocorrects + registers an offense for mismatched var = until test end and autocorrects + registers an offense for mismatched var = if test end and autocorrects + registers an offense for mismatched puts 1; while test end and autocorrects + registers an offense for mismatched if test end and autocorrects + registers an offense for mismatched class Test end and autocorrects + registers an offense for mismatched module Test end and autocorrects accepts matching puts 1; case ... end - registers an offense for mismatched puts 1; module Test end and autocorrects + accepts matching puts 1; until ... end + registers an offense for mismatched puts 1; class Test end and autocorrects + registers an offense for mismatched var = case a when b end and autocorrects + registers an offense for mismatched var << case a when b end and autocorrects + registers an offense for mismatched puts 1; until test end and autocorrects + accepts matching puts 1; unless ... end + accepts matching puts 1; while ... end + registers an offense for mismatched var = while test end and autocorrects accepts matching puts 1; module ... end - registers an offense for mismatched var << if test end and autocorrects + registers an offense for mismatched puts(if test end) and autocorrects + registers an offense for mismatched var = unless test end and autocorrects + accepts matching puts 1; class ... end registers an offense for mismatched puts 1; case a when b end and autocorrects - registers an offense for mismatched var = if test end and autocorrects + registers an offense for mismatched var << unless test end and autocorrects + registers an offense for mismatched until test end and autocorrects registers an offense for mismatched var << until test end and autocorrects - registers an offense for mismatched var << case a when b end and autocorrects + accepts matching puts 1; if ... end + registers an offense for mismatched var << while test end and autocorrects + accepts matching var = if ... end + registers an offense for mismatched puts 1; module Test end and autocorrects + registers an offense for mismatched var = if test end and autocorrects accepts matching var << while ... end + registers an offense for mismatched unless test end and autocorrects + accepts matching var = unless ... end accepts matching var = if ... end - accepts matching var = if ... end - registers an offense for mismatched until test end and autocorrects - registers an offense for mismatched var = unless test end and autocorrects - registers an offense for mismatched puts 1; until test end and autocorrects + registers an offense for mismatched var << if test end and autocorrects accepts matching var = case ... end - registers an offense for mismatched if test end and autocorrects - registers an offense for mismatched puts 1; unless test end and autocorrects - registers an offense for mismatched puts 1; while test end and autocorrects registers an offense for mismatched while test end and autocorrects - registers an offense for mismatched class Test end and autocorrects - registers an offense for mismatched var = while test end and autocorrects + when end is preceded by something else than whitespace + does not register an offense + case as argument + when EnforcedStyleAlignWith is keyword + accepts matching test case ... end + registers an offense for mismatched test case a when b end and autocorrects + when EnforcedStyleAlignWith is variable + accepts matching test case ... end + registers an offense for mismatched test case a when b end and autocorrects + when EnforcedStyleAlignWith is start_of_line + accepts matching test case a when b ... end + registers an offense for mismatched test case a when b end and autocorrects + when EnforcedStyleAlignWith is variable + accepts matching puts 1; until ... end + register an offense when using `+` operator method and `end` is not aligned + registers an offense for mismatched puts 1; until test end and autocorrects + registers an offense for mismatched module Test end and autocorrects + accepts matching module ... end + register an offense when using `-` operator method and `end` is not aligned + accepts matching class ... end + accepts matching puts 1; class ... end + registers an offense for mismatched while test end and autocorrects + registers an offense for mismatched puts 1; case a when b end and autocorrects + registers an offense for mismatched unless test end and autocorrects + accepts matching puts 1; while ... end accepts matching puts 1; if ... end + registers an offense for mismatched if test end and autocorrects + registers an offense for mismatched puts 1; module Test end and autocorrects + registers an offense for mismatched class Test end and autocorrects + registers an offense for mismatched puts 1; while test end and autocorrects registers an offense for mismatched case a when b end and autocorrects - registers an offense for mismatched module Test end and autocorrects - accepts matching var = while ... end - registers an offense for mismatched var = case a when b end and autocorrects - accepts matching puts 1; until ... end - registers an offense for mismatched puts(if test end) and autocorrects + accepts matching while ... end + registers an offense for mismatched puts 1; unless test end and autocorrects + accepts matching unless ... end registers an offense for mismatched puts 1; class Test end and autocorrects + accepts matching puts 1; case ... end + register an offense when using a conditional statement in a method argument and `end` is not aligned registers an offense for mismatched puts 1; if test end and autocorrects - registers an offense for mismatched var = until test end and autocorrects - accepts matching puts 1; class ... end - registers an offense for mismatched var << while test end and autocorrects + registers an offense for mismatched until test end and autocorrects + accepts matching puts 1; module ... end + accepts matching until ... end + accepts matching if ... end + accepts matching case ... end accepts matching puts 1; unless ... end - registers an offense for mismatched var = if test end and autocorrects - accepts matching var = unless ... end - registers an offense for mismatched unless test end and autocorrects - accepts matching var = until ... end - registers an offense for mismatched var << unless test end and autocorrects - accepts matching puts 1; while ... end - -RuboCop::Cop::Layout::ElseAlignment - accepts a ternary if - with def/defs - accepts an empty def body - accepts an empty defs body - when modifier and def are on the same line - accepts a correctly aligned body - registers an offense for else not aligned with private - with unless - registers an offense for misaligned else - accepts a correctly aligned else in an otherwise empty unless - accepts an empty unless - with begin/rescue/else/ensure/end - registers an offense for misaligned else - accepts a correctly aligned else - with def/rescue/else/ensure/end - registers an offense for misaligned else - accepts a correctly aligned else - with def/rescue/else/end - accepts a correctly aligned else - registers an offense for misaligned else - ensure/rescue/else in Block Argument - accepts a correctly aligned else - registers an offense for misaligned else - accepts a correctly aligned else with assignment - with case - accepts else aligned with when but not with case - accepts case without else - accepts correctly aligned case/when/else - registers an offense for misaligned else - >= Ruby 2.7 - with case match - accepts correctly aligned empty else - accepts case match without else - registers an offense for misaligned else - accepts correctly aligned case/when/else - with if statement - accepts indentation after else when if is on new line after assignment - accepts a one line if statement - accepts an if/else branches with rescue clauses - accepts a correctly aligned if/elsif/else/end - registers an offense for misaligned elsif - registers an offense for misaligned else - with assignment - when alignment style is variable - and end is aligned with keyword - registers an offense for an if - registers an offense for an if with element assignment - registers offenses for an if with setter - and end is aligned with variable - accepts an if-elsif-else with end aligned with setter - accepts an if with end aligned with element assignment - accepts an if/else - accepts an if/else with chaining with a block after the end - accepts an if-else with end aligned with setter - accepts an if/else with chaining after the end - when alignment style is keyword by choice - and end is aligned with keyword - accepts an if in assignment - accepts a while in assignment - accepts an until in assignment - accepts an if/else in assignment - accepts an if/else in assignment on next line - and end is aligned with variable - registers an offense for an if - for a file with byte order mark - accepts a correctly aligned if/elsif/else/end -RuboCop::Cop::Metrics::AbcSize - when Max is 10.3 - reports size and max as <10, 10, 40> 42.43/10.3 - when Max is 2.3 - accepts a total score of 2.24 - when Max is 2 - accepts two assignments - when Max is 100.321 - reports size and max as <100, 100, 400> 424.3/100.3 - when Max is 1000.3 - reports size and max as <1000, 1000, 4000> 4243/1000 - when Max is 1.3 - reports size and max as <1, 1, 4> 4.24/1.3 - when Max is 0 - accepts an empty method - treats safe navigation method calls like regular method calls + a condition - registers an offense for an if modifier - registers an offense for an assignment of a local variable - registers an offense for an assignment of an element - registers an offense for complex content including A, B, and C scores - registers an offense for a `define_method` - accepts an empty `define_method` - when CountRepeatedAttributes is `false` - does not count repeated attributes - Ruby 2.7 - registers an offense for a `define_method` with numblock - when method is in list of allowed methods - when AllowedPatterns is enabled - does not register an offense when defining a class method - does not register an offense when defining an instance method - does not register an offense when using `define_method` - when AllowedMethods is enabled - does not register an offense when defining an instance method - does not register an offense when using `define_method` - does not register an offense when defining a class method - when CountRepeatedAttributes is `true` - counts repeated attributes +RuboCop::Cop::Style::ArrayJoin + does not register an offense for ambiguous cases + does not register an offense for numbers + autocorrects '*' to 'join' when setting to a variable + autocorrects '*' to 'join' when there are no spaces + registers an offense for an array followed by string -RuboCop::Cop::Lint::SendWithMixinArgument - registers an offense when using `__send__` method - registers an offense when using `send` with `extend` - does not register an offense when using `extend` - registers an offense when using `public_send` method - does not register an offense when using `prepend` - does not register an offense when using `include` - registers an offense when using `send` with `prepend` - does not register an offense when not using a mixin method - registers an offense when using `send` with `include` - when specifying a mixin method as a string - registers an offense when using `send` with `prepend` - registers an offense when using `send` with `extend` - registers an offense when using `send` with `include` - when using namespace for module - registers an offense when using `send` with `include` +RuboCop::Cop::Lint::Loop + registers an offense and corrects for begin/end/while + accepts loop/break if + registers an offense for begin/end/until + accepts loop/break unless -RuboCop::Cop::Utils::FormatString - finds the correct number of fields - #named_interpolation? - behaves like named format sequence - does not detect escaped named format sequence - detects named format sequence - behaves like named format sequence - does not detect escaped named format sequence - detects named format sequence - behaves like named format sequence - does not detect escaped named format sequence - detects named format sequence - behaves like named format sequence - detects named format sequence - does not detect escaped named format sequence - #valid? - returns true when there are only named with escaped `%` formats - returns true when there are only named formats - returns false when there are numbered and named formats - returns true when there are only unnumbered formats - returns true when there are only numbered formats - returns false when there are unnumbered and numbered formats - returns false when there are unnumbered and named formats +RuboCop::Cop::Style::RedundantArgument + does not register an offense when method called with no receiver + does not register an offense when method called with more than one arguments + registers an offense and corrects when method called on literals + does not register an offense when method called with different argument + works with double-quoted strings when configuration is single-quotes + registers an offense and corrects when method called on variable + registers an offense and corrects when method called without parenthesis on variable + does not register an offense when method called with no arguments + registers an offense and corrects when method called without parenthesis on literals + non-builtin method + registers an offense and corrects with configured argument + does not register an offense with other argument -RuboCop::Cop::Style::NegatedIfElseCondition - works with duplicate nodes - works with comments and multiple statements - does not register an offense when negating condition for `if-elsif` - works with comments when one branch is a begin and the other is not - correctly moves comments at the end of branches - registers an offense and corrects nested `if-else` with negated condition - registers an offense and corrects when negating condition with `not` for `if-else` - registers an offense when using negated condition and `if` branch body is empty - registers an offense and corrects when negating condition with `!` for `if-else` - registers an offense and corrects when negating condition with `not` for ternary - does not register an offense when both branches are empty - works with comments when neither branch is a begin node - moves comments to correct branches during autocorrect - does not register an offense when `if` with `!!` condition - does not register an offense when `if` with negated condition has no `else` branch - does not register an offense when only part of the condition is negated - does not register an offense when the `else` branch is empty - registers an offense and corrects a multiline ternary - behaves like negation method - registers an offense and corrects when negating condition with `!=` in parentheses for ternary - registers an offense and corrects when negating condition with `!=` for `if-else` - registers an offense and corrects when negating condition with `!=` in begin-end for `if-else` - registers an offense and corrects when negating condition with `!=` for ternary - registers an offense and corrects when negating condition with `!=` in parentheses for `if-else` - registers an offense and corrects when negating condition with `!=` in begin-end for ternary - behaves like negation method - registers an offense and corrects when negating condition with `!~` for `if-else` - registers an offense and corrects when negating condition with `!~` in parentheses for `if-else` - registers an offense and corrects when negating condition with `!~` in begin-end for ternary - registers an offense and corrects when negating condition with `!~` in begin-end for `if-else` - registers an offense and corrects when negating condition with `!~` for ternary - registers an offense and corrects when negating condition with `!~` in parentheses for ternary +RuboCop::Cop::Style::ReturnNil + when enforced style is `return_nil` + does not register an offense for returning others + registers an offense for return + when enforced style is `return` + does not register an offense for returning others + does not register an offense for return nil from iterators + registers an offense for return nil -RuboCop::Cop::Layout::SpaceBeforeBlockBraces - when EnforcedStyle is space - registers an offense and corrects opposite + correct style - registers an offense and corrects multiline block where the left brace has no outer space - registers an offense and corrects left brace without outer space - accepts braces surrounded by spaces - Ruby 2.7 - registers an offense and corrects opposite + correct style - registers an offense and corrects multiline block where the left brace has no outer space - with space before empty braces allowed - accepts empty braces with outer space - registers an offense and corrects empty braces - with invalid value for EnforcedStyleForEmptyBraces - fails with an error - with space before empty braces not allowed - registers an offense and corrects empty braces - accepts empty braces without outer space - when EnforcedStyle is no_space - registers an offense and corrects correct + opposite style - accepts left brace without outer space - registers an offense and corrects braces surrounded by spaces - Ruby 2.7 - registers an offense and corrects correct + opposite style - with `EnforcedStyle` of `Style/BlockDelimiters` - accepts left brace without outer space +RuboCop::Cop::Style::FetchEnvVar + registers an offense when using `ENV || x` that is different from `if` condition in the body + registers an offense with using an `ENV` at multiple `if` condition in the body + registers an offense when using `ENV && x` that is different from `if` condition in the body + registers an offense when using an `ENV` at `if` condition in the body + when the node is a assigned by `||=` + registers an offense + when it is compared `!=` with other object + does not register an offense + when it is evaluated with no default values + registers an offense + when using `fetch` instead of `[]` + registers no offenses + when the node is a receiver of `&&=` + does not register an offense + when it is a hash key + registers an offense + when it is compared `==` with other object + does not register an offense + when it is used in a conditional expression + registers no offenses when using the same `ENV` var as `if` condition in the body with operator + registers an offense with `case` + registers no offenses when using the same `ENV` var as `if` condition in the body + registers an offense when using an `ENV` var that is different from `if` condition in the body + registers no offenses when using the same `ENV` var as `if` condition in the body with predicate method + registers no offenses with `unless` + registers no offenses with ternary operator + registers no offenses when using the same `ENV` var as `if` condition in the body with assignment method + registers no offenses when using the same `ENV` var as `if` condition in the body with other conditions + registers an offense with using an `ENV` var as `if` condition in the body with assignment method + registers no offenses with `if` + when `ENV[]` is the right end of `||` chains + registers an offense + when the node is a receiver of `||=` + does not register an offense + when it receives a message + registers no offenses + when it is an argument of a method + registers an offense + when `ENV[]` is the LHS of `||` + registers no offenses + when it receives a message with safe navigation + registers no offenses + with negation + registers no offenses + when it is assigned to a variable + registers an offense when using single assignment + registers an offense when using multiple assignment + when the env val is excluded from the inspection by the config + registers no offenses + when it is a hash value + registers an offense + when it is an array element + registers an offense + when it is used in an interpolation + registers an offense + when the node is a assigned by `&&=` + registers an offense -RuboCop::Cop::Style::TrailingBodyOnClass - autocorrects with comment after body - accepts regular class - registers offense with multi-line class - registers an offense when body trails after class definition - accepts class inheritance - when class is not on first line of processed_source - autocorrect offense +RuboCop::Cop::EnforceSuperclass + registers an offense for Class.new definition + registers an offense for models that subclass ActiveRecord::Base + registers an offense for models that subclass ::ActiveRecord::Base + registers an offense for top-level constant ::Class.new definition + registers an offense for model defined using top-level + registers an offense for single-line definitions + when ApplicationRecord subclasses ActiveRecord::Base + behaves like no offense + registers no offenses for `class ApplicationRecord < ActiveRecord::Base; end` + behaves like no offense + registers no offenses for `::ApplicationRecord = Class.new(ActiveRecord::Base) do; end +` + behaves like no offense + registers no offenses for `::ApplicationRecord = ::Class.new(::ActiveRecord::Base) do; end +` + behaves like no offense + registers no offenses for `ApplicationRecord = Class.new(::ActiveRecord::Base) do; end +` + behaves like no offense + registers no offenses for `class ::ApplicationRecord < ActiveRecord::Base; end` + behaves like no offense + registers no offenses for `ApplicationRecord = Class.new(ActiveRecord::Base) do; end +` + behaves like no offense + registers no offenses for `::ApplicationRecord = ::Class.new(::ActiveRecord::Base) +` + behaves like no offense + registers no offenses for `ApplicationRecord = Class.new(ActiveRecord::Base) +` + when MyModel subclasses ApplicationRecord + behaves like no offense + registers no offenses for `MyModel = Class.new(ApplicationRecord) do +end +MyModel = Class.new(ApplicationRecord) +` + behaves like no offense + registers no offenses for `class MyModel < ::ApplicationRecord; end` + behaves like no offense + registers no offenses for `class MyModel < ApplicationRecord; end` + behaves like no offense + registers no offenses for `MyModel = ::Class.new(::ApplicationRecord) do +end +MyModel = ::Class.new(::ApplicationRecord) +` -RuboCop::Cop::Layout::ParameterAlignment - aligned with first parameter - accepts a method definition without parameters - registers an offense and corrects alignment in simple case - registers an offense and corrects parameters with single indent - accepts the first parameter being on a new row - accepts proper indentation - doesn't get confused by splat - registers an offense and corrects parameters with double indent - accepts parameter lists on a single line - defining self.method - registers an offense and corrects parameters with single indent - accepts proper indentation - aligned with fixed indentation - accepts a method definition without parameters - accepts parameter lists on a single line - doesn't get confused by splat - accepts proper indentation - accepts the first parameter being on a new row - registers an offense and corrects parameters with double indent - registers an offense and corrects parameters aligned to first param - defining self.method - accepts proper indentation - registers an offense and corrects parameters aligned to first param +RuboCop::Cop::Style::Proc + registers an offense for a Proc.new call + registers an offense for ::Proc.new + accepts the Proc.new call without block + accepts the ::Proc.new call without block + Ruby 2.7 + registers an offense for a Proc.new call -RuboCop::Cop::Lint::UselessRuby2Keywords - when `ruby2_keywords` is given a `def` node - does not register an offense for a method with a `restarg` and `blockarg` - does not register an offense for a method with a `restarg` other optional args - registers an offense for a method with a `restarg` and `kwoptarg` - does not register an offense for a method with a `restarg` other positional args - registers an offense for a method with only `kwrestarg` - registers an offense for a method with a `restarg` and keyword args - registers an offense for a method with only keyword args - does not register an offense for a method with a `restarg` and no `kwrestarg` - registers an offense for a method with only positional args - registers an offense for a method without arguments - registers an offense for a method with a `restarg` and `kwrestarg` - when `ruby2_keywords` is given a symbol - registers an offense for an unnecessary `ruby2_keywords` - does not register an offense when there is no `def` - does not register an offense for an allowed def - does not register an offense when the `def` is at a different depth - with a dynamically defined method - registers an offense for an unnecessary `ruby2_keywords` - registers an offense when the method has a `shadowarg` - registers an offense for a numblock - does not register an offense for an allowed `ruby2_keywords` - does not register an offense when the method has a `restarg` and a `shadowarg` +RuboCop::Cop::Lint::UselessAssignment + when a variable is assigned and unreferenced in a class + registers an offense + when a variable is assigned and unreferenced in a method + registers an offense + when a keyword splat method argument is not used + accepts + when a variable is assigned and unreferenced in a singleton class + registers an offense + when a variable is assigned in single branch if and unreferenced + registers an offense + when a variable is assigned and unreferenced in a singleton method defined with variable name + registers an offense + when a variable is assigned in 2 identical if branches + doesn't think 1 of the 2 assignments is useless + when a variable is reassigned while referencing itself in rhs and referenced + accepts + when a variable is assigned and unreferenced in a class subclassing another class stored in local variable + registers an offense + when a variable is assigned at the end of rescue and would be referenced with retry + accepts + when a variable is reassigned with binary operator assignment and referenced + accepts + when a variable is assigned on each side of && and referenced after the && + accepts + when a variable is referenced in rhs of named capture expression + accepts + when a variable is reassigned multiple times in main body of begin then referenced in rescue + accepts + when an assignment in a if branch is referenced in another if branch + accepts + when a variable is assigned with operator assignment in rescue and would be referenced with retry + accepts + when a method argument is not used + accepts + inside a `case-match` node + does not register an offense when the variable is used + when a variable is reassigned in loop body but won't be referenced either next iteration or loop condition + registers an offense (PENDING: Requires an advanced logic that checks whether the return value of an operator assignment is used or not.) + when a setter is invoked with operator assignment in loop body + accepts + when a block local variable is assigned and unreferenced + registers offenses for the assignment + when there's an unreferenced reassignment in a if branch while the variable is referenced in a case branch in the paired else branch + registers an offense for the reassignment in the if branch + when a variable is reassigned in single branch if and referenced in the branch + registers an offense for the unreferenced assignment + when a variable is assigned in loop body and unreferenced + registers an offense + similar name suggestion + when there's a similar method invocation with explicit receiver + does not suggest any name + when there's a similar method invocation with arguments + does not suggest any name + when there's a similar variable + suggests the variable name + when there's a similar name but it's in inner scope + does not suggest any name + when there's a similar variable-like method invocation + suggests the method name + when there are only less similar names + does not suggest any name + when a variable is assigned and unreferenced in a singleton method defined with self keyword + registers an offense + when a variable is assigned while being passed to a method taking block + and the variable is used + accepts + and the variable is not used + registers an offense + when an anonymous keyword splat method argument is defined + accepts + when an unreferenced variable is reassigned in a block + accepts + when a variable is assigned and referenced when defining a module + does not register an offense + when a variable is assigned in branch of modifier if that references the variable in its conditional clauseand referenced after the branching + accepts + when a variable is assigned with multiple assignment and unreferenced + registers an offense + when a variable is assigned in main body of begin, rescue and else and reassigned in ensure then referenced after the begin + registers offenses for each assignment before ensure + when a named capture is unreferenced in other than top level + registers an offense + when a variable is assigned in begin and referenced outside + accepts + when a variable is assigned in loop body and referenced in post while condition + accepts + when a variable is assigned in main body of begin, rescue and else then referenced after the begin + accepts + when a block argument is not used + accepts + when a variable is assigned first with ||= and referenced + accepts + when a variable is reassigned multiple times in main body of begin then referenced after the begin + accepts + when a variable is reassigned and unreferenced in a if branch while the variable is referenced in the paired else branch + registers an offense for the reassignment in the if branch + when a referenced variable is reassigned but not re-referenced in a method defined in loop + registers an offense + when a optional keyword method argument is not used + accepts + when a variable is assigned with ||= before the last expression of the scope + registers an offense + when a keyword splat method argument is used + accepts + when a variable is assigned in each branch of if and referenced after the branching + accepts + when a local variable is unreferenced and zero arity super is called + registers an offense + when a variable is reassigned with binary operator assignment while assigning to itself in rhs then referenced + registers an offense for the assignment in rhs + when a variable is assigned in branch of modifier if that references the variable in its conditional clauseand unreferenced + registers an offense + when an unreferenced variable is reassigned and re-referenced + registers an offense for the unreferenced assignment + when an optional method argument is not used + accepts + when a named capture is referenced + accepts + when a variable is assigned and assigned again in a modifier condition + accepts without parentheses + accepts with parentheses + when a variable is reassigned at the end of loop body and would be referenced in loop condition + accepts + when a variable is assigned in main body of begin with rescue but unreferenced + registers an offense + when a referenced variable is reassigned in a block + accepts + when a variable is reassigned in single branch if and referenced after the branching + accepts + when a referenced variable is reassigned but not re-referenced + registers an offense for the non-re-referenced assignment + when a variable is reassigned at the end of loop body and would be referenced in next iteration + accepts + when a method argument is reassigned and zero arity super is called + accepts + when there is only one AST node and it is unused variable + registers an offense + when a variable is assigned in each branch of if and referenced in the else branch + registers an offense for the assignment in the if branch + when a method argument is reassigned but not passed to super + registers an offense + when a variable is assigned with operator assignment in top level + registers an offense + when a variable is shadowed by a block argument and unreferenced + registers an offense + when a variable is assigned and unreferenced in top level + registers an offense + when a rescued error variable is wrongly tried to be referenced in another rescue body + registers an offense + when a variable is assigned with ||= at the last expression of the scope + registers an offense + when a variable is assigned multiple times but unreferenced + registers offenses for each assignment + when a unreferenced variable is reassigned on the right side of && and referenced after the && + accepts + when a variable is assigned and unreferenced in a module + registers an offense + when there's an unreferenced assignment in top level if branch while the variable is referenced in the paired else branch + registers an offense for the assignment in the if branch + when a variable is reassigned with multiple assignment while referencing itself in rhs and referenced + accepts + when a variable is reassigned multiple times in main body of begin then referenced in ensure + accepts + when a block local variable is declared but not assigned + accepts + when a unreferenced variable is reassigned in same branch and referenced after the branching + registers an offense for the unreferenced assignment + when a variable is assigned and passed to a method followed by method taking block + accepts + when a block method argument is not used + accepts + when a variable is assigned in loop body and referenced in post until condition + accepts + when a variable is reassigned multiple times in ensure with rescue then referenced after the begin + registers an offense + when a variable is not used and the name starts with _ + accepts + when a variable that has same name as outer scope variable is not referenced in a method defined in loop + registers an offense + when a splat method argument is not used + accepts + when a variable is reassigned in a loop + for loop + accepts + while loop + accepts + post until loop + accepts + until loop + accepts + post while loop + accepts + when a unreferenced variable is reassigned on the left side of && and referenced after the && + registers an offense for the unreferenced assignment + when a variable is reassigned with logical operator assignment and referenced + accepts + when a named capture is unreferenced in top level + registers an offense + when there's an unreferenced reassignment in a if branch while the variable is referenced in the paired elsif branch + registers an offense for the reassignment in the if branch + when a variable is reassigned multiple times in rescue with ensure then referenced after the begin + registers an offense + when a variable is reassigned multiple times in rescue and referenced after the begin + registers an offense -RuboCop::Cop::Style::MixinUsage - does not register an offense when using inside nested module - include - registers an offense when using outside class (used above) - does not register an offense when using inside block and `if` condition is after `include` - registers an offense when using only `include` statement - does not register an offense when using outside class - does not register an offense when using inside block - does not register an offense when using inside class - doesn't register an offense when `include` call is a method argument - registers an offense when using `include` in method definition outside class or module - does not register an offense when using `include` in method definition inside module - registers an offense when using outside class (used below) - does not register an offense when using `include` in method definition inside class - Nested module - registers an offense when using outside class - Multiple definition classes in one - does not register an offense when using inside class - extend - registers an offense when using outside class - does not register an offense when using inside class - prepend - registers an offense when using outside class - does not register an offense when using inside class +RuboCop::Cop::Style::StderrPuts + registers an offense when using `$stderr.puts('hello')` + registers an offense when using `STDERR.puts('hello')` + registers an offense when using `::STDERR.puts('hello')` + registers no offense when using `STDERR.puts` with no arguments + registers no offense when using `$stderr.puts` with no arguments -RuboCop::Cop::Style::ClassMethods - registers an offense for methods using a class name - does not register an offense for other top-level singleton methods - does not register an offense outside class/module bodies - does not register an offense for methods using self - registers an offense for methods using a module name +RuboCop::Cop::Style::RegexpLiteral + when PercentLiteralDelimiters is configured with brackets + respects the configuration when autocorrecting + when PercentLiteralDelimiters is configured with slashes + respects the configuration when autocorrecting + when EnforcedStyle is set to mixed + a single-line %r regex with slashes + is accepted + when configured to allow inner slashes + registers an offense + a multi-line `//` regex with slashes + registers an offense + a single-line `//` regex without slashes + is accepted + a multi-line %r regex with slashes + is accepted + a multi-line `//` regex without slashes + registers an offense + a single-line `//` regex with slashes + registers an offense + when configured to allow inner slashes + is accepted + a multi-line %r regex without slashes + is accepted + a single-line %r regex without slashes + registers an offense + when EnforcedStyle is set to slashes + a single-line `//` regex with slashes and interpolation + registers an offense + when configured to allow inner slashes + is accepted + a multi-line %r regex without slashes + registers an offense + a single-line %r regex without slashes + registers an offense + a multi-line `//` regex with slashes + registers an offense + when configured to allow inner slashes + is accepted + a multi-line %r regex with slashes + is accepted + when configured to allow inner slashes + registers an offense + a multi-line `//` regex without slashes + is accepted + a single-line `%r//` regex with slashes + is accepted + when configured to allow inner slashes + preserves slashes after autocorrection + a single-line `//` regex without slashes + is accepted + a single-line %r regex with slashes + is accepted + when configured to allow inner slashes + registers an offense + a single-line `//` regex with slashes + registers an offense + when configured to allow inner slashes + is accepted + when EnforcedStyle is set to percent_r + a multi-line `//` regex with slashes + registers an offense + a single-line `//` regex with slashes + registers an offense + a multi-line %r regex without slashes + is accepted + a multi-line %r regex with slashes + is accepted + a multi-line `//` regex without slashes + registers an offense + a single-line %r regex without slashes + is accepted + a single-line `//` regex without slashes + registers an offense + a single-line %r regex with slashes + is accepted + when `EnforcedStyle: require_parentheses` of `Style/MethodCallWithArgsParentheses` cop + when using `%r` regexp with `EnforcedStyle: slashes` + registers an offense when used as a method argument + registers an offense when not used as a method argument + registers an offense when using a regexp starts with a blank + does not register an offense when using a regexp starts with a blank as a method argument + registers an offense when used as a safe navigation method argument + does not register an offense when using a regexp starts with a blank as a safe navigation method argument + when using `%r` regexp with `EnforcedStyle: mixed` + does not register an offense when using a regexp starts with a blank as a method argument + registers an offense when used as a method argument + registers an offense when using a regexp starts with a blank + registers an offense when used as a safe navigation method argument + registers an offense when not used as a method argument + does not register an offense when using a regexp starts with a blank as a safe navigation method argument + %r regex with other delimiters than curly braces + registers an offense + when `EnforcedStyle: omit_parentheses` of `Style/MethodCallWithArgsParentheses` cop + when using `%r` regexp with `EnforcedStyle: slashes` + does not register an offense when used as a method argument + registers an offense when not used as a method argument + does not register an offense when used as a safe navigation method argument + when using `%r` regexp with `EnforcedStyle: mixed` + does not register an offense when used as a method argument + registers an offense when not used as a method argument + does not register an offense when used as a safe navigation method argument + when regex contains slashes in interpolation + ignores the slashes that do not belong // regex -RuboCop::FileFinder - #find_last_file_upwards - returns nil when file is not found - returns the last file found upwards - #find_file_upwards - returns a file to be found upwards - returns nil when file is not found +RuboCop::Cop::Style::EvalWithLocation + registers an offense when using `instance_eval` with improper arguments + registers an offense when using correct file argument but incorrect line + does not register an offense if `eval` is called on another object + registers an offense when using `#eval` without any arguments + registers an offense when using `#eval` with `binding` only + registers an offense when using `#eval` with a string on a new line + registers an offense when using `class_eval` with improper arguments + accepts `eval` with a string, a filename and `__LINE__` on a new line + registers an offense when using `#class_eval` with an incorrect lineno + registers an offense when using `Kernel.eval` without any arguments + accepts `eval` with a string, a filename and `__LINE__` + accepts `eval` with a code that is a variable + registers an offense when using `#class_eval` without any arguments + registers an offense when using `#instance_eval` without any arguments + registers an offense when using `#eval` with a heredoc and an incorrect line number + registers an offense when using `#eval` with an incorrect line number + accepts `eval` with a heredoc, a filename and `__LINE__ + 1` + registers an offense when using `#module_eval` without any arguments + registers an offense when using `module_eval` with improper arguments + registers an offense when using `eval` with improper arguments + does not register an offense when using eval with block argument + registers an offense when using `#eval` without lineno + registers an offense when using `::Kernel.eval` without any arguments + registers an offense when using `#instance_eval` with a string argument in parentheses -RuboCop::Cop::Style::AccessorGrouping - when EnforcedStyle is separated - registers an offense and corrects when using grouped accessors with different access modifiers - registers an offense and corrects when the same accessor is given more than once in the same statement - registers an offense and corrects when using grouped accessors - does not register an offense for grouped accessors with comments - registers an offense and corrects when using grouped accessors within eigenclass - does not register an offense if the same accessor is listed twice - does not register an offense when using separated accessors - when there are comments for attributes - registers and corrects an offense - when EnforcedStyle is grouped - registers offense and corrects if at least two separate accessors without comments - does not register an offense when using grouped accessors - registers an offense and corrects when using separated accessors within eigenclass - does not register offense for accessors with comments - registers an offense and correct if the same accessor is listed twice - registers an offense and corrects when using separated accessors with different access modifiers - registers an offense and corrects when using separated accessors - does not register an offense when the same accessor is given more than once in the same statement +RuboCop::Cop::Badge + exposes cop name + exposes department name + can be converted to a string with the Department/CopName format + compares by value + .for + parses cop class name + parses cop class name + parses cop class name + parses cop class name + parses cop class name + .parse + parses identifier + parses identifier + parses identifier + parses identifier + parses identifier + parses identifier + .new + assigns department + assigns name + assigns name + assigns department + assigns department + assigns name + assigns name + assigns department + #camel_case + converts "rspec" to CamelCase + converts "lint" to CamelCase + converts "foo_bar" to CamelCase + #qualified? + says `Department/CopName` is qualified + says `Deep/Department/CopName` is qualified + says `CopName` is not qualified -RuboCop::Cop::Style::YodaCondition - enforce yoda - accepts number on left of <=> - accepts string literal on right of case equality check - accepts string literal on left - accepts arrays of numbers on both sides - registers an offense for string literal on right - accepts global variable on right - registers an offense for number on right of comparison - accepts assignment - accepts subtraction on right of comparison - registers an offense for nil on right - accepts negation - registers an offense for number on right - accepts instance variable on right - accepts accessor and variable on right in boolean expression - accepts method call on receiver on right - registers an offense for boolean literal on right - accepts class variable on right - accepts numbers on both sides - accepts variable on right after assignment - accepts safe navigation on right - with EnforcedStyle: require_for_equality_operators_only - accepts nil on right of comparison - accepts number on right of comparison - accepts mixed order in comparisons - registers an offense for negated equality check - registers an offense for equality check - within an if or ternary statement - registers an offense number on right in if condition - registers an offense for number on right of <= in ternary condition - registers an offense for number on right in modifier if - registers an offense for number on right of >= in ternary condition - registers an offense for nil on right in ternary condition - registers an offense number on right of comparison in if condition - enforce not yoda - accepts assignment - accepts __FILE__ on left in negated program name check - accepts safe navigation on left - accepts variable on left after assign - registers an offense for boolean literal on left - registers an offense number on left - accepts interpolated regex on left - accepts number on both sides - registers an offense for nil on left - registers an offense for string literal on left - accepts subtraction expression on left of comparison - accepts string literal on right - accepts accessor and variable on left in boolean expression - accepts instance variable on left - accepts negation - accepts class variable on left - accepts number on left of <=> - accepts __FILE__ on left in program name check - registers an offense number on left of comparison - accepts array of numbers on both sides - accepts interpolated string on left - accepts global variable on left - accepts string literal on left of case equality check - accepts method call on receiver on left - with EnforcedStyle: forbid_for_equality_operators_only - registers an offense for equality check - accepts nil on left of comparison - accepts mixed order in comparisons - registers an offense for negated equality check - accepts number on left of comparison - within an if or ternary statement - registers an offense for nil on left in ternary condition - registers an offense for number on left of >= in ternary condition - registers an offense for number on left in if condition - registers an offense for number on left of comparison in if condition - registers an offense for number on left in modifier if - registers an offense for number on left of <= in ternary condition +RuboCop::Cop::Lint::OutOfRangeRegexpRef + does not register offense to a regexp with encoding option and valid references for numbered captures + registers an offense when the regexp appears on the right hand side of `=~` + registers an offense when out of range references are used inside a when clause + ignores regexp when clause conditions that contain interpolations + registers an offense when out of range references are used for numbered captures + does not register offense to a regexp with valid references for a mix named and numbered captures + ignores `match` with no receiver + registers an offense when out of range references are used for mix of numbered and named captures + ignores `match` with no arguments + ignores calls to `match?` + only registers an offense for when clauses when the regexp is matched as a literal + registers an offense when references are used before any regexp + only registers an offense when the regexp is matched as a literal + registers an offense when the regexp is matched with `===` + registers an offense when out of range references are used for named captures + uses the maximum number of captures for when clauses with multiple conditions + does not register offense to a regexp with valid references for numbered captures + registers an offense when the regexp is matched with `match` + does not register offense to a regexp with valid references for named captures + does not register an offense when in range references are used inside a when clause + registers an offense when out of range references are used for non captures + does not register an offense regexp containing non literal + matching with `grep` + does not register an offense when in range references are used + only registers an offense when the regexp is matched as a literal + registers an offense when out of range references are used + matching with index + registers an offense when out of range references are used + only registers an offense when the regexp is matched as a literal + does not register an offense when in range references are used + matching with scan + does not register an offense when in range references are used + only registers an offense when the regexp is matched as a literal + registers an offense when out of range references are used + matching with rpartition + does not register an offense when in range references are used + registers an offense when out of range references are used + only registers an offense when the regexp is matched as a literal + matching with match + registers an offense when out of range references are used + only registers an offense when the regexp is matched as a literal + does not register an offense when in range references are used + matching with end_with? + does not register an offense when in range references are used + only registers an offense when the regexp is matched as a literal + registers an offense when out of range references are used + matching with sub! + does not register an offense when in range references are used + registers an offense when out of range references are used + only registers an offense when the regexp is matched as a literal + matching with start_with? + does not register an offense when in range references are used + only registers an offense when the regexp is matched as a literal + registers an offense when out of range references are used + matching with sub + registers an offense when out of range references are used + does not register an offense when in range references are used + only registers an offense when the regexp is matched as a literal + matching with gsub! + does not register an offense when in range references are used + registers an offense when out of range references are used + only registers an offense when the regexp is matched as a literal + matching with partition + registers an offense when out of range references are used + only registers an offense when the regexp is matched as a literal + does not register an offense when in range references are used + matching with slice + registers an offense when out of range references are used + does not register an offense when in range references are used + only registers an offense when the regexp is matched as a literal + matching with rindex + registers an offense when out of range references are used + does not register an offense when in range references are used + only registers an offense when the regexp is matched as a literal + matching with slice! + only registers an offense when the regexp is matched as a literal + does not register an offense when in range references are used + registers an offense when out of range references are used + matching with `[]` + registers an offense when out of range references are used + does not register an offense when in range references are used + only registers an offense when the regexp is matched as a literal + when calling a regexp method on a nth-ref node + registers an offense if the capturing groups have changed + does not register an offense when calling gsub on a valid nth-ref + registers an offense when calling gsub on an invalid nth-ref + matching with gsub + does not register an offense when in range references are used + only registers an offense when the regexp is matched as a literal + registers an offense when out of range references are used + when both the LHS and RHS use regexp + only considers the RHS regexp -RuboCop::Cop::VariableForce::Reference - .new - when non variable reference node is passed - raises error +RuboCop::Cop::Bundler::GemFilename + with default configuration (EnforcedStyle => `Gemfile`) + with non-root gems.rb file path + registers an offense + with non-root Gemfile file path + does not register an offense + with Gemfile.lock file path + does not register an offense + with gems.rb file path + registers an offense + with Gemfile file path + does not register an offense + with gems.locked file path + registers an offense + with non-root gems.locked file path + registers an offense + with non-root Gemfile.lock file path + does not register an offense + with EnforcedStyle set to `gems.rb` + with Gemfile.lock file path + registers an offense + with non-root Gemfile file path + registers an offense + with non-root gems.rb file path + does not register an offense + with non-root gems.locked file path + does not register an offense + with non-root Gemfile.lock file path + registers an offense + with gems.rb file path + does not register an offense + with Gemfile file path + registers an offense -RuboCop::Cop::Layout::MultilineMethodDefinitionBraceLayout - ignores single-line defs - ignores defs without params - ignores implicit defs - heredoc - detects heredoc structures that are safe to add to - ignores heredocs that could share a last line - new_line style - opening brace on separate line from first element - allows closing brace on separate line from last multiline element - detects closing brace on same line as last element - allows closing brace on separate line from last element - opening brace on same line as first element - autocorrects closing brace on same line as last element - detects closing brace on same line as last multiline element - allows closing brace on different line from last element - allows closing brace on different line from multi-line element - same_line style - opening brace on same line as first element - allows closing brace on same line as multi-line element - autocorrects closing brace on different line as last element - allows closing brace on same line from last element - detects closing brace on different line from multiline element - opening brace on separate line from first element - detects closing brace on different line from last element - allows closing brace on same line as last multiline element - allows closing brace on same line as last element - symmetrical style - opening brace on separate line from first element - allows closing brace on separate line from last multiline element - allows closing brace on separate line from last element - detects closing brace on same line as last element - opening brace on same line as first element - allows closing brace on same line as last multiline element - detects closing brace on different line from last element - allows closing brace on same line as last element - autocorrects closing brace on different line from last element +RuboCop::Cop::Naming::MemoizedInstanceVariableName + does not register an offense when or-assignment-based memoization is used outside a method definition + with default EnforcedStyleForLeadingUnderscores => disallowed + when or-assignment-based memoization is used + with dynamically defined methods + when a method is defined inside a module callback + when the method matches + does not register an offense + when the method does not match + registers an offense + when a singleton method is defined inside a module callback + when the method matches + does not register an offense + when the method does not match + registers an offense + when the variable name does not match the method name + registers an offense + when the variable name matches the method name + does not register an offense + memoized variable matches method name + does not register an offense + does not register an offense with a leading `_` for both names + does not register an offense when method has leading `_` + memoized variable matches predicate method name + does not register an offense + code follows memoized variable assignment + does not register an offense + memoized variable after other code + does not register an offense + instance variables in initialize methods + does not register an offense + memoized variable matches bang method name + does not register an offense + memoized variable matches method name during assignment + does not register an offense + non-memoized variable does not match method name + does not register an offense + memoized variable matches method name for block + does not register an offense + memoized variable does not match method name during assignment + registers an offense + memoized variable does not match method name + registers an offense + memoized variable after other code does not match method name + registers an offense + registers an offense for a predicate method + registers an offense for a bang method + memoized variable does not match class method name + registers an offense + memoized variable does not match method name for block + registers an offense + when defined?-based memoization is used + does not register an offense when there is no assignment + does not register an offense when some code after assignment + registers an offense when memoized variable does not match class method name + does not register an offense when some code before defined + registers an offense when memoized variable does not match method name + with dynamically defined methods + when the variable name does not match the method name + registers an offense + when a method is defined inside a module callback + when the method does not match + registers an offense + when the method matches + does not register an offense + when the variable name matches the method name + does not register an offense + when a singleton method is defined inside a module callback + when the method does not match + registers an offense + when the method matches + does not register an offense + memoized variable matches method name + does not register an offense when method has leading `_` + does not register an offense when memoized variable matches predicate method name + does not register an offense + does not register an offense with a leading `_` for both names + does not register an offense when memoized variable matches bang method name + non-memoized variable does not match method name + does not register an offense + EnforcedStyleForLeadingUnderscores: optional + when or-assignment-based memoization is used + memoized variable matches method name + does not register an offense with a leading `_` for both names + does not register an offense with a leading underscore + does not register an offense without a leading underscore + does not register an offense with a leading `_` for method name + when defined?-based memoization is used + memoized variable matches method name + does not register an offense with a leading `_` for both names + does not register an offense with a leading `_` for method name + does not register an offense with a leading underscore + does not register an offense without a leading underscore + EnforcedStyleForLeadingUnderscores: required + when defined?-based memoization is used + registers an offense when it has leading `_` but names do not match + does not register an offense with a leading `_` for both names + registers an offense when names match but missing a leading _ + with dynamically defined methods + when a singleton method is defined inside a module callback + when the method matches + does not register an offense + when the method does not match + registers an offense + when the variable name matches the method name + does not register an offense + when a method is defined inside a module callback + when the method does not match + registers an offense + when the method matches + does not register an offense + when the variable name does not match the method name + registers an offense + when or-assignment-based memoization is used + does not register an offense with a leading `_` for both names + registers an offense when it has leading `_` but names do not match + registers an offense when names match but missing a leading _ + with dynamically defined methods + when a singleton method is defined inside a module callback + when the method does not match + registers an offense + when the method matches + does not register an offense + when the variable name does not match the method name + registers an offense + when the variable name matches the method name + does not register an offense + when a method is defined inside a module callback + when the method matches + does not register an offense + when the method does not match + registers an offense -RuboCop::Cop::Style::RedundantSelfAssignment - does not register an offense when there is no a receiver - registers an offense and corrects when assigning to attribute of `self` - does not register an offense when assigning to attribute of `self` the result from other object - registers an offense and corrects when assigning to attribute of non `self` - does not register an offense when lhs and receiver are different - when lhs and receiver are the same - registers an offense and corrects when assigning to local variable - registers an offense and corrects when assigning to instance variable - registers an offense and corrects when assigning to global variable - registers an offense and corrects when assigning to class variable +RuboCop::Cop::Lint::TopLevelReturnWithArgument + Code segment with method-level return statements + expects offense when method-level & top-level return co-exist + Code segment with only top-level return statement + expects multiple offenses from the return with arguments statements + expects offense from the return with arguments + expects no offense from the return without arguments + Code segment with inline if along with top-level return + expects multiple offense from the return with arguments + expects no offense from the return without arguments + Code segment containing semi-colon separated statements + expects no offense from the return with arguments and multi-line code + expects an offense from the return with arguments and multi-line code + Code segment with block level returns other than the top-level return + expects no offense from the return without arguments + expects offense from the return with arguments + +RuboCop::Cop::Style::CaseLikeIf + does not register an offense when only single `if` + does not register an offense when using `==` with constant containing 1 letter in name + does not register an offense when using `cover?` without a receiver + does not register an offense when one of `||` subconditions is not convertible + does not register an offense when not all conditions contain target + registers an offense and corrects when using nested conditions with `||` + registers an offense and corrects when using `===` + does not register an offense when one of the branches contains `==` with class reference + registers an offense and corrects when using `match?` with regexp + does not register an offense when using `match?` without a receiver + does not register an offense when using `unless` + registers an offense and corrects when using `match?` with non regexp in other branches except first + does not register an offense when using modifier `if` + registers an offense and corrects when target is a method call + does not register an offense when using ternary operator + registers an offense and corrects when using `==` with constant + registers an offense and corrects when using `is_a?` + does not register an offense when only `if-else` + does not register an offense when using `=~` in first branch with non regexp + registers an offense and corrects when using `==` with literal + does not register an offense when using `include?` without a receiver + does not register an offense when using `==` with class reference + registers an offense and corrects when using `include?` with range + does not register an offense when using `equal?` without a receiver + does not register an offense when using `==` with method call with arguments + does not register an offense when using `match?` with non regexp + does not register an offense when an object overrides `equal?` with no arity + registers an offense and corrects when using `=~` + does not register an offense when using `match?` in first branch with non regexp + registers an offense and corrects when using `||` within conditions + when using regexp with named captures + does not register an offense with match and regexp on rhs + does not register an offense with match and regexp on lhs + does not register an offense with =~ and regexp on lhs + registers and corrects an offense with match? and regexp on lhs + registers and corrects an offense with =~ and regexp on rhs + registers and corrects an offense with match? and regexp on rhs + +RuboCop::Cop::Generator::RequireFileInjector + when a `require_relative` entry does not exist from before + injects a `require_relative` statement on the right line in the root file + when using an unknown department + inserts a `require_relative` statement to the bottom of the file + when a cop of style department already exists + injects a `require_relative` statement on the end of style department + when a `require` entry already exists + does not write to any file RuboCop::Cop::Security::CompoundHash - registers an offense when using XOR and bitshifts + does not register an offense when delegating to a single object + registers an offense when using addition in the implementation of the hash method registers an offense when using addition assignment operator in the implementation of the hash method registers an offense when using XOR operator in the implementation of the hash method, even without sub-calls to hash - registers an offense when using XOR operator in the implementation of the hash method - does not register an offense when delegating to Array#hash - does not register an offense when delegating to a single object - registers an offense when delegating to Array#hash for a single value - registers an offense when using XOR operator in the implementation of the hash method, even if intermediate variable is used registers an offense when using multiplication in the implementation of the hash method - registers an offense when using bitshift and OR + registers an offense if .hash is called on any elements of a hashed array + registers an offense for complex usage + registers an offense when using XOR operator in the implementation of the hash method registers an offense when using XOR assignment operator in the implementation of the hash method registers an offense when using multiplication assignment operator in the implementation of the hash method - registers an offense when using XOR operator in the implementation of the hash singleton method - registers an offense when using addition in the implementation of the hash method - registers an offense when using XOR operator in the implementation of a dynamic hash singleton method + registers an offense when using bitshift and OR registers an offense when using XOR operator in the implementation of a dynamic hash method - registers an offense for complex usage - registers an offense if .hash is called on any elements of a hashed array - registers an offense when using XOR between an array hash and a class + registers an offense when using XOR operator in the implementation of the hash method, even if intermediate variable is used registers an offense when using XOR involving super + registers an offense when using XOR operator in the implementation of a dynamic hash singleton method + registers an offense when using XOR operator in the implementation of the hash singleton method + registers an offense when using XOR and bitshifts + registers an offense when using XOR between an array hash and a class + does not register an offense when delegating to Array#hash + registers an offense when delegating to Array#hash for a single value -RuboCop::Cop::Lint::RequireRangeParentheses - registers an offense when the end of the range (`..`) is line break - does not register an offense when the end of the range (`..`) is line break and is enclosed in parentheses - does not register an offense when using `nil..42` - registers an offense when the end of the range (`...`) is line break - does not register an offense when begin and end of the range are on the same line - does not register an offense when using `42..nil` - Ruby >= 2.6 - does not register an offense when using endless range only - Ruby >= 2.7 - does not register an offense when using beginless range only - -RuboCop::Cop::Force - .force_name - returns the class name without namespace - #run_hook - invokes a hook in all cops - -RuboCop::Cop::AnnotationComment - #correct? - when there is duplication in the keywords - when the longer keyword is given first - behaves like correct - is expected to be truthy - behaves like correct - is expected to be truthy - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - when the shorter keyword is given first - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like correct - is expected to be truthy - behaves like correct - is expected to be truthy - when a colon is required - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like correct - is expected to be truthy - behaves like incorrect - is expected to be falsey - behaves like correct - is expected to be truthy - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like correct - is expected to be truthy - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - when no colon is required - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like correct - is expected to be truthy - behaves like incorrect - is expected to be falsey - behaves like correct - is expected to be truthy - behaves like incorrect - is expected to be falsey - behaves like incorrect - is expected to be falsey - behaves like correct - is expected to be truthy - #annotation? - when the keyword is multiple words - is expected to equal true - when given as the first word of a sentence - is expected to be falsey - when annotated with a non keyword - is expected to be falsey - when given a keyword followed by a colon - is expected to equal true - when the keyword is not capitalized properly - is expected to equal true - when it includes a keyword - is expected to be falsey - when given a keyword followed by a space - is expected to equal true - -RuboCop::Cop::Layout::MultilineOperationIndentation - when EnforcedStyle is aligned - accepts indented operands inside and outside a block - registers an offense and corrects misaligned string operand when the first operand has backslash continuation - registers an offense and corrects an unindented multiline operation that is the left operand in another operation - accepts aligned operands in if condition - accepts no extra indentation of third line - registers an offense and corrects indented operand in second argument - registers an offense and corrects emacs ruby-mode 1.1 indentation of an expression in an array - accepts aligned operands in assignment - registers an offense and corrects misaligned operands in unless condition - does not check method calls - accepts indented operands in for body - registers an offense and corrects three space indentation of second line - accepts two spaces indentation in assignment of array element - registers an offense and corrects no indentation of second line - accepts aligned or:ed operands in assignment - registers an offense and corrects misaligned string operand when plus is used - registers an offense and corrects unaligned operands in op-assignment - registers an offense and corrects one space indentation of second line - registers an offense and corrects indented operands in if condition - accepts two spaces indentation of second line - accepts indented operands in ordinary statement - accepts indented operands with ternary operators - registers an offense for misaligned operands in unless condition - registers an offense for misaligned operands in until condition - accepts indented code on LHS of equality operator - registers an offense for misaligned operands in while condition - accepts an expression where the first operand spans multiple lines - registers an offense and corrects extra indentation of third line - accepts two spaces indentation in assignment of local variable - accepts indented operands in an array - accepts indented operands inside block + assignment - accepts any indentation of parameters to #[] - registers an offense and corrects indented second part of string - registers an offense for misaligned operands in if condition - accepts alignment inside a grouped expression - accepts unary operations - when EnforcedStyle is indented - registers an offense for a 2 space indentation of while condition - registers an offense and corrects aligned operands in if conditions - registers an offense for a 2 space indentation of until condition - registers an offense and corrects aligned code on LHS of equality operator - accepts any indentation of method parameters - accepts indented operands in ordinary statement - accepts an expression where the first operand spans multiple lines - accepts two spaces indentation in assignment of array element - registers an offense and corrects three space indentation of second line - registers an offense and corrects extra indentation of third line - does not check method calls - accepts indented operands inside and outside a block - accepts indentation of return if condition - accepts indentation of assignment - accepts double indentation of if condition - accepts two spaces indentation of second line - accepts double indentation of while condition - accepts indented operands in if body - accepts indentation of return unless condition - accepts unary operations - accepts two spaces indentation in assignment of local variable - registers an offense and corrects one space indentation of second line - accepts no extra indentation of third line - accepts indented operands in until body - accepts indentation of next unless condition - accepts indented operands in for body - registers an offense and corrects an unindented multiline operation that is the left operand in another operation - accepts indented operands in unless body - accepts double indentation of unless condition - accepts indentation of next if condition - registers an offense and corrects correct + unrecognized style - accepts double indentation of until condition - accepts indented operands in if condition - registers an offense for a 2 space indentation of if condition - registers an offense and corrects aligned operators in assignment - registers an offense and corrects emacs ruby-mode 1.1 indentation of an expression in an array - accepts special indentation of for expression - accepts normal indentation of method parameters - registers an offense for a 2 space indentation of unless condition - accepts normal indentation inside grouped expression - registers an offense and corrects wrong indentation of for expression - accepts indented operands in an array - registers an offense and corrects no indentation of second line - accepts any indentation of parameters to #[] - accepts alignment inside a grouped expression - accepts indented operands in while body - accepts the indentation of a broken string - when indentation width is overridden for this cop - accepts indentation of until condition which is offset by a single normal indentation step - accepts indentation of while condition which is offset by a single normal indentation step - accepts indentation of unless condition which is offset by a single normal indentation step - accepts indentation of if condition which is offset by a single normal indentation step - registers an offense and corrects - registers an offense for a 4 space indentation of until condition - registers an offense for a 4 space indentation of if condition - registers an offense for a 4 space indentation of while condition - accepts indented operands in if body - accepts indented operands in if condition - accepts indented operands in until body - accepts indented operands in while body - registers an offense for a 4 space indentation of unless condition - accepts indented operands in unless body - -RuboCop::Cop::Lint::RedundantCopDisableDirective - .check - when there are no disabled lines - returns no offense - when there are disabled lines - and there are no offenses - and a comment disables - all cops - returns an offense - misspelled cops - returns an offense - itself and another cop - disabled on different ranges - returns no offense - and the other cop is disabled a second time - returns no offense - disabled on the same range - returns no offense - a cop that is disabled in the config - returns an offense - when that cop was previously enabled - returns no offense - if that cop has offenses - returns an offense - multiple cops, with abbreviated names - one of them has offenses - returns an offense - when using a directive comment after a non-directive comment - returns an offense - one cop - returns an offense - comment is not at the beginning of the file - and not all cops have offenses - returns an offense - multiple cops, and the leftmost one has no offenses - returns an offense - multiple cops, and one of them has offenses - returns an offense - itself and all cops - disabled on different ranges - returns no offense - multiple cops - returns an offense - an unknown cop - returns an offense - and there are two offenses - and a comment disables - one cop and then all cops - returns an offense - one cop twice - returns an offense - and there is an offense - and a comment disables - that cop but on other lines - returns an offense - all cops - returns no offense - that cop - returns no offense - with a disabled department - removes cop duplicated by department on previous line - removes redundant department - removes entire comment - does not remove correct department - removes cop duplicated by department - removes cop duplicated by department and leaves free text as a comment - autocorrecting whitespace - when there is only whitespace before the comment - leaves the whitespace - when the comment is the first line of the file - followed by a newline - removes the comment and newline - followed by another comment - removes the comment and newline - followed by code - removes the comment - when there is a blank line before inline comment - removes the comment and preceding whitespace - inline comment - removes the comment and preceding whitespace - when the comment is not the first line of the file - preserves whitespace before the comment - nested inside a namespace - preserves indentation - -RuboCop::Cop::Lint::DuplicateCaseCondition - registers an offense for subsequent repeated case conditionals - accepts non-redundant case expressions with an else expression - accepts trivial case expressions - registers multiple offenses for multiple repeated case conditionals - accepts non-redundant case expressions - accepts similar but not equivalent && expressions - registers an offense for repeated case conditionals - registers multiple offenses for repeated multi-value conditionals - registers an offense for repeated logical operator when expressions +RuboCop::Cop::Style::RedundantException + reports an offense for a raise with ::RuntimeError + reports an offense for a fail with RuntimeError and () + reports an offense for a raise with RuntimeError + accepts rescue w/ non redundant error + reports an offense for a fail with ::RuntimeError + accepts rescue w/ non redundant error + accepts rescue w/ non redundant error + reports an offense for a raise with RuntimeError.new + reports an offense for a fail with RuntimeError + reports an offense for a fail with RuntimeError.new + accepts a fail with RuntimeError if it does not have 2 args + accepts rescue w/ non redundant error + reports an offense for a raise with RuntimeError.new + reports an offense for a raise with RuntimeError and () + accepts a fail with ::RuntimeError if it does not have 2 args + reports an offense for a raise with ::RuntimeError.new + reports an offense for a fail with ::RuntimeError and () + accepts a raise with ::RuntimeError if it does not have 2 args + accepts a raise with RuntimeError if it does not have 2 args + reports an offense for a fail with ::RuntimeError.new + reports an offense for a raise with ::RuntimeError.new + reports an offense for a fail with RuntimeError.new + reports an offense for a raise with ::RuntimeError and () + reports an offense for a fail with ::RuntimeError.new -RuboCop::Cop::Style::EndlessMethod - Ruby >= 3.0 - EnforcedStyle: allow_single_line - registers an offense and corrects for a multiline endless method with begin - does not register an offense for an endless method - does not register an offense for an endless method with arguments - registers an offense and corrects for a multiline endless method - registers an offense and corrects for a multiline endless method with arguments - EnforcedStyle: disallow - registers an offense for an endless method - registers an offense for an endless method with arguments - EnforcedStyle: allow_always - does not register an offense for an endless method with arguments - does not register an offense for a multiline endless method with begin - does not register an offense for a multiline endless method - does not register an offense for an endless method - does not register an offense for a multiline endless method with arguments +RuboCop::Cop::Lint::NoReturnInBeginEndBlocks + accepts a block with no return when using *= + rejects a return statement inside a block when using = + accepts a block with no return when using ||= + accepts a block with no return when using **= + accepts a block with no return when using -= + rejects a return statement inside a block when using *= + rejects a return statement inside a block when using /= + rejects a return statement inside a block when using -= + accepts a block with no return when using = + rejects a return statement inside a block when using ||= + rejects a return statement inside a block when using += + accepts a block with no return when using /= + accepts a block with no return when using += + rejects a return statement inside a block when using **= -RuboCop::Cop::Lint::ToJSON - does not register an offense when using `#to_json` with arguments - registers an offense and corrects using `#to_json` without arguments +RuboCop::Cop::Style::NegatedWhile + does not blow up for empty until condition + autocorrects by replacing while not with until + registers an offense for while with "not" condition + registers an offense for while with exclamation point condition + autocorrects by replacing until not with while + accepts a while where only part of the condition is negated + accepts a while where the condition is doubly negated + does not blow up for empty while condition + registers an offense for until with exclamation point condition -RuboCop::Cop::Style::ConditionalAssignment - counts array assignment when determining multiple assignment - allows assignment using different operators in if else - allows assignment using different operators in if elsif else - autocorrects assignment in if else when the assignment spans multiple lines - allows modifier if inside of if else - allows method calls in if else - doesn't crash with empty braces - allows if elsif else with the same assignment only in if else - allows assignment in multiple branches when it is wrapped in a modifier - doesn't crash when assignment statement uses chars which have special meaning in a regex - registers an offense for assignment in if elsif else - registers an offense in an if else if the assignment is already at the line length limit - allows if elsif else with the same assignment only in if elsif - registers an offense for assignment in unless else - registers an offense for assignment in if then elsif then else - allows assignment of different variables in case when else - registers an offense for assignment in case with when else - allows different assignment types in case with when else - allows aref assignment with different indices in if..else - allows assignment of different variables in if else - registers an offense for assignment in ternary operation using strings - registers an offense for assignment in if elsif elsif else - allows modifier if - allows method calls in conditionals - allows if elsif else with the same assignment only in elsif else - allows assignment to the result of a ternary operation - allows if else without variable assignment - allows assignment using different (method) operators in if..else - registers an offense for assignment in case when then else - behaves like else followed by new conditional without else - allows if elsif else unless - with nested conditionals - does not consider branches of nested ifs - eventually autocorrects all branches - behaves like comparison methods - registers an offense for comparison methods in ternary operations - with end alignment to start_of_line - corrects comparison methods in case when - corrects comparison methods in unless else - corrects comparison methods in if elsif else - >= Ruby 2.7 - corrects comparison methods in case in - with end alignment to keyword - corrects comparison methods in case when - corrects comparison methods in if elsif else - corrects comparison methods in unless else - >= Ruby 2.7 - corrects comparison methods in case in - behaves like all assignment types - for a class variable lval - registers an offense for assignment using **= in ternary - for a instance variable lval - registers an offense for assignment using **= in ternary - for a global variable lval - registers an offense for assignment using **= in ternary - for a local variable lval - registers an offense for assignment using **= in ternary - with end alignment to start_of_line - for a instance variable lval - registers an offense for assignment using **= in if else - registers an offense for assignment using **= in case when - for a constant lval - registers an offense for assignment using **= in if else - registers an offense for assignment using **= in case when - for a global variable lval - registers an offense for assignment using **= in case when - registers an offense for assignment using **= in if else - for a local variable lval - registers an offense for assignment using **= in if else - registers an offense for assignment using **= in case when - for a class variable lval - registers an offense for assignment using **= in if else - registers an offense for assignment using **= in case when - for a constant lval - registers an offense for assignment using **= in ternary - with end alignment to keyword - for a local variable lval - registers an offense for assignment using **= in case when - registers an offense for assignment using **= in if else - for a instance variable lval - registers an offense for assignment using **= in if else - registers an offense for assignment using **= in case when - for a global variable lval - registers an offense for assignment using **= in case when - registers an offense for assignment using **= in if else - for a class variable lval - registers an offense for assignment using **= in if else - registers an offense for assignment using **= in case when - for a constant lval - registers an offense for assignment using **= in case when - registers an offense for assignment using **= in if else - behaves like else followed by new conditional without else - allows if elsif else if - behaves like all assignment types - for a global variable lval - registers an offense for assignment using ^= in ternary - for a instance variable lval - registers an offense for assignment using ^= in ternary - for a local variable lval - registers an offense for assignment using ^= in ternary - for a class variable lval - registers an offense for assignment using ^= in ternary - for a constant lval - registers an offense for assignment using ^= in ternary - with end alignment to start_of_line - for a global variable lval - registers an offense for assignment using ^= in if else - registers an offense for assignment using ^= in case when - for a local variable lval - registers an offense for assignment using ^= in case when - registers an offense for assignment using ^= in if else - for a constant lval - registers an offense for assignment using ^= in case when - registers an offense for assignment using ^= in if else - for a class variable lval - registers an offense for assignment using ^= in case when - registers an offense for assignment using ^= in if else - for a instance variable lval - registers an offense for assignment using ^= in if else - registers an offense for assignment using ^= in case when - with end alignment to keyword - for a local variable lval - registers an offense for assignment using ^= in case when - registers an offense for assignment using ^= in if else - for a constant lval - registers an offense for assignment using ^= in case when - registers an offense for assignment using ^= in if else - for a global variable lval - registers an offense for assignment using ^= in if else - registers an offense for assignment using ^= in case when - for a class variable lval - registers an offense for assignment using ^= in case when - registers an offense for assignment using ^= in if else - for a instance variable lval - registers an offense for assignment using ^= in case when - registers an offense for assignment using ^= in if else - behaves like all assignment types - for a class variable lval - registers an offense for assignment using << in ternary - for a local variable lval - registers an offense for assignment using << in ternary - with end alignment to start_of_line - for a local variable lval - registers an offense for assignment using << in case when - registers an offense for assignment using << in if else - for a global variable lval - registers an offense for assignment using << in if else - registers an offense for assignment using << in case when - for a constant lval - registers an offense for assignment using << in case when - registers an offense for assignment using << in if else - for a class variable lval - registers an offense for assignment using << in if else - registers an offense for assignment using << in case when - for a instance variable lval - registers an offense for assignment using << in case when - registers an offense for assignment using << in if else - for a constant lval - registers an offense for assignment using << in ternary - with end alignment to keyword - for a constant lval - registers an offense for assignment using << in case when - registers an offense for assignment using << in if else - for a class variable lval - registers an offense for assignment using << in case when - registers an offense for assignment using << in if else - for a local variable lval - registers an offense for assignment using << in case when - registers an offense for assignment using << in if else - for a instance variable lval - registers an offense for assignment using << in if else - registers an offense for assignment using << in case when - for a global variable lval - registers an offense for assignment using << in case when - registers an offense for assignment using << in if else - for a instance variable lval - registers an offense for assignment using << in ternary - for a global variable lval - registers an offense for assignment using << in ternary - behaves like all variable types - allows assignment to the return of a ternary - allows assignment to the return of case when - allows assignment to the return of if else - registers an offense assigning any variable type in ternary - registers an offense assigning any variable type in if else - registers an offense assigning any variable type in case when - IncludeTernaryExpressions false - allows assignment in ternary operation - behaves like all variable types - allows assignment to the return of case when - registers an offense assigning any variable type in if else - allows assignment to the return of a ternary - allows assignment to the return of if else - registers an offense assigning any variable type in case when - registers an offense assigning any variable type in ternary - behaves like all variable types - allows assignment to the return of if else - registers an offense assigning any variable type in ternary - allows assignment to the return of a ternary - registers an offense assigning any variable type in if else - allows assignment to the return of case when - registers an offense assigning any variable type in case when - behaves like all assignment types - with end alignment to keyword - for a instance variable lval - registers an offense for assignment using *= in if else - registers an offense for assignment using *= in case when - for a global variable lval - registers an offense for assignment using *= in case when - registers an offense for assignment using *= in if else - for a class variable lval - registers an offense for assignment using *= in case when - registers an offense for assignment using *= in if else - for a local variable lval - registers an offense for assignment using *= in case when - registers an offense for assignment using *= in if else - for a constant lval - registers an offense for assignment using *= in case when - registers an offense for assignment using *= in if else - for a global variable lval - registers an offense for assignment using *= in ternary - with end alignment to start_of_line - for a local variable lval - registers an offense for assignment using *= in if else - registers an offense for assignment using *= in case when - for a global variable lval - registers an offense for assignment using *= in if else - registers an offense for assignment using *= in case when - for a instance variable lval - registers an offense for assignment using *= in case when - registers an offense for assignment using *= in if else - for a class variable lval - registers an offense for assignment using *= in case when - registers an offense for assignment using *= in if else - for a constant lval - registers an offense for assignment using *= in if else - registers an offense for assignment using *= in case when - for a local variable lval - registers an offense for assignment using *= in ternary - for a instance variable lval - registers an offense for assignment using *= in ternary - for a constant lval - registers an offense for assignment using *= in ternary - for a class variable lval - registers an offense for assignment using *= in ternary - behaves like comparison methods - registers an offense for comparison methods in ternary operations - with end alignment to start_of_line - corrects comparison methods in unless else - corrects comparison methods in case when - corrects comparison methods in if elsif else - >= Ruby 2.7 - corrects comparison methods in case in - with end alignment to keyword - corrects comparison methods in if elsif else - corrects comparison methods in unless else - corrects comparison methods in case when - >= Ruby 2.7 - corrects comparison methods in case in - behaves like all assignment types - for a constant lval - registers an offense for assignment using %= in ternary - for a instance variable lval - registers an offense for assignment using %= in ternary - with end alignment to keyword - for a class variable lval - registers an offense for assignment using %= in case when - registers an offense for assignment using %= in if else - for a instance variable lval - registers an offense for assignment using %= in if else - registers an offense for assignment using %= in case when - for a local variable lval - registers an offense for assignment using %= in if else - registers an offense for assignment using %= in case when - for a constant lval - registers an offense for assignment using %= in case when - registers an offense for assignment using %= in if else - for a global variable lval - registers an offense for assignment using %= in case when - registers an offense for assignment using %= in if else - for a class variable lval - registers an offense for assignment using %= in ternary - for a global variable lval - registers an offense for assignment using %= in ternary - for a local variable lval - registers an offense for assignment using %= in ternary - with end alignment to start_of_line - for a global variable lval - registers an offense for assignment using %= in if else - registers an offense for assignment using %= in case when - for a class variable lval - registers an offense for assignment using %= in case when - registers an offense for assignment using %= in if else - for a constant lval - registers an offense for assignment using %= in case when - registers an offense for assignment using %= in if else - for a instance variable lval - registers an offense for assignment using %= in if else - registers an offense for assignment using %= in case when - for a local variable lval - registers an offense for assignment using %= in if else - registers an offense for assignment using %= in case when - behaves like all variable types - registers an offense assigning any variable type in case when - allows assignment to the return of if else - registers an offense assigning any variable type in if else - registers an offense assigning any variable type in ternary - allows assignment to the return of a ternary - allows assignment to the return of case when - configured to check conditions with multiple statements - allows assignment in multiple branches when it is wrapped in a modifier - registers an offense for multiple assignment when an earlier assignment is is protected by a modifier - assignment as the last statement - registers an offense in unless else with more than variable assignment - registers offense for multiple assignments in case when with multiple whens - registers an offense in if elsif else with some branches only containing variable assignment and others containing more than variable assignment - registers offense for multiple assignment in if elsif elsif else - registers an offense in if elsif else with more than variable assignment - registers an offense for multiple assignment in if elsif else - registers an offense in if else with more than variable assignment - registers offense for multiple assignments in case when with only one when - registers offense for multiple assignment in unless else - registers an offense in case when else with more than variable assignment - register an offense for multiple assignment in if else - multiple assignment in only one branch - registers an offense when multiple assignment is in if - registers an offense when multiple assignment is in elsif - registers an offense when multiple assignment is in else - behaves like allows out of order multiple assignment in if elsif else - allows out of order multiple assignment in if elsif else - autocorrect - corrects multiple assignment in if else - corrects multiple assignment in case when with multiple whens - corrects multiple assignment in unless else - corrects multiple assignment in case when - corrects multiple assignment in if elsif else - corrects assignment in an if statement that is nested in unless else - corrects multiple assignment in if elsif else with multiple elsifs - behaves like all assignment types - with end alignment to keyword - for a constant lval - registers an offense for assignment using ||= in if else - registers an offense for assignment using ||= in case when - for a class variable lval - registers an offense for assignment using ||= in if else - registers an offense for assignment using ||= in case when - for a global variable lval - registers an offense for assignment using ||= in if else - registers an offense for assignment using ||= in case when - for a instance variable lval - registers an offense for assignment using ||= in case when - registers an offense for assignment using ||= in if else - for a local variable lval - registers an offense for assignment using ||= in case when - registers an offense for assignment using ||= in if else - for a instance variable lval - registers an offense for assignment using ||= in ternary - for a local variable lval - registers an offense for assignment using ||= in ternary - with end alignment to start_of_line - for a class variable lval - registers an offense for assignment using ||= in if else - registers an offense for assignment using ||= in case when - for a instance variable lval - registers an offense for assignment using ||= in if else - registers an offense for assignment using ||= in case when - for a constant lval - registers an offense for assignment using ||= in if else - registers an offense for assignment using ||= in case when - for a global variable lval - registers an offense for assignment using ||= in case when - registers an offense for assignment using ||= in if else - for a local variable lval - registers an offense for assignment using ||= in if else - registers an offense for assignment using ||= in case when - for a constant lval - registers an offense for assignment using ||= in ternary - for a global variable lval - registers an offense for assignment using ||= in ternary - for a class variable lval - registers an offense for assignment using ||= in ternary - behaves like all assignment types - with end alignment to keyword - for a instance variable lval - registers an offense for assignment using <<= in case when - registers an offense for assignment using <<= in if else - for a global variable lval - registers an offense for assignment using <<= in if else - registers an offense for assignment using <<= in case when - for a local variable lval - registers an offense for assignment using <<= in if else - registers an offense for assignment using <<= in case when - for a constant lval - registers an offense for assignment using <<= in case when - registers an offense for assignment using <<= in if else - for a class variable lval - registers an offense for assignment using <<= in if else - registers an offense for assignment using <<= in case when - for a constant lval - registers an offense for assignment using <<= in ternary - for a instance variable lval - registers an offense for assignment using <<= in ternary - for a local variable lval - registers an offense for assignment using <<= in ternary - with end alignment to start_of_line - for a instance variable lval - registers an offense for assignment using <<= in if else - registers an offense for assignment using <<= in case when - for a local variable lval - registers an offense for assignment using <<= in if else - registers an offense for assignment using <<= in case when - for a class variable lval - registers an offense for assignment using <<= in if else - registers an offense for assignment using <<= in case when - for a constant lval - registers an offense for assignment using <<= in if else - registers an offense for assignment using <<= in case when - for a global variable lval - registers an offense for assignment using <<= in case when - registers an offense for assignment using <<= in if else - for a global variable lval - registers an offense for assignment using <<= in ternary - for a class variable lval - registers an offense for assignment using <<= in ternary - behaves like all assignment types - with end alignment to keyword - for a local variable lval - registers an offense for assignment using = in if else - registers an offense for assignment using = in case when - for a class variable lval - registers an offense for assignment using = in case when - registers an offense for assignment using = in if else - for a constant lval - registers an offense for assignment using = in if else - registers an offense for assignment using = in case when - for a global variable lval - registers an offense for assignment using = in case when - registers an offense for assignment using = in if else - for a instance variable lval - registers an offense for assignment using = in case when - registers an offense for assignment using = in if else - for a global variable lval - registers an offense for assignment using = in ternary - with end alignment to start_of_line - for a global variable lval - registers an offense for assignment using = in case when - registers an offense for assignment using = in if else - for a constant lval - registers an offense for assignment using = in case when - registers an offense for assignment using = in if else - for a class variable lval - registers an offense for assignment using = in case when - registers an offense for assignment using = in if else - for a instance variable lval - registers an offense for assignment using = in case when - registers an offense for assignment using = in if else - for a local variable lval - registers an offense for assignment using = in if else - registers an offense for assignment using = in case when - for a class variable lval - registers an offense for assignment using = in ternary - for a instance variable lval - registers an offense for assignment using = in ternary - for a constant lval - registers an offense for assignment using = in ternary - for a local variable lval - registers an offense for assignment using = in ternary - behaves like comparison methods - registers an offense for comparison methods in ternary operations - with end alignment to keyword - corrects comparison methods in unless else - corrects comparison methods in if elsif else - corrects comparison methods in case when - >= Ruby 2.7 - corrects comparison methods in case in - with end alignment to start_of_line - corrects comparison methods in if elsif else - corrects comparison methods in case when - corrects comparison methods in unless else - >= Ruby 2.7 - corrects comparison methods in case in - empty branch - allows an empty when branch with an else - allows assignment in unless without an else - allows an empty if statement - allows assignment in if without an else - allows if elsif without else - allows case with an empty else - allows an empty elsif statement - allows assignment in case when without an else - autocorrect - preserves comments during correction in case when else - corrects assignment to unbracketed array in if else - preserves comments during correction in if else - corrects =~ in ternary operations - constant assignment - corrects if..else with namespaced constant - corrects if..else with top-level constant - multiple assignment - does not register an offense in if else - does not register an offense in case when - aref assignment - corrects if..else - with different indices - doesn't register an offense - self.attribute= assignment - corrects if..else - with different receivers - doesn't register an offense - assignment from a method - corrects unless else - corrects if else - corrects case when - behaves like all assignment types - for a global variable lval - registers an offense for assignment using |= in ternary - for a instance variable lval - registers an offense for assignment using |= in ternary - with end alignment to start_of_line - for a local variable lval - registers an offense for assignment using |= in if else - registers an offense for assignment using |= in case when - for a global variable lval - registers an offense for assignment using |= in if else - registers an offense for assignment using |= in case when - for a constant lval - registers an offense for assignment using |= in if else - registers an offense for assignment using |= in case when - for a class variable lval - registers an offense for assignment using |= in case when - registers an offense for assignment using |= in if else - for a instance variable lval - registers an offense for assignment using |= in if else - registers an offense for assignment using |= in case when - with end alignment to keyword - for a global variable lval - registers an offense for assignment using |= in case when - registers an offense for assignment using |= in if else - for a class variable lval - registers an offense for assignment using |= in if else - registers an offense for assignment using |= in case when - for a instance variable lval - registers an offense for assignment using |= in if else - registers an offense for assignment using |= in case when - for a constant lval - registers an offense for assignment using |= in case when - registers an offense for assignment using |= in if else - for a local variable lval - registers an offense for assignment using |= in case when - registers an offense for assignment using |= in if else - for a class variable lval - registers an offense for assignment using |= in ternary - for a local variable lval - registers an offense for assignment using |= in ternary - for a constant lval - registers an offense for assignment using |= in ternary - behaves like comparison methods - registers an offense for comparison methods in ternary operations - with end alignment to start_of_line - corrects comparison methods in unless else - corrects comparison methods in case when - corrects comparison methods in if elsif else - >= Ruby 2.7 - corrects comparison methods in case in - with end alignment to keyword - corrects comparison methods in case when - corrects comparison methods in unless else - corrects comparison methods in if elsif else - >= Ruby 2.7 - corrects comparison methods in case in - behaves like all variable types - registers an offense assigning any variable type in if else - allows assignment to the return of case when - allows assignment to the return of if else - registers an offense assigning any variable type in case when - registers an offense assigning any variable type in ternary - allows assignment to the return of a ternary - assignment as the last statement - allows multiple assignment in if elsif elsif else - allows assignment in if elsif else with some branches only containing variable assignment and others containing more than variable assignment - allows multiple assignment in if else - allows multiple assignment in if elsif else when the last assignment is the same and the earlier assignments do not appear in all branches - allows multiple assignments in case when if there are uniq variables in the when branches - allows multiple assignment in if elsif else - allows multiple assignment in unless else - allows multiple assignment in case when else when the last assignment is the same and the earlier assignments do not appear in all branches - allows more than variable assignment in if elsif else - allows variable assignment in case when else with more than variable assignment - allows multiple assignments in case when with only one when - allows multiple assignments in case when with multiple whens - allows more than variable assignment in if else - allows multiple assignment in case statements when the last assignment is the same and the earlier assignments do not appear in all branches - allows variable assignment in unless else with more than variable assignment - behaves like allows out of order multiple assignment in if elsif else - allows out of order multiple assignment in if elsif else - multiple assignment in only one branch - allows multiple assignment is in elsif - does not register an offense when multiple assignment is in else - allows multiple assignment is in if - behaves like comparison methods - registers an offense for comparison methods in ternary operations - with end alignment to start_of_line - corrects comparison methods in case when - corrects comparison methods in unless else - corrects comparison methods in if elsif else - >= Ruby 2.7 - corrects comparison methods in case in - with end alignment to keyword - corrects comparison methods in unless else - corrects comparison methods in case when - corrects comparison methods in if elsif else - >= Ruby 2.7 - corrects comparison methods in case in - behaves like all assignment types - for a instance variable lval - registers an offense for assignment using &&= in ternary - for a local variable lval - registers an offense for assignment using &&= in ternary - with end alignment to keyword - for a constant lval - registers an offense for assignment using &&= in case when - registers an offense for assignment using &&= in if else - for a local variable lval - registers an offense for assignment using &&= in case when - registers an offense for assignment using &&= in if else - for a class variable lval - registers an offense for assignment using &&= in case when - registers an offense for assignment using &&= in if else - for a global variable lval - registers an offense for assignment using &&= in if else - registers an offense for assignment using &&= in case when - for a instance variable lval - registers an offense for assignment using &&= in case when - registers an offense for assignment using &&= in if else - for a global variable lval - registers an offense for assignment using &&= in ternary - with end alignment to start_of_line - for a instance variable lval - registers an offense for assignment using &&= in if else - registers an offense for assignment using &&= in case when - for a local variable lval - registers an offense for assignment using &&= in if else - registers an offense for assignment using &&= in case when - for a constant lval - registers an offense for assignment using &&= in case when - registers an offense for assignment using &&= in if else - for a class variable lval - registers an offense for assignment using &&= in case when - registers an offense for assignment using &&= in if else - for a global variable lval - registers an offense for assignment using &&= in if else - registers an offense for assignment using &&= in case when - for a class variable lval - registers an offense for assignment using &&= in ternary - for a constant lval - registers an offense for assignment using &&= in ternary - behaves like all assignment types - with end alignment to keyword - for a instance variable lval - registers an offense for assignment using += in if else - registers an offense for assignment using += in case when - for a global variable lval - registers an offense for assignment using += in if else - registers an offense for assignment using += in case when - for a class variable lval - registers an offense for assignment using += in case when - registers an offense for assignment using += in if else - for a constant lval - registers an offense for assignment using += in if else - registers an offense for assignment using += in case when - for a local variable lval - registers an offense for assignment using += in case when - registers an offense for assignment using += in if else - for a constant lval - registers an offense for assignment using += in ternary - for a global variable lval - registers an offense for assignment using += in ternary - with end alignment to start_of_line - for a local variable lval - registers an offense for assignment using += in if else - registers an offense for assignment using += in case when - for a constant lval - registers an offense for assignment using += in if else - registers an offense for assignment using += in case when - for a global variable lval - registers an offense for assignment using += in case when - registers an offense for assignment using += in if else - for a class variable lval - registers an offense for assignment using += in case when - registers an offense for assignment using += in if else - for a instance variable lval - registers an offense for assignment using += in if else - registers an offense for assignment using += in case when - for a local variable lval - registers an offense for assignment using += in ternary - for a instance variable lval - registers an offense for assignment using += in ternary - for a class variable lval - registers an offense for assignment using += in ternary - behaves like all variable types - allows assignment to the return of case when - allows assignment to the return of a ternary - allows assignment to the return of if else - registers an offense assigning any variable type in case when - registers an offense assigning any variable type in if else - registers an offense assigning any variable type in ternary - correction would exceed max line length - allows assignment to the same variable in if else if the correction would cause the condition to exceed the configured LineLength - allows assignment to the same variable in if else if the correction would create a line longer than the configured LineLength - allows assignment to the same variable in case when else if the correction would create a line longer than the configured LineLength - behaves like all assignment types - with end alignment to start_of_line - for a local variable lval - registers an offense for assignment using >>= in case when - registers an offense for assignment using >>= in if else - for a instance variable lval - registers an offense for assignment using >>= in case when - registers an offense for assignment using >>= in if else - for a constant lval - registers an offense for assignment using >>= in if else - registers an offense for assignment using >>= in case when - for a class variable lval - registers an offense for assignment using >>= in case when - registers an offense for assignment using >>= in if else - for a global variable lval - registers an offense for assignment using >>= in if else - registers an offense for assignment using >>= in case when - for a class variable lval - registers an offense for assignment using >>= in ternary - with end alignment to keyword - for a class variable lval - registers an offense for assignment using >>= in if else - registers an offense for assignment using >>= in case when - for a instance variable lval - registers an offense for assignment using >>= in if else - registers an offense for assignment using >>= in case when - for a global variable lval - registers an offense for assignment using >>= in case when - registers an offense for assignment using >>= in if else - for a constant lval - registers an offense for assignment using >>= in case when - registers an offense for assignment using >>= in if else - for a local variable lval - registers an offense for assignment using >>= in if else - registers an offense for assignment using >>= in case when - for a global variable lval - registers an offense for assignment using >>= in ternary - for a constant lval - registers an offense for assignment using >>= in ternary - for a instance variable lval - registers an offense for assignment using >>= in ternary - for a local variable lval - registers an offense for assignment using >>= in ternary - EndAlignment configured to start_of_line - autocorrect - uses proper end alignment in case - uses proper end alignment in if - uses proper end alignment in unless - behaves like comparison methods - registers an offense for comparison methods in ternary operations - with end alignment to start_of_line - corrects comparison methods in unless else - corrects comparison methods in case when - corrects comparison methods in if elsif else - >= Ruby 2.7 - corrects comparison methods in case in - with end alignment to keyword - corrects comparison methods in if elsif else - corrects comparison methods in unless else - corrects comparison methods in case when - >= Ruby 2.7 - corrects comparison methods in case in - behaves like all assignment types - for a global variable lval - registers an offense for assignment using /= in ternary - for a constant lval - registers an offense for assignment using /= in ternary - for a local variable lval - registers an offense for assignment using /= in ternary - for a instance variable lval - registers an offense for assignment using /= in ternary - with end alignment to start_of_line - for a constant lval - registers an offense for assignment using /= in case when - registers an offense for assignment using /= in if else - for a instance variable lval - registers an offense for assignment using /= in if else - registers an offense for assignment using /= in case when - for a local variable lval - registers an offense for assignment using /= in case when - registers an offense for assignment using /= in if else - for a class variable lval - registers an offense for assignment using /= in case when - registers an offense for assignment using /= in if else - for a global variable lval - registers an offense for assignment using /= in if else - registers an offense for assignment using /= in case when - for a class variable lval - registers an offense for assignment using /= in ternary - with end alignment to keyword - for a constant lval - registers an offense for assignment using /= in if else - registers an offense for assignment using /= in case when - for a class variable lval - registers an offense for assignment using /= in case when - registers an offense for assignment using /= in if else - for a local variable lval - registers an offense for assignment using /= in case when - registers an offense for assignment using /= in if else - for a global variable lval - registers an offense for assignment using /= in case when - registers an offense for assignment using /= in if else - for a instance variable lval - registers an offense for assignment using /= in if else - registers an offense for assignment using /= in case when - behaves like all assignment types - for a global variable lval - registers an offense for assignment using -= in ternary - for a local variable lval - registers an offense for assignment using -= in ternary - with end alignment to start_of_line - for a instance variable lval - registers an offense for assignment using -= in case when - registers an offense for assignment using -= in if else - for a local variable lval - registers an offense for assignment using -= in case when - registers an offense for assignment using -= in if else - for a constant lval - registers an offense for assignment using -= in if else - registers an offense for assignment using -= in case when - for a class variable lval - registers an offense for assignment using -= in case when - registers an offense for assignment using -= in if else - for a global variable lval - registers an offense for assignment using -= in case when - registers an offense for assignment using -= in if else - for a instance variable lval - registers an offense for assignment using -= in ternary - with end alignment to keyword - for a global variable lval - registers an offense for assignment using -= in if else - registers an offense for assignment using -= in case when - for a constant lval - registers an offense for assignment using -= in case when - registers an offense for assignment using -= in if else - for a instance variable lval - registers an offense for assignment using -= in case when - registers an offense for assignment using -= in if else - for a class variable lval - registers an offense for assignment using -= in case when - registers an offense for assignment using -= in if else - for a local variable lval - registers an offense for assignment using -= in case when - registers an offense for assignment using -= in if else - for a constant lval - registers an offense for assignment using -= in ternary - for a class variable lval - registers an offense for assignment using -= in ternary - behaves like comparison methods - registers an offense for comparison methods in ternary operations - with end alignment to start_of_line - corrects comparison methods in unless else - corrects comparison methods in case when - corrects comparison methods in if elsif else - >= Ruby 2.7 - corrects comparison methods in case in - with end alignment to keyword - corrects comparison methods in unless else - corrects comparison methods in if elsif else - corrects comparison methods in case when - >= Ruby 2.7 - corrects comparison methods in case in - behaves like all variable types - registers an offense assigning any variable type in case when - registers an offense assigning any variable type in if else - allows assignment to the return of case when - allows assignment to the return of a ternary - allows assignment to the return of if else - registers an offense assigning any variable type in ternary - for if elsif else if else - autocorrects the outer offense later - autocorrects the inner offense first - behaves like comparison methods - registers an offense for comparison methods in ternary operations - with end alignment to keyword - corrects comparison methods in if elsif else - corrects comparison methods in case when - corrects comparison methods in unless else - >= Ruby 2.7 - corrects comparison methods in case in - with end alignment to start_of_line - corrects comparison methods in unless else - corrects comparison methods in case when - corrects comparison methods in if elsif else - >= Ruby 2.7 - corrects comparison methods in case in - behaves like comparison methods - registers an offense for comparison methods in ternary operations - with end alignment to keyword - corrects comparison methods in unless else - corrects comparison methods in if elsif else - corrects comparison methods in case when - >= Ruby 2.7 - corrects comparison methods in case in - with end alignment to start_of_line - corrects comparison methods in case when - corrects comparison methods in unless else - corrects comparison methods in if elsif else - >= Ruby 2.7 - corrects comparison methods in case in - behaves like all assignment types - for a local variable lval - registers an offense for assignment using &= in ternary - for a class variable lval - registers an offense for assignment using &= in ternary - for a instance variable lval - registers an offense for assignment using &= in ternary - with end alignment to start_of_line - for a local variable lval - registers an offense for assignment using &= in if else - registers an offense for assignment using &= in case when - for a global variable lval - registers an offense for assignment using &= in case when - registers an offense for assignment using &= in if else - for a class variable lval - registers an offense for assignment using &= in case when - registers an offense for assignment using &= in if else - for a constant lval - registers an offense for assignment using &= in if else - registers an offense for assignment using &= in case when - for a instance variable lval - registers an offense for assignment using &= in if else - registers an offense for assignment using &= in case when - for a constant lval - registers an offense for assignment using &= in ternary - with end alignment to keyword - for a instance variable lval - registers an offense for assignment using &= in if else - registers an offense for assignment using &= in case when - for a constant lval - registers an offense for assignment using &= in if else - registers an offense for assignment using &= in case when - for a global variable lval - registers an offense for assignment using &= in if else - registers an offense for assignment using &= in case when - for a local variable lval - registers an offense for assignment using &= in case when - registers an offense for assignment using &= in if else - for a class variable lval - registers an offense for assignment using &= in if else - registers an offense for assignment using &= in case when - for a global variable lval - registers an offense for assignment using &= in ternary - behaves like comparison methods - registers an offense for comparison methods in ternary operations - with end alignment to start_of_line - corrects comparison methods in case when - corrects comparison methods in if elsif else - corrects comparison methods in unless else - >= Ruby 2.7 - corrects comparison methods in case in - with end alignment to keyword - corrects comparison methods in if elsif else - corrects comparison methods in unless else - corrects comparison methods in case when - >= Ruby 2.7 - corrects comparison methods in case in +RuboCop::Cop::Style::AccessModifierDeclarations + when `inline` is configured + does not offend when private is inlined with a symbol + registers an offense for correct + multiple opposite styles of #{access_modifier} usage + does not offend when module_function is inlined with a symbol + offends when protected is not inlined + accepts when #{access_modifier} is a hash literal value + registers an offense for correct + multiple opposite styles of #{access_modifier} usage + offends when protected is not inlined and has a comment + offends when private is not inlined + does not offend when protected is inlined with a method + does not offend when public is inlined with a symbol + does not offend when module_function is inlined with a method + registers an offense for correct + multiple opposite styles of #{access_modifier} usage + accepts when #{access_modifier} is a hash literal value + does not offend when public is inlined with a method + registers an offense for correct + multiple opposite styles of #{access_modifier} usage + offends when public is not inlined + offends when module_function is not inlined + accepts when #{access_modifier} is a hash literal value + accepts when #{access_modifier} is a hash literal value + offends when module_function is not inlined and has a comment + does not offend when protected is inlined with a symbol + does not offend when private is inlined with a method + offends when private is not inlined and has a comment + offends when public is not inlined and has a comment + when methods are modified by group modifier + registers and autocorrects an offense + when methods are modified by group modifier + registers and autocorrects an offense + allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + do not allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + when methods are modified by group modifier + registers and autocorrects an offense + allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + do not allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + when methods are modified by group modifier + registers and autocorrects an offense + allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + do not allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + do not allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + when `group` is configured + registers an offense for correct + multiple opposite styles of #{access_modifier} usage + does not offend when protected is not inlined + registers an offense for correct + multiple opposite styles of #{access_modifier} usage + does not registers an offense when using #{access_modifier} in a block + does not offend when private is not inlined and has a comment + accepts when #{access_modifier} is a hash literal value + accepts when #{access_modifier} is a hash literal value + registers an offense for correct + multiple opposite styles of #{access_modifier} usage + offends when private is inlined with a method + does not registers an offense when using #{access_modifier} in a block + does not offend when module_function is not inlined + does not offend when private is not inlined + registers an offense for correct + multiple opposite styles of #{access_modifier} usage + does not offend when module_function is not inlined and has a comment + does not registers an offense when using #{access_modifier} in a block + does not offend when public is not inlined + accepts when using only #{access_modifier} + offends when protected is inlined with a method + accepts when #{access_modifier} is a hash literal value + offends when public is inlined with a method + does not offend when public is not inlined and has a comment + accepts when using only #{access_modifier} + does not offend when protected is not inlined and has a comment + accepts when using only #{access_modifier} + offends when module_function is inlined with a method + accepts when #{access_modifier} is a hash literal value + does not registers an offense when using #{access_modifier} in a block + accepts when using only #{access_modifier} + allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + when non-existent method is modified by inline modifier with disallowed symbol + registers an offense but does not autocorrect it + when method is modified by inline modifier with disallowed symbol + registers and autocorrects an offense + allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + when method is modified by inline modifier where group modifier already exists + registers and autocorrects an offense + when method is modified by inline modifier + registers and autocorrects an offense + when method is modified by inline modifier where group modifier already exists + registers and autocorrects an offense + do not allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + when method is modified by inline modifier + registers and autocorrects an offense + do not allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + do not allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + when method is modified by inline modifier with disallowed symbol + registers and autocorrects an offense + when non-existent method is modified by inline modifier with disallowed symbol + registers an offense but does not autocorrect it + allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + when method is modified by inline modifier with disallowed symbol + registers and autocorrects an offense + do not allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + when method is modified by inline modifier + registers and autocorrects an offense + when method is modified by inline modifier + registers and autocorrects an offense + when method is modified by inline modifier where group modifier already exists + registers and autocorrects an offense + when method has comments + registers and autocorrects an offense + when method is modified by inline modifier with disallowed symbol + registers and autocorrects an offense + when method has comments + registers and autocorrects an offense + allow access modifiers on symbols + accepts when argument to #{access_modifier} is a symbol + when non-existent method is modified by inline modifier with disallowed symbol + registers an offense but does not autocorrect it + when method is modified by inline modifier where group modifier already exists + registers and autocorrects an offense + when non-existent method is modified by inline modifier with disallowed symbol + registers an offense but does not autocorrect it + when method has comments + registers and autocorrects an offense + when method has comments + registers and autocorrects an offense -RuboCop::Cop::Lint::RescueException - does not register an offense for rescue with other class - registers an offense for rescue with Exception => e - does not register an offense for rescue with a module prefix - registers an offense for rescue from Exception - does not crash when the namespace of a rescued class is in a local variable - registers an offense for rescue with ::Exception - does not register an offense for rescue with other classes - does not register an offense for rescue with no class - does not crash when the splat operator is used in a rescue - does not register an offense for rescue with no class and => e - registers an offense for rescue with StandardError, Exception +RuboCop::Cop::Lint::UselessRuby2Keywords + when `ruby2_keywords` is given a `def` node + registers an offense for a method with a `restarg` and `kwoptarg` + registers an offense for a method with only keyword args + registers an offense for a method with only positional args + registers an offense for a method with a `restarg` and keyword args + does not register an offense for a method with a `restarg` other positional args + registers an offense for a method with only `kwrestarg` + registers an offense for a method without arguments + does not register an offense for a method with a `restarg` and no `kwrestarg` + does not register an offense for a method with a `restarg` other optional args + does not register an offense for a method with a `restarg` and `blockarg` + registers an offense for a method with a `restarg` and `kwrestarg` + when `ruby2_keywords` is given a symbol + does not register an offense for an allowed def + does not register an offense when there is no `def` + registers an offense for an unnecessary `ruby2_keywords` + does not register an offense when the `def` is at a different depth + with a dynamically defined method + registers an offense for an unnecessary `ruby2_keywords` + does not register an offense when the method has a `restarg` and a `shadowarg` + registers an offense for a numblock + does not register an offense for an allowed `ruby2_keywords` + registers an offense when the method has a `shadowarg` -RuboCop::Cop::Style::EmptyMethod - when configured with compact style - with an empty instance method definition - registers an offense for method with arguments - registers an offense for method with closing paren on following line - registers an offense for empty method - registers an offense for method with blank line - registers an offense for method with arguments without parens - allows single line method - with an empty class method definition - registers an offense for method with blank line - allows single line method - registers an offense for empty method with arguments - registers an offense for empty method - with a non-empty instance method definition - allows multi line method - allows multi line method with comment - allows single line method - with a non-empty class method definition - allows multi line method - allows multi line method with comment - allows single line method - relation with Layout/LineLength - when the correction would exceed the configured maximum - reports an offense but does not correct - when that cop is disabled - corrects to long lines - when configured with expanded style - with an empty class method definition - allows multi line method with a blank line - allows empty multi line method - registers an offense for single line method - when method is nested in class scope - registers an offense for single line method - with a non-empty class method definition - allows multi line method with comment - allows single line method - allows multi line method - relation with Layout/LineLength - still corrects even if the method is longer than the configured Max - with an empty instance method definition - allows multi line method - registers an offense for single line method - allows multi line method with blank line - with a non-empty instance method definition - allows single line method - allows multi line method with a comment - allows multi line method +RuboCop::Cop::Layout::SpaceInsideRangeLiteral + accepts no space inside .. literal + accepts no space inside ... literal + accepts complex range literal with space in it + registers an offense in multiline range literal with space in it + accepts multiline range literal with no space in it + registers an offense for space inside .. literal + registers an offense for space inside ... literal -RuboCop::Cop::Style::ParenthesesAroundCondition - does not register an offense when parentheses in multiple expressions separated by semicolon - allows parens if the condition node is a modifier while op - does not blow up for empty unless condition - allows parens if the condition node is a modifier unless op - does not blow up when the condition is a ternary op - accepts parentheses around condition in a ternary - registers an offense for parentheses around condition - allows parens if the condition node is a modifier until op - does not blow up for empty if condition - accepts parentheses if there is no space between the keyword and (. - is not confused by leading parentheses in subexpression - is not confused by parentheses in subexpression - allows parens if the condition node is a modifier if op - allows parens if the condition node is a modifier rescue op - parentheses in multiline conditions are not allowed - registers an offense for parentheses around multiline condition - safe assignment is not allowed - does not accept element assignment in condition surrounded with parentheses - does not accept variable assignment in condition surrounded with parentheses - parentheses in multiline conditions are allowed - accepts parentheses around multiline condition - registers an offense for parentheses in single line condition - safe assignment is allowed - accepts variable assignment in condition surrounded with parentheses - accepts setter in condition surrounded with parentheses - accepts element assignment in condition surrounded with parentheses +RuboCop::Cop::Style::RedundantAssignment + accepts empty method body + reports an offense for def ending with assignment and returning + does not register an offense when ensure block present + accepts empty if body + accepts empty when nodes + when inside begin-end body + registers an offense and autocorrects + when rescue blocks present + registers an offense and autocorrects when inside function or rescue block + when inside a when-branch + registers an offense and autocorrects + when inside an if-branch + registers an offense and autocorrects -RuboCop::Cop::Style::NestedParenthesizedCalls - on a deeply nested argument - doesn't register an offense - on a nested, parenthesized method call - doesn't register an offense - on a non-parenthesized call nested in a parenthesized one - with a single argument to the nested call - registers an offense - when using safe navigation operator - registers an offense - with multiple arguments to the nested call - registers an offense - on an aref, nested in a parenthesized method call - doesn't register an offense - on a permitted method - doesn't register an offense - on a non-parenthesized method call - doesn't register an offense - backslash newline in method call +RuboCop::Cop::Lint::DeprecatedClassMethods + prefer `Dir.exist?` over `Dir.exists?` + does not register an offense for Dir.exist? + registers an offense and corrects ::Dir.exists? + does not register an offense for offensive method `exists?`on other receivers + registers an offense and corrects Dir.exists? + when using `ENV.freeze` + does not register an offense for method calls to `ENV` other than `freeze` registers an offense - on a call to a setter method - doesn't register an offense - on a method call with no arguments - doesn't register an offense - on a call with no arguments, nested in a parenthesized one - doesn't register an offense - -RuboCop::Cop::Style::RedundantFileExtensionInRequire - does not register an offense when requiring filename ending with `.so` - does not register an offense when requiring filename without an extension - does not register an offense when requiring variable as a filename - registers an offense and corrects when requiring filename ending with `.rb` - -RuboCop::Cop::Style::ZeroLengthPredicate - with collection variables - registers an offense for `collection.size != 0` - registers an offense for `0 == collection.size` - registers an offense for `collection.size == 0` - registers an offense for `0 != collection.size` - with strings - registers an offense for `string.size != 0` - registers an offense for `0 != string.size` - registers an offense for `string.size == 0` - registers an offense for `0 == string.size` - with hashes - registers an offense for `0 != hash.size` - registers an offense for `0 == hash.size - registers an offense for `hash.size == 0` - registers an offense for `hash.size != 0` - when name of the variable is `size` or `length` - accepts inequality check - accepts comparison - accepts equality check - when inspecting a StringIO object - when initialized with a string - does not register an offense with top-level ::StringIO - does not register an offense - when initialized without arguments - does not register an offense with top-level ::StringIO - does not register an offense - with arrays - registers an offense for `array.length != 0` - registers an offense for `0 != array.length` - registers an offense for `0 != array.size` - registers an offense for `1 > array.length` - registers an offense for `array.size != 0` - registers an offense for `1 > array.size` - registers an offense for `array.length > 0` - registers an offense for `array.length < 1` - registers an offense for `0 == array.length` - registers an offense for `array.size == 0` - registers an offense for `0 < array.size` - registers an offense for `array.size > 0` - registers an offense for `0 < array.length - registers an offense for `0 == array.size` - registers an offense for `array.length == 0` - registers an offense for `array.size < 1` - when inspecting a File::Stat object - does not register an offense - does not register an offense with ::File - when inspecting a Tempfile object - does not register an offense - does not register an offense with top-level ::Tempfile - -RuboCop::Cop::Lint::FlipFlop - registers an offense for exclusive flip-flops - registers an offense for inclusive flip-flops - -RuboCop::Cop::Lint::UnmodifiedReduceAccumulator - behaves like reduce/inject - does not affect inject called with no block args - does not affect inject called without a block - given a inject block - does not register an offense when returning the accumulator in a boolean statement - does not register an offense when returning the accumulator - does not register an offense when calling a method on the accumulator with the element - registers an offense for values returned with `next` - does not register an offense if the return value cannot be determined - registers an offense when returning an index setter on the accumulator - registers an offense with the element in interpolation - registers an offense when returning an index of the accumulator - does not register an offense when or-assigning the accumulator - does not look inside inner blocks - does not register an offense when mutating the element with the accumulator - does not register an offense when op-assigning the accumulator - registers an offense with the element in heredoc - does not register an offense with the accumulator in interpolation - registers an offense when returning accumulator[element]= - does not register an offense with the accumulator in heredoc - registers an offense when returning an expression with the element - does not register an offense when mutating the element with the another value - registers an offense when called with no argument - registers an offense for every violating return value - does not register an offense when assigning the accumulator - does not register an offense when returning a method called with the accumulator - does not register an offense when returning a method called on the accumulator - allows break with no value - does not register an offense when shovelling the accumulator - does not register an offense when returning a literal - allows the element to be the return value if the accumulator is returned in any branch - registers an offense when mutating the accumulator with the element but not returning it - registers an offense for values returned with `break` - does not register an offense when returning accumulator[element] - registers an offense when returning the element - does not register an offense when and-assigning the accumulator - does not register an offense when comparing - does not register an offense when returning the accumulator in an expression - argument count - ignores when there are not enough block arguments - registers an offense when there are more than two arguments but the element is returned - ignores when there is a splat argument - numblocks - does not register an offense when when returning the accumulator - registers an offense when returning the element - behaves like reduce/inject - does not affect reduce called with no block args - does not affect reduce called without a block - given a reduce block - does not register an offense when comparing - does not register an offense with the accumulator in interpolation - does not register an offense when returning the accumulator - does not register an offense when shovelling the accumulator - registers an offense when mutating the accumulator with the element but not returning it - allows the element to be the return value if the accumulator is returned in any branch - does not register an offense when returning a method called with the accumulator - does not register an offense when assigning the accumulator - does not register an offense when op-assigning the accumulator - registers an offense with the element in heredoc - does not register an offense when returning the accumulator in an expression - does not register an offense when returning the accumulator in a boolean statement - does not register an offense when returning accumulator[element] - registers an offense for values returned with `next` - does not register an offense when returning a method called on the accumulator - does not look inside inner blocks - registers an offense for every violating return value - registers an offense with the element in interpolation - allows break with no value - registers an offense when returning accumulator[element]= - does not register an offense with the accumulator in heredoc - does not register an offense when mutating the element with the accumulator - does not register an offense when or-assigning the accumulator - registers an offense for values returned with `break` - does not register an offense when mutating the element with the another value - does not register an offense if the return value cannot be determined - registers an offense when returning an index setter on the accumulator - registers an offense when returning an expression with the element - does not register an offense when returning a literal - does not register an offense when calling a method on the accumulator with the element - registers an offense when returning the element - registers an offense when returning an index of the accumulator - registers an offense when called with no argument - does not register an offense when and-assigning the accumulator - argument count - ignores when there are not enough block arguments - ignores when there is a splat argument - registers an offense when there are more than two arguments but the element is returned - numblocks - registers an offense when returning the element - does not register an offense when when returning the accumulator + when using `ENV.clone` + registers an offense + does not register an offense for method calls to `ENV` other than `clone` + prefer `Addrinfo#getaddrinfo` over `Socket.gethostbyname` + registers an offense for ::Socket.gethostbyname + registers an offense for Socket.gethostbyname + does not register an offense for method `gethostbyname` on other receivers + when using `ENV.dup` + registers an offense + does not register an offense for method calls to `ENV` other than `dup` + prefer `File.exist?` over `File.exists?` + does not register an offense for File.exist? + registers an offense and corrects ::File.exists? + registers an offense and corrects File.exists? + prefer `block_given?` over `iterator?` + registers an offense and corrects iterator? + does not register an offense for offensive method `iterator?`on other receivers + does not register an offense for block_given? + prefer `Addrinfo#getnameinfo` over `Socket.gethostbyaddr` + registers an offense for Socket.gethostbyaddr + does not register an offense for method `gethostbyaddr` on other receivers + registers an offense for ::Socket.gethostbyaddr -RuboCop::Cop::VariableForce::Scope - .new - when begin node is passed - accepts that as top level scope - when lvasgn node is passed - accepts that as top level scope - #include? - with ancestor node the scope does not include - is expected to equal false - with descendant node the scope does not include - is expected to equal false - with child node the scope does not include - is expected to equal false - with node of the scope itself - is expected to equal false - with child node the scope includes - is expected to equal true - #body_node - when the scope is instance method - returns the body node - when the scope is module - returns the body node - when the scope is top level - returns the body node - when the scope is block - returns the body node - when the scope is singleton method - returns the body node - when the scope is class - returns the body node - when the scope is singleton class - returns the body node - #name - when the scope is singleton method definition - returns the method name - when the scope is instance method definition - returns the method name - #each_node - outer scope boundary handling - when the scope is instance method - yields the argument and the body nodes - when the scope is module - yields the body nodes - when the scope is singleton method - yields the argument and the body nodes - when the scope is class - yields the body nodes - when the scope is singleton class - yields the body nodes - when the scope is block - yields the argument and the body nodes - when the scope is top level - yields the body nodes - inner scope boundary handling - when there's a method invocation with block - yields only the block node and the child send node - when there's a singleton method definition - yields only the defs node and the method host node +RuboCop::Cop::Style::BeginBlock + reports an offense for a BEGIN block -RuboCop::Cop::Layout::SingleLineBlockChain - does not register an offense for method call chained on the same line as a multiline block - does not register an offense for method call chained on a new line after a single line block - does not register an offense for method call chained without a dot - registers an offense for method call chained on the same line as a block - registers an offense for no selector method call chained on the same line as a block - does not register an offense for method call chained on a new line after a single line block with trailing dot +RuboCop::Cop::Lint::NonAtomicFileOperation + registers an offense when use `FileTest.exist?` before remove file + does not register an offense when use `FileTest.exist?` before creating file with an option `force: false` + registers an offense when use `FileTest.exist?` before remove file + registers an offense when use `FileTest.exist?` before creating file + registers an offense when use `FileTest.exist?` before remove file + registers an offense when use `FileTest.exist?` before creating file with an option not `force` + registers an offense when use `FileTest.exist?` before force remove file + registers an offense when use `FileTest.exist?` before remove file + registers an offense when use `FileTest.exist?` before remove file + does not register an offense when using complex conditional with `||` + does not register an offense when using complex conditional with `&&` + does not register an offense when use `FileTest.exist?` before remove recursive file + registers an offense when use `FileTest.exist?` before force creating file + registers an offense when use `FileTest.exist?` before force creating file + registers an offense when use file existence checks `unless` by postfix before creating file + does not register an offense when not a method of file operation + does not register an offense when checking for the existence of different files + registers an offense when use `FileTest.exist?` before force remove file + does not register an offense when not an exist check + registers an offense when use `FileTest.exist?` before remove file + does not register an offense when use `FileTest.exist?` before remove recursive file + registers an offense when use `FileTest.exist?` before force creating file + registers an offense when using `FileTest.exist?` as a condition for `elsif` + registers an offense when use `FileTest.exist?` before remove file + does not register an offense when not checking for the existence + registers an offense when use `FileTest.exist?` before creating file with an option `force: true` + registers an offense when use file existence checks `if` by postfix before removing file + registers an offense when use `FileTest.exist?` before remove file + registers an offense when use `FileTest.exist?` before remove file + registers an offense when use `FileTest.exist?` before remove file + does not register an offense when using `FileTest.exist?` with `if` condition that has `else` branch + registers an offense when use `FileTest.exists?` before creating file + does not register an offense when processing other than file operations + registers an offense when use `FileTest.exist?` with negated `if` before creating file -RuboCop::Cop::Lint::InterpolationCheck - registers an offense for interpolation in single quoted split string - does not register an offense for interpolation in nested strings - does not register offense for strings in %w() - registers an offense for interpolation in double + single quoted split string - registers an offense and corrects for interpolation in single quoted string - registers an offense and corrects when including interpolation and double quoted string in single quoted string - does not crash for \xff - does not register an offense for interpolation in a regexp - does not register an offense for escaped crab claws in dstr - does not register an offense for properly interpolation strings - does not register an offense for an escaped interpolation +RuboCop::Cop::Commissioner + #investigate + stores all errors raised by the cops + traverses the AST and invoke cops specific callbacks + when passed :raise_error option + re-raises the exception received while processing + traverses the AST with on_send / on_csend + for a restricted cop + calls on_send for the right method calls + on both csend and send + calls on_send for the right method calls + for unrestricted cops + calls on_send all method calls + when given a source with parsing errors + only calls on_other_file + when given a force + passes the input params to all cops/forces that implement their own #investigate method + when a cop reports offenses + returns all offenses found by the cops + when passed :raise_cop_error option + re-raises the exception received while processing -RuboCop::Cop::Style::BisectedAttrAccessor - registers an offense for accessors with the same visibility in different scopes - registers an offense and corrects when both accessors are in the same visibility scope - does not register an offense when accessors are within different visibility scopes - registers and corrects in a module - registers an offense and corrects when attr and attr_writer exists - does not register an offense when using `attr_accessor` - registers an offense and corrects properly when attr_writer is before attr_reader - registers an offense and corrects when both accessors of the splat exists - registers an offense and corrects when both accessors of the name exists - does not register an offense when only one accessor of the name exists - registers an offense and corrects when within eigenclass - registers an offense and corrects when both accessors of the name exists and accessor contains multiple names - multiple bisected accessors - when some attr names are bisected - registers and retains non-bisected attrs - when all attr names are bisected - registers and replaces with attr_accessor +RuboCop::RakeTask + running tasks + uses the default formatter from .rubocop.yml if no formatter option is given + runs with specified options if a block is given + will not error when result is not 0 and fail_on_error is false + exits when result is not 0 and fail_on_error is true + runs with default options + allows nested arrays inside formatters, options, and requires + autocorrect + runs with with the options that were passed to its parent task + runs with --autocorrect-all + runs with --autocorrect + defining tasks + creates a rubocop task and a rubocop autocorrect task + creates a rubocop task and a rubocop auto_correct task + creates a named task and a named auto_correct task + creates a named task and a named autocorrect task RuboCop::Cop::Style::HashExcept + does not register an offense when using `select` and comparing with `:key == lvar` does not register an offense when using `Hash#except` - does not register an offense when not using key block argument` - does not register an offense when using `select` and comparing with `lvar == :key` does not register an offense when using `reject` and comparing with `lvar != :key` - does not register an offense when using `reject` and `include?` does not register an offense when not using block` + does not register an offense when using `select` and comparing with `lvar == :key` + does not register an offense when not using key block argument` does not register an offense when using `reject` and comparing with `:key != lvar` - does not register an offense when using `select` and comparing with `:key == lvar` + does not register an offense when using `reject` and `include?` Ruby 2.7 or lower does not register an offense when using `select` and comparing with `:key != lvar` + does not register an offense when using `reject` and comparing with `:key == lvar` does not register an offense when using `select` and comparing with `lvar != :key` does not register an offense when using `reject` and comparing with `lvar == :key` - does not register an offense when using `reject` and comparing with `:key == lvar` Ruby 3.0 or higher + registers and corrects an offense when using `reject` and comparing with `lvar == :sym` + registers and corrects an offense when using `reject` and comparing with `:sym == lvar` + registers and corrects an offense when using `select` and comparing with `:sym != lvar` + does not register an offense when comparing with hash value does not register an offense when using `delete_if` and comparing with `lvar == :sym` registers and corrects an offense when using `select` and comparing with `lvar != :sym` + registers and corrects an offense when using `reject` and other than comparison by string and symbol using `eql?` does not register an offense when using `reject` and other than comparison by string and symbol using `==` registers and corrects an offense when using `reject` and comparing with `lvar == 'str'` - registers and corrects an offense when using `reject` and comparing with `lvar == :sym` - does not register an offense when comparing with hash value - registers and corrects an offense when using `select` and comparing with `:sym != lvar` - registers and corrects an offense when using `reject` and comparing with `:sym == lvar` - registers and corrects an offense when using `reject` and other than comparison by string and symbol using `eql?` registers and corrects an offense when using `filter` and comparing with `lvar != :sym` does not register an offense when using `keep_if` and comparing with `lvar != :sym` + using `include?` + registers and corrects an offense when using `filter` and calling `!include?` method with symbol array + registers and corrects an offense when using `reject` and calling `include?` method with dynamic string array + registers and corrects an offense when using `reject` and calling `include?` method with method call + registers and corrects an offense when using `reject` and calling `include?` method with variable + registers and corrects an offense when using `reject` and calling `include?` method with symbol array + registers and corrects an offense when using `select` and calling `!include?` method with symbol array + registers and corrects an offense when using `reject` and calling `include?` method with dynamic symbol array + does not register an offense when using `reject` and calling `include?` method with symbol array and second block value + using `in?` + does not register offenses when using `reject` and calling `key.in?` method with symbol array using `exclude?` does not register offenses when using `reject` and calling `!exclude?` method with symbol array when `AllCops/ActiveSupportExtensionsEnabled: true` - registers and corrects an offense when using `reject` and other than comparison by string and symbol using `eql?` registers and corrects an offense when using `filter` and comparing with `lvar != :sym` - does not register an offense when using `reject` and other than comparison by string and symbol using `==` - does not register an offense when using `keep_if` and comparing with `lvar != :sym` registers and corrects an offense when using `select` and comparing with `:sym != lvar` registers and corrects an offense when using `reject` and comparing with `lvar == 'str'` - registers and corrects an offense when using `reject` and comparing with `lvar == :sym` does not register an offense when using `delete_if` and comparing with `lvar == :sym` does not register an offense when comparing with hash value - registers and corrects an offense when using `reject` and comparing with `:sym == lvar` + registers and corrects an offense when using `reject` and comparing with `lvar == :sym` + registers and corrects an offense when using `reject` and other than comparison by string and symbol using `eql?` + does not register an offense when using `reject` and other than comparison by string and symbol using `==` registers and corrects an offense when using `select` and comparing with `lvar != :sym` + does not register an offense when using `keep_if` and comparing with `lvar != :sym` + registers and corrects an offense when using `reject` and comparing with `:sym == lvar` + using `exclude?` + registers and corrects an offense when using `select` and calling `exclude?` method with symbol array + does not register an offense when using `reject` and calling `exclude?` method with symbol array and second block value + registers and corrects an offense when using `reject` and calling `!exclude?` method with dynamic symbol array + registers and corrects an offense when using `reject` and calling `!exclude?` method with method call + registers and corrects an offense when using `reject` and calling `!exclude?` method with variable + registers and corrects an offense when using `filter` and calling `exclude?` method with symbol array + registers and corrects an offense when using `reject` and calling `!exclude?` method with symbol array + registers and corrects an offense when using `reject` and calling `!exclude?` method with dynamic string array using `in?` + does not register an offense when using `reject` and calling `in?` method with symbol array and second block value registers and corrects an offense when using `reject` and calling `key.in?` method with method call + registers and corrects an offense when using `reject` and calling `key.in?` method with dynamic symbol array registers and corrects an offense when using `reject` and calling `key.in?` method with dynamic string array - does not register an offense when using `reject` and calling `in?` method with symbol array and second block value + registers and corrects an offense when using `select` and calling `!key.in?` method with symbol array registers and corrects an offense when using `filter` and calling `!key.in?` method with symbol array registers and corrects an offense when using `reject` and calling `key.in?` method with symbol array - registers and corrects an offense when using `reject` and calling `key.in?` method with dynamic symbol array registers and corrects an offense when using `reject` and calling `key.in?` method with variable - registers and corrects an offense when using `select` and calling `!key.in?` method with symbol array using `include?` + registers and corrects an offense when using `reject` and calling `include?` method with dynamic symbol array + registers and corrects an offense when using `reject` and calling `include?` method with symbol array + registers and corrects an offense when using `select` and calling `!include?` method with symbol array registers and corrects an offense when using `reject` and calling `include?` method with dynamic string array + registers and corrects an offense when using `reject` and calling `include?` method with method call registers and corrects an offense when using `filter` and calling `!include?` method with symbol array registers and corrects an offense when using `reject` and calling `include?` method with variable - registers and corrects an offense when using `select` and calling `!include?` method with symbol array - registers and corrects an offense when using `reject` and calling `include?` method with dynamic symbol array - registers and corrects an offense when using `reject` and calling `include?` method with method call - registers and corrects an offense when using `reject` and calling `include?` method with symbol array - using `exclude?` - registers and corrects an offense when using `reject` and calling `!exclude?` method with dynamic symbol array - registers and corrects an offense when using `filter` and calling `exclude?` method with symbol array - registers and corrects an offense when using `reject` and calling `!exclude?` method with method call - does not register an offense when using `reject` and calling `exclude?` method with symbol array and second block value - registers and corrects an offense when using `select` and calling `exclude?` method with symbol array - registers and corrects an offense when using `reject` and calling `!exclude?` method with symbol array - registers and corrects an offense when using `reject` and calling `!exclude?` method with dynamic string array - registers and corrects an offense when using `reject` and calling `!exclude?` method with variable - using `in?` - does not register offenses when using `reject` and calling `key.in?` method with symbol array - using `include?` - registers and corrects an offense when using `reject` and calling `include?` method with method call - registers and corrects an offense when using `filter` and calling `!include?` method with symbol array - registers and corrects an offense when using `reject` and calling `include?` method with dynamic symbol array - registers and corrects an offense when using `reject` and calling `include?` method with symbol array - does not register an offense when using `reject` and calling `include?` method with symbol array and second block value - registers and corrects an offense when using `select` and calling `!include?` method with symbol array - registers and corrects an offense when using `reject` and calling `include?` method with dynamic string array - registers and corrects an offense when using `reject` and calling `include?` method with variable - -RuboCop::Cop::Layout::SpaceBeforeBrackets - does not register an offense when assigning an array - does not register an offense when using array literal argument without parentheses - does not register an offense when using percent array literal argument without parentheses - when assigning - does not register an offense when space is used in left bracket - does not register an offense when multiple spaces are inserted inside the left bracket - registers an offense and corrects when using space between receiver and left brackets - does not register an offense when not using space between receiver and left brackets - when referencing - does not register an offense when it is used as a method argument - does not register an offense when without receiver - does not register an offense when using space between method call and left brackets - registers an offense and corrects when using space between gvar receiver and left brackets - does not register an offense when not using space between variable receiver and left brackets - does not register an offense when array literal argument is enclosed in parentheses - does not register an offense when not using space between method call and left brackets - does not register an offense when call desugared `Hash#[]` to ivar receiver - registers an offense and corrects when using space between lvar receiver and left brackets - registers an offense and corrects when using space between ivar receiver and left brackets - registers an offense and corrects when using space between cvar receiver and left brackets - does not register an offense when call desugared `Hash#[]` to lvar receiver - does not register an offense when call desugared `Hash#[]` to cvar receiver - does not register an offense when using multiple arguments - -RuboCop::Cop::Lint::TripleQuotes - does not register an offense for implicit concatenation - quintuple quotes - registers an offense and corrects - heredocs - does not register an offense - string interpolation - does not register an offense - with nested extra quotes - registers an offense and corrects - triple quotes - on multiple lines - registers an offense and corrects - on one line - registers an offense and corrects - with only whitespace - does not register - when only quotes - registers an offense and corrects to a single empty quote -RuboCop::Cop::Style::ClassAndModuleChildren - nested style - registers an offense for not nested classes with explicit superclass - accepts :: in parent class on inheritance - accepts cbase module name - registers an offense for not nested modules - registers an offense for not nested classes - preserves comments - registers an offense for partially nested modules - registers an offense for partially nested classes - accepts cbase class name - accepts nested children - registers an offense for not nested classes when namespace is defined as a module - registers an offense for not nested classes when namespace is defined as a class - compact style - registers an offense for classes with partially nested children - registers a offense for modules with nested children - correctly indents heavily nested children - registers an offense for modules with partially nested children - preserves comments between classes - registers a offense for classes with nested one-liner children - accepts class/module with single method - registers and offense for deeply nested children - accepts nesting for classes with an explicit superclass - accepts compact style for classes/modules - accepts nesting for classes/modules with more than one child - registers a offense for classes with nested children +RuboCop::Cop::Style::NestedFileDirname + Ruby >= 3.1 + registers and corrects an offense when using `File.dirname(path)` nested two times + does not register an offense when using non nested `File.dirname(path)` + registers and corrects an offense when using `File.dirname(path)` nested three times + does not register an offense when using `File.dirname(path, 2)` + Ruby <= 3.0 + does not register an offense when using `File.dirname(path)` nested two times -RuboCop::Cop::Style::RedundantSort - does not register an offense for sort!.first - registers an offense when [-1] is called on sort_by - registers an offense when slice(0) is called on sort_by - does not register an offense when sort_by is used without first - does not register an offense for sort_by!(&:something).last - does not register an offense when first is used before sort - registers an offense when first is called on sort_by with line breaks and `and` operator - registers an offense when first is called on sort_by - registers an offense when first is called on sort_by with line breaks and `or` operator - does not register an offense when first is used without sort_by - registers an offense when first is called on sort_by with line breaks and `&&` operator - registers an offense when at(0) is called on sort_by - registers an offense when at(-1) is called with sort - registers an offense when first is called on sort_by no block - registers an offense when first is called on sort_by with line breaks - does not register an offense when sort_by is not given a block - registers an offense when last is called on sort_by - registers an offense when last is called with sort - registers an offense when last is called on sort with comparator - registers an offense when slice(0) is called on sort - registers an offense with `sort_by { a || b }` - registers an offense when last is called on sort_by no block - registers an offense when slice(-1) is called on sort_by - registers an offense when [0] is called on sort_by - registers an offense when first is called on sort_by with line breaks and `||` operator - does not register an offense when sort has an argument - registers an offense when [0] is called on sort - registers an offense when [](0) is called on sort - does not register an offense when first has an argument - registers an offense when [-1] is called on sort - registers an offense when first is called with sort - registers an offense when [](-1) is called on sort_by +RuboCop::Cop::Lint::SafeNavigationChain + TargetRubyVersion >= 2.3 + registers an offense for ordinary method chain exists after safe navigation method call with a block + registers an offense for safe navigation with > operator + registers an offense for ordinary method chain exists after safe navigation method call + accepts usages of safe navigation with `-@` method + registers an offense for ordinary method call exists after safe navigation method call + accepts usages of safe navigation with == operator + registers an offense for safe navigation on the right-hand side of the `*` + accepts usages of safe navigation with `present?` method + registers an offense for ordinary method chain exists after safe navigation method call with an argument + registers an offense for safe navigation with []= operator + registers an offense for ordinary method chain exists after safe navigation method call with a block-pass + accepts usages of safe navigation with | operator + accepts usages of method chain with safe navigation only + accepts usages of safe navigation with `try` method + registers an offense for ordinary method call exists after safe navigation method call with an argument + accepts usages of safe navigation with `nil?` method + registers an offense for safe navigation with >= operator + accepts usages of safe navigation with `+@` method + registers an offense for safe navigation on the right-hand side of the `-` + registers an offense for safe navigation on the right-hand side of the `+` + accepts usages of safe navigation at last only with argument + accepts usages of safe navigation at last only + accepts usages of safe navigation with `blank?` method + accepts usages of safe navigation with assignment method + registers an offense for safe navigation with <= operator + registers an offense for safe navigation with + operator + accepts usages of safe navigation with self assignment method + accepts usages of method chain with safe navigation only with argument + accepts usages of safe navigation with `in?` method + accepts usages of safe navigation with || operator + accepts usages of ordinary method chain + accepts usages of safe navigation with && operator + registers an offense for safe navigation with < operator + accepts usages of safe navigation with `to_d` method + accepts usages of safe navigation with & operator + registers an offense for safe navigation on the right-hand side of the `/` + accepts usages of ordinary method chain with argument + accepts usages of safe navigation with === operator + registers an offense for safe navigation with [] operator + proper highlighting + when in a method + when there are methods after + when used with a modifier if + when there are methods before + when in a begin >= Ruby 2.7 - when using numbered parameter - registers an offense and corrects when first is called on sort_by - registers an offense and corrects when at(0) is called on sort_by - registers an offense and corrects when last is called on sort with comparator - when not taking first or last element - does not register an offense when [-1] is called on sort with an argument - does not register an offense when [1] is called on sort - does not register an offense when at(-2) is called on sort_by + registers an offense for ordinary method chain exists after safe navigation method call with a block using numbered parameter -RuboCop::Cop::Metrics::ClassLength - accepts empty classes - rejects a class with more than 5 lines - accepts a class with 5 lines - accepts a class with less than 5 lines - does not count blank lines - reports the correct beginning and end lines - when `CountAsOne` is not empty - folds array into one line - when CountComments is enabled - also counts commented lines - registers an offense for a class that only contains comments - when inspecting a class defined with Struct.new +RuboCop::Cop::Lint::UnderscorePrefixedVariableName + in a method calling `super` with arguments + when an underscore-prefixed argument is not used + does not register an offense + when an underscore-prefixed argument is used explicitly + registers an offense + when an underscore-prefixed keyword block argument is used registers an offense - registers an offense when multiple assignments to constants - registers an offense when inspecting or equals (`||=`) for constant - when CountComments is disabled - accepts classes that only contain comments - when inspecting a class defined with ::Class.new + when AllowKeywordBlockArguments is set + does not register an offense + when an underscore-prefixed variable in top-level scope is used registers an offense - when overlapping constant assignments - does not register an offense - when inspecting a class defined with Class.new + when an underscore-prefixed method argument is used registers an offense - when a class has inner classes - rejects a class with 6 lines that belong to the class directly - does not count lines of inner classes - when using numbered parameter - when inspecting a class defined with ::Class.new + in a method calling `binding` without arguments + when an underscore-prefixed argument is used explicitly registers an offense - when inspecting a class defined with Struct.new - registers an offense when multiple assignments to constants - registers an offense when inspecting or equals (`||=`) for constant + when an underscore-prefixed argument is not used explicitly + does not register an offense + when an underscore-prefixed block argument is used + registers an offense + registers an offense + when non-underscore-prefixed variable is used + does not register an offense + in a method calling `binding` with arguments + when an underscore-prefixed argument is not used + does not register an offense + when an underscore-prefixed argument is used explicitly registers an offense - when inspecting a class defined with Class.new + when an underscore-prefixed variable is captured by a block + accepts + when an underscore-prefixed variable is reassigned + does not register an offense + in a method calling `super` without arguments + when an underscore-prefixed argument is used explicitly registers an offense + when an underscore-prefixed argument is not used explicitly + does not register an offense + when an underscore-prefixed variable is used + registers an offense + when an underscore-prefixed named capture variable is used + registers an offense -RuboCop::Cop::Layout::LeadingEmptyLines - allows blank lines without any comments or code - accepts not having a blank line before a comment - registers an offense and corrects a new line before a comment - registers an offense and corrects a new line before a class - registers an offense and corrects a new line before code - accepts not having a blank line before code - allows an empty input - accepts not having a blank line before a class - registers an offense and corrects multiple new lines before a class - autocorrect - in collaboration - does not invoke conflicts with other cops +RuboCop::Cop::Style::RedundantCondition + ternary expression (?:) + accepts expressions when the condition and if branch do not match + when condition and if_branch are same + registers an offense and corrects + registers an offense and corrects with ternary expression and the branches contains chained parenthesized method call + registers an offense and corrects brackets accesses + registers an offense and corrects when the else branch contains `rescue` + registers an offense and corrects with ternary expression and the branches contains parenthesized method call + registers an offense and corrects class vars + registers an offense and corrects functions + registers an offense and corrects when the else branch contains an irange + registers an offense and corrects when the else branch contains an erange + registers an offense and corrects nested vars + registers an offense and corrects when the else branch contains `and` + when regular condition (if) + accepts different when the condition does not match the branch + accepts elsif + when condition and if_branch are same + registers an offense and corrects when the branches contains arithmetic operation + registers an offense and corrects + does not register offenses when using `nil?` and the branches contains assignment + registers an offense and corrects when the branches contains parenthesized method call + registers an offense and corrects when the branches contains method call + registers an offense and corrects when `if` condition and `then` branch are the same and it has no `else` branch + registers an offense and correct when the branches are the same with the same receivers + accepts an elsif branch + does not register offenses when the branches contains hash key access + registers an offense and corrects modifier nodes offense + accepts complex else branches + does not register an offense when using assignment by hash key access + autocorrects when using `<<` method higher precedence than `||` operator + registers an offense and corrects when the branches contains assignment + does not register offenses when the branches contains assignment but target not matched + registers an offense and corrects multiline nodes + registers an offense and corrects when using modifier if + registers an offense and corrects when the branches contains assignment method + registers an offense and corrects when defined inside method and the branches contains assignment + registers an offense and corrects when the else branch contains an irange + registers an offense and corrects when `raise` without argument parentheses in `else` + registers an offense and corrects when using operator method in `else` + registers an offense and corrects when the branches contains method call with braced hash + accepts when using ternary if in `else` branch + registers an offense and corrects when the branches contains method call with non-braced hash + does not register offenses when using `nil?` and the branches contains method which has multiple arguments + does not register an offense when the branches are the same with different receivers + registers an offense and corrects complex one liners + registers an offense and corrects when a method without argument parentheses in `else` + when inverted condition (unless) + registers no offense + when condition and else branch are same + registers an offense + accepts complex unless branches -RuboCop::PathUtil - #absolute? - returns a falsey value for a path beginning with a directory name - returns a truthy value for a path beginning with slash - #match_path? - matches regexps - matches glob expressions - matches dir/** for hidden file - does not match dir/** for file in hidden dir - matches strings to the full path - does not match file in a subdirectory - does not match invalid UTF-8 paths - #relative_path - builds paths relative to PWD by default as a stop-gap - supports custom base paths +RuboCop::Cop::RangeHelp + source indicated by #range_with_surrounding_comma + when side is :both + is expected to eq ",Error," + when side is :right + is expected to eq "Error," + when side is :left + is expected to eq ",Error" + source indicated by #range_by_whole_lines + with beginning of one line + with include_final_newline + is expected to eq "puts 'another example'\n" + without include_final_newline + is expected to eq "puts 'another example'" + when part of a single line is selected + with include_final_newline + is expected to eq "puts 'example'\n" + without include_final_newline + is expected to eq "puts 'example'" + when source doesn't end with a newline + with include_final_newline + is expected to eq 30 + is expected to eq "newline_at_end" + without include_final_newline + is expected to eq "newline_at_end" + with a whole line plus beginning of next line + without include_final_newline + is expected to eq "puts 'example'\nputs 'another example'" + with include_final_newline + is expected to eq "puts 'example'\nputs 'another example'\n" + with parts of two lines + without include_final_newline + is expected to eq "puts 'example'\nputs 'another example'" + with include_final_newline + is expected to eq "puts 'example'\nputs 'another example'\n" + with parts of four lines + without include_final_newline + is expected to eq "puts 'example'\nputs 'another example'\n\nsomething_else" + with include_final_newline + is expected to eq "puts 'example'\nputs 'another example'\n\nsomething_else\n" + with a whole line except newline selected + with include_final_newline + is expected to eq "puts 'example'\n" + without include_final_newline + is expected to eq "puts 'example'" + with end of one line + without include_final_newline + is expected to eq "puts 'example'" + with include_final_newline + is expected to eq "puts 'example'\n" + source indicated by #range_with_surrounding_space + when passing range as a positional argument + behaves like works with various `side`s + when side is :right + is expected to eq "a(2) " + when side is :both + is expected to eq " a(2) " + when side is :left + is expected to eq " a(2)" + when passing range as a kwarg + behaves like works with various `side`s + when side is :both + is expected to eq " a(2) " + when side is :left + is expected to eq " a(2)" + when side is :right + is expected to eq "a(2) " + #range_with_comments_and_lines + returns a range that includes related comments and whole lines -RuboCop::Cop::Style::OpenStructUse - when using OpenStruct - for ::OpenStruct - when used in assignments - registers an offense - when inheriting from it via Class.new - registers an offense - when inheriting from it via < - registers an offense - for OpenStruct - when inheriting from it via Class.new - registers an offense - when used in assignments - registers an offense - when inheriting from it via < - registers an offense - when not using OpenStruct - registers no offense - when using custom namespaced OpenStruct - when inheriting from it - is expected to eq "class A < SomeNamespace::OpenStruct; end" - when defined in custom namespace - when class - is expected to eq "module SomeNamespace\n class OpenStruct\n end\nend\n" - when module - is expected to eq "module SomeNamespace\n module OpenStruct\n end\nend\n" - when used in assignments - registers no offense +RuboCop::Cop::Gemspec::DependencyVersion + with `EnforcedStyle: required` + using add_development_dependency + does not register an offense when adding development dependency by parenthesized call with version specification + does not register an offense when adding development dependency with version specification + does not register an offense when adding development dependency with branch specification + does not register an offense when adding development dependency with commit ref specification + does not register an offense when adding development dependency by parenthesized call with commit ref specification + registers an offense when adding development dependency using git option without version specification + does not register an offense when adding development dependency by parenthesized call with tag specification + registers an offense when adding development dependency by parenthesized call without version specification + registers an offense when adding development dependency without version specification + does not register an offense when adding development dependency with tag specification + registers an offense when adding development dependency using git option by parenthesized call without version specification + does not register an offense when adding development dependency by parenthesized call with branch specification + using add_dependency + does not register an offense when adding dependency with branch specification + registers an offense when adding dependency using git option by parenthesized call without version specification + registers an offense when adding dependency using git option without version specification + does not register an offense when adding dependency with tag specification + registers an offense when adding dependency by parenthesized call without version specification + does not register an offense when adding dependency by parenthesized call with tag specification + registers an offense when adding dependency without version specification + does not register an offense when adding dependency with commit ref specification + does not register an offense when adding dependency by parenthesized call with version specification + does not register an offense when adding dependency by parenthesized call with branch specification + does not register an offense when adding dependency by parenthesized call with commit ref specification + does not register an offense when adding dependency with version specification + using add_runtime_dependency + does not register an offense when adding runtime dependency by parenthesized call with commit ref specification + does not register an offense when adding runtime dependency with commit ref specification + does not register an offense when adding runtime dependency with version specification + registers an offense when adding runtime dependency without version specification + does not register an offense when adding runtime dependency with branch specification + does not register an offense when adding runtime dependency by parenthesized call with tag specification + does not register an offense when adding runtime dependency with tag specification + does not register an offense when adding runtime dependency by parenthesized call with version specification + registers an offense when adding runtime dependency using git option by parenthesized call without version specification + does not register an offense when adding runtime dependency by parenthesized call with branch specification + registers an offense when adding runtime dependency using git option without version specification + registers an offense when adding runtime dependency by parenthesized call without version specification + with `AllowedGems` + registers an offense when adding dependency without version specification excepts allowed gems + registers an offense when adding dependency by parenthesized call without version specification excepts allowed gems + with `EnforcedStyle: forbidden` + using add_dependency + registers an offense when adding dependency by parenthesized call with version specification + registers an offense when adding dependency with commit ref specification + registers an offense when adding dependency by parenthesized call with tag specification + does not register an offense when adding dependency using git option by parenthesized call without version specification + registers an offense when adding dependency with tag specification + registers an offense when adding dependency by parenthesized call with branch specification + registers an offense when adding dependency with version specification + registers an offense when adding dependency with branch specification + does not register an offense when adding dependency using git option without version specification + does not register an offense when adding dependency by parenthesized call without version specification + registers an offense when adding dependency by parenthesized call with commit ref specification + does not register an offense when adding dependency without version specification + using add_development_dependency + does not register an offense when adding development dependency using git option without version specification + registers an offense when adding development dependency by parenthesized call with version specification + registers an offense when adding development dependency with branch specification + registers an offense when adding development dependency with version specification + does not register an offense when adding development dependency by parenthesized call without version specification + registers an offense when adding development dependency with commit ref specification + registers an offense when adding development dependency by parenthesized call with tag specification + registers an offense when adding development dependency with tag specification + registers an offense when adding development dependency by parenthesized call with branch specification + does not register an offense when adding development dependency using git option by parenthesized call without version specification + does not register an offense when adding development dependency without version specification + registers an offense when adding development dependency by parenthesized call with commit ref specification + with `AllowedGems` + registers an offense when adding dependency without version specification + registers an offense when adding dependency by parenthesized call without version specification + using add_runtime_dependency + does not register an offense when adding runtime dependency using git option by parenthesized call without version specification + registers an offense when adding runtime dependency by parenthesized call with branch specification + registers an offense when adding runtime dependency with commit ref specification + does not register an offense when adding runtime dependency using git option without version specification + does not register an offense when adding runtime dependency by parenthesized call without version specification + does not register an offense when adding runtime dependency without version specification + registers an offense when adding runtime dependency with tag specification + registers an offense when adding runtime dependency by parenthesized call with commit ref specification + registers an offense when adding runtime dependency with branch specification + registers an offense when adding runtime dependency with version specification + registers an offense when adding runtime dependency by parenthesized call with version specification + registers an offense when adding runtime dependency by parenthesized call with tag specification -RuboCop::Cop::Lint::LambdaWithoutLiteralBlock - registers and corrects an offense when using lambda with `&proc {}` block argument - does not register an offense when using lambda with a symbol proc - registers and corrects an offense when using lambda with a proc variable block argument - does not register an offense when using `lambda.call` - registers and corrects an offense when using lambda with `&Proc.new {}` block argument - does not register an offense when using lambda with a literal block +RuboCop::Cop::Lint::Syntax + .offenses_from_processed_source + with a diagnostic error + returns an offense + with --autocorrect --disable-uncorrectable options + returns an offense + with --display-cop-names option + returns an offense with cop name + with a parser error + returns an offense + with --display-cop-names option + returns an offense with cop name -RuboCop::Cop::Lint::RaiseException - registers an offense and corrects for `raise` with `Exception.new` and message - does not register an offense when raising Exception with explicit namespace - registers an offense and corrects for `raise` with `Exception.new(args*)` - does not register an offense for `raise` without arguments - registers an offense and corrects for `fail` with `Exception` and message - registers an offense and corrects for `raise` with `Exception` - registers an offense and corrects for `raise` with `Exception` and message - registers an offense and corrects for `fail` with `Exception` - registers an offense and corrects for `raise` with `::Exception` and message - registers an offense and corrects for `raise` with `::Exception.new` - registers an offense and corrects for `fail` with `Exception.new` and message - registers an offense and corrects for `raise` with `::Exception` - does not register an offense for `fail` without arguments - when under namespace - does not register an offense when Exception without cbase specified - registers an offense and corrects when Exception with cbase specified +RuboCop::Cop::Style::PercentLiteralDelimiters + `%q` string + does not register an offense for preferred delimiters + registers an offense for other delimiters + does not register an offense for other delimiters when containing preferred delimiter characters + `%W` interpolated string array + registers an offense for other delimiters when containing preferred delimiter characters in interpolation + does not register an offense for preferred delimiters + registers an offense for other delimiters + does not register an offense for other delimiters when containing preferred delimiter characters + `%r` interpolated regular expression + registers an offense for other delimiters when containing preferred delimiter characters in interpolation + does not register an offense for preferred delimiters + registers an offense for a regular expression with option + does not register an offense for other delimiters when containing preferred delimiter characters + registers an offense for other delimiters + `%i` symbol array + registers an offense for other delimiters + does not register an offense for preferred delimiters + does not register an offense for non-preferred delimiters enclosing escaped delimiters + `%w` string array + does not register an offense for preferred delimiters with a pairing delimiters + does not register an offense for preferred delimiters + registers an offense for other delimiters + does not register an offense for other delimiters when containing preferred delimiter characters + does not register an offense for preferred delimiters with only a closing delimiter + does not register an offense for preferred delimiters with not a pairing delimiter + `%Q` interpolated string + registers an offense for other delimiters when containing preferred delimiter characters in interpolation + registers an offense for other delimiters + does not register an offense for other delimiters when containing preferred delimiter characters + does not register an offense for preferred delimiters + invalid cop config + raises an error when invalid configuration is specified + `%I` interpolated symbol array + does not register an offense for preferred delimiters + registers an offense for other delimiters + registers an offense for other delimiters when containing preferred delimiter characters in interpolation + autocorrect + preserves line breaks when fixing a multiline array + preserves irregular indentation when correcting a multiline array + fixes a string array in a scope + preserves indentation when correcting a multiline array + behaves like escape characters + corrects %r with \n in it + corrects %r with \t in it + behaves like escape characters + corrects %s with \t in it + corrects %s with \n in it + behaves like escape characters + corrects %i with \t in it + corrects %i with \n in it + behaves like escape characters + corrects %q with \n in it + corrects %q with \t in it + behaves like escape characters + corrects %x with \t in it + corrects %x with \n in it + behaves like escape characters + corrects %W with \n in it + corrects %W with \t in it + behaves like escape characters + corrects %Q with \n in it + corrects %Q with \t in it + behaves like escape characters + corrects %w with \t in it + corrects %w with \n in it + behaves like escape characters + corrects % with \t in it + corrects % with \n in it + `%s` symbol + does not register an offense for preferred delimiters + registers an offense for other delimiters + `default` override + allows individual preferred delimiters to override `default` + allows all preferred delimiters to be set with one key + `%x` interpolated system call + does not register an offense for preferred delimiters + does not register an offense for other delimiters when containing preferred delimiter characters + registers an offense for other delimiters + registers an offense for other delimiters when containing preferred delimiter characters in interpolation + `%` interpolated string + registers an offense when the source contains invalid characters + does not register an offense for other delimiters when containing preferred delimiter characters + registers an offense for a string with no content + does not register an offense for preferred delimiters + registers an offense for other delimiters when containing preferred delimiter characters in interpolation + registers an offense for other delimiters -RuboCop::Cop::Style::FormatStringToken - ignores __FILE__ - ignores time format (when used as argument to strftime) - ignores time format and unrelated `format` method using - ignores percent escapes - ignores time format (when used as argument to strptime) - ignores xstr - ignores time format when it is stored in a variable - ignores `%r` regexp - ignores placeholder arguments - handles dstrs - supports flags and modifiers - works inside hashes - ignores http links - ignores regexp - behaves like enforced styles for format string tokens - when enforced style is unannotated - #correctable_sequence? - when enforced style is template - #correctable_sequence? - does not register offenses for annotated style - detects when the cop must be disabled to avoid offenses - supports dynamic string with interpolation - configures the enforced style to template after inspecting "%{a}" - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when enforced style is annotated - detects when the cop must be disabled to avoid offenses - sets the enforced style to annotated after inspecting "%s" - registers offenses for template style - supports dynamic string with interpolation - #correctable_sequence? - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - registers offense for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - behaves like enforced styles for format string tokens - when enforced style is annotated - supports dynamic string with interpolation - #correctable_sequence? - sets the enforced style to annotated after inspecting "%s" - detects when the cop must be disabled to avoid offenses - registers offenses for template style - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - registers offense for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when enforced style is template - supports dynamic string with interpolation - #correctable_sequence? - configures the enforced style to template after inspecting "%{a}" - does not register offenses for annotated style - detects when the cop must be disabled to avoid offenses - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when enforced style is unannotated - #correctable_sequence? - behaves like enforced styles for format string tokens - when enforced style is unannotated - #correctable_sequence? - when enforced style is annotated - supports dynamic string with interpolation - registers offenses for template style - sets the enforced style to annotated after inspecting "%s" - detects when the cop must be disabled to avoid offenses - #correctable_sequence? - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - registers offense for dual unannotated - when enforced style is template - #correctable_sequence? - does not register offenses for annotated style - supports dynamic string with interpolation - detects when the cop must be disabled to avoid offenses - configures the enforced style to template after inspecting "%{a}" - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - behaves like enforced styles for format string tokens - when enforced style is unannotated - #correctable_sequence? - when enforced style is annotated - supports dynamic string with interpolation - detects when the cop must be disabled to avoid offenses - registers offenses for template style - #correctable_sequence? - sets the enforced style to annotated after inspecting "%s" - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - registers offense for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when enforced style is template - configures the enforced style to template after inspecting "%{a}" - supports dynamic string with interpolation - detects when the cop must be disabled to avoid offenses - does not register offenses for annotated style - #correctable_sequence? - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - does not register offenses for dual unannotated - behaves like enforced styles for format string tokens - when enforced style is template - does not register offenses for annotated style - supports dynamic string with interpolation - configures the enforced style to template after inspecting "%{a}" - detects when the cop must be disabled to avoid offenses - #correctable_sequence? - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when enforced style is unannotated - #correctable_sequence? - when enforced style is annotated - detects when the cop must be disabled to avoid offenses - #correctable_sequence? - supports dynamic string with interpolation - registers offenses for template style - sets the enforced style to annotated after inspecting "%s" - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - registers offense for dual unannotated - does not register offenses for single unannotated - behaves like enforced styles for format string tokens - when enforced style is template - supports dynamic string with interpolation - configures the enforced style to template after inspecting "%{a}" - detects when the cop must be disabled to avoid offenses - does not register offenses for annotated style - #correctable_sequence? - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when enforced style is annotated - detects when the cop must be disabled to avoid offenses - supports dynamic string with interpolation - registers offenses for template style - #correctable_sequence? - sets the enforced style to annotated after inspecting "%s" - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - registers offense for dual unannotated - does not register offenses for single unannotated - when enforced style is unannotated - #correctable_sequence? - behaves like enforced styles for format string tokens - when enforced style is template - does not register offenses for annotated style - #correctable_sequence? - configures the enforced style to template after inspecting "%{a}" - detects when the cop must be disabled to avoid offenses - supports dynamic string with interpolation - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when enforced style is unannotated - #correctable_sequence? - when enforced style is annotated - sets the enforced style to annotated after inspecting "%s" - detects when the cop must be disabled to avoid offenses - registers offenses for template style - supports dynamic string with interpolation - #correctable_sequence? - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - registers offense for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - behaves like enforced styles for format string tokens - when enforced style is unannotated - #correctable_sequence? - when enforced style is annotated - supports dynamic string with interpolation - #correctable_sequence? - sets the enforced style to annotated after inspecting "%s" - registers offenses for template style - detects when the cop must be disabled to avoid offenses - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - registers offense for dual unannotated - when enforced style is template - supports dynamic string with interpolation - detects when the cop must be disabled to avoid offenses - #correctable_sequence? - does not register offenses for annotated style - configures the enforced style to template after inspecting "%{a}" - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - behaves like enforced styles for format string tokens - when enforced style is annotated - #correctable_sequence? - supports dynamic string with interpolation - registers offenses for template style - detects when the cop must be disabled to avoid offenses - sets the enforced style to annotated after inspecting "%s" - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - registers offense for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when enforced style is template - detects when the cop must be disabled to avoid offenses - does not register offenses for annotated style - configures the enforced style to template after inspecting "%{a}" - #correctable_sequence? - supports dynamic string with interpolation - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when enforced style is unannotated - #correctable_sequence? - when enforced style is unannotated - gives a helpful error message - behaves like enforced styles for format string tokens - when enforced style is template - configures the enforced style to template after inspecting "%{a}" - detects when the cop must be disabled to avoid offenses - #correctable_sequence? - supports dynamic string with interpolation - does not register offenses for annotated style - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when enforced style is unannotated - #correctable_sequence? - when enforced style is annotated - supports dynamic string with interpolation - detects when the cop must be disabled to avoid offenses - registers offenses for template style - #correctable_sequence? - sets the enforced style to annotated after inspecting "%s" - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - registers offense for dual unannotated - when enforced style is annotated - gives a helpful error message - when AllowedMethods is disabled - registers an offense - when AllowedPatterns is enabled - does not register an offense - registers an offense for different method call within ignored method - does not register an offense for value in nested structure - when AllowedMethods is enabled - does not register an offense - does not register an offense for value in nested structure - registers an offense for different method call within ignored method - when AllowedPatterns is disabled - registers an offense - when enforced style is template - gives a helpful error message - behaves like enforced styles for format string tokens - when enforced style is annotated - detects when the cop must be disabled to avoid offenses - sets the enforced style to annotated after inspecting "%s" - registers offenses for template style - #correctable_sequence? - supports dynamic string with interpolation - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - registers offense for dual unannotated - does not register offenses for single unannotated - when enforced style is unannotated - #correctable_sequence? - when enforced style is template - supports dynamic string with interpolation - does not register offenses for annotated style - detects when the cop must be disabled to avoid offenses - configures the enforced style to template after inspecting "%{a}" - #correctable_sequence? - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - behaves like enforced styles for format string tokens - when enforced style is unannotated - #correctable_sequence? - when enforced style is template - supports dynamic string with interpolation - configures the enforced style to template after inspecting "%{a}" - detects when the cop must be disabled to avoid offenses - #correctable_sequence? - registers offenses for annotated style - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - registers offense for dual unannotated - when enforced style is annotated - registers offenses for template style - #correctable_sequence? - detects when the cop must be disabled to avoid offenses - sets the enforced style to annotated after inspecting "%s" - supports dynamic string with interpolation - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - registers offense for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - behaves like enforced styles for format string tokens - when enforced style is unannotated - #correctable_sequence? - when enforced style is template - supports dynamic string with interpolation - #correctable_sequence? - configures the enforced style to template after inspecting "%{a}" - does not register offenses for annotated style - detects when the cop must be disabled to avoid offenses - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when enforced style is annotated - detects when the cop must be disabled to avoid offenses - registers offenses for template style - supports dynamic string with interpolation - #correctable_sequence? - sets the enforced style to annotated after inspecting "%s" - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - registers offense for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - behaves like enforced styles for format string tokens - when enforced style is unannotated - #correctable_sequence? - when enforced style is template - detects when the cop must be disabled to avoid offenses - supports dynamic string with interpolation - #correctable_sequence? - configures the enforced style to template after inspecting "%{a}" - does not register offenses for annotated style - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when enforced style is annotated - supports dynamic string with interpolation - registers offenses for template style - detects when the cop must be disabled to avoid offenses - sets the enforced style to annotated after inspecting "%s" - #correctable_sequence? - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - registers offense for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - behaves like enforced styles for format string tokens - when enforced style is template - configures the enforced style to template after inspecting "%{a}" - does not register offenses for annotated style - #correctable_sequence? - supports dynamic string with interpolation - detects when the cop must be disabled to avoid offenses - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when enforced style is unannotated - #correctable_sequence? - when enforced style is annotated - supports dynamic string with interpolation - #correctable_sequence? - registers offenses for template style - sets the enforced style to annotated after inspecting "%s" - detects when the cop must be disabled to avoid offenses - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - registers offense for dual unannotated - does not register offenses for single unannotated - behaves like enforced styles for format string tokens - when enforced style is template - #correctable_sequence? - does not register offenses for annotated style - detects when the cop must be disabled to avoid offenses - configures the enforced style to template after inspecting "%{a}" - supports dynamic string with interpolation - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when enforced style is unannotated - #correctable_sequence? - when enforced style is annotated - detects when the cop must be disabled to avoid offenses - registers offenses for template style - sets the enforced style to annotated after inspecting "%s" - supports dynamic string with interpolation - #correctable_sequence? - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - registers offense for dual unannotated - behaves like enforced styles for format string tokens - when enforced style is annotated - registers offenses for template style - detects when the cop must be disabled to avoid offenses - #correctable_sequence? - supports dynamic string with interpolation - sets the enforced style to annotated after inspecting "%s" - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - registers offense for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when enforced style is unannotated - #correctable_sequence? - when enforced style is template - #correctable_sequence? - supports dynamic string with interpolation - does not register offenses for annotated style - detects when the cop must be disabled to avoid offenses - configures the enforced style to template after inspecting "%{a}" - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - behaves like enforced styles for format string tokens - when enforced style is annotated - detects when the cop must be disabled to avoid offenses - sets the enforced style to annotated after inspecting "%s" - registers offenses for template style - #correctable_sequence? - supports dynamic string with interpolation - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - registers offense for dual unannotated - does not register offenses for single unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when enforced style is unannotated - #correctable_sequence? - when enforced style is template - configures the enforced style to template after inspecting "%{a}" - detects when the cop must be disabled to avoid offenses - supports dynamic string with interpolation - does not register offenses for annotated style - #correctable_sequence? - behaves like maximum allowed unannotated - when MaxUnannotatedPlaceholdersAllowed is 1 - does not register offenses for single unannotated - does not register offenses for dual unannotated - when MaxUnannotatedPlaceholdersAllowed is 2 - does not register offenses for dual unannotated - does not register offenses for single unannotated - -RuboCop::Cop::Style::TrailingMethodEndStatement - register offense with trailing end on method with comment - register offense with trailing end on 3 line method - does not register on single line method - autocorrects all trailing ends for larger example - does not register on single line no op - register offense with trailing end inside class - register offense with trailing end on 2 line method - register offense with trailing end on method with block - when Ruby 3.0 or higher - does not register an offense when using endless method definition - does not register an offense when endless method definition signature and body are on different lines - -RuboCop::Cop::Style::EmptyCaseCondition - given a case statement with an empty case - with multiple when branches and no else - behaves like detect/correct empty case, accept non-empty case - accepts the source with case - registers an offense and autocorrects - with when branches using then - behaves like detect/correct empty case, accept non-empty case - registers an offense and autocorrects - accepts the source with case - when using `when ... then` in `case` in a method call - behaves like detect/correct empty case, accept non-empty case - accepts the source with case - registers an offense and autocorrects - with a when branch including comma-delimited alternatives - behaves like detect/correct empty case, accept non-empty case - accepts the source with case - registers an offense and autocorrects - when using `return ... if` in `when` clause and assigning the return value of `case` - does not register an offense - when using `return` in `else` clause and assigning the return value of `case` - does not register an offense - with a single when branch and an else - behaves like detect/correct empty case, accept non-empty case - registers an offense and autocorrects - accepts the source with case - when using `return ... if` in `else` clause and assigning the return value of `case` - does not register an offense - when used as an argument of a method with comment - behaves like detect/correct empty case, accept non-empty case - accepts the source with case - registers an offense and autocorrects - with a single when branch and no else - behaves like detect/correct empty case, accept non-empty case - registers an offense and autocorrects - accepts the source with case - with first when branch including comma-delimited alternatives - behaves like detect/correct empty case, accept non-empty case - registers an offense and autocorrects - accepts the source with case - with multiple when branches and an `else` with code comments - behaves like detect/correct empty case, accept non-empty case - accepts the source with case - registers an offense and autocorrects - with multiple when branches and an else - behaves like detect/correct empty case, accept non-empty case - accepts the source with case - registers an offense and autocorrects - when used as an argument of a method without comment - behaves like detect/correct empty case, accept non-empty case - registers an offense and autocorrects - accepts the source with case - when using `return` in `when` clause and assigning the return value of `case` - does not register an offense - when using `when ... then` in `case` in `return` - behaves like detect/correct empty case, accept non-empty case - registers an offense and autocorrects - accepts the source with case - -RuboCop::Cop::Style::EmptyLambdaParameter - registers an offense for an empty block parameter with a lambda - does not crash on a super - accepts a keyword lambda - -RuboCop::Cop::Style::RedundantCapitalW - registers no offense for normal arrays of strings - registers no offense for %w with interpolation-like syntax - registers no offense for %w without interpolation - does not register an offense for array of non-words - registers no offense for %W with interpolation - registers no offense for %W with special characters - registers an offense for misused %W - does not register an offense for array with empty strings - does not register an offense for array containing non-string - registers no offense for arrays with character constants - registers an offense for misused %W with different bracket - does not register an offense for array with one element - registers no offense for normal arrays of strings with interpolation - -RuboCop::Formatter::FuubarStyleFormatter - #progressbar_color - when an error offense is detected in a file - is red - and then a convention offense is detected in the next file - is still red - when a convention offense is detected in a file - is yellow - initially - is green - when no offenses are detected in a file - is still green - when convention and error offenses are detected in a file - is red - when a offense is detected in a file and autocorrected - is green - #with_color - when color is enabled - outputs coloring sequence code at the beginning and the end - when color is disabled - outputs nothing +RuboCop::Cop::InternalAffairs::ExampleDescription + with `expect_no_corrections` + registers an offense when given an improper description + in conjunction with expect_offense + registers an offense when given an improper description + when not making an expectation on offenses + does not register an offense + with `expect_offense` + does not register an offense when given a proper description + does not register an offense when given an unexpected description + registers an offense when given an improper description + with `expect_correction` + registers an offense when given an improper description + in conjunction with expect_offense + registers an offense when given an improper description + when the description is invalid for both methods + registers an offense for the first method encountered + with `expect_no_offenses` + does not crash when given a proper description that is split with + + registers an offense when given an improper description + does not register an offense when given a proper description + does not register an offense when given an unexpected description -RuboCop::Cop::Style::RedundantBegin - registers an offense and corrects when using `begin` without `rescue` or `ensure` - does not register an offense when using `begin` for semantic operator conditions - reports an offense for def with redundant begin block - reports an offense when multi-line `begin` block has single statement and it is inside condition - accepts a def with a begin block after a statement - does not register an offense when using `begin` for or assignment and method call - accepts a defs with required begin block - does not register an offense when using body of `begin` is empty - does not register an offense when using `begin` for assignment - does not register an offense when using `begin` with `until` - reports an offense when multi-line `begin` block has single statement with modifier condition - does not register an offense when using `begin` with `while` - registers and corrects an offense when using `begin` with single statement for or assignment - reports an offense for single line def with redundant begin block - registers and corrects an offense when using multi-line `if` in `begin` block - registers and corrects an offense when using `begin` with single statement that called a block for or assignment - does not register an offense when using `begin` with `ensure` - accepts when multi-line `begin` block has multiple statements with modifier condition - does not register an offense when using `begin` with no statements for or assignment - does not register an offense when using `begin` for logical operator conditions - reports an offense for defs with redundant begin block - does not register an offense when using `begin` with `rescue` - registers and corrects an offense when using modifier `if` single statement in `begin` block - does not register an offense when using `begin` with multiple statement for or assignment - accepts when one-liner `begin` block has multiple statements with modifier condition - does not register an offense when using `begin` for method argument - reports an offense when assigning nested blocks which contain `begin` blocks - reports an offense when one-liner `begin` block has single statement with modifier condition - reports an offense when assigning nested `begin` blocks - accepts a def with required begin block - autocorrects when there are trailing comments - doesn't modify spacing when autocorrecting - < Ruby 2.5 - accepts a do-end block with a begin-end - >= ruby 2.5 - registers an offense for a do-end block with redundant begin-end - accepts a {} block with a begin-end - accepts a block with a begin block after a statement - accepts a stabby lambda with a begin-end - accepts super with block - when using endless method definition - accepts when `begin` block has no statements - accepts when `begin` block has multiple statements - registers when `begin` block has a single statement - Ruby 2.7 - reports an offense when assigning nested blocks which contain `begin` blocks +RuboCop::Cop::Style::IfWithBooleanLiteralBranches + when condition is a logical operator and operands do not known whether to return boolean value + does not register an offense when using `if foo || bar` with opposite boolean literal branches + does not register an offense when using `unless foo || bar` with opposite boolean literal branches + does not register an offense when using `unless foo && bar` with boolean literal branches + does not register an offense when using `unless foo && bar` with opposite boolean literal branches + does not register an offense when using `unless foo || bar` with boolean literal branches + does not register an offense when using `if foo && bar` with opposite boolean literal branches + does not register an offense when using `if foo || bar` with boolean literal branches + does not register an offense when using `if foo && bar` with boolean literal branches + when double negative is used in condition + registers and corrects an offense when using `if !!condition` with opposite boolean literal branches + registers and corrects an offense when using `if !!condition` with boolean literal branches + when condition is a logical operator and all operands are predicate methods + registers and corrects an offense when using `if foo? && bar? && baz?` with boolean literal branches + registers and corrects an offense when using `if foo? && bar?` with boolean literal branches + registers and corrects an offense when using `unless foo? || bar?` with boolean literal branches + registers and corrects an offense when using `if foo? && bar? || baz?` with boolean literal branches + registers and corrects an offense when using `if foo? && bar?` with opposite boolean literal branches + registers and corrects an offense when using `unless foo? || bar?` with opposite boolean literal branches + when `AllowedMethods: nonzero?` + does not register an offense when using `nonzero?` + when condition is a comparison method + registers and corrects an offense when using opposite ternary operator with boolean literal branches + registers and corrects an offense when using `if` with boolean literal branches directly under `def` + registers and corrects an offense when using `if foo == bar` with opposite boolean literal branches + registers and corrects an offense when using `if` with boolean literal branches directly under `def` + does not register an offense when using a branch that is not boolean literal + registers and corrects an offense when using opposite ternary operator with boolean literal branches + does not register an offense when using a branch that is not boolean literal + registers and corrects an offense when using `if foo == bar` with opposite boolean literal branches + registers and corrects an offense when using `unless foo == bar` with boolean literal branches + registers and corrects an offense when using ternary operator with boolean literal branches + registers and corrects an offense when using opposite ternary operator with boolean literal branches + registers and corrects an offense when using `unless foo == bar` with opposite boolean literal branches + registers and corrects an offense when using `if foo == bar` with boolean literal branches + does not register an offense when using a branch that is not boolean literal + registers and corrects an offense when using `if foo == bar` with boolean literal branches + registers and corrects an offense when using `if foo == bar` with opposite boolean literal branches + registers and corrects an offense when using `if` with boolean literal branches directly under `def` + registers and corrects an offense when using `if` with boolean literal branches directly under `def` + registers and corrects an offense when using ternary operator with boolean literal branches + registers and corrects an offense when using `unless foo == bar` with opposite boolean literal branches + registers and corrects an offense when using `unless foo == bar` with opposite boolean literal branches + registers and corrects an offense when using `if foo == bar` with opposite boolean literal branches + registers and corrects an offense when using `if foo == bar` with boolean literal branches + registers and corrects an offense when using ternary operator with boolean literal branches + registers and corrects an offense when using `unless foo == bar` with boolean literal branches + registers and corrects an offense when using `unless foo == bar` with boolean literal branches + registers and corrects an offense when using `unless foo == bar` with opposite boolean literal branches + does not register an offense when using a branch that is not boolean literal + does not register an offense when using a branch that is not boolean literal + does not register an offense when using a branch that is not boolean literal + registers and corrects an offense when using ternary operator with boolean literal branches + registers and corrects an offense when using `if foo == bar` with opposite boolean literal branches + registers and corrects an offense when using `unless foo == bar` with boolean literal branches + registers and corrects an offense when using `if foo == bar` with boolean literal branches + registers and corrects an offense when using ternary operator with boolean literal branches + registers and corrects an offense when using `if` with boolean literal branches directly under `def` + registers and corrects an offense when using `if foo == bar` with opposite boolean literal branches + registers and corrects an offense when using opposite ternary operator with boolean literal branches + registers and corrects an offense when using `if foo == bar` with opposite boolean literal branches + registers and corrects an offense when using `unless foo == bar` with boolean literal branches + does not register an offense when using a branch that is not boolean literal + registers and corrects an offense when using `unless foo == bar` with opposite boolean literal branches + registers and corrects an offense when using `if foo == bar` with boolean literal branches + registers and corrects an offense when using opposite ternary operator with boolean literal branches + registers and corrects an offense when using `unless foo == bar` with boolean literal branches + registers and corrects an offense when using `if foo == bar` with boolean literal branches + registers and corrects an offense when using ternary operator with boolean literal branches + registers and corrects an offense when using `unless foo == bar` with boolean literal branches + registers and corrects an offense when using opposite ternary operator with boolean literal branches + registers and corrects an offense when using ternary operator with boolean literal branches + registers and corrects an offense when using `unless foo == bar` with opposite boolean literal branches + registers and corrects an offense when using `if` with boolean literal branches directly under `def` + registers and corrects an offense when using `if` with boolean literal branches directly under `def` + registers and corrects an offense when using `if foo == bar` with boolean literal branches + registers and corrects an offense when using opposite ternary operator with boolean literal branches + registers and corrects an offense when using `unless foo == bar` with opposite boolean literal branches + when using `elsif` with boolean literal branches + does not register an offense when using multiple `elsif` with boolean literal branches + registers and corrects an offense when using single `elsif` with boolean literal branches + when condition is a method that does not known whether to return boolean value + does not register an offense when using `unless condition` with opposite boolean literal branches + does not register an offense when using `if condition` with opposite boolean literal branches + does not register an offense when using `unless condition` with boolean literal branches + does not register an offense when using `if condition` with boolean literal branches + when condition is a predicate method + registers and corrects an offense when using `elsif foo.do_something?` with opposite boolean literal branches + registers and corrects an offense when using `unless foo.do_something?` with opposite boolean literal branches + registers and corrects an offense when using `elsif foo.do_something?` with boolean literal branches + registers and corrects an offense when using `if foo.do_something?` with opposite boolean literal branches + registers and corrects an offense when using `unless foo.do_something?` with boolean literal branches + registers and corrects an offense when using `if foo.do_something?` with boolean literal branches + when complex condition + registers and corrects an offense when using `if foo? || bar && baz?` with boolean literal branches + registers and corrects an offense when using `if foo? && bar && baz?` with boolean literal branches + does not register an offense when using `if foo? || bar || baz?` with boolean literal branches + registers and corrects an offense when using `if foo? || (bar && baz)?` with boolean literal branches + does not register an offense when using `if foo? && (bar || baz)?` with boolean literal branches + does not register an offense when using `if (foo? && bar) || baz?` with boolean literal branches + register and corrects an offense when using `if (foo? || bar) && baz?` with boolean literal branches + does not register an offense when using `if foo? && bar || baz?` with boolean literal branches -RuboCop::Cop::Layout::FirstArgumentIndentation - when EnforcedStyle is consistent - for method calls within method calls - registers an offense and corrects an over-indented first argument - accepts first argument indented relative to previous line - when IndentationWidth:Width is 2 - does not view []= as an outer method call - registers an offense and corrects an under-indented first argument - registers an offense and corrects lines affected by another offense - registers an offense and corrects an over-indented first argument of `super` - registers an offense and corrects an over-indented first argument on a pipe method name - registers an offense and corrects an over-indented first argument on a plus sign method name - accepts a first argument that is not preceded by a line break - accepts method calls with no arguments - does not view chained call as an outer method call - accepts operator calls - registers an offense and corrects an over-indented first argument - registers an offense and corrects an over-indented first argument on an alphanumeric method name - for assignment - accepts a correctly indented first argument and does not care about the second argument - with line break - registers an offense and corrects an under-indented first argument - accepts a correctly indented first argument - when the receiver contains a line break - accepts a correctly indented first argument preceded by an empty line - accepts a correctly indented first argument - registers an offense and corrects an over-indented first argument - when preceded by a comment line - registers an offense and corrects an under-indented first argument - accepts a correctly indented first argument - for a setter call - accepts an unindented value - when using safe navigation operator - registers an offense and corrects an under-indented 1st argument - when indentation width is overridden for this cop only - registers an offense and corrects an over-indented first argument - accepts a correctly indented first argument - when IndentationWidth:Width is 4 - registers an offense and corrects an over-indented first argument - when EnforcedStyle is special_for_inner_method_call_in_parentheses - when IndentationWidth:Width is 2 - registers an offense and corrects lines affected by another offense - accepts a first argument that is not preceded by a line break - accepts method calls with no arguments - does not view []= as an outer method call - accepts operator calls - registers an offense and corrects an over-indented first argument on a pipe method name - does not view chained call as an outer method call - registers an offense and corrects an over-indented first argument of `super` - registers an offense and corrects an over-indented first argument - registers an offense and corrects an over-indented first argument on a plus sign method name - registers an offense and corrects an under-indented first argument - registers an offense and corrects an over-indented first argument on an alphanumeric method name - when using safe navigation operator - registers an offense and corrects an under-indented 1st argument - when the receiver contains a line break - registers an offense and corrects an over-indented first argument - accepts a correctly indented first argument preceded by an empty line - accepts a correctly indented first argument - when preceded by a comment line - registers an offense and corrects an under-indented first argument - accepts a correctly indented first argument - for a setter call - accepts an unindented value - for assignment - accepts a correctly indented first argument and does not care about the second argument - with line break - accepts a correctly indented first argument - registers an offense and corrects an under-indented first argument - for method calls within method calls - with outer parentheses - accepts a correctly indented first argument in interpolation - accepts a correctly indented first argument with fullwidth characters - registers an offense and corrects an under-indented first argument - registers an offense and corrects an over-indented first argument - without outer parentheses - accepts a first argument with consistent style indentation - when indentation width is overridden for this cop only - accepts a correctly indented first argument - registers an offense and corrects an over-indented first argument - when IndentationWidth:Width is 4 - registers an offense and corrects an over-indented first argument - when EnforcedStyle is special_for_inner_method_call - for method calls within method calls - without outer parentheses - accepts a first argument with special indentation - with outer parentheses - registers an offense and corrects an over-indented first argument - when indentation width is overridden for this cop only - accepts a correctly indented first argument - registers an offense and corrects an over-indented first argument - when IndentationWidth:Width is 4 - registers an offense and corrects an over-indented first argument - when IndentationWidth:Width is 2 - registers an offense and corrects an over-indented first argument - accepts operator calls - accepts method calls with no arguments - registers an offense and corrects an over-indented first argument on an alphanumeric method name - does not view chained call as an outer method call - registers an offense and corrects lines affected by another offense - does not view []= as an outer method call - registers an offense and corrects an over-indented first argument of `super` - accepts a first argument that is not preceded by a line break - registers an offense and corrects an over-indented first argument on a pipe method name - registers an offense and corrects an over-indented first argument on a plus sign method name - registers an offense and corrects an under-indented first argument - for assignment - accepts a correctly indented first argument and does not care about the second argument - with line break - accepts a correctly indented first argument - registers an offense and corrects an under-indented first argument - when using safe navigation operator - registers an offense and corrects an under-indented 1st argument - when the receiver contains a line break - registers an offense and corrects an over-indented first argument - accepts a correctly indented first argument - accepts a correctly indented first argument preceded by an empty line - when preceded by a comment line - registers an offense and corrects an under-indented first argument - accepts a correctly indented first argument - for a setter call - accepts an unindented value - when EnforcedStyle is consistent_relative_to_receiver - when IndentationWidth:Width is 4 - registers an offense and corrects an over-indented first argument - when indentation width is overridden for this cop only - registers an offense and corrects an over-indented first argument - accepts a correctly indented first argument - for method calls within method calls - without outer parentheses - accepts a first argument with special indentation - indents all relative to the receiver - with outer parentheses - registers an offense and corrects an over-indented 1st argument - indents all relative to the receiver - when IndentationWidth:Width is 2 - registers an offense and corrects lines affected by other offenses - registers an offense and corrects an over-indented first argument - does not register an offense when argument has expected indent width and the method is preceded by splat - does not register an offense when argument has expected indent width and the method is preceded by double splat - accepts a first argument that is not preceded by a line break - accepts operator calls - does not view chained call as an outer method call - registers an offense and corrects an under-indented first argument - does not view []= as an outer method call - accepts method calls with no arguments - for assignment - register an offense and corrects a correctly indented first argument and does not care about the second argument - with line break - accepts a correctly indented first argument - registers an offense and corrects an under-indented first argument - when the receiver contains a line break - accepts a correctly indented first argument preceded by an empty line - registers an offense and corrects an over-indented 1st argument - accepts a correctly indented first argument - when preceded by a comment line - registers an offense and corrects an under-indented first argument - accepts a correctly indented first argument +RuboCop::Cop::InternalAffairs::RedundantMessageArgument + does not register an offense when formatted `MSG` is passed + does not register an offense when `#message` with another node is passed + when `#message` with offending node is passed + when there are others keyword arguments + registers an offense + when message is the only keyword argument + registers an offense + when `MSG` is passed + registers an offense + when `#message` is passed + registers an offense -RuboCop::Cop::InternalAffairs::RedundantLetRuboCopConfigNew - does not register an offense when using `let(:config)` with arguments to `RuboCop::Config.new` - registers an offense when using `let(:config)` with no argument `RuboCop::Config.new` and `:config` is specified - registers an offense when using `let(:config)` and `:config` is already specified in `describe` - registers an offense when using `let(:config)` and `:config` is not specified in `describe` +RuboCop::Cop::Style::FrozenStringLiteralComment + never + registers an offense for a disabled frozen string literal comment below shebang above an encoding comments + registers an offense for a frozen string literal comment below shebang above an encoding comments + registers an offense for a disabled frozen string literal comment on the top line + accepts not having a frozen string literal comment on the top line + allows not having a frozen string literal comment under an encoding comment + accepts an empty source + accepts not having not having a frozen string literal comment under a shebang + accepts a frozen string literal comment under ruby code + accepts a source with no tokens + registers an offense for a disabled frozen string literal below a shebang comment + registers an offense for having a frozen string literal comment after other comments + registers an offense for a frozen string literal comment below an encoding comment + registers an offense for a disabled frozen string literal below an encoding comment + registers an offense for a disabled frozen string literal comment below shebang and encoding comments + registers an offense for a frozen string literal comment on the top line + registers an offense for a frozen string literal comment below shebang and encoding comments + allows not having a frozen string literal comment under a shebang and an encoding comment + registers an offense for a frozen string literal comment below a shebang comment + always_true + accepts a frozen string literal comment below an encoding comment and extra space + registers an offense for not having a frozen string literal comment under an encoding comment and extra space + accepts a frozen string literal comment under shebang with no other code + registers an offense for not having a frozen string literal comment under a shebang, an encoding comment, and extra space + registers an offense for a disabled frozen string literal comment below shebang and encoding comments + registers an offense for a disabled frozen string literal comment under shebang with no other code + registers an offense for arbitrary tokens under shebang with no other code + accepts a frozen string literal below an encoding comment + registers an offense for arbitrary tokens below shebang above an encoding comments + accepts a source with no tokens + registers an offense for not having a frozen string literal comment under shebang with no other code + accepts a frozen string literal below a shebang comment + registers an offense for not having a frozen string literal comment under a shebang and an encoding comment + registers an offense for a disabled frozen string literal above an empty line + accepts an empty source + registers an offense for a disabled frozen string literal comment below an encoding comment and extra space + accepts a frozen string literal on the top line + registers an offense for a disabled frozen string literal on the top line + accepts a frozen string literal comment after other comments + registers an offense for a disabled frozen string literal + registers an offense for a disabled frozen string literal comment below shebang above an encoding comments + accepts an emacs style combined magic comment + registers an offense for a disabled frozen string literal below a shebang comment + accepts a frozen string literal comment below shebang and encoding comments + registers an offense for arbitrary tokens below an encoding comment and extra space + registers an offense for having a frozen string literal comment under ruby code + registers an offense for arbitrary tokens + registers an offense for a disabled frozen string literal comment after other comments + registers an offense for arbitrary tokens below shebang, an encoding comment, and extra space + registers an offense for not having a frozen string literal comment under an encoding comment + registers an offense for a disabled frozen string literal comment below shebang, an encoding comment, and extra space + accepts a frozen string literal comment below shebang above an encoding comments + registers an offense for arbitrary tokens below an encoding comment + registers an offense for arbitrary tokens above an empty line + accepts a frozen string literal comment below shebang, an encoding comment, and extra space + registers an offense for an extra first empty line + registers an offense for a disabled frozen string literal below an encoding comment + registers an offense for arbitrary tokens below shebang and encoding comments + registers an offense for not having a frozen string literal comment on the top line + registers an offense for arbitrary tokens below a shebang comment + target_ruby_version < 2.3 + accepts calling << on a string with interpolation + accepts freezing a string + accepts calling << on a string + accepts freezing a string with interpolation + always + accepts a source with no tokens + accepts an emacs style combined magic comment + accepts a frozen string literal comment below shebang above an encoding comments + registers an offense for not having a frozen string literal comment under a shebang and an encoding comment + registers an offense with an empty line between magic comments and the code + accepts a disabled frozen string literal below a shebang comment + registers an offense for an extra first empty line + registers an offense for having a frozen string literal comment under ruby code + registers an offense for not having a frozen string literal comment on the top line + accepts a disabled frozen string literal comment below shebang and encoding comments + accepts an empty source + registers an offense for not having a frozen string literal comment under a shebang + accepts a frozen string literal comment after other comments + registers an offense for not having a frozen string literal comment when there is only a shebang + registers an offense for not having a frozen string literal comment under an encoding comment + accepts a disabled frozen string literal on the top line + accepts a frozen string literal comment below newline-separated magic comments + registers an offense for not having a frozen string literal comment under an encoding comment separated by a newline + accepts a disabled frozen string literal comment below shebang above an encoding comments + accepts a frozen string literal comment below shebang and encoding comments + registers an offense for arbitrary tokens + accepts a disabled frozen string literal below an encoding comment + accepts a frozen string literal below an encoding comment + accepts a frozen string literal below a shebang comment + accepts a frozen string literal on the top line -RuboCop::Cop::Lint::StructNewOverride - registers an offense using `Struct.new(...)` with multiple overrides - registers an offense using `Struct.new(string, ...symbols)` - does not register an offense with no overrides - does not register an offense with an override within a given block - registers an offense using `Struct.new(...)` with a block - registers an offense using `Struct.new(...)` with an option argument - registers an offense using `Struct.new(symbol)` - registers an offense using `Struct.new(symbol, string)` - registers an offense using `Struct.new(...symbols)` - registers an offense using `::Struct.new(symbol)` +RuboCop::Cop::Naming::ConstantName + registers offenses for camel case in multiple const assignment + checks qualified const names + does not check names if rhs is a method call + does not check if rhs is another constant + does not check names if rhs is a method call with conditional assign + registers an offense for non-POSIX upper case in const name + registers an offense for camel case in const namewhen using frozen range assignment + does not check names if rhs is a `Struct.new` + registers an offense for camel case in const namewhen using frozen object assignment + allows screaming snake case in const name + does not check names if rhs is a `Struct.new` with conditional assign + does not check names if rhs is a `Class.new` with conditional assign + does not check names if rhs is a method call with block + registers 1 offense if rhs is offending const assignment + does not check if rhs is a non-offensive const assignment + registers an offense for camel case in const name + allows screaming snake case with POSIX upper case characters + registers an offense for snake case in const name + does not check names if rhs is a `Class.new` + allows screaming snake case in multiple const assignment + when a rhs is a conditional expression + when conditional branches contain only constants + does not check names + when conditional branches contain only string values + registers an offense + when conditional branches contain a value other than a constant + does not check names -RuboCop::Cop::Lint::PercentSymbolArray - detecting colons or commas in a %i/%I string - accepts tokens without colons or commas - registers an offense and corrects when symbols contain colons and are comma separated - registers an offense and corrects when one symbol has a colon but there are no commas - accepts likely false positive $, - accepts tokens without colons or commas - registers an offense and corrects when one symbol has a colon but there are no commas - registers an offense and corrects when there are no colons but one comma - accepts likely false positive $, - registers an offense and corrects when there are no colons but one comma - registers an offense and corrects when symbols contain colons and are comma separated - with binary encoded source - registers an offense and corrects when tokens contain quotes - accepts if tokens contain no quotes +RuboCop::CLI + finds a file with no .rb extension but has a shebang line + checks a given file with faults and returns 1 + registers an offense for a syntax error + registers an offense for Parser warnings + can process a file with an invalid UTF-8 byte sequence + does not register any offenses for an empty file + style guide only usage + via the cli option + --only-guide-cops + skips cops that have no link to a style guide + runs cops for rules that link to a style guide + overrides configuration of AllCops/StyleGuideCopsOnly + via the config + AllCops/StyleGuideCopsOnly + when it is false + runs cops for rules regardless of any link to the style guide + when it is true + skips cops that have no link to a style guide + AllCops/DisabledByDefault + when it is false + runs all cops that are enabled in default configuration + when it is true + runs only the cop configured in .rubocop.yml + when lines end with CR+LF + reports an offense + for a disabled cop + reports no offense when enabled on part of a file + configuration of target Ruby versions + when configured with an unsupported ruby + fails with an error message + when configured with an unknown version + fails with an error message + rubocop:disable comment + can disable all cops in a code section + can disable selected cops on a single line + can disable all cops on a single line + can disable selected cops in a code section + when not necessary + causes an offense to be reported + and RedundantCopDisableDirective is individually excluded + does not report RedundantCopDisableDirective offenses + and RedundantCopDisableDirective is disabled through department + does not report RedundantCopDisableDirective offenses + and there are no other offenses + exits with error code + when using `rubocop:disable` line comment for `Lint/EmptyBlock` + does not register an offense for `Lint/RedundantCopDisableDirective` + when using `rubocop:disable` line comment for `Style/RedundantInitialize` + does not register an offense for `Lint/RedundantCopDisableDirective` + and RedundantCopDisableDirective is individually disabled + does not report RedundantCopDisableDirective offenses + without using namespace + can disable selected cops on a single line but prints a warning + when --autocorrect-all is given + does not trigger RedundantCopDisableDirective due to lines moving around + Specify `--init` option to `rubocop` command + when .rubocop.yml already exists + fails with an error message + when .rubocop.yml does not exist + generate a .rubocop.yml file + when checking a correct file + returns 0 + when super is used with a block + still returns 0 + when a directory is named `*` + does not crash + when interrupted + returns 130 + configuration of `AutoCorrect` + when setting `AutoCorrect: false` for `Style/StringLiterals` + does not suggest `1 offense autocorrectable` for `Style/StringLiterals` + when given a file/directory that is not under the current dir + and the Rakefile path is absolute + checks a Rakefile but Style/FileName does not report + and the Rakefile path is relative + checks a Rakefile but Style/FileName does not report + and the directory is absolute + checks a Rakefile but Style/FileName does not report + and the directory is relative + checks a Rakefile but Style/FileName does not report + cops can exclude files based on config + ignores excluded files + obsolete cops + when configuration for TrailingComma is given + fails with an error message + info severity + when given `--display-only-fail-level-offenses` + returns a 0 code but does not list offenses + when given `--fail-level info` + returns a 1 code + when there are not only info offenses + returns a 1 code + when `Lint/Syntax` is given `Severity: info` + is an invalid configuration + when there are only info offenses + returns a 0 code + unknown cop + in configuration file is given + prints the error and exists with code 2 + configuration of `require` + unknown library is specified + exits with 2 + when errors are raised while processing files due to bugs + displays an error message to stderr + configuration from file + allows the default configuration file as the -c argument + can exclude a vendor directory indirectly + excludes the vendor directory by default + fails when a configuration file has invalid YAML syntax + can exclude a typical vendor directory + cannot disable Syntax offenses + ignores excluded files + works when a configuration file specifies Severity for Metrics/ParameterLists and Layout + runs without errors for an unrecognized cop name in .rubocop.yml and `--ignore-unrecognized-cops` option is given + fails when a configuration file specifies an invalid Severity + can be configured to override a parameter that is a hash in a special case + can be configured to merge a parameter that is a hash + can exclude directories relative to .rubocop.yml + works when a configuration file specifies Severity for Metrics/ParameterLists and Layout/LineLength + can use an alternative max line length from a config file + works when a cop that others depend on is disabled + displays cop names if DisplayCopNames is false + can exclude a vendor directory with an erroneous config file + only reads configuration in explicitly included hidden directories + does not read files in excluded list + uses the DefaultFormatter if another formatter is not specified + matches included/excluded files correctly when . argument is given + prints an error message for an unrecognized EnforcedStyle + works when a configuration file passed by -c specifies Exclude with strings + prefers a config file in ancestor directory to another in home + displays style guide URLs if DisplayStyleGuide is true + can disable parser-derived offenses with warning severity + can be configured with option to disable a certain error + prints a warning for an unrecognized configuration parameter + works when a configuration file passed by -c specifies Exclude with regexp + can have different config files in different directories + does not consider Include parameters in subdirectories + prints an error for an unrecognized cop name in .rubocop.yml + shows an error if the input file cannot be found + finds included files + can be configured with project config to disable a certain error + when obsolete MultiSpaceAllowedForOperators param is used + displays a warning + when configuration is taken from $HOME/.rubocop.yml + handles relative excludes correctly when run from project root + when MultilineOperationIndentation is used with aligned style and IndentationWidth parameter + fails with an error message + when MultilineMethodCallIndentation is used with aligned style and IndentationWidth parameter + fails with an error message + when a value in a hash is overridden with nil + acts as if the key/value pair was removed + when configured for indented_internal_methods style indentation + registers offense for normal indentation in module + accepts indented_internal_methods style indentation + registers offense for normal indentation in class + when --force-default-config option is specified + when config file specified with -c + ignores config file + when no config file specified + ignores config file + when a file inherits from a higher level + inherits relative excludes correctly + without using namespace + can be configured with option to disable a certain error + when parallel static by default + when specifying `--debug` option only` + fails with an error message + when setting `UseCache: true` + fails with an error message + when setting `UseCache: false` + fails with an error message + when specifying `--debug` and `-a` options` + uses parallel inspection when correcting the file -RuboCop::Cop::Style::GuardClause - registers an offense when using `|| raise` in `then` branch - does not report an offense if break is inside if..elsif..else..end - registers an error with return in the if branch - registers an error with return in the else branch - doesn't register an error if condition has multiple lines - doesn't register an error if control flow expr has multiple lines - accepts a method which body is if / unless with else - does not report an offense if raise "error" is inside if..elsif..else..end - registers an error with next in the else branch - doesn't report an offense if condition has multiple lines - does not report an offense if return is inside if..elsif..else..end - registers an error if non-control-flow branch has multiple lines - registers an error with break in the if branch - accepts a method with empty parentheses as its body - doesn't register an error if control flow expr has multiple lines - registers an error if non-control-flow branch has multiple lines - does not report an offense if raise "error" is inside elsif - registers an offense when using `and return` in `then` branch - registers an offense when using `and return` in `else` branch - doesn't register an error if control flow expr has multiple lines - accepts a method which body does not end with if / unless - doesn't register an error if control flow expr has multiple lines - registers an error if non-control-flow branch has multiple lines - does not report an offense if return is inside elsif - registers an error with raise "error" in the if branch - doesn't register an error if condition has multiple lines - does not report an offense if next is inside if..elsif..else..end - registers an offense when using `|| raise` in `else` branch - does not report an offense if break is inside elsif - does not report an offense if body is if..elsif..end - accepts a method whose body is a modifier if / unless - registers an error with next in the if branch - registers an error with raise "error" in the else branch - registers an error if non-control-flow branch has multiple lines - doesn't register an error if condition has multiple lines - doesn't register an error if condition has multiple lines - does not report an offense if next is inside elsif - does not register an offense when assigning the result of a guard condition with `else` - registers an error with break in the else branch - MinBodyLength: 1 - reports an offense for if whose body has 1 line - behaves like reports offense - reports an offense if method body ends with if / unless without else - reports an offense if method body is if / unless without else - behaves like reports offense - reports an offense if method body ends with if / unless without else - reports an offense if method body is if / unless without else - Invalid MinBodyLength - fails with an error - method in module - registers an offense for singleton methods - registers an offense for instance method - MinBodyLength: 4 - accepts a method whose body has 3 lines - AllowConsecutiveConditionals: false - reports an offense when not allowed same depth multiple if statement andpreceding expression is a conditional at the same depth - AllowConsecutiveConditionals: true - reports an offense when allowed same depth multiple if statement andpreceding expression is not a conditional at the same depth - does not register an offense when allowed same depth multiple if statement andpreceding expression is not a conditional at the same depth - with Metrics/MaxLineLength enabled - when the correction is too long for a single line - with a trivial body - does not register an offense - with a nested `if` node - does registers an offense - with a nested `begin` node - does registers an offense - with Metrics/MaxLineLength disabled - registers an offense with modifier example code regardless of length +RuboCop::Cop::Style::SingleLineMethods + autocorrects def with argument and no parentheses + autocorrects def with semicolon before end + registers an offense for a single-line method and method body is enclosed in parentheses + does not crash on an method with a capitalized name + registers an offense for a single-line method + autocorrects def with argument in parentheses + autocorrects defs with parentheses after method name + accepts a multi-line method + autocorrects def with semicolon after method name + when `Style/EndlessMethod` is enabled + prior to ruby 3.0 + corrects to a multiline method + with `allow_single_line` style + behaves like convert to endless method + corrects to an endless class method definition when using < + corrects to an endless class method definition when using == + does not add parens if they are already present + corrects to an endless class method definition when using != + corrects to an endless class method definition when using <= + corrects to an endless class method definition + corrects to an endless method definition + corrects to a normal method if the method body contains multiple statements + corrects to multiline method definition when defining setter method + retains comments + does not to an endless class method definition when using `next` + corrects to an endless method definition when single line method call with parentheses + corrects to an endless class method definition when using === + corrects to an endless class method definition when using > + does not to an endless class method definition when using `break` + corrects to an endless method definition when single line method call without parentheses + corrects to an endless method definition when method body is a literal + does not to an endless class method definition when using `return` + corrects to an endless class method definition when using >= + handles arguments properly + with AllowIfMethodIsEmpty: true + does not correct + with AllowIfMethodIsEmpty: false + does not turn a method with no body into an endless method + with `allow_always` style + behaves like convert to endless method + corrects to an endless method definition when single line method call with parentheses + does not add parens if they are already present + corrects to a normal method if the method body contains multiple statements + corrects to an endless method definition when method body is a literal + does not to an endless class method definition when using `break` + handles arguments properly + corrects to an endless class method definition when using > + retains comments + corrects to an endless method definition when single line method call without parentheses + does not to an endless class method definition when using `next` + corrects to an endless class method definition when using === + corrects to an endless class method definition + corrects to an endless class method definition when using <= + corrects to an endless method definition + does not to an endless class method definition when using `return` + corrects to multiline method definition when defining setter method + corrects to an endless class method definition when using == + corrects to an endless class method definition when using >= + corrects to an endless class method definition when using != + corrects to an endless class method definition when using < + with AllowIfMethodIsEmpty: false + does not turn a method with no body into an endless method + with AllowIfMethodIsEmpty: true + does not correct + with `disallow` style + corrects to an normal method + endless methods + does not register an offense + when AllowIfMethodIsEmpty is enabled + accepts a single-line empty method + when AllowIfMethodIsEmpty is disabled + registers an offense for an empty method + when `Style/EndlessMethod` is disabled + corrects to an normal method -RuboCop::Cop::Lint::OutOfRangeRegexpRef - registers an offense when references are used before any regexp - registers an offense when the regexp appears on the right hand side of `=~` - does not register offense to a regexp with encoding option and valid references for numbered captures - ignores `match` with no receiver - ignores `match` with no arguments - does not register an offense when in range references are used inside a when clause - does not register offense to a regexp with valid references for named captures - does not register an offense regexp containing non literal - does not register offense to a regexp with valid references for numbered captures - registers an offense when the regexp is matched with `match` - registers an offense when out of range references are used inside a when clause - uses the maximum number of captures for when clauses with multiple conditions - registers an offense when out of range references are used for mix of numbered and named captures - ignores calls to `match?` - only registers an offense for when clauses when the regexp is matched as a literal - registers an offense when the regexp is matched with `===` - registers an offense when out of range references are used for non captures - ignores regexp when clause conditions that contain interpolations - does not register offense to a regexp with valid references for a mix named and numbered captures - only registers an offense when the regexp is matched as a literal - registers an offense when out of range references are used for numbered captures - registers an offense when out of range references are used for named captures - matching with gsub! - does not register an offense when in range references are used - only registers an offense when the regexp is matched as a literal - registers an offense when out of range references are used - matching with end_with? - does not register an offense when in range references are used - only registers an offense when the regexp is matched as a literal - registers an offense when out of range references are used - matching with `grep` - does not register an offense when in range references are used - only registers an offense when the regexp is matched as a literal - registers an offense when out of range references are used - matching with slice - registers an offense when out of range references are used - does not register an offense when in range references are used - only registers an offense when the regexp is matched as a literal - matching with start_with? - only registers an offense when the regexp is matched as a literal - does not register an offense when in range references are used - registers an offense when out of range references are used - matching with `[]` - does not register an offense when in range references are used - registers an offense when out of range references are used - only registers an offense when the regexp is matched as a literal - matching with sub - only registers an offense when the regexp is matched as a literal - does not register an offense when in range references are used - registers an offense when out of range references are used - matching with slice! - does not register an offense when in range references are used - registers an offense when out of range references are used - only registers an offense when the regexp is matched as a literal - matching with match - does not register an offense when in range references are used - only registers an offense when the regexp is matched as a literal - registers an offense when out of range references are used - matching with sub! - registers an offense when out of range references are used - does not register an offense when in range references are used - only registers an offense when the regexp is matched as a literal - matching with partition - does not register an offense when in range references are used - only registers an offense when the regexp is matched as a literal - registers an offense when out of range references are used - matching with scan - only registers an offense when the regexp is matched as a literal - registers an offense when out of range references are used - does not register an offense when in range references are used - matching with index - only registers an offense when the regexp is matched as a literal - registers an offense when out of range references are used - does not register an offense when in range references are used - matching with gsub - only registers an offense when the regexp is matched as a literal - registers an offense when out of range references are used - does not register an offense when in range references are used - matching with rpartition - does not register an offense when in range references are used - registers an offense when out of range references are used - only registers an offense when the regexp is matched as a literal - when both the LHS and RHS use regexp - only considers the RHS regexp - when calling a regexp method on a nth-ref node - registers an offense when calling gsub on an invalid nth-ref - does not register an offense when calling gsub on a valid nth-ref - registers an offense if the capturing groups have changed - matching with rindex - only registers an offense when the regexp is matched as a literal - registers an offense when out of range references are used - does not register an offense when in range references are used +RuboCop::ConfigRegeneration + #options + when the todo file is malformed + is expected to eq {:auto_gen_config=>true} + it parses options from the generation comment + is expected to eq {:auto_gen_config=>true, :auto_gen_only_exclude=>true, :auto_gen_timestamp=>false, :exclude_limit=>"100", :offense_counts=>false} + when there is a blank todo file + is expected to eq {:auto_gen_config=>true} + when no todo file exists + is expected to eq {:auto_gen_config=>true} -RuboCop::Cop::Style::OptionalArguments - registers an offense when an optional argument is followed by a required argument - allows methods with multiple optional arguments at the end - allows methods with only one optional argument - allows methods without arguments - allows methods with only one required argument - allows methods with only required arguments - registers an offense for each optional argument when multiple optional arguments are followed by a required argument - allows methods with only optional arguments - named params - with default values - allows optional arguments before an optional named argument - required params - allows optional arguments before required named arguments - registers an offense for optional arguments that come before required arguments where there are name arguments - allows optional arguments to come before a mix of required and optional named argument +RuboCop::Cop::Style::RedundantEach + does not register an offense when not chaining `each_` calls + does not register an offense when using `each_with_index` + does not register an offense when using `each_with_index.reverse_each` + does not register an offense when using `reverse_each(&:foo).each {...}` + registers an offense when using `each.each(&:foo)` + does not register an offense when using `each` with a symbol proc for last argument + registers an offense when using `each.each_with_index` + registers an offense when using `each.reverse_each` + registers an offense when using `each.each` + does not register an offense when using only single `each` + does not register an offense when using `reverse_each {}.each {}` + does not register an offense when using `each` with a symbol proc argument + does not register an offense when using `each {}.each_with_index {}` + registers an offense when using `reverse_each.each` + registers an offense when using `reverse_each.each_with_index` + does not register an offense when using `each` as enumerator + does not register an offense when using `each.with_object` + does not register an offense when using `each.with_index` + does not register an offense when using `each {}.reverse_each {}` + does not register an offense when using `each_with_object` + does not register an offense when using `each_ancestor.each` + does not register an offense when any method is used between methods with `each` in the method name + does not register an offense when using `each {}.each_with_object([]) {}` + registers an offense when using a method starting with `each_` with `each_with_index` + registers an offense when using `reverse_each.each_with_object` + registers an offense when using `each.each_with_object` + does not register an offense when using `each_foo {}.each_with_object([]) {}` + registers an offense when using a method starting with `each_` with `each_with_object` -RuboCop::Cop::Style::Not - autocorrects "not" followed by parens with ! - parenthesizes when `not` would change the meaning of a binary exp - registers an offense for not - parenthesizes when `not` is applied to or - uses the reverse operator when `not` is applied to a comparison - parenthesizes when `not` is applied to and - parenthesizes when `not` is applied to a ternary op - does not register an offense for ! - autocorrects "not" with ! +RuboCop::Cop::Lint::NumberedParameterAssignment + registers an offense when using `_0` lvar + registers an offense when using `_10` lvar + does not register an offense when index assignment + does not register an offense when using non numbered parameter + when Ruby 2.7 or lower + registers an offense when using `_7` numbered parameter + registers an offense when using `_5` numbered parameter + registers an offense when using `_8` numbered parameter + registers an offense when using `_3` numbered parameter + registers an offense when using `_2` numbered parameter + registers an offense when using `_6` numbered parameter + registers an offense when using `_4` numbered parameter + registers an offense when using `_1` numbered parameter + registers an offense when using `_9` numbered parameter -RuboCop::Cop::Style::AsciiComments - accepts comments with only ascii chars - registers an offense for a comment with non-ascii chars - registers an offense for comments with mixed chars - when certain non-ascii chars are allowed - registers an offense for comments with non-allowed non-ascii chars - accepts comment with allowed non-ascii chars +RuboCop::Cop::Lint::EmptyEnsure + does not register an offense for non-empty ensure + registers an offense and corrects empty ensure RuboCop::Cop::Style::RedundantInterpolation - registers an offense for "#@var" - registers an offense for "#{1 + 1; 2 + 2}" - registers an offense for "#{@var}" - registers an offense for "#{$1}" - registers an offense for "#$+" - accepts strings with characters after the interpolation - accepts strings with characters before the interpolation - registers an offense for ["#{@var}"] - registers an offense for "#{1 + 1}" registers an offense for "#{do_something 42}" + registers an offense for "#{$1}" + registers an offense for "#$var" + registers an offense for "#{@@var}" registers an offense for "#{foo.do_something 42}" - registers an offense for "#$1" - registers an offense for "#{number}" - registers an offense for "%|#{1 + 1}|" - registers an offense for "#@@var" + accepts strings implicitly concatenated with an earlier string registers an offense for "#{var}" + accepts strings with characters before the interpolation + registers an offense for "#{1 + 1; 2 + 2}" + accepts strings with characters after the interpolation + registers an offense for "%|#{1 + 1}|" + registers an offense for "#{1 + 1}" + accepts strings that are part of a %W() accepts strings implicitly concatenated with a later string + registers an offense for "#{@var}" + registers an offense for "#@@var" + registers an offense for "%Q(#{1 + 1})" + registers an offense for "#{$+}" + registers an offense for "#$+" registers an offense for "#{$var}" + registers an offense for "#{number}" + registers an offense for "#@var" + registers an offense for ["#{@var}"] registers an offense for "#{do_something(42)}" - registers an offense for "#{@@var}" - registers an offense for "#{$+}" - accepts strings that are part of a %W() - registers an offense for "#$var" - registers an offense for "%Q(#{1 + 1})" - accepts strings implicitly concatenated with an earlier string - -RuboCop::YAMLDuplicationChecker - when yaml has duplicated keys in the top level - calls block with keys - calls block - when yaml does not have any duplication - does not call block - when yaml has duplicated keys in the second level - calls block with keys - calls block - -RuboCop::Cop::Lint::SafeNavigationWithEmpty - in a conditional - registers an offense and corrects on `&.empty?` - does not register an offense on `.empty?` - outside a conditional - registers no offense - -RuboCop::Cop::Layout::SpaceAroundOperators - accepts operators with spaces - accepts exclamation point definition - accepts an assignment with spaces - accepts scope operator - accepts a unary - accepts an assignment with a blank line - accepts an assignment by `for` statement - accepts operator surrounded by tabs - accepts rational - accepts an assignment with the same alignment margins - accepts ::Kernel::raise - accepts unary operators without space - accepts exponent operator without spaces - accepts an operator at the beginning of a line - registers an offense and corrects singleton class operator` - accepts []= without space - accepts argument default values without space - accepts splat operator - accepts def of operator - accepts an operator called with method syntax - accepts ranges - accepts an assignment followed by newline - accepts [arg] without space - registers an offense and corrects exclamation point negation - accepts an operator at the end of a line - accepts some operators that are exceptions & don't need spaces - accepts the result of the ExtraSpacing Cop - accepts operator symbols - registers an offenses for exponent operator with spaces - accepts [] without space - extra space around operators - does not register an offenses match operators between `+=` and `<<` - registers an offense and corrects inheritance < with too many spaces - registers an offense and corrects hash rocket with too many spaces at rescue - registers an offense and corrects arguments to a method - accepts for a hash rocket with an extra space for alignment on multiple line - registers an offense and corrects operators with too many spaces on the same line - registers an offense and corrects a setter call with too many spaces - does not register an offenses match operators between `<<` and `+=` - registers an offense and corrects binary operators that could be unary - registers an offense and corrects various assignments with too many spaces - registers an offense and corrects a hash rocket with an extra spaceon multiple line - registers an offense and corrects match operators with too many spaces - registers an offense and corrects ternary operator with too many spaces - registers an offense and corrects a hash rocket with too many spaces - registers an offense and corrects equality operators with too many spaces - registers an offense and corrects operators with too many spaces - registers an offense and corrects assignment with too many spaces on either side - registers an offense and corrects `-` with too many spaces with negative lhs operand - behaves like modifier with extra space - registers an offense in presence of modifier while statement - behaves like modifier with extra space - registers an offense in presence of modifier until statement - behaves like modifier with extra space - registers an offense in presence of modifier unless statement - when does not allowed for alignment - registers an offense and corrects an extra space - behaves like modifier with extra space - registers an offense in presence of modifier if statement - missing space around operators - registers an offense and corrects a setter call without spaces - registers an offense and corrects `-` without space with a negative lhs operand - registers an offense and corrects match operators without space - registers an offense and corrects equality operators without space - registers an offense for binary operators that could be unary - registers an offense for operators without spaces - doesn't register an offense for operators with newline on right - registers an offense for assignment without space on both sides - registers an offense and corrects hash rocket without space at rescue - registers an offense and corrects inheritance < without space - registers an offense and corrects string concatenation without messing up new lines - registers an offense and corrects arguments to a method - registers an offense and corrects various assignments without space - when a hash literal is on a single line - and Layout/HashAlignment:EnforcedHashRocketStyle is table - registers an offense and corrects a hash rocket without spaces - and Layout/HashAlignment:EnforcedHashRocketStyle is key - registers an offense and corrects a hash rocket without spaces - behaves like modifier with missing space - registers an offense in presence of modifier until statement - behaves like modifier with missing space - registers an offense in presence of modifier unless statement - ternary operators - registers an offense and corrects operators with no spaces - registers an offense and corrects operators with just a leading space - registers an offense and corrects operators with just a trailing space - when a hash literal is on multiple lines - and Layout/HashAlignment:EnforcedHashRocketStyle is table - doesn't register an offense for a hash rocket without spaces - and Layout/HashAlignment:EnforcedHashRocketStyle is key - registers an offense and corrects a hash rocket without spaces - behaves like modifier with missing space - registers an offense in presence of modifier if statement - behaves like modifier with missing space - registers an offense in presence of modifier while statement - when EnforcedStyleForExponentOperator is space - registers an offenses for exponent operator without spaces - when Layout/ExtraSpacing has `ForceEqualSignAlignment` configured to true - allows constants to be aligned - allows variables to be aligned - >= Ruby 2.7 - does not register an offenses for one-line pattern matching syntax (`in`) - >= Ruby 3.0 - registers an offenses for one-line pattern matching syntax (`=>`) - -RuboCop::Cop::Style::ClassVars - registers an offense for class variable declaration - does not register an offense for class variable usage - registers an offense for class variable set on class receiver - registers an offense for class variable set in class - -RuboCop::Cop::InternalAffairs::UselessRestrictOnSend - registers an offense when using `RESTRICT_ON_SEND` and not defines send callback method - does not register an offense when using `RESTRICT_ON_SEND` and defines `on_send` with alias_method - does not register an offense when using `RESTRICT_ON_SEND` and defines `on_send` with alias - does not register an offense when using `RESTRICT_ON_SEND` and defines `on_send` - does not register an offense when using `RESTRICT_ON_SEND` and defines `after_send` with alias - does not register an offense when using `RESTRICT_ON_SEND` and defines `after_send` with alias_method - does not register an offense when using `RESTRICT_ON_SEND` and defines `after_send` + registers an offense for "#$1" -RuboCop::Cop::Style::StringLiteralsInInterpolation - when configured with a bad value - fails - configured with double quotes preferred - registers an offense for single quotes within embedded expression - registers an offense for single quotes within embedded expression in a heredoc string - configured with single quotes preferred - accepts double quotes on static strings within a method - can handle character literals - registers an offense for double quotes within embedded expression - registers an offense for double quotes within embedded expression in a heredoc string - can handle a built-in constant parsed as string - accepts double quotes on a broken static string - accepts double quotes on a static string +RuboCop::Cop::Gemspec::RequiredRubyVersion + registers an offense when `required_ruby_version` is an empty array + registers an offense when `required_ruby_version` is not specified + registers an offense when `required_ruby_version` is blank + target ruby version > 2.6 + registers an offense when `required_ruby_version` is specified with >= and is higher than `TargetRubyVersion` + registers an offense when `required_ruby_version` is specified with ~> and is higher than `TargetRubyVersion` + target ruby version > 2.7 + does not register an offense when `required_ruby_version` is specified with >= and equals `TargetRubyVersion` + does not register an offense when lowest version of `required_ruby_version` equals `TargetRubyVersion` + does not register an offense when `required_ruby_version` is specified with ~> and equals `TargetRubyVersion` + registers an offense when `required_ruby_version` is specified with >= without a minor version and is lower than `TargetRubyVersion` + does not register an offense when `required_ruby_version` is specified with ~> without a patch version and equals `TargetRubyVersion` + does not register an offense when `required_ruby_version` is specified with >= without a patch version and equals `TargetRubyVersion` + registers an offense when `required_ruby_version` is specified with ~> without a minor version and is lower than `TargetRubyVersion` + target ruby version > 2.7 + recognizes Gem::Requirement and registers offense + registers an offense when `required_ruby_version` is specified with >= and is lower than `TargetRubyVersion` + registers an offense when `required_ruby_version` is specified in array and is lower than `TargetRubyVersion` + recognizes a Gem::Requirement with multiple requirements and does not register an offense + registers an offense when `required_ruby_version` is specified with ~> and is lower than `TargetRubyVersion` + false negatives + does not register an offense when `required_ruby_version` is assigned as a variable (string literal) + does not register an offense when `required_ruby_version` is assigned as a variable (an array of string literal) -RuboCop::Cop::Style::RedundantParentheses - accepts parentheses around a constant passed to when - registers an offense for parens around a positive exponent - accepts parentheses inside an irange - accepts parentheses around operator keywords - accepts parentheses when enclosed in parentheses at `while-post` - registers an offense for parens around a literal hash value and following newline - accepts parentheses in super call with hash - registers an offense and corrects an array of multiple heredocs - registers an offense for parens around an interpolated expression - registers an offense for parens around a float exponentiation base - accepts parentheses when they touch the preceding keyword - accepts parentheses when they touch the following keyword - registers an offense for parens around a variable after semicolon - registers an offense for parens around method body - accepts parentheses around an irange - registers an offense for parens around a block body - registers an offense for parens around last expressions in method body - registers an offense for parens around a literal in array and following newline - registers an offense when there is space around the parentheses - registers an offense for parens around last expressions in block body - accepts parentheses when enclosed in parentheses at `until-post` - registers an offense for parens around a literal in array - accepts parentheses in yield call with hash - registers an offense and corrects when method arguments are unnecessarily parenthesized - registers an offense for parens around a negative exponent - registers an offense for parens around an integer exponentiation base - registers an offense and corrects for a parenthesized item in a hash where the comma is on a line with the closing parens - registers an offense for parens around a literal hash value - accepts parentheses around an erange - accepts parentheses inside an erange - accepts parentheses around a method call with unparenthesized arguments - registers an offense for parens around a receiver of a method call with an argument - accepts parentheses around the error passed to rescue - behaves like redundant - registers an offense for parentheses around a literal - behaves like redundant - registers an offense for parentheses around a keyword - behaves like redundant - registers an offense for parentheses around a literal - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like redundant - registers an offense for parentheses around an unary operation - behaves like redundant - registers an offense for parentheses around a literal - behaves like redundant - registers an offense for parentheses around an unary operation - behaves like redundant - registers an offense for parentheses around a literal - when the first argument in a method call begins with a hash literal - accepts parentheses if the argument list is not parenthesized - registers an offense if the argument list is parenthesized - behaves like redundant - registers an offense for parentheses around a method call - behaves like plausible - accepts parentheses when arguments are unparenthesized - ternaries - when Style/TernaryParentheses has EnforcedStyle: require_parentheses_when_complex - behaves like plausible - accepts parentheses when arguments are unparenthesized - when Style/TernaryParentheses has EnforcedStyle: require_parentheses - behaves like plausible - accepts parentheses when arguments are unparenthesized - when Style/TernaryParentheses is not enabled - registers an offense for parens around constant ternary condition - when Style/TernaryParentheses has EnforcedStyle: require_no_parentheses - registers an offense for parens around ternary condition - behaves like redundant - registers an offense for parentheses around a method call - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like redundant - registers an offense for parentheses around a literal - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like redundant - registers an offense for parentheses around a keyword - behaves like redundant - registers an offense for parentheses around a literal - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like keyword with arguments - behaves like redundant - registers an offense for parentheses around a keyword - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like redundant - registers an offense for parentheses around a keyword - behaves like redundant - registers an offense for parentheses around a keyword - behaves like redundant - registers an offense for parentheses around an unary operation - behaves like redundant - registers an offense for parentheses around a keyword - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like redundant - registers an offense for parentheses around a constant - behaves like redundant - registers an offense for parentheses around a method call - behaves like redundant - registers an offense for parentheses around a method call - behaves like redundant - registers an offense for parentheses around a method call - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like redundant - registers an offense for parentheses around a method call - behaves like redundant - registers an offense for parentheses around a literal - behaves like redundant - registers an offense for parentheses around a literal - behaves like keyword with return value - behaves like redundant - registers an offense for parentheses around a keyword - behaves like redundant - registers an offense for parentheses around a keyword - behaves like redundant - registers an offense for parentheses around a keyword - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like redundant - registers an offense for parentheses around a literal - behaves like redundant - registers an offense for parentheses around a keyword - behaves like keyword with arguments - behaves like redundant - registers an offense for parentheses around a keyword - behaves like redundant - registers an offense for parentheses around a keyword - behaves like redundant - registers an offense for parentheses around a keyword - behaves like plausible - accepts parentheses when arguments are unparenthesized - when a hash literal is the second argument in a method call - registers an offense - behaves like keyword with return value - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like redundant - registers an offense for parentheses around a keyword - behaves like redundant - registers an offense for parentheses around a keyword - behaves like redundant - registers an offense for parentheses around a keyword - behaves like redundant - registers an offense for parentheses around a variable - when parentheses are used like method argument parentheses - accepts parens around the arg - behaves like redundant - registers an offense for parentheses around a variable - literals in an array - when there is a comma on the same line as the closing parentheses - registers an offense and corrects when there is assignment - registers an offense and corrects when there is a subsequent item - registers an offense and corrects when there is no subsequent item - registers an offense and corrects when there is a trailing comma - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like redundant - registers an offense for parentheses around a literal - behaves like redundant - registers an offense for parentheses around a method call - behaves like redundant - registers an offense for parentheses around a literal - behaves like redundant - registers an offense for parentheses around a literal - behaves like redundant - registers an offense for parentheses around a keyword - behaves like keyword with return value - behaves like redundant - registers an offense for parentheses around a keyword - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like redundant - registers an offense for parentheses around a keyword - behaves like redundant - registers an offense for parentheses around a keyword - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like redundant - registers an offense for parentheses around a method call - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like redundant - registers an offense for parentheses around an unary operation - behaves like redundant - registers an offense for parentheses around a literal - behaves like redundant - registers an offense for parentheses around a method call - behaves like redundant - registers an offense for parentheses around a keyword - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like redundant - registers an offense for parentheses around a keyword - behaves like plausible - accepts parentheses when arguments are unparenthesized - when a non-parenthesized call has an arg and a block - accepts parens around the arg - behaves like redundant - registers an offense for parentheses around a literal - behaves like redundant - registers an offense for parentheses around a literal - behaves like plausible - accepts parentheses when arguments are unparenthesized - behaves like redundant - registers an offense for parentheses around a variable - behaves like redundant - registers an offense for parentheses around a literal - pin operator - behaves like allowed parentheses - accepts parentheses on a method call on an instance variable - behaves like allowed parentheses - accepts parentheses on a hash literal - behaves like allowed parentheses - accepts parentheses on a method call on a local variable - behaves like allowed parentheses - accepts parentheses on a range literal - behaves like allowed parentheses - accepts parentheses on a method call on a class variable - behaves like redundant parentheses - registers an offense and corrects a local variable - behaves like redundant parentheses - registers an offense and corrects a global variable - behaves like allowed parentheses - accepts parentheses on a function call with no arguments - behaves like allowed parentheses - accepts parentheses on an int literal - behaves like allowed parentheses - accepts parentheses on a method call on a global variable - behaves like allowed parentheses - accepts parentheses on an array literal - behaves like redundant parentheses - registers an offense and corrects an instance variable - behaves like allowed parentheses - accepts parentheses on an expression - behaves like allowed parentheses - accepts parentheses on a function call with arguments - behaves like redundant parentheses - registers an offense and corrects a class variable - behaves like plausible - accepts parentheses when arguments are unparenthesized +RuboCop::Cop::Style::RedundantSelfAssignmentBranch + does not register an offense when lhs is not variable + registers and corrects an offense when self-assigning redundant else branch and empty if branch + does not register an offense when using `elsif` and self-assigning the value of `then` branch + does not register an offense when self-assigning redundant else ternary branch for ivar + registers and corrects an offense when self-assigning redundant if ternary branch + does not register an offense when not self-assigning redundant branches + registers and corrects an offense when self-assigning redundant else branch and empty else branch + does not register an offense when self-assigning redundant else branch and multiline else branch + registers and corrects an offense when self-assigning redundant else ternary branch + registers and corrects an offense when self-assigning redundant if branch + does not register an offense when using `elsif` and self-assigning the value of `elsif` branch + does not register an offense when self-assigning redundant else ternary branch for gvar + does not register an offense when using only if branch + does not register an offense when multi assignment + does not register an offense when self-assigning redundant else branch and multiline if branch + registers and corrects an offense when self-assigning redundant else branch + does not register an offense when using `elsif` and self-assigning the value of `else` branch + does not register an offense when self-assigning redundant else ternary branch for cvar -RuboCop::Cop::Gemspec::DependencyVersion - with `EnforcedStyle: required` - using add_runtime_dependency - does not register an offense when adding runtime dependency by parenthesized call with branch specification - registers an offense when adding runtime dependency without version specification - does not register an offense when adding runtime dependency by parenthesized call with commit ref specification - does not register an offense when adding runtime dependency with branch specification - does not register an offense when adding runtime dependency with tag specification - registers an offense when adding runtime dependency using git option by parenthesized call without version specification - does not register an offense when adding runtime dependency by parenthesized call with tag specification - does not register an offense when adding runtime dependency with commit ref specification - does not register an offense when adding runtime dependency with version specification - does not register an offense when adding runtime dependency by parenthesized call with version specification - registers an offense when adding runtime dependency using git option without version specification - registers an offense when adding runtime dependency by parenthesized call without version specification - with `AllowedGems` - registers an offense when adding dependency by parenthesized call without version specification excepts allowed gems - registers an offense when adding dependency without version specification excepts allowed gems - using add_development_dependency - does not register an offense when adding development dependency by parenthesized call with commit ref specification - does not register an offense when adding development dependency by parenthesized call with version specification - does not register an offense when adding development dependency with version specification - does not register an offense when adding development dependency by parenthesized call with branch specification - does not register an offense when adding development dependency by parenthesized call with tag specification - does not register an offense when adding development dependency with commit ref specification - does not register an offense when adding development dependency with tag specification - registers an offense when adding development dependency using git option without version specification - registers an offense when adding development dependency without version specification - registers an offense when adding development dependency by parenthesized call without version specification - does not register an offense when adding development dependency with branch specification - registers an offense when adding development dependency using git option by parenthesized call without version specification - using add_dependency - does not register an offense when adding dependency by parenthesized call with commit ref specification - registers an offense when adding dependency by parenthesized call without version specification - does not register an offense when adding dependency by parenthesized call with version specification - registers an offense when adding dependency without version specification - registers an offense when adding dependency using git option by parenthesized call without version specification - does not register an offense when adding dependency with branch specification - does not register an offense when adding dependency with commit ref specification - registers an offense when adding dependency using git option without version specification - does not register an offense when adding dependency by parenthesized call with branch specification - does not register an offense when adding dependency with tag specification - does not register an offense when adding dependency by parenthesized call with tag specification - does not register an offense when adding dependency with version specification - with `EnforcedStyle: forbidden` - with `AllowedGems` - registers an offense when adding dependency without version specification - registers an offense when adding dependency by parenthesized call without version specification - using add_dependency - does not register an offense when adding dependency without version specification - registers an offense when adding dependency with branch specification - does not register an offense when adding dependency using git option without version specification - registers an offense when adding dependency by parenthesized call with tag specification - registers an offense when adding dependency with tag specification - registers an offense when adding dependency with version specification - registers an offense when adding dependency by parenthesized call with branch specification - does not register an offense when adding dependency by parenthesized call without version specification - registers an offense when adding dependency by parenthesized call with commit ref specification - registers an offense when adding dependency by parenthesized call with version specification - registers an offense when adding dependency with commit ref specification - does not register an offense when adding dependency using git option by parenthesized call without version specification - using add_runtime_dependency - registers an offense when adding runtime dependency with version specification - registers an offense when adding runtime dependency with branch specification - does not register an offense when adding runtime dependency using git option without version specification - registers an offense when adding runtime dependency by parenthesized call with commit ref specification - registers an offense when adding runtime dependency by parenthesized call with tag specification - registers an offense when adding runtime dependency by parenthesized call with branch specification - does not register an offense when adding runtime dependency by parenthesized call without version specification - does not register an offense when adding runtime dependency using git option by parenthesized call without version specification - registers an offense when adding runtime dependency with tag specification - registers an offense when adding runtime dependency by parenthesized call with version specification - does not register an offense when adding runtime dependency without version specification - registers an offense when adding runtime dependency with commit ref specification - using add_development_dependency - registers an offense when adding development dependency by parenthesized call with tag specification - does not register an offense when adding development dependency using git option without version specification - registers an offense when adding development dependency with tag specification - does not register an offense when adding development dependency by parenthesized call without version specification - registers an offense when adding development dependency by parenthesized call with commit ref specification - registers an offense when adding development dependency with version specification - registers an offense when adding development dependency with branch specification - registers an offense when adding development dependency by parenthesized call with version specification - does not register an offense when adding development dependency using git option by parenthesized call without version specification - registers an offense when adding development dependency with commit ref specification - does not register an offense when adding development dependency without version specification - registers an offense when adding development dependency by parenthesized call with branch specification +RuboCop::Cop::Style::RescueStandardError + explicit + accepts rescue modifier + when rescuing in a method definition + accepts rescuing StandardError with other errors + accepts rescuing StandardError by itself, assigned to a variable + accepts rescuing StandardError by itself + accepts rescuing a single error other than StandardError + accepts rescuing StandardError with other errors, assigned to a variable + accepts rescuing a single error other than StandardError, assigned to a variable + when the error is assigned to a variable + registers an offense + when rescue is called without an error class + registers an offense + when rescuing in a begin block + accepts rescuing StandardError by itself + accepts rescuing a single error other than StandardErrorassigned to a variable + accepts rescuing StandardError with other errors + accepts rescuing StandardError by itself, assigned to a variable + accepts rescuing a single error other than StandardError + accepts rescuing StandardError with other errors, assigned to a variable + when calling rescue without an error class + registers an offense + when the error is assigned to a variable + registers an offense + implicit + accepts rescue modifier + when rescuing in a method definition + accepts rescuing a single error other than StandardError, assigned to a variable + accepts rescuing StandardError with other errors + accepts rescuing no error class, assigned to a variable + accepts rescuing no error class + accepts rescuing StandardError with other errors, assigned to a variable + accepts rescuing a single error other than StandardError + when rescuing StandardError by itself + registers an offense + when the error is assigned to a variable + registers an offense + when rescuing in a begin block + accepts rescuing no error class, assigned to a variable + accepts rescuing StandardError with other errors + accepts rescuing a single error class other than StandardError, assigned to a variable + accepts rescuing ::StandardError with other errors + accepts rescuing a single error class other than StandardError + accepts rescuing no error class + accepts rescuing StandardError with other errors, assigned to a variable + when rescuing StandardError by itself + registers an offense + with ::StandardError + registers an offense + when the error is assigned to a variable + registers an offense + with ::StandardError + registers an offense -RuboCop::Cop::Style::MultilineTernaryOperator - registers an offense and corrects when the false branch is on a separate line - accepts a single line ternary operator expression - registers an offense and corrects when condition is multiline - registers an offense and corrects when condition is multiline and using assignment method - register an offense and corrects when returning a multiline ternary operator expression with `next` - register an offense and corrects when returning a multiline ternary operator expression with method call - register an offense and corrects when returning a multiline ternary operator expression with `break` - register an offense and corrects when returning a multiline ternary operator expression with `return` - registers an offense and corrects when everything is on a separate line - registers an offense and corrects when the false branch is on a separate line and assigning a return value - registers an offense and corrects when condition is multiline and using hash key assignment - registers offense and corrects when the if branch and the else branch are on a separate line from the condition +RuboCop::Cop::Lint::AmbiguousRange + for an erange + can handle an endless range + registers an offense and corrects when not parenthesized + does not register an offense if the range is composed of literals + does not register an offense for `self` + does not register an offense if the range is parenthesized + registers an offense and corrects when one side is parenthesized but the other is not + registers an offense and corrects when the entire range is parenthesized but contains complex boundaries + does not register an offense for a variable + can handle a beginningless range + does not register an offense for a constant + registers an offense and corrects when there are clauses on both sides + method calls + with RequireParenthesesForMethodChains: false + does not register an offense for a chained method call with parens + does not register an offense for a chained method call without parens + behaves like common behavior + does not register an offense for a unary - + requires parens when calling a method on a basic literal + does not register an offense for a non-chained method call + does not register an offense for a unary + + with RequireParenthesesForMethodChains: true + does not register an offense for a chained method call with parens + registers an offense for a chained method call without parens + behaves like common behavior + requires parens when calling a method on a basic literal + does not register an offense for a unary + + does not register an offense for a non-chained method call + does not register an offense for a unary - + for an irange + registers an offense and corrects when the entire range is parenthesized but contains complex boundaries + can handle an endless range + registers an offense and corrects when one side is parenthesized but the other is not + does not register an offense if the range is parenthesized + registers an offense and corrects when not parenthesized + does not register an offense for `self` + does not register an offense for a constant + does not register an offense if the range is composed of literals + can handle a beginningless range + registers an offense and corrects when there are clauses on both sides + does not register an offense for a variable + method calls + with RequireParenthesesForMethodChains: false + does not register an offense for a chained method call with parens + does not register an offense for a chained method call without parens + behaves like common behavior + does not register an offense for a unary + + does not register an offense for a unary - + does not register an offense for a non-chained method call + requires parens when calling a method on a basic literal + with RequireParenthesesForMethodChains: true + does not register an offense for a chained method call with parens + registers an offense for a chained method call without parens + behaves like common behavior + does not register an offense for a non-chained method call + does not register an offense for a unary - + does not register an offense for a unary + + requires parens when calling a method on a basic literal -RuboCop::Cop::Lint::EmptyExpression - when used as a return value - registers an offense in the return value of a case statement - registers an offense in the return value of a condition - registers an offense in the return value of a method - when used as a standalone expression - registers an offense - with nested empty expressions - registers an offense - when used as an assignment - registers an offense for the assigned value - when used in a condition - registers an offense in the condition of a ternary operator - registers an offense inside `case` - registers an offense inside `elsif` - registers an offense inside `when` - registers an offense in the return value of a ternary operator - registers an offense inside `if` +RuboCop::Cop::Style::StringChars + does not register an offense when using `split` + registers and corrects an offense when using `split` without parentheses + does not register an offense when using `split(/ /)` + does not register an offense when using `chars` + registers and corrects an offense when using `split("")` + registers and corrects an offense when using `split('')` + registers and corrects an offense when using `split(//)` RuboCop::Cop::Lint::UnreachableLoop - does not register an offense when using `return do_something(value) || next` in a loop - registers an offense when using `return do_something(value) || break` in a loop does not register an offense when using `return do_something(value) || redo` in a loop - does not register an offense when branch includes continue statement preceding break statement handles inner loops + registers an offense when using `return do_something(value) || break` in a loop + does not register an offense when using `return do_something(value) || next` in a loop + does not register an offense when branch includes continue statement preceding break statement + with an enumerator method + in the middle of a method chain + does not register an offense + not chained + registers an offense + as the last item in a method chain + registers an offense + Ruby 2.7 + registers an offense when using `return do_something(value) || break` in a loop without preceding continue statements - registers an offense when using `case-when-else` with all break branches does not register an offense when using `if` without `else` + does not register an offense when using `case-when-else` and not all branches are breaking registers an offense when using `if-else` with all break branches + registers an offense when using `case-when-else` with all break branches + registers an offense when using `break` does not register an offense when using `if-elsif-else` and not all branches are breaking does not register an offense when using `case` without `else` - does not register an offense when using `case-when-else` and not all branches are breaking - registers an offense when using `break` with AllowedPatterns with a non ignored method call registers an offense @@ -9060,16399 +5596,15248 @@ registers an offense with a ignored method call does not register an offense - Ruby 2.7 - registers an offense when using `return do_something(value) || break` in a loop - with an enumerator method - as the last item in a method chain - registers an offense - not chained - registers an offense - in the middle of a method chain - does not register an offense with preceding continue statements does not register an offense when using `if-else` with all break branches - does not register an offense when using `case-when-else` with all break branches does not register an offense when using `break` + does not register an offense when using `case-when-else` with all break branches -RuboCop::Cop::Lint::FormatParameterMismatch - does not register an offense for sprintf with splat argument - registers an offense when calling Kernel.sprintf and the fields do not match - registers an offense when there are less arguments than expected - does not register offense for `String#%` when arguments, fields match - finds faults even when the string looks like a HEREDOC - does not register an offense when single argument is a hash - registers an offense when calling Kernel.format and the fields do not match - registers an offense for String#% - correctly ignores double percent - does not register an offense when using named parameters with escaped `%` - accepts an extra arg for dynamic width with other preceding flags - does not register an offense when arguments and fields match - constants do not register offenses - registers an offense when there are more arguments than expected - registers offense with sprintf - does not register an offense when single argument is not an array - accepts an extra argument for dynamic width - does not register an offense when using named parameters - does not register an offense for format with splat argument - does not register an offense argument is the result of a message send - ignores percent right next to format string - correctly parses different sprintf formats - identifies correctly digits for spacing in format - registers an offense if extra argument for dynamic width not given - when passed an empty array +RuboCop::Cop::Gemspec::OrderedDependencies + When using method call to gem names + does not register any offenses + When using a local variable in an argument of dependent gem + does not register any offenses + behaves like ordered dependency + when add_dependency + When gems are alphabetically sorted + does not register any offenses + when gems are not alphabetically sorted + registers an offense + when dependency is separated by multiline comment + with TreatCommentsAsGroupSeparators: false + registers an offense + with TreatCommentsAsGroupSeparators: true + accepts + when each individual group of line is sorted + does not register any offenses + when different dependencies are consecutive + does not register any offenses + behaves like ordered dependency + when add_development_dependency + when gems are not alphabetically sorted + registers an offense + when dependency is separated by multiline comment + with TreatCommentsAsGroupSeparators: false + registers an offense + with TreatCommentsAsGroupSeparators: true + accepts + when each individual group of line is sorted + does not register any offenses + When gems are alphabetically sorted + does not register any offenses + behaves like ordered dependency + when add_runtime_dependency + when gems are not alphabetically sorted + registers an offense + When gems are alphabetically sorted + does not register any offenses + when dependency is separated by multiline comment + with TreatCommentsAsGroupSeparators: true + accepts + with TreatCommentsAsGroupSeparators: false + registers an offense + when each individual group of line is sorted + does not register any offenses + +RuboCop::Cop::Lint::ErbNewArguments + <= Ruby 2.5 + does not register an offense when using `ERB.new` with non-keyword arguments + >= Ruby 2.6 + does not register an offense when using `ERB.new` with keyword arguments + registers an offense when using `ERB.new` with non-keyword 2nd, 3rd and 4th arguments andkeyword 5th argument + registers an offense when using `ERB.new` with non-keyword 2nd and 3rd arguments andkeyword 4th argument + does not register an offense when using `ERB.new` without optional arguments + registers an offense when using `ERB.new` with non-keyword 2nd argument + registers an offense when using `ERB.new` with non-keyword 2nd, 3rd and 4th arguments + registers an offense when using `ERB.new` with non-keyword 2nd and 3rd arguments + registers an offense when using `::ERB.new` with non-keyword 2nd, 3rd and 4th arguments + when using `ActionView::Template::Handlers::ERB.new` + does not register an offense when using `ERB.new` without arguments + +RuboCop::Cop::Style::HashEachMethods + when node matches a keys#each or values#each + when `AllowedReceivers: ['execute']` + does not register an offense when receiver is `execute` method + registers an offense when receiver is not allowed name + does not register an offense when receiver is `execute` method with a symbol proc argument + does not register an offense when receiver is `execute` variable + when receiver is implicit + does not register an offense for `values.each` + does not register an offense for `keys.each` with a symbol proc argument + does not register an offense for `values.each` with a symbol proc argument + does not register an offense for `keys.each` + does not register an offense for each_key + does not register an offense for each_value + when receiver is a hash literal + does not register an offense for {}#each_value + registers offense, autocorrects {}#keys.each with {}#each_key + registers offense, autocorrects {}#values.each with {}#each_value + registers offense, autocorrects {}#keys.each to {}#each_key with a symbol proc argument + registers offense, autocorrects {}#values.each to {}#each_value with a symbol proc argument + does not register an offense for {}#each_key + when receiver is a send + registers offense, autocorrects foo#keys.each to foo#each_key with a symbol proc argument + registers offense, autocorrects foo#keys.each to foo#each_key + registers offense, autocorrects foo#values.each to foo#each_value + registers offense, autocorrects foo#values.each to foo#each_value with a symbol proc argument + does not register an offense for Hash#each_value + does not register an offense for foo#each_key + Ruby 2.7 + registers offense, autocorrects foo#keys.each to foo#each_key with numblock + +RuboCop::Cop::Style::InverseMethods + registers an offense for !(foo < bar) + allows an inverse method when double negation is used + registers an offense for !(foo > bar) + registers an offense for !foo.any? + registers an offense for not (foo > bar) + registers an offense for calling !.none? with a block + allows comparing camel case constants on the left + registers an offense for !foo.odd? + registers an offense for !foo.present? + registers an offense for !foo.blank? + registers an offense for !foo.none? + registers an offense for !foo.even? + registers an offense for !foo.exclude? + registers an offense for calling !.none? with a symbol proc + registers an offense for not (foo !~ bar) + registers an offense for !(foo == bar) + registers an offense for not (foo =~ bar) + allows comparing camel case constants on the right + allows an inverse method with a block when double negation is used + registers an offense for not (foo == bar) + registers an offense for !foo.include? + registers an offense for not (foo < bar) + registers an offense for !(foo !~ bar) + registers an offense for !(foo =~ bar) + registers an offense for calling !.any? inside parens + registers an offense for not (foo != bar) + allows an inverse method in a block with next + registers an offense for !(foo != bar) + allows a method call without a not + registers an offense for comparing snake case constants on the right + registers an offense for comparing snake case constants on the left + behaves like all variable types + registers an offense for calling !@@foo.none? + registers an offense for calling not @@foo.none? + behaves like all variable types + registers an offense for calling !@foo.none? + registers an offense for calling not @foo.none? + behaves like all variable types + registers an offense for calling !FOO.none? + registers an offense for calling not FOO.none? + Ruby 2.7 + registers an offense for calling !.none? with a numblock + behaves like all variable types + registers an offense for calling not $foo.none? + registers an offense for calling !$foo.none? + behaves like all variable types + registers an offense for calling not foo.none? + registers an offense for calling !foo.none? + inverse blocks + corrects an inverted method call when using `BasicObject#!` with spaces before the method call + corrects an inverted method call + registers a single offense for nested inverse method calls + corrects a complex inverted method call + registers an offense for foo.select { |e| !e } + corrects an inverted method call when using `BasicObject#!` with spaces before the method call + registers an offense for a multiline inverted equality block + registers an offense for foo.select! { |e| !e } + corrects an inverted method call when using `BasicObject#!` + registers a single offense for nested inverse method calls + corrects a complex inverted method call + corrects an inverted method call when using `BasicObject#!` with spaces before the method call + corrects an inverted do end method call + corrects an inverted method call when using `BasicObject#!` with spaces before the method call + registers an offense for a multiline inverted equality block + corrects an inverted method call + corrects an inverted method call when using `BasicObject#!` + registers an offense for an inverted equality block + corrects a complex inverted method call + corrects an inverted method call + corrects a complex inverted method call + registers an offense for a multiline inverted equality block + registers an offense for a multiline method call where the last method is inverted + registers a single offense for nested inverse method calls + registers an offense for foo.reject { |e| !e } + corrects an inverted method call when using `BasicObject#!` + registers an offense for a multiline method call where the last method is inverted + registers an offense for a multiline method call where the last method is inverted + registers a single offense for nested inverse method calls + corrects an inverted method call when using `BasicObject#!` + corrects an inverted do end method call + registers an offense for a multiline method call where the last method is inverted + registers an offense for an inverted equality block + corrects an inverted method call + registers an offense for an inverted equality block + corrects an inverted do end method call + registers an offense for foo.reject! { |e| !e } + corrects an inverted do end method call + registers an offense for an inverted equality block + registers an offense for a multiline inverted equality block + behaves like all variable types + registers an offense for calling not foo.bar.none? + registers an offense for calling !foo.bar.none? + behaves like all variable types + registers an offense for calling not foo["bar"].none? + registers an offense for calling !foo["bar"].none? + behaves like all variable types + registers an offense for calling !FOO::BAR.none? + registers an offense for calling not FOO::BAR.none? + +RuboCop::Cop::Lint::SymbolConversion + does not register an offense for a dstr + does not register an offense for a symbol that requires quotes + does not register an offense for a normal symbol + in a hash + keys + does not register an offense for a normal symbol + registers and corrects an offense for a quoted symbol that ends with `?` + does not register an offense for a require quoted symbol + does not register an offense for operators + does not register an offense for a require quoted symbol that ends with `=` + registers an offense for a quoted symbol + does not register an offense for a require quoted symbol that contains `:` + registers and corrects an offense for a quoted symbol that ends with `!` + values + registers an offense for a quoted symbol key + does not register an offense for a normal symbol + registers an offense for a quoted symbol value + behaves like offense + registers an offense for :"foo" + behaves like offense + registers an offense for "foo-bar".to_sym + behaves like offense + registers an offense for "foo_bar".intern + behaves like offense + registers an offense for :foo.to_sym + behaves like offense + registers an offense for "foo_bar".to_sym + single quoted symbol does not register an offense - on format with %{} interpolations - and multiple arguments - registers an offense - and 1 argument - does not register an offense - when format is not a string literal + behaves like offense + registers an offense for "foo".to_sym + behaves like offense + registers an offense for "foo-bar".intern + inside a percent literal array does not register an offense - behaves like variables - does not register an offense for format called on a variable - does not register an offense for % called on a variable - does not register an offense for format called on a variable - when multiple arguments are called for - and a single variable argument is passed - does not register an offense - and a single send node is passed - does not register an offense - when using (digit)$ flag - registers an offense when mismatch between the maximum value specified by (digit)$ flag and the number of arguments - does not register an offense when match between the maximum value specified by (digit)$ flag and the number of arguments + behaves like offense + registers an offense for :foo.intern + implicit `to_sym` call does not register an offense - when format is invalid - registers an offense - behaves like variables - does not register an offense for format called on a variable - does not register an offense for % called on a variable - does not register an offense for format called on a variable - behaves like variables - does not register an offense for format called on a variable - does not register an offense for format called on a variable - does not register an offense for % called on a variable - when splat argument is present - does not register an offense when args count is less than expected - when args count is more than expected - does not register an offense for `#sprintf` - does not register an offense for `#format` - registers an offense for `#%` - behaves like variables - does not register an offense for format called on a variable - does not register an offense for format called on a variable - does not register an offense for % called on a variable - with wildcard - does not register an offense for width - does not register an offense for width and precision - does not register an offense for multiple wildcards - does not register an offense for precision - behaves like variables - does not register an offense for % called on a variable - does not register an offense for format called on a variable - does not register an offense for format called on a variable - when argument itself contains format characters and formats in format string and argument are not equal - ignores argument formatting - on format with %<> interpolations - and 1 argument + behaves like offense + registers an offense for "foo".intern + EnforcedStyle: consistent + with a key with = + requires symbols to be quoted + hash where no keys need to be quoted does not register an offense - and multiple arguments - registers an offense - -RuboCop::Cop::Naming::HeredocDelimiterNaming - with a squiggly heredoc - does not register an offense with a meaningful delimiter - registers an offense with a non-meaningful delimiter - with a non-interpolated heredoc - when using back tick delimiters - does not register an offense with a meaningful delimiter - registers an offense with a non-meaningful delimiter - when using non-word delimiters + with different quote styles + does not register an offense + hash where keys are quoted but do not need to be registers an offense - when using single quoted delimiters - registers an offense with a non-meaningful delimiter - does not register an offense with a meaningful delimiter - when using double quoted delimiters - registers an offense with a non-meaningful delimiter - does not register an offense with a meaningful delimiter - with multiple heredocs starting on the same line - does not register an offense with meaningful delimiters - registers an offense with a trailing non-meaningful delimiter - registers an offense with a leading non-meaningful delimiter - with a naked heredoc - registers an offense with a non-meaningful delimiter - does not register an offense with a meaningful delimiter - with an interpolated heredoc - does not register an offense with a meaningful delimiter - registers an offense with a non-meaningful delimiter - when the delimiter contains non-letter characters - does not register an offense when delimiter contains an underscore - does not register an offense when delimiter contains a number + hash where there are keys needing quoting + registers an offense for unquoted keys + with a mix of string and symbol keys + does not register an offense + in an alias + does not register an offense + behaves like offense + registers an offense for :"foo_bar" -RuboCop::Cop::Style::LineEndConcatenation - registers an offense for dynamic string concat with << at line end - registers multiple offenses when there are chained concatenationscombined with << calls - registers multiple offenses when there are chained << methods - autocorrects a + with trailing whitespace to \ - registers an offense for string concat with << and \ at line ends - accepts string concat with a return value of method on a string - accepts string concat with a return value of method on an interpolated string - autocorrects only the lines that should be autocorrected - registers offenses only for the appropriate lines in chained concats - accepts string concat at line end when % literals are involved - registers an offense for string concat with << at line end - registers an offense for string concat at line end - autocorrects a + with \ to just \ - accepts string concat on the same line - registers multiple offenses when there are chained concatenations - accepts string concat at line end when followed by comment - registers an offense for dynamic string concat at line end - accepts string concat at line end for special strings like __FILE__ - accepts string concat at line end when followed by a comment line +RuboCop::Cop::Style::Copyright + does not register an offense when the notice is present + does not register an offense when the notice is not the first comment + does not register an offense when the notice is in a block comment + when the copyright notice is missing and the source code file starts with an encoding comment + adds an offense + when the copyright notice is missing and the source code file starts with a shebang + adds an offense + when the source code file is empty + adds an offense + when the copyright notice comes after any code + adds an offense + when the copyright notice is missing and the source code file starts with shebang and an encoding comment + adds an offense + when the copyright notice is missing + fails to autocorrect if no AutocorrectNotice is given + adds an offense + fails to autocorrect when the AutocorrectNotice does not match the Notice pattern -RuboCop::Cop::Style::AutoResourceCleanup - does not register an offense for File.open with block-pass - does not register an offense for File.open with immediate close - registers an offense for File.open without block - does not register an offense for File.open with block +RuboCop::Cop::Layout::ClosingParenthesisIndentation + accepts begin nodes that are not grouped expressions + for method calls + with first multiline arg on new line + accepts ) on the same level as ( with args on same line + accepts ) on the same level as ( with second arg on new line + with no line break before 1st parameter + does not register an offense when using keyword arguments + registers an offense and corrects misindented ) when ) is aligned with the params + registers an offense for misaligned ) + accepts a correctly aligned ) + accepts a correctly indented ) + accepts a correctly indented ) inside a block + with line break before 1st parameter + registers an offense for misaligned ) + accepts a correctly aligned ) + without arguments + can handle indentation up against the left edge + accepts a correctly aligned ) against ( + accepts empty () + for method assignments with indented parameters + without arguments + can handle indentation up against the left edge + accepts a correctly aligned ) against ( + can handle indentation up against the method + registers an offense for misaligned ) + accepts empty () + with no line break before 1st parameter + can handle hash arguments that are not broken over lines + accepts a correctly aligned ) + accepts a correctly indented ) + can handle individual arguments that are broken over lines + can handle indentation up against the left edge + registers an offense for misaligned ) + can handle inner method calls + with line break before 1st parameter + accepts a correctly aligned ) + registers an offense for misaligned ) + for method definitions + with line break before 1st parameter + accepts a correctly aligned ) + registers an offense for misaligned ) + with no line break before 1st parameter + registers an offense for misaligned ) + accepts a correctly aligned ) + accepts empty () + for method chains + registers an offense and corrects method chains + can handle multiple chains with differing breaks + when using safe navigation operator + registers an offense and corrects misaligned ) + for grouped expressions + with line break before 1st operand + accepts a correctly aligned ) + registers an offense for misaligned ) + with no line break before 1st operand + registers an offense for misaligned ) + accepts a correctly aligned ) + accepts ) that does not begin its line -RuboCop::Cop::Style::RedundantInitialize - registers and corrects an offense for an `initialize` method with arguments that only calls `super` - registers an offense for an `initialize` method with a default argument that does nothing - does not register an offense for an `initialize` method with a default keyword argument that calls `super` - does not register an offense for an empty `initialize` method with a splat` - does not register an offense for an `initialize` method with only a comment - does not register an offense for an `initialize` method that calls `super` with a different argument list - does not register an offense for an empty method not named `initialize` - does not register an offense for an empty `initialize` method with a argument forwarding` - registers and corrects an offense for an `initialize` method with no arguments that calls `super` with no arguments - does not register an offense for an `initialize` method that calls another method after `super` - does not register an offense for a method not named `initialize` that only calls super - registers and corrects an offense for an `initialize` method that only calls `super` - registers and corrects an offense for an `initialize` method with arguments that only calls `super` with explicit args - does not register an offense for an empty `initialize` method with a splat` and super - does not register an offense for an `initialize` method that calls another method before `super` - does not register an offense for an `initialize` method that calls `super` with no arguments - registers and corrects an offense for an empty `initialize` method - does not register an offense for an `initialize` method that calls another method - registers an offense for an `initialize` method with a default keyword argument that does nothing - does not register an offense for an empty `initialize` method with a kwsplat` - does not register an offense for an `initialize` method with a default argument that calls `super` - when `AllowComments: false` - registers and corrects an offense for an `initialize` method with only a comment +RuboCop::Cop::Layout::MultilineOperationIndentation + when EnforcedStyle is aligned + registers an offense and corrects unaligned operands in op-assignment + registers an offense for misaligned operands in unless condition + registers an offense and corrects indented operands in if condition + registers an offense for misaligned operands in while condition + registers an offense for misaligned operands in if condition + registers an offense and corrects misaligned string operand when the first operand has backslash continuation + registers an offense and corrects three space indentation of second line + registers an offense and corrects one space indentation of second line + registers an offense and corrects extra indentation of third line + accepts indented operands in ordinary statement + accepts aligned operands in assignment + accepts indented operands with ternary operators + accepts unary operations + does not check method calls + accepts aligned operands in if condition + registers an offense and corrects indented operand in second argument + registers an offense and corrects emacs ruby-mode 1.1 indentation of an expression in an array + registers an offense and corrects no indentation of second line + accepts indented operands inside block + assignment + registers an offense and corrects misaligned operands in unless condition + accepts indented operands in for body + accepts no extra indentation of third line + registers an offense for misaligned operands in until condition + accepts indented operands inside and outside a block + accepts aligned or:ed operands in assignment + registers an offense and corrects indented second part of string + accepts an expression where the first operand spans multiple lines + registers an offense and corrects an unindented multiline operation that is the left operand in another operation + registers an offense and corrects misaligned string operand when plus is used + accepts any indentation of parameters to #[] + accepts indented code on LHS of equality operator + accepts two spaces indentation of second line + accepts alignment inside a grouped expression + accepts two spaces indentation in assignment of local variable + accepts two spaces indentation in assignment of array element + accepts indented operands in an array + when EnforcedStyle is indented + accepts two spaces indentation in assignment of local variable + accepts double indentation of unless condition + registers an offense and corrects three space indentation of second line + registers an offense and corrects no indentation of second line + registers an offense and corrects aligned operators in assignment + registers an offense and corrects correct + unrecognized style + accepts normal indentation of method parameters + accepts unary operations + accepts indented operands in an array + accepts double indentation of until condition + accepts indented operands in if condition + accepts special indentation of for expression + accepts the indentation of a broken string + accepts indentation of next unless condition + registers an offense and corrects one space indentation of second line + accepts alignment inside a grouped expression + accepts two spaces indentation in assignment of array element + accepts indented operands in ordinary statement + registers an offense and corrects emacs ruby-mode 1.1 indentation of an expression in an array + accepts indentation of next if condition + accepts double indentation of while condition + accepts indented operands in until body + accepts any indentation of parameters to #[] + registers an offense for a 2 space indentation of until condition + registers an offense and corrects aligned operands in if conditions + registers an offense and corrects wrong indentation of for expression + accepts double indentation of if condition + accepts indentation of return unless condition + registers an offense and corrects an unindented multiline operation that is the left operand in another operation + accepts any indentation of method parameters + accepts no extra indentation of third line + registers an offense and corrects extra indentation of third line + accepts indented operands in unless body + accepts two spaces indentation of second line + accepts normal indentation inside grouped expression + registers an offense for a 2 space indentation of while condition + accepts indented operands in while body + accepts indentation of return if condition + registers an offense for a 2 space indentation of unless condition + registers an offense for a 2 space indentation of if condition + accepts indented operands in for body + accepts indentation of assignment + accepts an expression where the first operand spans multiple lines + accepts indented operands in if body + does not check method calls + accepts indented operands inside and outside a block + registers an offense and corrects aligned code on LHS of equality operator + when indentation width is overridden for this cop + accepts indented operands in unless body + registers an offense for a 4 space indentation of until condition + accepts indentation of unless condition which is offset by a single normal indentation step + registers an offense for a 4 space indentation of if condition + accepts indented operands in while body + registers an offense for a 4 space indentation of while condition + accepts indented operands in if condition + accepts indentation of while condition which is offset by a single normal indentation step + accepts indentation of until condition which is offset by a single normal indentation step + accepts indentation of if condition which is offset by a single normal indentation step + registers an offense for a 4 space indentation of unless condition + accepts indented operands in if body + registers an offense and corrects + accepts indented operands in until body -RuboCop::Cop::InternalAffairs::CreateEmptyFile - does not register an offense when using `create_file(path)` - registers an offense when using `create_file(path, '') - does not register an offense when using `create_file(path, ['foo', 'bar'])` - does not register an offense when using `receiver.create_file(path, '')` - does not register an offense when using `create_file(path, 'hello')` - registers an offense when using `create_file(path, "") +RuboCop::Cop::Layout::ConditionPosition + accepts condition on the same line + registers an offense and corrects for condition on the next line + accepts condition on a different line for modifiers + registers an offense and corrects for elsif condition on the next line + registers an offense and corrects for condition on the next line + registers an offense and corrects for condition on the next line + accepts ternary ops + accepts condition on the same line + registers an offense and corrects for condition on the next line + accepts condition on a different line for modifiers + accepts condition on a different line for modifiers + accepts condition on the same line + accepts condition on a different line for modifiers + accepts condition on the same line -RuboCop::Cop::Lint::IneffectiveAccessModifier - when no access modifier is used - doesn't register an offense - when there is `begin` before a method definition - does not register an offense - when `protected` is applied to a class method - registers an offense - when there is an intervening instance method - still registers an offense - when a `class << self` block is used - doesn't register an offense - when `private` is applied to a class method - registers an offense - when `private_class_method` is used - when `private_class_method` contains all private method names - doesn't register an offense - when `private_class_method` does not contain the method - registers an offense +RuboCop::Runner + how formatter is invoked + #file_finished + sends a file path + sends an array of detected offenses for the file + the passed path + is frozen + #finished + when RuboCop is interrupted by user + sends only processed file paths + when RuboCop finished inspecting all files normally + sends all file paths + the passed files paths + is frozen + invocation order + is called in the proper sequence + #started + sends all file paths + the passed files paths + is frozen + #file_started + sends a file path + sends file specific information hash + the passed path + is frozen -RuboCop::Cop::Lint::RequireParentheses - accepts condition that is not a call - registers an offense for missing parentheses around expression in ternary - accepts missing parentheses when using ternary operator in square bracksts - accepts calls to methods that are operators - accepts method call with parentheses in ternary - accepts method calls that are all operations - accepts missing parentheses around expression with + operator - registers an offense for missing parentheses around expression with || operator - registers an offense for missing parentheses around expression with && operator - accepts missing parentheses when method is not a predicate - accepts calls to methods that are setters - accepts missing parentheses when using ternary operator - accepts parentheses around expression with boolean operator - accepts method calls without parentheses followed by keyword and/or - when using safe navigation operator - registers an offense for missing parentheses around expression with && operator +RuboCop::Cop::Lint::StructNewOverride + does not register an offense with no overrides + does not register an offense with an override within a given block + registers an offense using `Struct.new(string, ...symbols)` + registers an offense using `Struct.new(...symbols)` + registers an offense using `Struct.new(symbol)` + registers an offense using `::Struct.new(symbol)` + registers an offense using `Struct.new(symbol, string)` + registers an offense using `Struct.new(...)` with multiple overrides + registers an offense using `Struct.new(...)` with an option argument + registers an offense using `Struct.new(...)` with a block -RuboCop::Cop::Style::SingleLineBlockParams - finds wrong argument names in calls with different syntax - does not report when destructuring is used - finds incorrectly named parameters with leading underscores - reports an offense if the names are in reverse order - does not report if the right names are used but not all arguments are given - ignores :reduce symbols - reports an offense if the names are partially correct - allows an unused parameter to have a leading underscore - ignores do..end blocks - does not report if no block arguments are present - reports an offense if the arguments names are wrong and not all arguments are given - allows calls with proper argument names +RuboCop::Cop::Security::Eval + accepts eval as method + accepts eval as variable + registers an offense for eval as command + registers an offense for eval as function + accepts eval with a multiline string + accepts eval with a string that interpolates a literal + registers an offense for eval with string that has an interpolation + accepts eval with no arguments + registers an offense `Binding#eval` + accepts eval on a literal string + with an explicit binding, filename, and line number + accepts eval on a literal string + registers an offense for eval as command + registers an offense for eval as function -RuboCop::Cop::Layout::CaseIndentation - with EnforcedStyle: case - with IndentOneStep: true - `case` ... `when` - registers an offense and corrects a `when` clause that is equally indented with `case` - accepts a `when` clause that's 2 spaces deeper than `case` - regarding assignment where the right hand side is a `case` - accepts a correctly indented assignment - registers an offense and corrects an assignment indented some other way - with everything on a single line - does not register an offense - when indentation width is overridden for this cop only - respects cop-specific IndentationWidth - `case` ... `in` - registers an offense and corrects an `in` clause that is equally indented with `case` - accepts an `in` clause that's 2 spaces deeper than `case` - with everything on a single line - does not register an offense - when indentation width is overridden for this cop only - respects cop-specific IndentationWidth - regarding assignment where the right hand side is a `case` - accepts a correctly indented assignment - registers an offense and corrects an assignment indented some other way - with IndentOneStep: false - `case` ... `when` - doesn't get confused by symbols named `case` or `when` - doesn't get confused by strings with `case` in them - accepts a `when` clause that's equally indented with `case` - accepts correctly indented whens in complex combinations - registers an offense and corrects a `when` clause that is indented deeper than `case` - with everything on a single line - does not register an offense - regarding assignment where the right hand side is a `case` - registers an offense and corrects assignment indented as end - accepts a correctly indented assignment - registers an offense and corrects correct + opposite style - registers an offense and corrects assignment indented some other way - `case` ... `in` - doesn't get confused by strings with `case` in them - accepts correctly indented whens in complex combinations - accepts an `in` clause that's equally indented with `case` - doesn't get confused by symbols named `case` or `in` - registers an offense and corrects an `in` clause that is indented deeper than `case` - regarding assignment where the right hand side is a `case` - registers an offense and corrects assignment indented some other way - registers an offense and corrects assignment indented as `end` - accepts a correctly indented assignment - registers an offense and corrects correct + opposite style - with everything on a single line - does not register an offense - when `when` is on the same line as `case` - registers an offense but does not autocorrect - with EnforcedStyle: end - with IndentOneStep: true - `case` ... `when` - with everything on a single line - does not register an offense - regarding assignment where the right hand side is a `case` - registers an offense and corrects an assignment indented some other way - accepts a correctly indented assignment - registers an offense and corrects an assignment indented as `case` - `case` ... `in` - regarding assignment where the right hand side is a `case` - accepts a correctly indented assignment - registers an offense and corrects an assignment indented as `case` - registers an offense and corrects an assignment indented some other way - with everything on a single line - does not register an offense - with IndentOneStep: false - `case` ... `in` - `in` and `end` same line - does not register an offense - with everything on a single line - does not register an offense - regarding assignment where the right hand side is a `case` - registers an offense and corrects an assignment indented some other way - accepts a correctly indented assignment - `case` ... `when` - `when` and `end` same line - does not register an offense - `else` and `end` same line - does not register an offense - regarding assignment where the right hand side is a `case` - accepts a correctly indented assignment - registers an offense and corrects an assignment indented some other way - with everything on a single line - does not register an offense +RuboCop::Cop::Lint::AssignmentInCondition + accepts = in a block followed by method call + registers an offense for = in condition inside a block + accepts = in a block that is called in a condition + registers an offense for lvar assignment in until condition + registers an offense for lvar assignment in while condition + registers an offense for gvar assignment in condition + registers an offense for ivar assignment in condition + accepts ||= in condition + registers an offense for clvar assignment in condition + does not blow up for empty if condition + registers an offense for lvar assignment in condition + does not blow up for empty unless condition + registers an offense for constant assignment in condition + registers an offense for assignment after == in condition + registers an offense for assignment methods + accepts == in condition + accepts assignment in a block after || + registers an offense for assignment after ||= in condition + registers an offense for collection element assignment in condition + safe assignment is not allowed + does not accept []= in condition surrounded with braces + does not accept = in condition surrounded with braces + safe assignment is allowed + accepts = in condition surrounded with braces + accepts []= in condition surrounded with braces -RuboCop::Cop::Lint::RedundantSafeNavigation - registers an offense and corrects when `&.` is used inside `if` condition - does not register an offense when using `&.` outside of conditions - does not register an offense when using `&.respond_to?` with `nil` specific method as argument in condition - registers an offense and corrects when `&.` is used inside `#{loop_type}` condition - registers an offense and corrects when `&.` is used inside `unless` condition - does not register an offense when using `&.` with non-allowed method in condition - registers an offense and corrects when `&.` is used inside `#{loop_type}` condition - registers an offense and corrects when `&.` is used inside complex condition +RuboCop::Ext::RegexpNode + #parsed_tree + with a regexp not containing interpolation + returns the expected tree + with an extended mode regexp with comment + returns the expected tree + with a regexp with subexpressions + has location information + with a regexp containing interpolation + returns the expected blanked tree + with a regexp containing a multi-line interpolation + returns the expected blanked tree + #each_capture + when called with a `named: false` + is expected to match [(be an instance of Regexp::Expression::Group::Capture)] + when called with a `named: true` + is expected to match [(be an instance of Regexp::Expression::Group::Named)] + when called without argument + is expected to match [(be an instance of Regexp::Expression::Group::Capture), (be an instance of Regexp::Expression::Group::Named)] -RuboCop::Cop::Layout::SpaceAfterColon - accepts colons in strings - accepts colons in symbols - accepts colon in ternary followed by space - registers an offense and corrects colon without space after it - accepts hash rockets - registers an offense and corrects a keyword optional argument without a space - accepts colons denoting required keyword argument - accepts hashes with a space after colons - accepts required keyword arguments - accepts if - Ruby >= 3.1 - accepts colons denoting hash value omission argument - does not register an offense colon without space after it when using hash value omission +RuboCop::Cop::Style::CommentedKeyword + registers an offense and corrects for one-line cases + registers an offense and corrects when commenting on the same line as `module` + registers an offense and corrects when commenting on the same line as `class` + accepts keyword letter sequences that are not keywords + does not register an offense if AST contains # symbol + does not register an offense if there are no comments after keywords + checks a long comment in less than one second + does not register an offense for certain comments + registers an offense and corrects when commenting on indented keywords + registers an offense and corrects when commenting after keyword with spaces + registers an offense and corrects when commenting on the same line as `def` + registers an offense and corrects when commenting on the same line as `begin` + registers an offense and corrects when commenting on the same line as `end` -RuboCop::Cop::Style::SpecialGlobalVars - when style is use_english_names - when add require English is enabled - when English has not been required at top-level - adds require English for $$ - adds require English for $$ in nested code - does not add for replacement outside of English lib - adds require English for twice `$*` in nested code - when English is already required at top-level - moves require English above replacement - leaves require English alone for $$ - when add require English is disabled - generates correct auto-config when mixed styles are used - registers an offense for $: - autocorrects #{$!} to #{$ERROR_INFO} - does not register an offense for backrefs like $1 - is clear about variables from the English library vs those not - autocorrects #$: to #{$LOAD_PATH} - registers an offense for $" - autocorrects $/ to $INPUT_RECORD_SEPARATOR - generates correct auto-config when Perl variable names are used - registers an offense for $$ - registers an offense for $0 - when style is use_perl_names - registers an offense for $PROCESS_ID - registers an offense for $PROGRAM_NAME - registers an offense for $LOADED_FEATURES - registers an offense for $LOAD_PATH - does not register an offense for backrefs like $1 - registers an offense for $PID - autocorrects $INPUT_RECORD_SEPARATOR to $/ - autocorrects #{$LOAD_PATH} to #$: - when style is use_builtin_english_names - does not register an offense for backrefs like $1 - generates correct auto-config when Perl variable names are used - autocorrects non-preffered builtin names - generates correct auto-config when mixed styles are used - does not register an offense for Perl names - does not register an offenses for builtin names +RuboCop::Cop::InternalAffairs::NodeTypePredicate + does not register an offense for a predicate node type check + comparison node type check + registers an offense and autocorrects -RuboCop::Cop::Style::RedundantRegexpEscape - with a single-line %r// regexp - without escapes - does not register an offense - with escaped slashes - does not register an offense - with a multi-line %r// regexp - without escapes - does not register an offense - with escaped slashes - does not register an offense - with a single-line %r{} regexp - without escapes - does not register an offense - with redundantly-escaped slashes - registers an offense and corrects - with an escaped { or } inside a character class - does not register an offense - with an escaped { or } outside a character class - does not register an offense - with a single-line %r() regexp - with escaped delimiters and regexp options - does not register an offense - without escapes - does not register an offense - with escaped delimiters outside a character-class - does not register an offense - with escaped delimiters inside a character-class - does not register an offense - with a multi-line %r{} regexp - with redundantly-escaped slashes - registers an offense and corrects - without escapes - does not register an offense - with a # inside a character class - does not register an offense - with a redundant escape after a line with comment - registers an offense and corrects - with a single-line %r~~ regexp - with escaped delimiters and regexp options - does not register an offense - with escaped delimiters outside a character-class - does not register an offense - with escaped delimiters inside a character-class - does not register an offense - without escapes - does not register an offense - with a single-line %r<> regexp - with escaped delimiters outside a character-class - does not register an offense - without escapes - does not register an offense - with escaped delimiters inside a character-class - does not register an offense - with escaped delimiters and regexp options - does not register an offense - with multibyte characters - removes the escape character at the right position - with a single-line %r!! regexp - with escaped delimiters inside a character-class - does not register an offense - without escapes - does not register an offense - with escaped delimiters outside a character-class - does not register an offense - with escaped delimiters and regexp options - does not register an offense - with a single-line `//` regexp - with an escaped 'n101' outside a character class - does not register an offense - with an escaped 'o' outside a character class - does not register an offense - with an escaped 'A' inside a character class - does not register an offense - with an escaped 'Q' outside a character class - does not register an offense - with an escaped '?' outside a character class - does not register an offense - with an escaped 'l' inside a character class - does not register an offense - with an escaped 'u0041' outside a character class - does not register an offense - with an escape inside an interpolated string - does not register an offense - with an escaped 'i' outside a character class - does not register an offense - with escaped slashes - does not register an offense - with a POSIX character class then disallowed escape inside a character class - registers an offense and corrects - with an interpolation followed by redundant escapes - registers offenses and corrects - with an escaped 'v' outside a character class - does not register an offense - with a POSIX character class then allowed escape inside a character class - does not register an offense - with an escaped '$' inside a character class - registers an offense and corrects - with an escaped 'D' inside a character class - does not register an offense - with an escaped 'z' outside a character class - does not register an offense - with an escaped 'I' inside a character class - does not register an offense - with an escaped '^' outside a character class - does not register an offense - with an escaped 'P{alpha}' outside a character class - does not register an offense - with a line continuation - does not register an offense - with an escaped 'H' inside a character class - does not register an offense - with an escaped 'i' inside a character class - does not register an offense - with an escaped 'a' inside a character class - does not register an offense - with an escaped 'w' outside a character class - does not register an offense - with an escaped 'V' outside a character class - does not register an offense - with an escaped ' ' outside a character class - does not register an offense - with an escaped 'f' inside a character class - does not register an offense - with an escaped 'b' outside a character class - does not register an offense - with an escaped '{' outside a character class - does not register an offense - with an escaped 'Z' inside a character class - does not register an offense - with an escaped '[' outside a character class - does not register an offense - with an interpolated unnecessary-escape regexp - registers an offense and corrects - with an escaped 'r' inside a character class - does not register an offense - with an escaped '$' outside a character class - does not register an offense - with an escaped 'y' outside a character class - does not register an offense - with an escaped 'I' outside a character class - does not register an offense - with an escaped 'b' inside a character class - does not register an offense - with an escaped 'W' outside a character class - does not register an offense - with an escaped 'h' inside a character class - does not register an offense - without escapes - does not register an offense - with an escaped 'O' outside a character class - does not register an offense - with an escaped 'F' outside a character class - does not register an offense - with an escaped 't' inside a character class - does not register an offense - with an escaped 'n101' inside a character class - does not register an offense - with an escaped 'v' inside a character class - does not register an offense - with an uppercase metacharacter outside a character class - does not register an offense - with an escaped 'Q' inside a character class - does not register an offense - with an escaped 'Y' inside a character class - does not register an offense - with an escaped 'f' outside a character class - does not register an offense - with an escaped 'C-c' inside a character class - does not register an offense - with an escaped 's' inside a character class - does not register an offense - with an escaped 'G' inside a character class - does not register an offense - with an escaped '.' inside a character class - registers an offense and corrects - with an escaped 'L' outside a character class - does not register an offense - with an escaped interpolation outside a character class - does not register an offense - with an escaped 'cc' outside a character class - does not register an offense - with an escaped 'X' outside a character class - does not register an offense - with an escaped 'F' inside a character class - does not register an offense - with an escaped 'w' inside a character class - does not register an offense - with an escaped '}' outside a character class - does not register an offense - with an invalid g escape - does not register an offense - with an escaped 'm' outside a character class - does not register an offense - with an escaped 'p{alpha}' outside a character class - does not register an offense - with an escaped 'M-a' inside a character class - does not register an offense - with an escaped 'J' outside a character class - does not register an offense - with an escaped 'e' outside a character class - does not register an offense - with an escaped 'T' inside a character class - does not register an offense - with an escaped 'U' inside a character class - does not register an offense - with an escaped 'L' inside a character class - does not register an offense - with an escaped 'r' outside a character class - does not register an offense - with an escaped 'q' outside a character class - does not register an offense - with an escaped 't' outside a character class - does not register an offense - with an escaped '*' outside a character class - does not register an offense - with an escaped '+' inside a character class - registers an offense and corrects - with an escaped 'x41' inside a character class - does not register an offense - with an escaped '-' character being the last character inside a character class - registers an offense and corrects - with an escaped '[' inside a character class - does not register an offense - with an escaped 'U' outside a character class - does not register an offense - with an escaped 'D' outside a character class - does not register an offense - with an escaped 'O' inside a character class - does not register an offense - with an escaped ']' outside a character class - does not register an offense - with an escaped '|' inside a character class - registers an offense and corrects - with an escaped '(' outside a character class - does not register an offense - with an escaped 'K' inside a character class - does not register an offense - with an escaped 'A' outside a character class - does not register an offense - with an escaped 'N' outside a character class - does not register an offense - with an escaped 'h' outside a character class - does not register an offense - with an uppercase metacharacter inside a character class - does not register an offense - with an escaped 'j' outside a character class - does not register an offense - with a nested character class then allowed escape - does not register an offense - with an escaped 'd' inside a character class - does not register an offense - with an escaped '}' inside a character class - registers an offense and corrects - with an escaped interpolation inside a character class - does not register an offense - with an escaped 'Y' outside a character class - does not register an offense - with an escaped 's' outside a character class - does not register an offense - with an escaped 'q' inside a character class - does not register an offense - with an escaped 'R' outside a character class - does not register an offense - with an escaped 'u{0041}' outside a character class - does not register an offense - with an escaped 'd' outside a character class - does not register an offense - with an escaped '-' inside a character class - registers an offense and corrects - with an escaped 'W' inside a character class - does not register an offense - with an escaped 'y' inside a character class - does not register an offense - with a character class and following escaped char - does not register an offense - with an escaped ')' inside a character class - registers an offense and corrects - with regexp options and a redundant escape - registers offenses and corrects - with an escaped '+' outside a character class - does not register an offense - with an escaped 'B' inside a character class - does not register an offense - with an escaped '\' inside a character class - does not register an offense - with an escaped 'u0041' inside a character class - does not register an offense - with an escaped '-' outside a character class - registers an offense and corrects - with an escaped '#' inside a character class - does not register an offense - with a backreference - does not register an offense - with an escaped '{' inside a character class - registers an offense and corrects - with an escaped 'P{alpha}' inside a character class - does not register an offense - with an escaped ')' outside a character class - does not register an offense - with an escaped 'J' inside a character class - does not register an offense - with an escaped 'M-a' outside a character class - does not register an offense - with an escaped 'Z' outside a character class - does not register an offense - with an escaped 'cc' inside a character class - does not register an offense - with an escaped 'X' inside a character class - does not register an offense - with an escaped 'G' outside a character class - does not register an offense - with an escaped ' -' outside a character class - does not register an offense - with an escaped 'm' inside a character class - does not register an offense - with an escaped 'S' inside a character class - does not register an offense - with an escaped 'j' inside a character class - does not register an offense - with multiple escaped metachars inside a character class - registers offenses and corrects - with a line continuation within a character class - does not register an offense - with an escaped 'V' inside a character class - does not register an offense - with an escaped 'K' outside a character class - does not register an offense - with an escaped . inside a character class beginning with : - registers an offense and corrects - with an escaped 'u{0041}' inside a character class - does not register an offense - with an escaped 'x41' outside a character class - does not register an offense - with an escaped 'H' outside a character class - does not register an offense - with an escaped 'o' inside a character class - does not register an offense - with an escaped '^' inside a character class - does not register an offense - with an escaped 'R' inside a character class - does not register an offense - with an escaped '?' inside a character class - registers an offense and corrects - with an escaped 'B' outside a character class - does not register an offense - with an escaped ' ' inside a character class - does not register an offense - with an escaped 'N' inside a character class - does not register an offense - with an escaped 'z' inside a character class - does not register an offense - with an escaped 'C-c' outside a character class - does not register an offense - with an escaped '(' inside a character class - registers an offense and corrects - with an escaped 'l' outside a character class - does not register an offense - with an escaped 'S' outside a character class - does not register an offense - with an escaped 'T' outside a character class - does not register an offense - with an escaped '*' inside a character class - registers an offense and corrects - with an escaped 'E' inside a character class - does not register an offense - with an escaped '#' outside a character class - does not register an offense - with an escaped '\' outside a character class - does not register an offense - with an escaped 'E' outside a character class - does not register an offense - with an escaped ']' inside a character class - does not register an offense - with a free-spaced mode regex - with a commented redundant escape - does not register an offense - with a commented redundant escape on a single line - does not register an offense - with a commented [ and ] - does not register an offense - with redundant escape preceded by an escaped comment - registers offenses and corrects - with an escaped 'a' outside a character class - does not register an offense - with an escaped '|' outside a character class - does not register an offense - with an escaped 'e' inside a character class - does not register an offense - with a nested character class containing redundant escape - registers an offense and corrects - with an escaped '+' inside a character class inside a group - registers an offense and corrects - with an escaped 'p{alpha}' inside a character class - does not register an offense - with an escaped '-' character being the first character inside a character class - registers an offense and corrects - with an escaped '.' outside a character class - does not register an offense - with an escaped character class and following escaped char - does not register an offense - with a single-line %r@@ regexp - with escaped delimiters and regexp options - does not register an offense - with escaped delimiters outside a character-class - does not register an offense - with escaped delimiters inside a character-class - does not register an offense - without escapes - does not register an offense - with a single-line %r__ regexp - with escaped delimiters and regexp options - does not register an offense - with escaped delimiters outside a character-class - does not register an offense - with escaped delimiters inside a character-class - does not register an offense - without escapes - does not register an offense - with a single-line %r^^ regexp - without escapes - does not register an offense - with escaped delimiters inside a character-class - does not register an offense - with escaped delimiters and regexp options - does not register an offense - with escaped delimiters outside a character-class - does not register an offense +RuboCop::Cop::Layout::IndentationWidth + with Width set to 4 + registers and corrects offense for bad indentation + for a file with byte order mark + accepts correctly indented method definition + with ignored patterns set + accepts unindented lines for those keywords + with if statement + registers an offense for bad indentation of an if body + with Width set to 2 + with def/rescue/end + registers an offense for bad indent of defs bodies with a modifier + registers an offense for bad indentation of bodies + with module + leaves body unchanged if the first body line is on the same line with module keyword + when consistency style is normal + registers an offense for bad indentation of a module body + accepts an empty module body + when consistency style is indented_internal_methods + accepts normal non-indented internal methods of module functions + registers an offense for bad indentation of a module body + with case match + accepts correctly indented case/in/else + accepts indented in/else plus indented body + accepts case/in/else with then beginning a line + registers an offense for bad indentation in a case/else body + accepts aligned value in `in` clause and `else` is empty + accepts case/in/else laid out as a table + accepts aligned values in `in` clause + registers an offense for bad indentation in a case/in body + with block + registers an offense for bad indentation of a do/end body + accepts an empty block body + accepts a correctly indented block body + accepts badly indented code if block end is not on separate line + registers an offense for bad indentation of `do` ... `ensure` ... `end` block + does not register an offense for good indentation of `do` ... `ensure` ... `end` block + registers an offense for bad indentation of a {} body + Ruby 2.7 + registers an offense for bad indentation of a do-end body + registers an offense for bad indentation of a {} body + when using safe navigation operator + registers an offense for an if with setter + registers an offense for bad indentation of a {} body + when consistency style is indented_internal_methods + registers an offense for bad indentation in a do/end body + with def/defs + when end is aligned with start of line + accepts an empty defs body + with an assignment + registers an offense for bad indentation of a def body + accepts an empty def body + registers an offense for bad indentation of a defs body + when modifier and def are on the same line + registers an offense for bad indentation of a defs body + registers an offense for bad indentation of a def body + accepts a correctly aligned body + when multiple modifiers and def are on the same line + accepts a correctly aligned body + registers an offense for bad indentation of a defs body + registers an offense for bad indentation of a def body + when multiple modifiers are used in a block anda method call is made at end of the block + accepts a correctly aligned body + registers an offense for bad indentation of a def + registers an offense for bad indentation of a def body + when end is aligned with def + accepts an empty def body + registers an offense for bad indentation of a defs body + with an assignment + accepts an empty defs body + registers an offense for bad indentation of a def body + when modifier and def are on the same line + registers an offense for bad indentation of a defs body + accepts a correctly aligned body + registers an offense for bad indentation of a def body + with begin/rescue/else/ensure/end + registers an offense for bad indentation of bodies + with unless + registers an offense for bad indentation of an unless body + accepts an empty unless + with class + leaves body unchanged if the first body line is on the same line with class keyword + accepts an empty class body + leaves body unchanged if the first body line is on the same line with an opening of singleton class + registers an offense for bad indentation of a class body + when consistency style is normal + accepts indented public, protected, and private + registers offenses for indented_internal_methods indentation + with access modifier + registers an offense and corrects for bad modifier indentation before good method definition + registers an offense for bad indentation of sections + when consistency style is outdent + accepts access modifier is outdent + when consistency style is indented_internal_methods + registers an offense for normal non-indented internal methods indentation + registers an offense for normal non-indented internal methods indentation when defined in a singleton class + with while/until + registers an offense for bad indentation of an until body + registers an offense for bad indentation of begin/end/while + accepts an empty while + registers an offense for bad indentation of a while body + with if statement + does not raise any error with empty braces + accepts `rescue`/`ensure` after an empty body + registers and corrects on offense for bad indentation + registers an offense for bad indentation of an else body when if and elsif body contains no code + accepts if/then/else/end laid out as another table + registers an offense for bad indentation of an elsif body + accepts `rescue` after an empty def + registers offense for bad indentation of modifier if in else + accepts `ensure` after an empty body + accepts an if/else branches with rescue clauses + accepts a one line if statement + accepts `rescue`/`ensure` after an empty def + accepts a correctly aligned if/elsif/else/end as a method argument + accepts `rescue` after an empty body + registers an offense for bad indentation of an if body + accepts a correctly aligned if/elsif/else/end + accepts indentation after if on new line after assignment + accepts if/elsif/else/end laid out as a table + registers an offense for bad indentation of an else body + accepts `ensure` after an empty def + does not correct in scopes that contain block comments + registers offense for bad indentation of ternary inside else + handles lines with only whitespace + leaves rescue ; end unchanged + accepts an empty if + indents parenthesized expressions + does not indent heredoc strings + leaves block unchanged if block end is not on its own line + registers an offense for bad indentation of an else body when if body contains no code + with assignment + when alignment style is start_of_line + and end is aligned with keyword + registers an offense for an if with element assignment + registers an offense for an if + registers an offense for an until + registers an offense for a while + registers an offense for an if with setter + accepts an if/else in assignment on next line + and end is aligned with variable + accepts an if with end aligned with variable + accepts an if/else with chaining with a block after the end + accepts an if with end aligned with element assignment + accepts an if/else with chaining after the end + accepts an if with end aligned with setter + accepts an if/else + and end is aligned randomly + registers an offense for an until + registers an offense for a while + registers an offense for an if + when alignment style is keyword + and end is aligned with variable + registers an offense for an if + registers and corrects bad indentation + registers an offense for a while + and end is aligned with keyword + accepts an if/else in assignment on next line + accepts a while in assignment + accepts an if in assignment + accepts an until in assignment + accepts an if/else in assignment + when alignment style is variable + and end is aligned randomly + registers an offense for a while + registers an offense for an if + registers an offense for an until + and end is aligned with keyword + accepts an if/else in assignment on next line + registers an offense for a while + registers an offense for an if + registers an offense for an if with element assignment + registers an offense for an if with setter + registers an offense for an until + and end is aligned with variable + accepts an if with end aligned with element assignment + accepts an if with end aligned with setter + accepts an if/else with chaining after the end + accepts an if/else with chaining with a block after the end + accepts an if with end aligned with variable + accepts an if/else + with for + registers an offense for bad indentation of a for body + accepts an empty for + with case + accepts aligned values in when clause + accepts correctly indented case/when/else + registers an offense for bad indentation in a case/when body + registers an offense for bad indentation in a case/else body + accepts indented when/else plus indented body + accepts case/when/else laid out as a table + accepts case/when/else with then beginning a line -RuboCop::Cop::Style::Strip - registers an offense for str.lstrip.rstrip - registers an offense for str.rstrip.lstrip +RuboCop::Cop::VariableForce::VariableTable + #declare_variable + adds variable to current scope with its name as key + returns the added variable + #current_scope_level + decreases by popping scope + increases by pushing scope + #find_variable with an empty scope stack + returns nil + #find_variable + when current scope is not block + when a variable with the target name exists in current scope + and also exists in outer scope + returns the current scope variable + and does not exist in outer scope + returns the current scope variable + when a variable with the target name does not exist in current scope + and does not exist in all outer scopes + returns nil + but exists in the direct outer scope + returns nil + when current scope is block + when a variable with the target name exists in current scope + and also exists in outer scope + returns the current scope variable + and does not exist in outer scope + returns the current scope variable + when a variable with the target name does not exist in current scope + and does not exist in all outer scopes + returns nil + but exists in a indirect outer scope + when the direct outer scope is block + returns the indirect outer scope variable + when the direct outer scope is not block + returns nil + but exists in the direct outer scope + returns the direct outer scope variable + #accessible_variables + when there are no variables + returns empty array + when the direct outer scope has some variables + and the current scope is block + returns the current and direct outer scope variables + and the current scope is not block + returns only the current scope variables + when the current scope has some variables + returns all the variables + #push_scope + returns pushed scope object + #pop_scope + returns popped scope object -RuboCop::Cop::Metrics::CyclomaticComplexity - when Max is 1 - deals with nested if blocks containing && and || - registers an offense for &. - registers an offense for ||= - registers an offense for an if modifier - accepts a method with no decision points - registers an offense for an unless modifier - registers an offense for an until block - accepts an empty method - accepts an empty `define_method` - counts enumerating methods with block-pass as +1 - registers an offense for || - registers an offense for &&= - registers an offense for a rescue block - registers an offense for a while block - counts repeated &. on same untouched local variable as 1 - registers an offense for && - does not count blocks in general - counts only a single method - registers an offense for and - registers an offense for an elsif block - registers an offense for a for block - registers an offense for a case/when block - registers an offense for a ternary operator - registers an offense for or - registers an offense for a `define_method` - accepts complex code outside of methods - counts enumerating methods with blocks as +1 - Ruby 2.7 - counts enumerating methods with numblocks as +1 - when AllowedPatterns is enabled - does not register an offense when defining a class method - does not register an offense when using `define_method` - does not register an offense when defining an instance method - when AllowedMethods is enabled - does not register an offense when defining an instance method - does not register an offense when defining a class method - does not register an offense when using `define_method` - when Max is 2 - counts stupid nested if and else blocks +RuboCop::Cop::Style::OptionalArguments + allows methods with multiple optional arguments at the end + registers an offense for each optional argument when multiple optional arguments are followed by a required argument + allows methods with only one required argument + allows methods with only required arguments + allows methods without arguments + allows methods with only one optional argument + allows methods with only optional arguments + registers an offense when an optional argument is followed by a required argument + named params + required params + allows optional arguments to come before a mix of required and optional named argument + allows optional arguments before required named arguments + registers an offense for optional arguments that come before required arguments where there are name arguments + with default values + allows optional arguments before an optional named argument -RuboCop::Cop::Lint::RedundantDirGlobSort - does not register an offense when not using `sort` for `Dir` - does not register an offense when using `sort` without a receiver - when Ruby 2.7 or lower - does not register an offense and correction when using `Dir.glob.sort` - does not register an offense and correction when using `::Dir.glob.sort` - does not register an offense and correction when using `Dir[].sort.each do` - does not register an offense and correction when using `Dir[].sort.each(&do_something)` - when Ruby 3.0 or higher - does not register an offense when using `Dir[*path].sort` - does not register an offense when using `Dir['./b/*.txt', './a/*.txt'].sort` - does not register an offense when using `Dir.glob(*path).sort` - does not register an offense when not using `sort` with `sort: false` option for `Dir` - registers an offense and correction when using `::Dir.glob.sort` - registers an offense and correction when using `Dir[].sort.each do` - does not register an offense when using `Dir.glob('./b/*.txt', './a/*.txt').sort` - registers an offense and correction when using `Dir[].sort.each(&do_something)` - does not register an offense when using `collection.sort` - registers an offense and correction when using `Dir.glob.sort` +RuboCop::Cop::Lint::PercentStringArray + detecting quotes or commas in a %w/%W string + accepts likely false positive :"#{a}" + accepts likely false positive %w(' ") + accepts tokens without quotes or commas + adds an offense and corrects when one token is quoted but there are no commas + accepts likely false positive %W(#{a} b) + accepts likely false positive :"#{a}" + accepts likely false positive %W(' ") + accepts likely false positive %W(' " ! = # ,) + accepts tokens without quotes or commas + accepts likely false positive %w(#{a} b) + adds an offense and corrects when there are no quotes but one comma + adds an offense and corrects when tokens contain quotes and are comma separated + accepts likely false positive %w(' " ! = # ,) + adds an offense and corrects when tokens contain both types of quotes + adds an offense and corrects when tokens contain both types of quotes + adds an offense and corrects when there are no quotes but one comma + adds an offense and corrects when one token is quoted but there are no commas + adds an offense and corrects when tokens contain quotes and are comma separated + with binary encoded source + accepts if tokens contain no quotes + adds an offense and corrects when tokens contain quotes + with invalid byte sequence in UTF-8 + add an offense and corrects when tokens contain quotes + accepts if tokens contain invalid byte sequence only -RuboCop::Cop::Style::IpAddresses - does not register an offense on an empty string - IPv6 - registers an offense for a shortened address - does not register an offense for an invalid address - registers an offense for an address with 0s collapsed - registers an offense for a valid address - registers an offense for a very short address - registers an offense for the loopback address - the unspecified address :: (shortform of 0:0:0:0:0:0:0:0) - does not register an offense - when it is removed from the allowed addresses - registers an offense - IPv4 - registers an offense for a valid address - does not register an offense for an address inside larger text - does not register an offense for an invalid address - with allowed addresses - does not register an offense for a allowed addresses - does not register an offense if the case differs +RuboCop::ResultCache + .cleanup + removes the oldest files in the cache if needed + cached result that was saved with no command line option + when --cache-root is given + takes the cache_root from the options + when --format is given + is valid and can be loaded + when a cache source is read + has utf8 encoding + when --display-cop-names is given + is invalid + when --only is given + is invalid + when offenses are saved + an offense with status unsupported + serializes them with unsupported status + an offense with status uncorrected + serializes them with uncorrected status + an offense with status corrected + serializes them with uncorrected status + an offense with status corrected_with_todo + serializes them with uncorrected status + an offense with status new_status + serializes them with new_status status + when no option is given + is valid and can be loaded + when end of line characters have changed + is invalid + when file permission have changed + is invalid + when team external_dependency_checksum changes + is invalid + when file contents have changed + is invalid + when team external_dependency_checksum is the same + is valid + when a symlink is present in the cache location + and symlink attack protection is disabled + permits caching and prints no warning + and symlink attack protection is enabled + prevents caching and prints a warning + the cache path + when CacheRootDirectory is set + contains the given root + and RUBOCOP_CACHE_ROOT is set + contains the root from RUBOCOP_CACHE_ROOT + when CacheRootDirectory not set + and XDG_CACHE_HOME is set + contains the given path and UID + and XDG_CACHE_HOME is not set + contains $HOME/.cache + #save + when the @path is not writable + behaves like invalid cache location + doesn't raise an exception + behaves like invalid cache location + doesn't raise an exception + when the default internal encoding is UTF-8 + writes non UTF-8 encodable data to file with no exception -RuboCop::Cop::Lint::CircularArgumentReference - circular argument references in keyword arguments - when the keyword argument is not circular, but calls a method of its own class with a self specification - does not register an offense - when there is one circular argument reference - registers an offense - when the keyword argument is not circular, and calls a method +RuboCop::Cop::Lint::AmbiguousOperator + with a block ampersand in the first argument + without parentheses + without whitespaces on the right of the operator + registers an offense and corrects + with a whitespace on the right of the operator + does not register an offense + with parentheses around the block argument does not register an offense - when there are multiple offensive keyword arguments - registers an offense - when the keyword argument is not circular + with a splat operator in the first argument + without parentheses + without whitespaces on the right of the operator + registers an offense and corrects + with a whitespace on the right of the operator + does not register an offense + with parentheses around the splatted argument does not register an offense - when the keyword argument is not circular, but calls a method of some other object with the same name + with `+` unary operator in the first argument + without parentheses + with a whitespace on the right of the operator + does not register an offense + without whitespaces on the right of the operator when a method with no arguments is used in advance + registers an offense and corrects + without whitespaces on the right of the operator + registers an offense and corrects + with parentheses around the operator does not register an offense - circular argument references in ordinal arguments - when the seemingly-circular default value is a method call + with `-` unary operator in the first argument + without parentheses + with a whitespace on the right of the operator + does not register an offense + without whitespaces on the right of the operator + registers an offense and corrects + with parentheses around the operator does not register an offense - when the method contains a circular argument reference - registers an offense - when the method does not contain a circular argument reference + with a keyword splat operator in the first argument + without parentheses + without whitespaces on the right of the operator + registers an offense and corrects + with a whitespace on the right of the operator + does not register an offense + with parentheses around the keyword splat operator does not register an offense + when using safe navigation operator with a unary operator + does not register an offense -RuboCop::Cop::Layout::FirstHashElementLineBreak - ignores implicit hashes in method calls without parens - registers an offense and corrects hash nested in a method call - ignores implicit hashes in method calls with parens - registers an offense and corrects elements listed on the first line - ignores implicit hashes in method calls that are improperly formatted - registers an offense and corrects single element multi-line hash - ignores elements listed on a single line +RuboCop::Cop::Style::HashTransformKeys + when using Ruby 2.6 or newer + does not flag `_.to_h{...}` when its receiver is `zip` + does not flag `_.to_h{...}` when its receiver is `each_with_index` + does not flag `_.to_h{...}` when its receiver is `with_index` + does not flag `_.to_h{...}` when its receiver is an array literal + does not flag `_.to_h{...}` when both key & value are transformed + does not flag _.to_h {...} when key block argument is unused + flags _.to_h{...} when transform_keys could be used + below Ruby 2.5 + does not flag even if transform_keys could be used + when using Ruby 2.5 or newer + correctly autocorrects Hash[_.map{...}] + flags Hash[_.map{...}] when transform_keys could be used + does not flag Hash[_.map{...}] when both key & value are transformed + flags _.map{...}.to_h when transform_keys could be used when line break before `to_h` + does not flag _.map {...}.to_h when key block argument is unused + does not flag `_.map{...}.to_h` when its receiver is `zip` + does not flag each_with_object when no transformation occurs + does not flag key transformation when receiver is array literal + does not flag `Hash[_.map{...}]` when its receiver is `zip` + correctly autocorrects _.map{...}.to_h without block + does not flag each_with_object when its receiver is array literal + does not flag `_.map{...}.to_h` when its receiver is `each_with_index` + does not flag each_with_object when key transformation uses value + flags _.map{...}.to_h when transform_keys could be used + does not flag `each_with_object` when its receiver is `zip` + does not flag each_with_object when both key & value are transformed + does not flag `Hash[_.map{...}]` when its receiver is `with_index` + flags _.map {...}.to_h when transform_keys could be used when wrapped in another block + does not flag `Hash[_.map{...}]` when its receiver is `each_with_index` + does not flag each_with_object when its argument is not modified + does not flag `_.map{...}.to_h` when its receiver is `with_index` + correctly autocorrects _.map{...}.to_h with block + does not flag `each_with_object` when its argument is used in the key + does not flag _.map{...}.to_h when both key & value are transformed + does not flag `each_with_object` when its receiver is `with_index` + does not flag `Hash[_.map{...}]` when its receiver is an array literal + does not flag key transformation in the absence of to_h + does not flag `each_with_object` when its receiver is `each_with_index` + with multiline block + flags each_with_object when transform_keys could be used + with safe navigation operator + flags each_with_object when transform_keys could be used + with inline block + flags each_with_object when transform_keys could be used + below Ruby 2.6 + does not flag _.to_h{...} -RuboCop::Cop::Lint::UselessAccessModifier - behaves like nested in a begin..end block - still flags repeated `protected` - doesn't flag an access modifier from surrounding scope - behaves like method defined with define_method - doesn't register an offense if a block is passed - doesn't register an offense if a -> is passed - doesn't register an offense if a proc is passed - doesn't register an offense if a lambda is passed - when using ActiveSupport behavior when Rails is not eabled - reports offenses and corrects - behaves like method defined using instance_eval - doesn't register an offense if a method is defined - registers an offense if no method is defined - inside a class - registers an offense when a modifier is outside the block and a method is defined only inside the block - registers two offenses when a modifier is inside and outside the and no method is defined - behaves like def in new block - doesn't register an offense if a method is defined in ::Struct.new - registers an offense if no method is defined in ::Struct.new - behaves like method defined on a singleton class - inside a class - doesn't register an offense if the modifier is the same as outside the meta-class - registers an offense even if a non-singleton-class method is defined - doesn't register an offense if a method is defined - registers an offense if no method is defined after the modifier - registers an offense if no method is defined - outside a class - doesn't register an offense if a method is defined - registers an offense if no method is defined - registers an offense if no method is defined after the modifier - behaves like method defined with define_method - doesn't register an offense if a proc is passed - doesn't register an offense if a lambda is passed - doesn't register an offense if a block is passed - doesn't register an offense if a -> is passed - behaves like method named by access modifier name - does not register an offense for `private` - behaves like method defined with define_method - doesn't register an offense if a lambda is passed - doesn't register an offense if a proc is passed - doesn't register an offense if a block is passed - doesn't register an offense if a -> is passed - behaves like at the top of the body - doesn't register an offense for `private` - doesn't register an offense for `protected` - registers an offense and corrects for `public` - behaves like nested in a begin..end block - still flags repeated `private` - doesn't flag an access modifier from surrounding scope - behaves like methods defined in an iteration - doesn't register an offense for map - doesn't register an offense for each - behaves like nested in a begin..end block - still flags repeated `public` - behaves like methods defined in an iteration - doesn't register an offense for map - doesn't register an offense for each - behaves like nested modules - doesn't register an offense for nested modules - unused modifiers - registers an offense with a nested module - registers an offense when outside a nested module - registers an offense when inside a nested module - behaves like method named by access modifier name - does not register an offense for `public` - when a def is an argument to a method call - does not register an offense - behaves like method named by access modifier name - does not register an offense for `private` - behaves like at the end of the body - registers an offense for trailing `public` - when using inline modifiers - does not register an offense - behaves like unused visibility modifiers - registers an offense and corrects when visibility is immediately changed without any intervening defs - when an access modifier has no methods - registers an offense and corrects - behaves like method defined using class_eval - doesn't register an offense if a method is defined - registers an offense if no method is defined - inside a class - registers two offenses when a modifier is inside and outside the block and no method is defined - registers an offense when a modifier is outside the block and a method is defined only inside the block - behaves like methods defined in an iteration - doesn't register an offense for each - doesn't register an offense for map - behaves like method named by access modifier name - does not register an offense for `public` - behaves like nested modules - doesn't register an offense for nested classs - unused modifiers - registers an offense with a nested class - registers an offense when outside a nested class - registers an offense when inside a nested class - behaves like method defined on a singleton class - outside a class - doesn't register an offense if a method is defined - registers an offense if no method is defined - registers an offense if no method is defined after the modifier - inside a class - registers an offense if no method is defined after the modifier - registers an offense even if a non-singleton-class method is defined - doesn't register an offense if the modifier is the same as outside the meta-class - doesn't register an offense if a method is defined - registers an offense if no method is defined - behaves like repeated visibility modifiers - registers an offense when `private` is repeated - behaves like at the end of the body - registers an offense for trailing `protected` - behaves like def in new block - registers an offense if no method is defined in ::Struct.new - doesn't register an offense if a method is defined in ::Struct.new - behaves like def in new block - doesn't register an offense if a method is defined in Struct.new - registers an offense if no method is defined in Struct.new - when only a constant or local variable is defined after the modifier - registers an offense and corrects - registers an offense and corrects - behaves like non-repeated visibility modifiers - registers an offense and corrects even when `public` is not repeated - doesn't register an offense when `private` is not repeated - doesn't register an offense when `protected` is not repeated - when using ActiveSupport's `concerning` method - still points out redundant uses within the block - is aware that this creates a new scope - Ruby 2.7 - still points out redundant uses within the block - behaves like method defined with define_method - doesn't register an offense if a -> is passed - doesn't register an offense if a proc is passed - doesn't register an offense if a lambda is passed - doesn't register an offense if a block is passed - behaves like nested in a begin..end block - doesn't flag an access modifier from surrounding scope - still flags repeated `protected` - behaves like at the end of the body - registers an offense for trailing `protected` - behaves like repeated visibility modifiers - registers an offense when `protected` is repeated - behaves like def in new block - doesn't register an offense if a method is defined in Struct.new - registers an offense if no method is defined in Struct.new - behaves like repeated visibility modifiers - registers an offense when `public` is repeated - when using the class_methods method from ActiveSupport::Concern - is aware that this creates a new scope - behaves like at the end of the body - registers an offense for trailing `private` - behaves like def in new block - registers an offense if no method is defined in ::Class.new - doesn't register an offense if a method is defined in ::Class.new - behaves like def in new block - doesn't register an offense if a method is defined in Module.new - registers an offense if no method is defined in Module.new - behaves like def in new block - registers an offense if no method is defined in ::Class.new - doesn't register an offense if a method is defined in ::Class.new - behaves like conditionally defined method - doesn't register an offense for unless - doesn't register an offense for if - behaves like def in new block - registers an offense if no method is defined in ::Module.new - doesn't register an offense if a method is defined in ::Module.new - behaves like def in new block - registers an offense if no method is defined in Class.new - doesn't register an offense if a method is defined in Class.new - behaves like conditionally defined method - doesn't register an offense for unless - doesn't register an offense for if - behaves like repeated visibility modifiers - registers an offense when `public` is repeated - behaves like at the top of the body - doesn't register an offense for `protected` - registers an offense and corrects for `public` - doesn't register an offense for `private` - when private_class_method is used without arguments - registers an offense and corrects - behaves like method named by access modifier name - does not register an offense for `protected` - behaves like nested in a begin..end block - still flags repeated `public` - when an access modifier is followed by attr_* - does not register an offense - behaves like def in new block - registers an offense if no method is defined in Module.new - doesn't register an offense if a method is defined in Module.new - when multiple class definitions in file but only one has offense - registers an offense and corrects - behaves like method defined using class_eval - registers an offense if no method is defined - doesn't register an offense if a method is defined - inside a class - registers an offense when a modifier is outside the block and a method is defined only inside the block - registers two offenses when a modifier is inside and outside the block and no method is defined - behaves like nested modules - doesn't register an offense for nested classs - unused modifiers - registers an offense when inside a nested class - registers an offense when outside a nested class - registers an offense with a nested class - behaves like methods defined in an iteration - doesn't register an offense for map - doesn't register an offense for each - behaves like nested modules - doesn't register an offense for nested modules - unused modifiers - registers an offense when outside a nested module - registers an offense when inside a nested module - registers an offense with a nested module - behaves like at the end of the body - registers an offense for trailing `public` - when using a known method-creating method - is aware that this creates a new method - still points out redundant uses within the module - behaves like conditionally defined method - doesn't register an offense for if - doesn't register an offense for unless - when an access modifier has no effect - registers an offense and corrects - when class is empty save modifier +RuboCop::Cop::Style::IfUnlessModifierOfIfUnless + provides a good error message + conditional with modifier in body + accepts + nested conditionals + accepts + ternary with modifier registers an offense and corrects - behaves like method defined using instance_eval - registers an offense if no method is defined - doesn't register an offense if a method is defined - inside a class - registers an offense when a modifier is outside the block and a method is defined only inside the block - registers two offenses when a modifier is inside and outside the and no method is defined - behaves like unused visibility modifiers - registers an offense and corrects when visibility is immediately changed without any intervening defs - when an access modifier is followed by a class method defined on constant + `unless` / `else` with modifier registers an offense and corrects - behaves like method defined on a singleton class - outside a class - registers an offense if no method is defined after the modifier - registers an offense if no method is defined - doesn't register an offense if a method is defined - inside a class - doesn't register an offense if the modifier is the same as outside the meta-class - doesn't register an offense if a method is defined - registers an offense even if a non-singleton-class method is defined - registers an offense if no method is defined - registers an offense if no method is defined after the modifier - behaves like method named by access modifier name - does not register an offense for `protected` - behaves like conditionally defined method - doesn't register an offense for unless - doesn't register an offense for if - behaves like nested in a begin..end block - still flags repeated `private` - doesn't flag an access modifier from surrounding scope - behaves like method defined on a singleton class - inside a class - registers an offense if no method is defined after the modifier - doesn't register an offense if a method is defined - registers an offense even if a non-singleton-class method is defined - registers an offense if no method is defined - doesn't register an offense if the modifier is the same as outside the meta-class - outside a class - doesn't register an offense if a method is defined - registers an offense if no method is defined - registers an offense if no method is defined after the modifier - when private_class_method is used with arguments - does not register an offense - behaves like def in new block - doesn't register an offense if a method is defined in Class.new - registers an offense if no method is defined in Class.new - behaves like at the end of the body - registers an offense for trailing `private` - when there are consecutive access modifiers + conditional with modifier registers an offense and corrects - behaves like non-repeated visibility modifiers - doesn't register an offense when `protected` is not repeated - doesn't register an offense when `private` is not repeated - registers an offense and corrects even when `public` is not repeated - behaves like repeated visibility modifiers - registers an offense when `protected` is repeated - behaves like def in new block - registers an offense if no method is defined in ::Module.new - doesn't register an offense if a method is defined in ::Module.new - behaves like repeated visibility modifiers - registers an offense when `private` is repeated - when passing method as symbol - does not register an offense - -RuboCop::Cop::Security::Open - registers an offense for open with mode argument - accepts open with a literal string starting with a pipe - accepts open with prefix string literal plus something - registers an offense for open with a block - accepts open with string that has a prefixed interpolation - registers an offense for open with dynamic string that is not prefixed - accepts File.open as method - accepts open with a string that interpolates a literal - registers an offense for open - registers an offense for `::URI.open` with string that starts with a pipe - registers an offense for `URI.open` with string that starts with a pipe - registers an offense for open with string that starts with a pipe - accepts open with no arguments - accepts open on a literal string - accepts open as variable - registers an offense for `URI.open` with a block - -RuboCop::Cop::Layout::SpaceAfterComma - inside hash braces - when EnforcedStyle for SpaceInsideBlockBraces is space - registers an offense for no space between a comma and a closing brace - behaves like common behavior - accepts a space between a comma and a closing brace - when EnforcedStyle for SpaceInsideBlockBraces is no_space - accepts no space between a comma and a closing brace - behaves like common behavior - accepts a space between a comma and a closing brace - array index commas without space - behaves like ends with an item - registers an offense and does autocorrection - behaves like trailing comma - accepts the last comma - block argument commas without space - behaves like trailing comma - accepts the last comma - behaves like ends with an item - registers an offense and does autocorrection - method call arg commas without space - behaves like ends with an item - registers an offense and does autocorrection - -RuboCop::Cop::Layout::RedundantLineBreak - when InspectBlocks is false - for a block - accepts when the method call has parentheses - accepts when the method call has no arguments - when Layout/SingleLineBlockChain is disabled - accepts a multiline block without a chained method call - accepts a method call chained onto a multiline block - when Layout/SingleLineBlockChain is enabled - accepts a multiline block without a chained method call - when Layout/SingleLineBlockChain is enabled - accepts a method call chained onto a single line block - for an expression that does not fit on a single line - accepts a method call on a multiple lines - with a longer max line length - accepts a method call followed by binary operations that are too long taken together - accepts an assignment containing a method definition - accepts method call with a do keyword that would just surpass the max line length - registers an offense for a method call with a do keyword that is just under the max line length - accepts a complex method call on a multiple lines - accepts an assignment containing a heredoc - for a block - accepts when it is difficult to convert to single line - when Layout/SingleLineBlockChain is disabled - reports an offense for a method call chained onto a single line block - for an expression that fits on a single line - registers an offense for a method call on multiple lines inside a block - registers an offense for a method call on multiple lines - accepts a method call on a single line - registers an offense for a method call with a double quoted split string in parentheses - registers an offense for a method call as right hand side of an assignment - accepts a method call with a block - accepts a method call on multiple lines if there are comments on them - accepts a binary expression containing an if expression - registers an offense for a method call with a double and single quoted split string - accepts an assignment containing a case expression - registers an offense for a method call with a double quoted split string without parentheses - registers an offense for a method call with a split operation - accepts an assignment containing an if expression - registers an offense for a method call on multiple lines with backslash - accepts an assignment containing a begin-end expression - registers an offense for a method call with a single quoted split string - method chains - properly corrects a method chain on multiple lines - does not register an offense with a heredoc argument - registers an offense and corrects with a arguments on multiple lines - registers an offense and corrects with a string argument on multiple lines - with LineLength Max 100 - registers an offense for a method without parentheses on multiple lines - when InspectBlocks is true - when Layout/SingleLineBlockChain is disabled - reports an offense for a method call chained onto a single line block - for an expression that does not fit on a single line - accepts a method call on a multiple lines - with a longer max line length - registers an offense for a method call with a do keyword that is just under the max line length - accepts method call with a do keyword that would just surpass the max line length - accepts a complex method call on a multiple lines - accepts a method call followed by binary operations that are too long taken together - accepts an assignment containing a method definition - accepts an assignment containing a heredoc - for a block - accepts when it is difficult to convert to single line - when Layout/SingleLineBlockChain is enabled - accepts a method call chained onto a single line block - for a block - registers an offense when the method call has parentheses - registers an offense when the method call has no arguments - when Layout/SingleLineBlockChain is disabled - reports an offense for a multiline block without a chained method call - reports an offense for a method call chained onto a multiline block - when Layout/SingleLineBlockChain is enabled - reports an offense for a multiline block without a chained method call - for an expression that fits on a single line - accepts a binary expression containing an if expression - accepts an assignment containing a case expression - accepts a method call with a block - registers an offense for a method call with a single quoted split string - registers an offense for a method call with a double quoted split string in parentheses - accepts a method call on a single line - registers an offense for a method call with a split operation - registers an offense for a method call on multiple lines with backslash - registers an offense for a method call with a double quoted split string without parentheses - accepts an assignment containing an if expression - accepts an assignment containing a begin-end expression - registers an offense for a method call with a double and single quoted split string - accepts a method call on multiple lines if there are comments on them - registers an offense for a method call on multiple lines - registers an offense for a method call on multiple lines inside a block - registers an offense for a method call as right hand side of an assignment - method chains - does not register an offense with a heredoc argument - properly corrects a method chain on multiple lines - registers an offense and corrects with a string argument on multiple lines - registers an offense and corrects with a arguments on multiple lines - with LineLength Max 100 - registers an offense for a method without parentheses on multiple lines - -RuboCop::Cop::Style::Alias - when EnforcedStyle is prefer_alias_method - does not register an offense for alias in an instance_eval block - registers an offense for alias with symbol args - registers an offense for alias with bareword args - does not register an offense for alias_method - does not register an offense for alias with gvars - when EnforcedStyle is prefer_alias - registers an offense for alias_method in a class block - registers an offense for alias_method at the top level - does not register an offense for alias in an instance_eval block - does not register an offense for alias_method in a method def - registers an offense for alias with symbol args - does not register an offense for alias_method in self.method def - does not register an offense for alias_method in a block - registers an offense for alias_method in a module block - does not register an offense for alias_method with explicit receiver - does not register an offense for alias_method with non-literal method call argument - does not register an offense for alias with bareword args - does not register an offense for alias_method with non-literal constant argument - -RuboCop::Cop::Layout::FirstParameterIndentation - align_parentheses style - valid indentation on multi-line defs - accepts correctly indented first element hash - accepts correctly indented first element - invalid indentation on multi-line defs - normal arguments - registers an offense and corrects incorrectly indented first element - hash arguments - registers an offense and corrects incorrectly indented first element - hash arguments static def - registers an offense and corrects incorrectly indented first element - single line method defs - ignores - ignores with hash args - no paren method defs - ignores with hash args - ignores - consistent style - valid indentation on multi-line defs - accepts correctly indented first element - accepts correctly indented first element hash - invalid indentation on multi-line defs - hash arguments static method def - registers an offense and corrects incorrectly indented first element - normal arguments - registers an offense and corrects incorrectly indented first element - hash arguments - registers an offense and corrects incorrectly indented first element - valid indentation on static multi-line defs - accepts correctly indented first element - accepts correctly indented first element hash - no paren method defs - ignores with hash args - ignores - single line method defs - ignores with hash args - ignores - -RuboCop::Formatter::WorstOffendersFormatter - #finished - when there are many offenses - sorts by offense count first and then by cop name - -RuboCop::CLI --disable-uncorrectable - --disable-uncorrectable - does not disable anything for cops that support autocorrect - when exist offense for Layout/SpaceInsideArrayLiteralBrackets - when `EnforcedStyle: space` - does not disable anything for cops that support autocorrect - when `EnforcedStyle: no_space` - does not disable anything for cops that support autocorrect - if a one-line disable statement doesn't fit - adds before-and-after disable statement - and the offense is inside a heredoc - adds before-and-after disable statement around the heredoc - if one one-line disable statement fits - adds it when the cop supports autocorrect but does not correct the offense - adds it - but there are more offenses on the line and they don't all fit - adds both one-line and before-and-after disable statements - and there are two offenses of the same kind on one line - adds a single one-line disable statement -RuboCop::Cop::Lint::AssignmentInCondition - does not blow up for empty if condition - registers an offense for = in condition inside a block - accepts = in a block that is called in a condition - registers an offense for lvar assignment in until condition - registers an offense for clvar assignment in condition - accepts == in condition - registers an offense for constant assignment in condition - registers an offense for ivar assignment in condition - accepts assignment in a block after || - does not blow up for empty unless condition - registers an offense for assignment after == in condition - registers an offense for gvar assignment in condition - registers an offense for collection element assignment in condition - registers an offense for lvar assignment in while condition - registers an offense for assignment after ||= in condition - accepts ||= in condition - registers an offense for assignment methods - registers an offense for lvar assignment in condition - accepts = in a block followed by method call - safe assignment is not allowed - does not accept = in condition surrounded with braces - does not accept []= in condition surrounded with braces - safe assignment is allowed - accepts []= in condition surrounded with braces - accepts = in condition surrounded with braces +RuboCop::Cop::Style::ObjectThen + EnforcedStyle: then + registers an offense for yield_self with proc param + accepts yield_self without a block + accepts yield_self with more than 1 param + Ruby 2.5 + accepts yield_self with block + Ruby 2.6 + registers an offense for yield_self with block + Ruby 2.7 + registers an offense for yield_self with block + EnforcedStyle: yield_self + registers an offense for then with proc param + accepts then with more than 1 param + registers an offense for then with block + accepts then without a block -RuboCop::Cop::Lint::MissingCopEnableDirective - when the maximum range size is finite - does not register an offense when the disable cop is re-enabled within the limit - does not register an offense when the disable department is re-enabled within the limit - registers an offense when a cop is disabled and never re-enabled - registers an offense when a cop is disabled for too many lines - registers an offense when a department is disabled and never re-enabled - registers an offense when a department is disabled for too many lines - when the cop is disabled in the config - reports no offense when re-disabling it until EOF - when the maximum range size is infinite - registers an offense when a department is disabled and never re-enabled - registers an offense when a cop is disabled and never re-enabled - does not register an offense when the disable department is re-enabled - does not register an offense when the disable cop is re-enabled +RuboCop::Cop::Lint::UnreachableCode + registers an offense for `retry` in `begin` + accepts code with conditional `next` + registers an offense for `return` in all `case` branches + accepts `exit` is in `if` branch only + accepts `break` is in `else` branch only + registers an offense for `exit!` in all `if` branches + registers an offense for `abort` in all `if` and `elsif` branches + registers an offense for `abort` in all `if` branches with other expressions + accepts `retry` is in all `if` branches + registers an offense for `raise` in all `if` branches + registers an offense for `return` in all `if` branches with other expressions + accepts `next` is in `else` branch only + registers an offense for `raise` in all `case` branches + accepts `return` is in `if` branch only + registers an offense for `exit!` in all `case` branches + registers an offense for `break` in all `if` branches with other expressions + accepts `redo` as the final expression + accepts `exit` is in `if`, and without `else` + accepts `raise` is in `if` branch only + accepts `exit!` is in `if` branch only + accepts code with conditional `abort` + registers an offense for `exit!` before other statements + accepts `retry` is in `if` branch only + registers an offense for `next` in all `case` branches + accepts `raise` is in `if`, and without `else` + accepts `abort` is in `else` branch only + registers an offense for `exit` in all `case` branches + registers an offense for `redo` in all `if` branches with other expressions + accepts code with conditional `break` + accepts `next` is not in `elsif` branch + registers an offense for `exit` in all `if` and `elsif` branches + registers an offense for `throw` in all `case` branches + accepts code with conditional `exit!` + registers an offense for `fail` before other statements + accepts `break` is in all `if` branches + registers an offense for `break` in `begin` + registers an offense for `raise` in `begin` + registers an offense for `throw` in all `if` and `elsif` branches + accepts `throw` is in all `if` branches + accepts `throw` is in `else` branch only + accepts `fail` is in `if`, and without `else` + accepts code with conditional `retry` + registers an offense for `retry` in all `case` branches + registers an offense for `next` in all `if` branches with other expressions + accepts `fail` as the final expression + accepts `raise` is in `case` branch without else + accepts `exit` is not in `elsif` branch + accepts `throw` is in `case` branch without else + registers an offense for `return` in all `if` and `elsif` branches + registers an offense for `next` in all `if` and `elsif` branches + registers an offense for `exit!` in all `if` and `elsif` branches + accepts `exit` is in `else` branch only + accepts `return` is in `if`, and without `else` + accepts `return` is in all `if` branches + accepts `throw` is not in `elsif` branch + registers an offense for `redo` in all `if` and `elsif` branches + registers an offense for `raise` in all `if` branches with other expressions + registers an offense for `abort` in `begin` + accepts code with conditional `exit` + accepts `break` is not in `elsif` branch + accepts `exit!` as the final expression + accepts `return` is not in `elsif` branch + accepts `next` is in `if`, and without `else` + accepts `next` is in `case` branch without else + registers an offense for `return` in all `if` branches + accepts `redo` is in `if`, and without `else` + accepts `throw` is in `if`, and without `else` + accepts `next` is in all `if` branches + registers an offense for `break` in all `case` branches + registers an offense for `redo` in all `case` branches + accepts `redo` is in `case` branch without else + accepts `break` is in `if` branch only + accepts `return` is in `case` branch without else + accepts `exit` is in `case` branch without else + accepts `redo` is not in `elsif` branch + accepts `throw` as the final expression + registers an offense for `exit` before other statements + registers an offense for `abort` before other statements + accepts `redo` is in `else` branch only + registers an offense for `throw` in `begin` + registers an offense for `fail` in `begin` + registers an offense for `exit` in all `if` branches + registers an offense for `retry` in all `if` and `elsif` branches + accepts `fail` is in `else` branch only + accepts `raise` is not in `elsif` branch + registers an offense for `retry` in all `if` branches with other expressions + accepts code with conditional `redo` + registers an offense for `exit!` in `begin` + accepts `retry` is in `case` branch without else + registers an offense for `fail` in all `if` branches with other expressions + accepts `exit!` is in `if`, and without `else` + registers an offense for `break` in all `if` and `elsif` branches + registers an offense for `return` before other statements + registers an offense for `retry` in all `if` branches + registers an offense for `abort` in all `case` branches + registers an offense for `break` before other statements + accepts `fail` is in `if` branch only + accepts `retry` as the final expression + registers an offense for `retry` before other statements + registers an offense for `next` in all `if` branches + registers an offense for `throw` before other statements + registers an offense for `abort` in all `if` branches + accepts `abort` is not in `elsif` branch + registers an offense for `throw` in all `if` branches with other expressions + accepts `redo` is in `if` branch only + registers an offense for `raise` before other statements + accepts `next` as the final expression + registers an offense for `exit!` in all `if` branches with other expressions + accepts `break` is in `if`, and without `else` + accepts `break` is in `case` branch without else + registers an offense for `next` in `begin` + registers an offense for `throw` in all `if` branches + accepts code with conditional `throw` + accepts `break` as the final expression + accepts `return` as the final expression + registers an offense for `raise` in all `if` and `elsif` branches + accepts `abort` as the final expression + accepts `retry` is not in `elsif` branch + accepts `redo` is in all `if` branches + accepts `throw` is in `if` branch only + registers an offense for `redo` before other statements + accepts `exit` is in all `if` branches + accepts `next` is in `if` branch only + accepts code with conditional `raise` + accepts `exit!` is in `else` branch only + registers an offense for `redo` in `begin` + accepts `raise` is in all `if` branches + accepts `exit!` is in `case` branch without else + registers an offense for `redo` in all `if` branches + accepts code with conditional `return` + registers an offense for `next` before other statements + accepts `exit!` is in all `if` branches + registers an offense for `break` in all `if` branches + accepts `fail` is not in `elsif` branch + accepts `abort` is in `if` branch only + accepts `abort` is in `if`, and without `else` + accepts `abort` is in all `if` branches + accepts `return` is in `else` branch only + accepts `fail` is in `case` branch without else + accepts `retry` is in `else` branch only + accepts `retry` is in `if`, and without `else` + registers an offense for `return` in `begin` + accepts `fail` is in all `if` branches + accepts `exit!` is not in `elsif` branch + registers an offense for `fail` in all `case` branches + accepts `exit` as the final expression + accepts `abort` is in `case` branch without else + registers an offense for `fail` in all `if` branches + registers an offense for `fail` in all `if` and `elsif` branches + accepts `raise` as the final expression + accepts code with conditional `fail` + accepts `raise` is in `else` branch only + registers an offense for `exit` in `begin` + registers an offense for `exit` in all `if` branches with other expressions -RuboCop::Cop::Lint::HashCompareByIdentity - registers an offense when using hash method with `object_id` as a key - registers an offense when using hash methods with `object_id` on receiver as a key - does not register an offense for hash methods without `object_id` as key +RuboCop::Cop::Lint::IncompatibleIoSelectWithFiberScheduler + registers an offense when using `IO.select` with read argument and using return value but does not autocorrect + does not register an offense when using `Enumerable#select` + registers and corrects an offense when using `IO.select` with single read as `self` and timeout arguments + registers and corrects an offense when using `IO.select` with multiple read argument and specify the first argument only + registers an offense when using `IO.select` with write argument and using return value but does not autocorrect + registers and corrects an offense when using `IO.select` with single write argument + registers and corrects an offense when using `::IO.select` with single read and timeout arguments + registers and corrects an offense when using `IO.select` with single write as `self` and timeout arguments + does not register an offense when using `IO.select` with multiple write arguments + registers and corrects an offense when using `IO.select` with single write and timeout arguments + registers and corrects an offense when using `IO.select` with single read and timeout arguments + registers and corrects an offense when using `::IO.select` with single read argument + does not register an offense when using `IO.select` with multiple read arguments + registers and corrects an offense when using `IO.select` with single read argument + does not register an offense when using `IO.select` with read and write arguments + registers and corrects an offense when using `IO.select` with single write, `nil`, and timeout arguments + registers and corrects an offense when using `IO.select` with single read, `nil`, and timeout arguments + registers and corrects an offense when using `IO.select` with single read argument and specify the first argument only -RuboCop::Cop::Style::Copyright - does not register an offense when the notice is in a block comment - does not register an offense when the notice is not the first comment - does not register an offense when the notice is present - when the copyright notice comes after any code - adds an offense - when the copyright notice is missing - fails to autocorrect when the AutocorrectNotice does not match the Notice pattern - adds an offense - fails to autocorrect if no AutocorrectNotice is given - when the copyright notice is missing and the source code file starts with an encoding comment - adds an offense - when the copyright notice is missing and the source code file starts with shebang and an encoding comment - adds an offense - when the source code file is empty - adds an offense - when the copyright notice is missing and the source code file starts with a shebang - adds an offense +RuboCop::Cop::Style::SingleArgumentDig + >= Ruby 2.7 + when using dig with arguments forwarding + does not register an offense + dig over literal + with single argument + registers an offense and corrects unsuitable use of dig + with multiple arguments + does not register an offense + when using dig with splat operator + does not register an offense + when without a receiver + does not register an offense + dig over a variable as caller + with single argument + registers an offense and corrects unsuitable use of dig + when using multiple `dig` in a method chain + registers and corrects an offense + with multiple arguments + does not register an offense + when using dig with splat operator + does not register an offense -RuboCop::Cop::Lint::UriEscapeUnescape - registers an offense when using `URI.escape('@?@!', '!?')` - registers an offense when using `::URI.unescape(enc_uri)` - registers an offense when using `URI.decode(enc_uri)` - registers an offense when using `URI.encode('http://example.com')` - registers an offense when using `URI.escape('http://example.com')` - registers an offense when using `URI.unescape(enc_uri)` - registers an offense when using `::URI.escape('http://example.com')` - registers an offense when using `::URI.decode(enc_uri)` - registers an offense when using `::URI.encode('http://example.com)` +RuboCop::Cop::Style::GlobalVars + does not register an offense for built-in variable $CLASSPATH + does not register an offense for built-in variable $> + does not register an offense for built-in variable $-w + does not register an offense for built-in variable $\ + does not register an offense for built-in variable $+ + does not register an offense for built-in variable $PREMATCH + does not register an offense for built-in variable $; + does not register an offense for built-in variable $0 + does not register an offense for built-in variable $" + does not register an offense for built-in variable $DEBUG + does not register an offense for built-in variable $MATCH + does not register an offense for built-in variable $LAST_PAREN_MATCH + does not register an offense for built-in variable $FIELD_SEPARATOR + does not register an offense for built-in variable $-F + does not register an offense for built-in variable $LOADED_FEATURES + does not register an offense for built-in variable $OUTPUT_FIELD_SEPARATOR + does not register an offense for built-in variable $! + does not register an offense for built-in variable $LOAD_PATH + does not register an offense for built-in variable $DEFAULT_OUTPUT + does not register an offense for built-in variable $ERROR_INFO + does not register an offense for built-in variable $-a + does not register an offense for built-in variable $` + does not register an offense for built-in variable $-0 + does not register an offense for built-in variable $_ + does not register an offense for built-in variable $stdout + does not register an offense for built-in variable $, + does not register an offense for built-in variable $POSTMATCH + does not register an offense for built-in variable $: + does not register an offense for built-in variable $INPUT_RECORD_SEPARATOR + does not register an offense for built-in variable $LAST_READ_LINE + does not register an offense for built-in variable $& + does not register an offense for built-in variable $INPUT_LINE_NUMBER + does not register an offense for built-in variable $* + does not register an offense for built-in variable $OFS + does not register an offense for built-in variable $ERROR_POSITION + does not register an offense for built-in variable $< + does not register an offense for built-in variable $-p + does not register an offense for built-in variable $ENV_JAVA + does not register an offense for built-in variable $VERBOSE + does not register an offense for built-in variable $-i + does not register an offense for built-in variable $/ + allows user permitted variables + does not register an offense for built-in variable $PROGRAM_NAME + does not register an offense for built-in variable $-I + does not register an offense for built-in variable $JRUBY_VERSION + does not register an offense for built-in variable $OUTPUT_RECORD_SEPARATOR + does not register an offense for built-in variable $PROCESS_ID + does not register an offense for built-in variable $$ + does not register an offense for built-in variable $? + does not register an offense for built-in variable $FILENAME + does not register an offense for built-in variable $-v + does not register an offense for built-in variable $ORS + does not register an offense for built-in variable $JRUBY_REVISION + does not register an offense for built-in variable $ARGV + does not register an offense for built-in variable $SAFE + registers an offense for $custom + does not register an offense for built-in variable $DEFAULT_INPUT + does not register an offense for built-in variable $NR + does not register an offense for built-in variable $CHILD_STATUS + does not register an offense for built-in variable $= + does not register an offense for built-in variable $IGNORECASE + does not register an offense for built-in variable $. + does not register an offense for built-in variable $-l + does not register an offense for built-in variable $stderr + does not register an offense for built-in variable $~ + does not register an offense for built-in variable $LAST_MATCH_INFO + does not register an offense for built-in variable $@ + does not register an offense for built-in variable $stdin + does not register an offense for built-in variable $' + does not register an offense for built-in variable $FS + does not register an offense for backrefs like $1 + does not register an offense for built-in variable $PID + does not register an offense for built-in variable $-d + does not register an offense for built-in variable $RS RuboCop::Options option - --disable-uncorrectable - accepts together with an unsafe autocorrect argument - accepts together with a safe autocorrect argument - fails if given without an autocorrect argument + --autocorrect + Specify only --autocorrect + sets some autocorrect options + Specify --autocorrect and --autocorrect-all + emits a warning and sets some autocorrect options + --fix-layout + sets some autocorrect options + --cache-root + fails if also `--cache false` is given + fails if no argument is given + accepts a path as argument deprecated options - --safe-auto-correct - emits a warning and sets the correct options instead --auto-correct emits a warning and sets the correct options instead + --safe-auto-correct + emits a warning and sets the correct options instead --auto-correct-all emits a warning and sets the correct options instead + --raise-cop-error + raises cop errors + --require + requires the passed path + --disable-uncorrectable + accepts together with an unsafe autocorrect argument + accepts together with a safe autocorrect argument + fails if given without an autocorrect argument + --autocorrect-all + sets some autocorrect options + --display-only-fail-level-offenses + fails if given with an autocorrect argument --regenerate-todo - when todo options are overridden after --regenerate-todo - is expected to eq {:auto_gen_config=>true, :exclude_limit=>"50", :offense_counts=>false, :regenerate_todo=>true} when no other options are given is expected to eq {:auto_gen_config=>true, :exclude_limit=>"100", :offense_counts=>false, :regenerate_todo=>true} + when todo options are overridden before --regenerate-todo + is expected to eq {:auto_gen_config=>true, :exclude_limit=>"50", :offense_counts=>false, :regenerate_todo=>true} when disabled options are overridden to be enabled is expected to eq {:auto_gen_config=>true, :exclude_limit=>"100", :offense_counts=>true, :regenerate_todo=>true} - when todo options are overridden before --regenerate-todo + when todo options are overridden after --regenerate-todo is expected to eq {:auto_gen_config=>true, :exclude_limit=>"50", :offense_counts=>false, :regenerate_todo=>true} + -h/--help + shows help text + lists all builtin formatters + exits cleanly + --cache + fails if no argument is given + accepts true as argument + accepts false as argument + fails if unrecognized argument is given + --exclude-limit + fails if given first without argument + fails if given without --auto-gen-config + fails if given last without argument + fails if given alone without argument --parallel + combined with --auto-gen-config + ignores --parallel combined with an autocorrect argument combined with --fix-layout allows --parallel - combined with --autocorrect - allows --parallel combined with --autocorrect-all allows --parallel - combined with --fail-fast - ignores --parallel + combined with --autocorrect + allows --parallel combined with --cache false ignores --parallel combined with two incompatible arguments ignores --parallel and lists both incompatible arguments - combined with --auto-gen-config + combined with --fail-fast ignores --parallel - --exclude-limit + --auto-gen-config + accepts other options + incompatible cli options + rejects using -v with -V + rejects using -V with --show-cops + mentions all incompatible options when more than two are used + rejects using -v with --show-cops + --auto-gen-only-exclude fails if given without --auto-gen-config - fails if given last without argument - fails if given first without argument - fails if given alone without argument - --require - requires the passed path - --display-only-fail-level-offenses - fails if given with an autocorrect argument - --fix-layout - sets some autocorrect options - --cache-root - fails if also `--cache false` is given - fails if no argument is given - accepts a path as argument - --raise-cop-error - raises cop errors - --autocorrect - Specify --autocorrect and --autocorrect-all - emits a warning and sets some autocorrect options - Specify only --autocorrect - sets some autocorrect options --fail-level accepts severity initial letters accepts full severity names accepts the "fake" severities A/autocorrect - --no-parallel - disables parallel from file - -h/--help - exits cleanly - shows help text - lists all builtin formatters - --auto-gen-config - accepts other options - --auto-gen-only-exclude - fails if given without --auto-gen-config - --display-only-correctable - fails if given with an autocorrect argument - fails if given with --display-only-failed - --cache - fails if unrecognized argument is given - fails if no argument is given - accepts true as argument - accepts false as argument -s/--stdin + fails if more than one path is given succeeds with exactly one path fails if no paths are given - fails if more than one path is given - --autocorrect-all - sets some autocorrect options --display-only-failed fails if given without --format junit works if given with --format junit - incompatible cli options - rejects using -v with -V - rejects using -V with --show-cops - mentions all incompatible options when more than two are used - rejects using -v with --show-cops + --no-parallel + disables parallel from file + --display-only-correctable + fails if given with --display-only-failed + fails if given with an autocorrect argument options precedence RUBOCOP_OPTS environment variable - has higher precedence then options from .rubocop file has lower precedence then command line options - .rubocop directory - is ignored and command line options are used + has higher precedence then options from .rubocop file .rubocop file has lower precedence then command line options has lower precedence then options from RUBOCOP_OPTS env variable + .rubocop directory + is ignored and command line options are used -RuboCop::Cop::Layout::EmptyLineAfterMultilineCondition - does not register an offense when new line after modifier `if` with multiline condition - does not register an offense for `if` with single line condition - does not register an offense when modifier `if` with multiline conditionis the last child of its parent - does not register an offense for `while` with single line condition - does not register an offense when new line after `rescue` with multiline exceptions - registers an offense when no new line after `if` with multiline condition - registers an offense when no new line after `elsif` with multiline condition - does not register an offense when new line after modifier `while` with multiline condition - does not register an offense when modifier `while` with multiline conditionis the last child of its parent - does not register an offense for `rescue` with singleline exceptions - registers an offense when no new line after modifier `while` with multiline condition - registers an offense when no new line after `while` with multiline condition - does not register an offense when new line after `elsif` with multiline condition - registers an offense when no new line after modifier `if` with multiline condition - does not register an offense when new line after `while` with multiline condition - does not register an offense when new line after `when` with multiline condition - does not register an offense when `if` at the top level - does not register an offense for `when` with singleline condition - does not register an offense when new line after `if` with multiline condition - registers an offense when no new line after `when` with multiline condition - registers an offense when no new line after `rescue` with multiline exceptions - registers an offense when no new line after `until` with multiline condition +RuboCop::Cop::Layout::FirstMethodParameterLineBreak + registers an offense and corrects params with default values + accepts params listed on a single line + accepts methods without params + registers an offense and corrects params on first line of singleton method + accepts params without parens + registers an offense and corrects params listed on the first line + accepts single-line methods -RuboCop::Cop::Team - #inspect_file - returns offenses - when autocorrection is enabled - still returns offenses - does autocorrection - when Parser reports non-fatal warning for the file - returns Parser warning offenses - returns offenses from cops - when a cop has no interest in the file - returns all offenses except the ones of the cop - when autocorrection is enabled and file encoding is mismatch - no error occurs - when done twice - allows cops to get ready - when a correction raises an error - records Team#errors - when Cop#on_* raises an error - records Team#errors - #forces - returns force instances - when no cops joined force - returns nothing - when a cop joined a force - returns the force - when multiple cops joined a same force - returns only one force instance - .new - calls mobilize when passed classes - accepts cops directly classes - when incompatible cops are correcting together - autocorrects without SyntaxError - #debug? - when the option argument of .new is omitted - is expected to be falsey - when { debug: true } is passed to .new - is expected to be truthy - #cops - returns cop instances - when only some cop classes are passed to .new - returns only instances of the classes - when some classes are disabled with config - does not return instances of the classes - #autocorrect? - when { autocorrect: true } is passed to .new - is expected to be truthy - when the option argument of .new is omitted - is expected to be falsey - #external_dependency_checksum - does not error with no cops - when cop with different checksum joins - has a different checksum for the whole team - when a cop joins - returns string - when multiple cops join - returns string +RuboCop::Cop::Lint::HeredocMethodCallPosition + incorrect cases + chained case without args + detects + simple incorrect case with paren + detects + simple incorrect case + detects + with trailing comma in method call + detects + chained case no parens + detects + chained case with multiple line args + detects + chained case with parens + detects + correct cases + ignores if no call + accepts chained correct case + accepts simple correct case -RuboCop::Cop::Style::RedundantFreeze - allows .freeze on method call - behaves like mutable objects - allows { a: 1, b: 2 } with freeze - behaves like immutable objects - registers an offense for frozen :"" - behaves like immutable objects - registers an offense for frozen [1, 2, 3].size - behaves like mutable objects - allows ('a' + 'b') with freeze - behaves like immutable objects - registers an offense for frozen 'foo'.count - behaves like immutable objects - registers an offense for frozen 1 - behaves like mutable objects - allows (a + b) with freeze - behaves like mutable objects - allows ENV['foo'] with freeze - behaves like mutable objects - allows ([42] * 42) with freeze - behaves like mutable objects - allows ::ENV['foo'] with freeze - behaves like immutable objects - registers an offense for frozen :sym - behaves like mutable objects - allows [1, 2, 3] with freeze - behaves like mutable objects - allows 'str' with freeze - behaves like immutable objects - registers an offense for frozen (a > b) - behaves like immutable objects - registers an offense for frozen ('a' > 'b') - behaves like immutable objects - registers an offense for frozen (2 > 1) - behaves like immutable objects - registers an offense for frozen (1 + 2) - behaves like mutable objects - allows ('a' * 20) with freeze - when the receiver is a string literal - Regexp and Range literals - Ruby 2.7 or lower - behaves like mutable objects - allows /./ with freeze - behaves like mutable objects - allows (1...5) with freeze - behaves like mutable objects - allows (1..5) with freeze - Ruby 3.0 or higher - behaves like immutable objects - registers an offense for frozen (1...5) - behaves like immutable objects - registers an offense for frozen /./ - behaves like immutable objects - registers an offense for frozen (1..5) - Ruby 3.0 or higher - when the frozen string literal comment is missing - behaves like mutable objects - allows "#{a}" with freeze - when the frozen string literal comment is true - behaves like mutable objects - allows "#{a}" with freeze - when the frozen string literal comment is false - behaves like mutable objects - allows "#{a}" with freeze - Ruby 2.7 or lower - when the frozen string literal comment is false - behaves like mutable objects - allows "#{a}" with freeze - when the frozen string literal comment is true - behaves like immutable objects - registers an offense for frozen "#{a}" - when the frozen string literal comment is missing - behaves like mutable objects - allows "#{a}" with freeze - behaves like immutable objects - registers an offense for frozen 1.5 - behaves like mutable objects - allows "top#{1 + 2}" with freeze +RuboCop::Cop::Style::SignalException + when enforced style is `raise` + accepts `fail` if a custom `fail` singleton method is defined + accepts `fail` if a custom `fail` instance method is defined + registers an offense for fail in begin section + registers an offense for fail in def body + registers an offense for `fail` with `Kernel` as explicit receiver + accepts `fail` with explicit receiver + registers an offense for fail in rescue section + when enforced style is `semantic` + registers an offense for raise in begin section + registers an offense for fail in def rescue section + registers an offense for fail in second rescue + is not confused by nested begin/rescue + registers an offense for `raise` and `fail` with `::Kernel` as explicit receiver + registers one offense for each raise + registers an offense for fail in rescue section + accepts raise in def with multiple rescues + registers an offense for raise not in a begin/rescue/end + accepts `raise` and `fail` with explicit receiver + accepts raise in rescue section + accepts raise in def rescue section + registers an offense for `raise` and `fail` with `Kernel` as explicit receiver + registers only offense for one raise that should be fail + registers an offense for raise in def body + when enforced style is `fail` + registers an offense for `raise` with `Kernel` as explicit receiver + registers an offense for raise in begin section + registers an offense for raise in def body + registers an offense for raise in rescue section + accepts `raise` with explicit receiver -RuboCop::Cop::Style::AccessModifierDeclarations - when `inline` is configured - offends when public is not inlined and has a comment - offends when private is not inlined - registers an offense for correct + multiple opposite styles of #{access_modifier} usage - offends when module_function is not inlined and has a comment - registers an offense for correct + multiple opposite styles of #{access_modifier} usage - does not offend when protected is inlined with a symbol - accepts when #{access_modifier} is a hash literal value - offends when protected is not inlined and has a comment - does not offend when protected is inlined with a method - does not offend when public is inlined with a method - does not offend when module_function is inlined with a method - does not offend when module_function is inlined with a symbol - accepts when #{access_modifier} is a hash literal value - registers an offense for correct + multiple opposite styles of #{access_modifier} usage - does not offend when public is inlined with a symbol - registers an offense for correct + multiple opposite styles of #{access_modifier} usage - accepts when #{access_modifier} is a hash literal value - does not offend when private is inlined with a method - accepts when #{access_modifier} is a hash literal value - offends when public is not inlined - offends when module_function is not inlined - does not offend when private is inlined with a symbol - offends when protected is not inlined - offends when private is not inlined and has a comment - do not allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - when methods are modified by group modifier - registers and autocorrects an offense - do not allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - do not allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - when methods are modified by group modifier - registers and autocorrects an offense - allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - when methods are modified by group modifier - registers and autocorrects an offense - do not allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - when methods are modified by group modifier - registers and autocorrects an offense - when `group` is configured - registers an offense for correct + multiple opposite styles of #{access_modifier} usage - registers an offense for correct + multiple opposite styles of #{access_modifier} usage - accepts when using only #{access_modifier} - does not offend when module_function is not inlined and has a comment - does not registers an offense when using #{access_modifier} in a block - does not offend when public is not inlined - does not registers an offense when using #{access_modifier} in a block - accepts when #{access_modifier} is a hash literal value - offends when private is inlined with a method - offends when protected is inlined with a method - registers an offense for correct + multiple opposite styles of #{access_modifier} usage - offends when module_function is inlined with a method - does not offend when module_function is not inlined - does not offend when protected is not inlined - does not offend when private is not inlined - does not offend when private is not inlined and has a comment - does not registers an offense when using #{access_modifier} in a block - accepts when #{access_modifier} is a hash literal value - registers an offense for correct + multiple opposite styles of #{access_modifier} usage - accepts when #{access_modifier} is a hash literal value - does not offend when protected is not inlined and has a comment - offends when public is inlined with a method - accepts when using only #{access_modifier} - does not offend when public is not inlined and has a comment - does not registers an offense when using #{access_modifier} in a block - accepts when #{access_modifier} is a hash literal value - accepts when using only #{access_modifier} - accepts when using only #{access_modifier} - when method is modified by inline modifier where group modifier already exists - registers and autocorrects an offense - when non-existent method is modified by inline modifier with disallowed symbol - registers an offense but does not autocorrect it - when method is modified by inline modifier with disallowed symbol - registers and autocorrects an offense - allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - when method has comments - registers and autocorrects an offense - when method is modified by inline modifier - registers and autocorrects an offense - when non-existent method is modified by inline modifier with disallowed symbol - registers an offense but does not autocorrect it - when method is modified by inline modifier with disallowed symbol - registers and autocorrects an offense - when method is modified by inline modifier with disallowed symbol - registers and autocorrects an offense - when method is modified by inline modifier - registers and autocorrects an offense - do not allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - when method is modified by inline modifier where group modifier already exists - registers and autocorrects an offense - when method has comments - registers and autocorrects an offense - when method is modified by inline modifier - registers and autocorrects an offense - when method is modified by inline modifier - registers and autocorrects an offense - do not allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - when method is modified by inline modifier where group modifier already exists - registers and autocorrects an offense - when method is modified by inline modifier where group modifier already exists - registers and autocorrects an offense - when non-existent method is modified by inline modifier with disallowed symbol - registers an offense but does not autocorrect it - do not allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - when method is modified by inline modifier with disallowed symbol - registers and autocorrects an offense - do not allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - when method has comments - registers and autocorrects an offense - allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - allow access modifiers on symbols - accepts when argument to #{access_modifier} is a symbol - when method has comments - registers and autocorrects an offense - when non-existent method is modified by inline modifier with disallowed symbol - registers an offense but does not autocorrect it +RuboCop::Cop::Lint::DeprecatedConstants + registers and corrects an offense when using `FALSE` + registers and corrects an offense when using deprecated methods that have no deprecated version + registers and corrects an offense when using deprecated methods that have no alternative + registers and corrects an offense when using `NIL` + does not register an offense when not using deprecated constant + registers and corrects an offense when using `::Triple::Nested::Constant` + registers and corrects an offense when using `::FALSE` + registers and corrects an offense when using `::TRUE` + does not register an offense when using `__ENCODING__ + registers and corrects an offense when using `::NIL` + registers and corrects an offense when using `TRUE` + Ruby >= 2.6 + registers and corrects an offense when using `Net::HTTPServerException` + Ruby >= 3.0 + registers and corrects an offense when using `::Random::DEFAULT` + registers and corrects an offense when using `Random::DEFAULT` + Ruby <= 2.5 + does not register an offense when using `Net::HTTPServerException` + Ruby <= 2.7 + does not register an offense when using `Random::DEFAULT` -RuboCop::Cop::Style::IfWithBooleanLiteralBranches - when using `elsif` with boolean literal branches - does not register an offense when using multiple `elsif` with boolean literal branches - registers and corrects an offense when using single `elsif` with boolean literal branches - when complex condition - does not register an offense when using `if foo? || bar || baz?` with boolean literal branches - does not register an offense when using `if (foo? && bar) || baz?` with boolean literal branches - registers and corrects an offense when using `if foo? || (bar && baz)?` with boolean literal branches - does not register an offense when using `if foo? && (bar || baz)?` with boolean literal branches - does not register an offense when using `if foo? && bar || baz?` with boolean literal branches - registers and corrects an offense when using `if foo? && bar && baz?` with boolean literal branches - registers and corrects an offense when using `if foo? || bar && baz?` with boolean literal branches - register and corrects an offense when using `if (foo? || bar) && baz?` with boolean literal branches - when condition is a logical operator and operands do not known whether to return boolean value - does not register an offense when using `if foo || bar` with opposite boolean literal branches - does not register an offense when using `unless foo || bar` with opposite boolean literal branches - does not register an offense when using `if foo && bar` with boolean literal branches - does not register an offense when using `unless foo || bar` with boolean literal branches - does not register an offense when using `if foo && bar` with opposite boolean literal branches - does not register an offense when using `unless foo && bar` with opposite boolean literal branches - does not register an offense when using `unless foo && bar` with boolean literal branches - does not register an offense when using `if foo || bar` with boolean literal branches - when condition is a comparison method - registers and corrects an offense when using `unless foo == bar` with boolean literal branches - registers and corrects an offense when using `if` with boolean literal branches directly under `def` - registers and corrects an offense when using `if foo == bar` with opposite boolean literal branches - does not register an offense when using a branch that is not boolean literal - registers and corrects an offense when using `if foo == bar` with boolean literal branches - registers and corrects an offense when using `if foo == bar` with opposite boolean literal branches - registers and corrects an offense when using ternary operator with boolean literal branches - registers and corrects an offense when using `if` with boolean literal branches directly under `def` - registers and corrects an offense when using `unless foo == bar` with opposite boolean literal branches - registers and corrects an offense when using `if foo == bar` with boolean literal branches - registers and corrects an offense when using opposite ternary operator with boolean literal branches - registers and corrects an offense when using `unless foo == bar` with boolean literal branches - registers and corrects an offense when using `if foo == bar` with opposite boolean literal branches - registers and corrects an offense when using `if foo == bar` with boolean literal branches - registers and corrects an offense when using `if foo == bar` with boolean literal branches - registers and corrects an offense when using opposite ternary operator with boolean literal branches - registers and corrects an offense when using opposite ternary operator with boolean literal branches - registers and corrects an offense when using ternary operator with boolean literal branches - registers and corrects an offense when using ternary operator with boolean literal branches - registers and corrects an offense when using opposite ternary operator with boolean literal branches - registers and corrects an offense when using `if foo == bar` with boolean literal branches - registers and corrects an offense when using `if` with boolean literal branches directly under `def` - registers and corrects an offense when using `unless foo == bar` with opposite boolean literal branches - registers and corrects an offense when using `if foo == bar` with opposite boolean literal branches - registers and corrects an offense when using `unless foo == bar` with opposite boolean literal branches - registers and corrects an offense when using `if foo == bar` with boolean literal branches - registers and corrects an offense when using `unless foo == bar` with boolean literal branches - registers and corrects an offense when using `unless foo == bar` with boolean literal branches - registers and corrects an offense when using `if` with boolean literal branches directly under `def` - does not register an offense when using a branch that is not boolean literal - registers and corrects an offense when using `if foo == bar` with boolean literal branches - registers and corrects an offense when using ternary operator with boolean literal branches - registers and corrects an offense when using `if foo == bar` with opposite boolean literal branches - does not register an offense when using a branch that is not boolean literal - registers and corrects an offense when using opposite ternary operator with boolean literal branches - registers and corrects an offense when using `unless foo == bar` with opposite boolean literal branches - registers and corrects an offense when using `unless foo == bar` with boolean literal branches - registers and corrects an offense when using `unless foo == bar` with opposite boolean literal branches - registers and corrects an offense when using `if foo == bar` with opposite boolean literal branches - registers and corrects an offense when using `unless foo == bar` with opposite boolean literal branches - registers and corrects an offense when using opposite ternary operator with boolean literal branches - registers and corrects an offense when using ternary operator with boolean literal branches - does not register an offense when using a branch that is not boolean literal - registers and corrects an offense when using `unless foo == bar` with opposite boolean literal branches - registers and corrects an offense when using `unless foo == bar` with boolean literal branches - registers and corrects an offense when using opposite ternary operator with boolean literal branches - registers and corrects an offense when using ternary operator with boolean literal branches - does not register an offense when using a branch that is not boolean literal - registers and corrects an offense when using ternary operator with boolean literal branches - registers and corrects an offense when using `if` with boolean literal branches directly under `def` - registers and corrects an offense when using `unless foo == bar` with boolean literal branches - registers and corrects an offense when using `if foo == bar` with opposite boolean literal branches - registers and corrects an offense when using `if` with boolean literal branches directly under `def` - does not register an offense when using a branch that is not boolean literal - registers and corrects an offense when using `if` with boolean literal branches directly under `def` - does not register an offense when using a branch that is not boolean literal - when condition is a logical operator and all operands are predicate methods - registers and corrects an offense when using `if foo? && bar? && baz?` with boolean literal branches - registers and corrects an offense when using `if foo? && bar? || baz?` with boolean literal branches - registers and corrects an offense when using `if foo? && bar?` with opposite boolean literal branches - registers and corrects an offense when using `unless foo? || bar?` with opposite boolean literal branches - registers and corrects an offense when using `unless foo? || bar?` with boolean literal branches - registers and corrects an offense when using `if foo? && bar?` with boolean literal branches - when `AllowedMethods: nonzero?` - does not register an offense when using `nonzero?` - when double negative is used in condition - registers and corrects an offense when using `if !!condition` with opposite boolean literal branches - registers and corrects an offense when using `if !!condition` with boolean literal branches - when condition is a method that does not known whether to return boolean value - does not register an offense when using `if condition` with opposite boolean literal branches - does not register an offense when using `if condition` with boolean literal branches - does not register an offense when using `unless condition` with boolean literal branches - does not register an offense when using `unless condition` with opposite boolean literal branches - when condition is a predicate method - registers and corrects an offense when using `if foo.do_something?` with boolean literal branches - registers and corrects an offense when using `unless foo.do_something?` with opposite boolean literal branches - registers and corrects an offense when using `unless foo.do_something?` with boolean literal branches - registers and corrects an offense when using `if foo.do_something?` with opposite boolean literal branches - registers and corrects an offense when using `elsif foo.do_something?` with boolean literal branches - registers and corrects an offense when using `elsif foo.do_something?` with opposite boolean literal branches +RuboCop::Cop::InternalAffairs::UselessMessageAssertion + registers an offense for specs that expect offense using the MSG + registers an offense for specs that assert using the MSG + does not register an offense for an assertion about the message + registers an offense for described_class::MSG in let -RuboCop::Cop::Bundler::GemComment - when investigating Gemfiles - and the file is empty - does not register any offenses - when the "OnlyFor" option is set - including one or more option names but not "version_specifiers" - when a gem is uncommented and has a version specifier but none of the specified options - does not register an offense - when a gem is uncommented and contains only options not specified - does not register an offense - when a gem is uncommented and has one of the specified options - registers an offense - including "version_specifiers" - when a gem is uncommented and has a version specifier along with other options - registers an offense - when a gem is uncommented and has options but no version specifiers - does not register an offense - when a gem is uncommented and has no version specified - does not register an offense - when a gem is uncommented and has multiple version specifiers - registers an offense - when a gem is uncommented and has a version specifier - registers an offense - when a gem is commented - does not register an offense - including "restrictive_version_specifiers" - when a gem is uncommented and has both minimum and non-minimum version specifier - registers an offense - when a gem is uncommented and has a frozen version specifier - registers an offense - when a gem is uncommented and has no version specified - does not register an offense - when a gem is uncommented and has a non-minimum version specifier with a leading space - registers an offense - when a gem is commented - does not register an offense - when a gem is uncommented and has a version specifier without operator - registers an offense - when a gem is uncommented and has a pessimistic version specifier - registers an offense - when a gem is uncommented and has a version specifier along with other options - registers an offense - when a gem is uncommented and has only a minimum version specifier - does not register an offense - when a gem is uncommented and has options but no version specifiers - does not register an offense - and the file contains source and group - does not register any offenses - and a gem has no comment - registers an offense - and the gem is commented on the same line - does not register any offenses - and the gem is commented - does not register any offenses - and the gem is permitted - does not register any offenses - when investigating Ruby files - does not register any offenses +RuboCop::Cop::Style::ColonMethodDefinition + accepts a class method defined using . + using self + registers an offense for a class method defined using :: + using the class name + registers an offense for a class method defined using :: -RuboCop::Cop::Style::IdenticalConditionalBranches - on if..else with slightly different trailing lines - doesn't register an offense - on case without else - doesn't register an offense - on if..else with identical bodies and assigning to a variable used in `if` condition - doesn't register an offense - on case with identical leading lines - registers and corrects an offense - when one of the case branches is empty - does not register an offense - on if..else with identical trailing lines - registers and corrects an offense - with empty brace - does not raise any error - on case with empty when - doesn't register an offense - on case..when with identical bodies and assigning to a variable used in `case` condition - doesn't register an offense - on if..else with identical bodies - registers and corrects an offense - on case with identical bodies - registers an offense and corrects - on if..else with identical leading lines - registers and corrects an offense - with a ternary - registers an offense - on case with identical trailing lines - registers and corrects an offense - when using pattern matching - on case-match without else - doesn't register an offense - on case-match with identical bodies - registers an offense and corrects - on case..in with identical bodies and assigning to a variable used in `case` condition - doesn't register an offense - when one of the case-match branches is empty +RuboCop::Cop::Style::IpAddresses + does not register an offense on an empty string + with allowed addresses + does not register an offense if the case differs + does not register an offense for a allowed addresses + IPv6 + registers an offense for a very short address + registers an offense for the loopback address + does not register an offense for an invalid address + registers an offense for a valid address + registers an offense for an address with 0s collapsed + registers an offense for a shortened address + the unspecified address :: (shortform of 0:0:0:0:0:0:0:0) does not register an offense - on case-match with identical trailing lines - registers and corrects an offense - on case-match with empty when - doesn't register an offense - on case-match with identical leading lines - registers and corrects an offense - on if..elsif with no else - doesn't register an offense + when it is removed from the allowed addresses + registers an offense + IPv4 + does not register an offense for an address inside larger text + does not register an offense for an invalid address + registers an offense for a valid address -RuboCop::Cop::Style::ParallelAssignment - registers an offense with indices and attributes when assignments must be reordered to preserve meaning - registers an offense when assigning to namespaced constants - corrects when the right variable is an array - corrects when the expression is missing spaces - registers an offense when the right side has mixed expressions - corrects when using nested indentation - allows more right variables than left variables - corrects parallel assignment inside rescue statements within method definitions - corrects when assignments must be reordered to avoid changing meaning - corrects when assigning from multiple methods with blocks - corrects when assigning to method returns - corrects when the expression uses a modifier if statement inside a method - corrects when the expression uses a modifier unless statement - corrects when the expression uses a modifier rescue statement inside of a method - registers an offense when left hand side ends with an implicit variable - corrects parallel assignment in if statements - corrects when the expression uses a modifier rescue statement as the only thing inside of a method - corrects parallel assignment in while statements - allows more left variables than right variables - corrects when the number of left hand variables matches the number of right hand variables - corrects parallel assignment in until statements - corrects parallel assignment in rescue statements within begin ... rescue - corrects parallel assignment in unless statements - registers an offense when the right side has methods with/without blocks - registers an offense with indices of different variables - corrects when the right variable is a word array - registers an offense when right hand side has maps with blocks - corrects when the right variable is a symbol array - corrects when the expression uses a modifier until statement - corrects when using constants - registers an offense with indices - registers an offense when right hand side has namespaced constants - registers an offense with attributes when assignments must be reordered to preserve meaning - registers an offense when the right side has constants - registers an offense when assigning to same variables in same order - allows expanding an assigned var - corrects when the expression uses a modifier rescue statement - corrects when using single indentation - corrects when using parallel assignment in singleton method - registers an offense when assignments must be reordered to preserve meaning - corrects when the expression uses a modifier if statement - registers an offense when the right side has mulitiple arrays - registers an offense when the right side has multiple hashes - corrects when the expression uses a modifier while statement - behaves like allowed - allows assignment of: a, = 1, 2, 3 - behaves like allowed - allows assignment of: a = 1; b = 2; - behaves like allowed - allows assignment of: a, b, c = b, c, a - behaves like allowed - allows assignment of: a = *'foo' - behaves like allowed - allows assignment of: obj.attr1, obj.attr2 = obj.attr2, obj.attr1 - behaves like allowed - allows assignment of: obj.attr1, ary[0] = ary[0], obj.attr1 - behaves like allowed - allows assignment of: a[0], a[1] = a[1], a[0] - using custom indentation width - works with rescue - works with guard clauses - works with standard correction - works with nesting - behaves like allowed - allows assignment of: CONSTANT, = 1, 2 - behaves like allowed - allows assignment of: a, b, c = *node, 1, 2 - behaves like allowed - allows assignment of: a, b = foo.map { |e| e.id } - behaves like allowed - allows assignment of: *a, b = [1, 2, 3] - behaves like allowed - allows assignment of: a, b = foo() - behaves like allowed - allows assignment of: a = 1 - behaves like allowed - allows assignment of: a, b, c = 1, 2, *node - behaves like allowed - allows assignment of: self.a, self.b = b, a - behaves like allowed - allows assignment of: a, b = *foo - behaves like allowed - allows assignment of: begin_token, end_token = CONSTANT - behaves like allowed - allows assignment of: a, b = b, a - behaves like allowed - allows assignment of: a, = a - behaves like allowed - allows assignment of: a, b = Float::INFINITY - behaves like allowed - allows assignment of: array = [1, 2, 3]; a, = array; - behaves like allowed - allows assignment of: a, *b = [1, 2, 3] - behaves like allowed - allows assignment of: a, b = (a + b), (a - b) - behaves like allowed - allows assignment of: a, = *'foo' - behaves like allowed - allows assignment of: foo = [1, 2, 3]; a, b, c = foo; - behaves like allowed - allows assignment of: a = a - behaves like allowed - allows assignment of: ary[0], ary[1], ary[2] = ary[1], ary[2], ary[0] - behaves like allowed - allows assignment of: a, = 1 - behaves like allowed - allows assignment of: self.a, self.b = self.b, self.a - behaves like allowed - allows assignment of: a, = *foo +RuboCop::Cop::Style::KeywordParametersOrder + registers an offense and corrects when multiple `kwoptarg`s are interleaved with `kwarg`sand last argument is `kwrestarg` and argument parentheses omitted + does not register an offense when there are no `kwoptarg`s before `kwarg`s + registers an offense and corrects when `kwoptarg` is before `kwarg` + registers an offense and corrects when multiple `kwoptarg`s are interleaved with `kwarg`s + registers an offense and corrects when `kwoptarg` is before `kwarg` and argument parentheses omitted + registers an offense and corrects when multiple `kwoptarg`s are interleaved with `kwarg`sand last argument is `blockarg` and argument parentheses omitted + registers an offense and corrects when multiple `kwoptarg` are before `kwarg` and argument parentheses omitted + when using block keyword parameters + registers an offense and corrects when `kwoptarg` is before `kwarg` + does not register an offense when there are no `kwoptarg`s before `kwarg`s -RuboCop::Cop::Style::SwapValues - does not register an offense when idiomatically swapping variables - does not register an offense when almost swapping variables - handles comments when correcting - does not register an offense when assigning receiver object at `def` - behaves like verbosely swapping - registers an offense and corrects when verbosely swapping mixed variables - behaves like verbosely swapping - registers an offense and corrects when verbosely swapping global variables - behaves like verbosely swapping - registers an offense and corrects when verbosely swapping constant with namespaces variables - behaves like verbosely swapping - registers an offense and corrects when verbosely swapping constant variables - behaves like verbosely swapping - registers an offense and corrects when verbosely swapping class variables - behaves like verbosely swapping - registers an offense and corrects when verbosely swapping instance variables - behaves like verbosely swapping - registers an offense and corrects when verbosely swapping local variables +RuboCop::Cop::Lint::RefinementImportMethods + Ruby <= 3.0 + does not register an offense when using `include` in `refine` block + does not register an offense when using `prepend` in `refine` block + Ruby >= 3.1 + registers an offense when using `prepend` in `refine` block + does not register an offense when using `import_methods` in `refine` block + registers an offense when using `include` in `refine` block + does not register an offense when using `include` with a receiver in `refine` block -RuboCop::Formatter::OffenseCountFormatter - #file_finished - when any offenses are detected - increments the count for the cop in offense_counts - when no offenses are detected - does not add to offense_counts - #report_summary - when an offense is detected - shows the cop and the offense count - #finished - when output tty is true - has a progress bar - when there are many offenses - when --display-style-guide was not given - sorts by offense count first and then by cop name - when --display-style-guide was given - shows links and sorts by offense count first and then by cop name +RuboCop::Cop::Lint::CircularArgumentReference + circular argument references in keyword arguments + when there is one circular argument reference + registers an offense + when the keyword argument is not circular, but calls a method of its own class with a self specification + does not register an offense + when there are multiple offensive keyword arguments + registers an offense + when the keyword argument is not circular, but calls a method of some other object with the same name + does not register an offense + when the keyword argument is not circular, and calls a method + does not register an offense + when the keyword argument is not circular + does not register an offense + circular argument references in ordinal arguments + when the method contains a circular argument reference + registers an offense + when the method does not contain a circular argument reference + does not register an offense + when the seemingly-circular default value is a method call + does not register an offense -RuboCop::Formatter::DisabledConfigFormatter - when any offenses are detected - displays YAML configuration disabling all cops with offenses - when exclude_limit option is passed - respects the file exclusion list limit - when exclude_limit option is omitted - disables the cop with 15 offending files - with autocorrect supported cop - adds a comment about --autocorrect option - when no files are inspected - creates a .rubocop_todo.yml even in such case - when there's .rubocop.yml - merges in excludes from .rubocop.yml +RuboCop::Cop::Style::MultilineBlockChain + accepts a chain of blocks spanning one line + accepts a multi-line block chained with calls on one line + accepts a chain of calls followed by a multi-line block + with multi-line block chaining + registers an offense for a simple case + registers two offenses for a chain of three blocks + registers an offense for a chain where the second block is single-line + registers an offense for a slightly more complicated case + accepts a chain where the first block is single-line + Ruby 2.7 + registers an offense for a slightly more complicated case -RuboCop::Cop::AlignmentCorrector - #correct - within string literals - does not insert whitespace - with large column deltas - with plain heredoc (<<) - behaves like heredoc indenter - does not change indentation of here doc bodies and end markers - with heredoc in backticks (<<``) - behaves like heredoc indenter - does not change indentation of here doc bodies and end markers - with single-line here docs - does not indent body and end marker - simple indentation - with a negative column delta - outdents - with a positive column delta - indents +RuboCop::Server::Cache + .pid_running? + works properly when concurrency with server stopping and cleaning cache dir + .cache_path + when .rubocop.yml is empty + when cache root path is not specified path + does not raise an error + when `RUBOCOP_CACHE_ROOT` environment variable is set + when cache root path is not specified path and `XDG_CACHE_HOME` environment variable is specified + contains the root from `RUBOCOP_CACHE_ROOT` + when cache root path is specified path + contains the root from cache root path + when cache root path is not specified path + contains the root from `RUBOCOP_CACHE_ROOT` + when cache root path is not specified as default + is the default path + when `CacheRootDirectory` configure value is set + when cache root path is not specified path + contains the root from `CacheRootDirectory` configure value + when cache root path is not specified path and `XDG_CACHE_HOME` environment variable is spacified + contains the root from `CacheRootDirectory` configure value + when cache root path is specified path + contains the root from cache root path + when `XDG_CACHE_HOME` environment variable is set + when cache root path is not specified path + contains the root from `XDG_CACHE_HOME` + when cache root path is specified path + contains the root from cache root path + when ERB pre-processing of the configuration file + when cache root path is not specified path + does not raise an error + when cache root path is specified path + is the specified path -RuboCop::Cop::Layout::ExtraSpacing - when ForceEqualSignAlignment is true - does not register an offense if assignments are aligned - does not register offenses for multiple complex nested assignments - does not register an offense if assignments are separated by blanks - does not register an offense when optarg equals is not aligned with assignment equals sign - aligns the first assignment with the following assignment - registers an offense and corrects consecutive assignments that are not aligned - registers an offense and corrects consecutive aref assignments which are not aligned - register offenses and correct consecutive operator assignments which are not aligned - register offenses and correct consecutive attribute assignments which are not aligned - does not register alignment errors on outdented lines - register offenses and correct complex nested assignments - when AllowForAlignment is true - registers an offense and corrects double extra spacing in variable assignment - registers an offense and corrects extra space before a float - ignores trailing whitespace - accepts space between key and value in a hash with hash rockets - registers an offense and corrects alignment with token not preceded by space - registers an offense and corrects extra spacing in class inheritance - ignores whitespace at the beginning of the line - accepts aligned values of an implicit hash literal - ignores whitespace inside a string - registers an offense and corrects extra spacing before a unary plus in an argument list - with extra spacing for alignment purposes - such as lining up assignments - allows it - such as aligning long assignment expressions that include line breaks - allows it - such as aligning comments on non-adjacent lines - allows it - such as aligning with the same character - allows it - such as aligning = on lines where there are trailing comments - allows it - such as aligning tokens with empty line between - allows it - such as lining up different kinds of assignments - allows it - such as aligning trailing comments - allows it - such as lining up assignments with empty lines and comments in between - allows it - when spaces are present in a single-line hash literal - registers an offense and corrects hashes with symbol keys - registers an offense and corrects hashes with hash rockets - when AllowForAlignment is false - registers an offense and corrects extra space before a float - registers an offense and corrects extra spacing before a unary plus in an argument list - registers an offense and corrects double extra spacing in variable assignment - accepts aligned values of an implicit hash literal - ignores whitespace at the beginning of the line - accepts space between key and value in a hash with hash rockets - ignores trailing whitespace - ignores whitespace inside a string - registers an offense and corrects alignment with token not preceded by space - registers an offense and corrects extra spacing in class inheritance - when spaces are present in a single-line hash literal - registers an offense and corrects hashes with symbol keys - registers an offense and corrects hashes with hash rockets - with extra spacing for alignment purposes - such as aligning tokens with empty line between - registers offense(s) - such as lining up assignments with empty lines and comments in between - registers offense(s) - such as lining up different kinds of assignments - registers offense(s) - such as lining up assignments - registers offense(s) - such as aligning with the same character - registers offense(s) - such as aligning = on lines where there are trailing comments - registers offense(s) - such as aligning long assignment expressions that include line breaks - registers offense(s) - such as aligning trailing comments - registers offense(s) - such as aligning comments on non-adjacent lines - registers offense(s) - when AllowBeforeTrailingComments is - true - allows it - doesn't interfere with AllowForAlignment - being false - such as aligning comments on non-adjacent lines - registers offense(s) - such as aligning = on lines where there are trailing comments - registers offense(s) - such as aligning with the same character - registers offense(s) - such as aligning long assignment expressions that include line breaks - registers offense(s) - such as lining up assignments - registers offense(s) - such as aligning trailing comments - does not register an offense - such as aligning tokens with empty line between - does not register an offense - such as lining up different kinds of assignments - registers offense(s) - such as lining up assignments with empty lines and comments in between - registers offense(s) - being true - such as aligning tokens with empty line between - allows it - such as aligning with the same character - allows it - such as lining up assignments - allows it - such as lining up assignments with empty lines and comments in between - allows it - such as aligning trailing comments - allows it - such as aligning = on lines where there are trailing comments - allows it - such as aligning long assignment expressions that include line breaks - allows it - such as lining up different kinds of assignments - allows it - such as aligning comments on non-adjacent lines - allows it - false - regsiters offense - does not trigger on only one space before comment +RuboCop::Cop::Naming::ClassAndModuleCamelCase + registers an offense for underscore in class and module name + allows module_parent method + is not fooled by qualified names + accepts CamelCase names + custom allowed names + does not register offense for multiple allowed names -RuboCop::Cop::Lint::DuplicateRequire - registers and corrects an offense when duplicate `require` is detected - does not register an offense when using single `require` - does not register an offense when same feature argument but different require method - does not register an offense when calling user-defined `require` method - registers and corrects an offense when duplicate requires are interleaved with some other code - registers and corrects an offense when duplicate `require` through `Kernel` is detected - registers and corrects an offense when duplicate `require_relative` is detected - registers and corrects an offense for multiple duplicate requires - registers and corrects an offense for duplicate non top-level requires - does not register an offense when there are no duplicate `require`s +RuboCop::Cop::Force + .force_name + returns the class name without namespace + #run_hook + invokes a hook in all cops -RuboCop::Cop::Style::MultilineWhenThen - registers an offense when one line for multiple candidate values of `when` - does not register an offense for hash when statement with then - registers an offense for multiline (two lines in a body) when statement with then - registers an offense for multiline (one line in a body) when statement with then - doesn't register an offense for multiline when statementwith then followed by other lines - does not register an offense for array when statement with then - registers an offense for empty when statement with then - doesn't register an offense for empty when statement without then - doesn't register an offense when `then` required for a body of `when` is used - autocorrects when the body of `when` branch starts with `then` - does not register an offense when line break for multiple candidate values of `when` - doesn't register an offense for multiline when statement without then - doesn't register an offense for singleline when statement with then +RuboCop::Formatter::ProgressFormatter + #report_file_as_mark + when a refactor convention offense is detected + prints "C" + when a refactor severity offense is detected + prints "R" + when different severity offenses are detected + prints highest level mark + when no offenses are detected + prints "." + #file_finished + when any offenses are detected + calls #report_as_with_mark + when no offenses are detected + calls #report_as_with_mark + #finished + calls #report_summary + when any offenses are detected + reports all detected offenses for all failed files + when no offenses are detected + does not report offenses -RuboCop::Cop::Style::MethodCallWithoutArgsParentheses - registers an offense for `obj.method += func()` - accepts special lambda call syntax - registers an offense for `obj.method ||= func()` - autocorrects calls that could be empty literals - accepts parens after not - registers an offense for `obj.method &&= func()` - accepts parens in method call with args - registers an offense for parens in method call without args - accepts parentheses for methods starting with an upcase letter - assignment to a variable with the same name - accepts parens in default argument assignment - accepts parens in shorthand assignment - accepts parens in complex assignment - accepts parens in parallel assignment - accepts parens in local variable assignment - when AllowedPatterns is enabled - ignores method listed in AllowedMethods - when AllowedMethods is enabled - ignores method listed in AllowedMethods - method call as argument - registers an empty parens offense for multiple assignment - registers an offense with empty parens - accepts without parens +RuboCop::Cop::Style::StaticClass + registers an offense when class has only class method + does not register an offense when class has a parent + registers an offense when class has assignments along with class methods + does not register an offense when class has `class << self` with macro calls + does not register an offense when class has macro-like method + does not register an offense when class is empty + registers an offense when class extends a module + does not register an offense for modules + does not register an offense when class has instance method + registers an offense when class has `class << self` with class methods + does not register an offense when class includes/prepends a module -RuboCop::Cop::Layout::CommentIndentation - when allow_for_alignment is true - registers offenses and corrects before __END__ but not after - registers an offense and corrects - accepts comments with extra indentation if aligned with comment on previous line - around program structure keywords - accepts correctly indented comments - with a blank line following the comment - accepts a correctly indented comment - near various kinds of brackets - accepts correctly indented comments - is unaffected by closing bracket that does not begin a line - on outer level - registers an offense and corrects an incorrectly indented (2) comment - accepts a correctly indented comment - registers an offense and corrects a documentation comment - accepts a comment that follows code - registers an offense and corrects an incorrectly indented (1) comment - registers an offense for each incorrectly indented comment - when allow_for_alignment is false - registers an offense and corrects - registers an offense for comments with extra indentation - registers offenses and corrects before __END__ but not after - around program structure keywords - accepts correctly indented comments - with a blank line following the comment - accepts a correctly indented comment - near various kinds of brackets - accepts correctly indented comments - is unaffected by closing bracket that does not begin a line - on outer level - registers an offense and corrects a documentation comment - registers an offense for each incorrectly indented comment - registers an offense and corrects an incorrectly indented (2) comment - accepts a comment that follows code - registers an offense and corrects an incorrectly indented (1) comment - accepts a correctly indented comment +RuboCop::Cop::Lint::UriRegexp + registers an offense and corrects using `::URI.regexp` without argument + does not register an offense when using `regexp` with variable receiver + does not register an offense when using `regexp` without receiver + registers an offense and corrects using `::URI.regexp` with argument + registers an offense and corrects using `URI.regexp` without argument + registers an offense and corrects using `URI.regexp` with argument + array argument + registers an offense and corrects using `URI.regexp` with %i arrays + registers an offense and corrects using `URI.regexp` with literal arrays + registers an offense and corrects using `URI.regexp` with %w arrays RuboCop::Cop::Lint::TrailingCommaInAttributeDeclaration registers an offense when using trailing comma does not register an offense when not using trailing comma -RuboCop::Cop::Style::OrAssignment - when using unless var; var = something; end - registers an offense for global variables - registers an offense for class variables - registers an offense for instance variables - does not register an offense if any of the variables are different - registers an offense for normal variables - when using var = if var; var; else; something; end - does not register an offense if any of the variables are different - registers an offense with normal variables - registers an offense with global variables - registers an offense with instance variables - registers an offense with class variables - when using `elsif` statement - does not register an offense - when using var = var ? var : something - registers an offense with instance variables - registers an offense with normal variables - registers an offense with class variables - registers an offense with global variables - does not register an offense if any of the variables are different - when `then` branch body is empty - registers an offense - when using var = something unless var - registers an offense for normal variables - registers an offense for global variables - registers an offense for instance variables - registers an offense for class variables - does not register an offense if any of the variables are different - -RuboCop::Cop::Lint::RedundantSplatExpansion - allows assigning to a splat variable - allows expanding a method call on an array literal - accepts expanding a variable as a method parameter - registers an offense and corrects an array literal being expanded in a rescue - allows expansions of an array that is assigned to a variable in rescue - allows an array using a constructor - allows assigning to a splat - allows splat expansion inside of an array - allows assigning a variable to a splat expansion of a variable - allows assigning to an expanded range - when `AllowPercentLiteralArrayArgument: true` - does not register an offense when using percent symbol literal array - does not register an offense when using percent string literal array - behaves like splat expansion - method parameters - registers an offense and converts to an array - behaves like splat literal assignment - registers an offense and converts to an array - expanding an array literal in a when condition - registers an offense and corrects %I to a list of symbols - registers an offense and corrects an array using %W - registers an offense and corrects an array using %w - allows an array using a constructor - registers an offense and corrects %i to a list of symbols - registers an offense and corrects an array using [] - allows an array that is assigned to a variable - when `AllowPercentLiteralArrayArgument: false` - registers an offense when using percent symbol literal array - registers an offense when using percent literal array - splat expansion of method parameters - registers an offense and corrects an array literal %i - registers an offense and corrects an array literal %I - behaves like array splat expansion - method parameters - registers an offense and converts to a list of arguments - behaves like splat literal assignment - registers an offense and removes the splat from array - behaves like array splat expansion - method parameters - registers an offense and converts to a list of arguments - behaves like splat literal assignment - registers an offense and removes the splat from array - behaves like array splat expansion - method parameters - registers an offense and converts to a list of arguments - behaves like splat literal assignment - registers an offense and removes the splat from array - behaves like array splat expansion - behaves like splat literal assignment - registers an offense and removes the splat from array - method parameters - registers an offense and converts to a list of arguments - behaves like array splat expansion - behaves like splat literal assignment - registers an offense and removes the splat from array - method parameters - registers an offense and converts to a list of arguments - behaves like splat expansion - behaves like splat literal assignment - registers an offense and converts to an array - method parameters - registers an offense and converts to an array - splat expansion inside of an array - registers an offense and corrects expansion of %w to a list of words - registers an offense and corrects expansion of %W to a list of words - registers an offense and corrects the expansion of an array literalinside of an array literal - arrays being expanded with %i variants using splat expansion - splat expansion inside of an array - registers an offense and corrects %i to a list of symbols - registers an offense and changes %I to a list of symbols - behaves like splat expansion - method parameters - registers an offense and converts to an array - behaves like splat literal assignment - registers an offense and converts to an array - assignment to splat expansion - registers an offense and corrects an array using a constructor - registers and corrects an array using top-level const - behaves like splat expansion - behaves like splat literal assignment - registers an offense and converts to an array - method parameters - registers an offense and converts to an array - expanding Array.new call on array literal - with ::Array.new - when the array literal contains exactly one element - registers an offense and corrects - when the array literal contains more than one element - accepts - when the array literal contains exactly one element - registers an offense and corrects - expanding Array.new call on method argument +RuboCop::Cop::Layout::BlockAlignment + accepts end aligned with a global variable + registers an offense for mismatched block end with a method call + registers an offense for mismatched block end with a variable + registers an offense for mismatched block end with a mass assignment + accepts a block end that does not begin its line + accepts end aligned with an or-asgn (||=) + registers an offense for mismatched block end with a constant + registers an offense for mismatched block end with an op-asgn (+=, -=) + accepts end aligned with an instance variable + accepts end aligned with a method call + registers an offense for mismatched block end with a class variable + does not raise an error for nested block in a method call + accepts end aligned with a method call with arguments + accepts end aligned with an op-asgn (+=, -=) + accepts end aligned with an and-asgn (&&=) + registers an offense for mismatched block end with an instance variable + registers an offense for mismatched end with a method call with arguments + accepts end aligned with a constant + registers an offense for mismatched block end with a global variable + accepts end aligned with a variable + accepts end aligned with a mass assignment + registers an offense for mismatched end not aligned with the block that is an argument + accepts end aligned with a class variable + registers an offense for mismatched block end with an and-asgn (&&=) + accepts end aligned with a call chain left hand side + registers an offense for mismatched block end with an or-asgn (||=) + accepts end aligned with the block when the block is a method argument + when the block is a logical operand + accepts a correctly aligned block end + when the block has arguments + registers an offense for mismatched block end + Ruby 2.7 + registers an offense for mismatched block end with a mass assignment + accepts end aligned with a call chain left hand side + on a splatted method call + aligns end with the splat operator + registers an offense and corrects misaligned end braces + when the block has no arguments + registers an offense for mismatched block end + when configured to align with start_of_line + allows when start_of_line aligned + errors when do aligned + when configured to align with do + allows when do aligned + errors when start_of_line aligned + on a bit-flipped method call + registers an offense and corrects misaligned end brace + aligns end with the ~ operator + when variables of a mass assignment spans several lines + registers an offense for end aligned with the block + accepts end aligned with the variables + when the block is defined on the next line + accepts end aligned with the block expression + registers an offenses for mismatched end alignment + on a logically negated method call + aligns end with the ! operator registers an offense and corrects - -RuboCop::Cop::Layout::SpaceBeforeSemicolon - does not register an offense for no space before semicolons - registers an offense and corrects space before semicolon - registers an offense and corrects more than one space before a semicolon - inside block braces - when EnforcedStyle for SpaceInsideBlockBraces is no_space - registers an offense and corrects a space between an opening brace and a semicolon - behaves like common behavior - accepts no space between an opening brace and a semicolon - when EnforcedStyle for SpaceInsideBlockBraces is space - accepts a space between an opening brace and a semicolon - behaves like common behavior - accepts no space between an opening brace and a semicolon - heredocs + when the block is terminated by } + mentions } (not end) in the message + when there is an assignment chain + accepts end aligned with the first variable + registers an offense for an end aligned with the 2nd variable + on an arithmetically negated method call registers an offense and corrects + aligns end with the - operator + and the block is an operand + accepts end aligned with a variable + when multiple similar-looking blocks have misaligned ends + registers an offense for each of them + when the method part is a call chain that spans several lines + registers offenses for misaligned ends + accepts pretty alignment style + accepts end indented as the start of the block + accepts two kinds of end alignment -RuboCop::Cop::Lint::BigDecimalNew - does not register an offense when using `BigDecimal()` - registers an offense and corrects using `::BigDecimal.new()` - registers an offense and corrects using `BigDecimal.new()` +isolated environment + is not affected by a config file above the work directory RuboCop::Cop::Layout::SpaceBeforeComma + registers an offense and corrects block argument with space before comma registers an offense and corrects array index with space before comma - registers an offense and corrects method call arg with space before comma handles more than one space before a comma does not register an offense for no spaces before comma - registers an offense and corrects block argument with space before comma + registers an offense and corrects method call arg with space before comma heredocs registers an offense and corrects -RuboCop::Cop::Layout::EmptyLinesAroundAttributeAccessor - registers an offense and corrects for an attribute accessor and `rubocop:enable` comment line - accepts code that separates an attribute accessor from the code with a newline - accepts code that separates attribute accessors from the code and comment line with a newline - accepts code when attribute method is method chained - accepts code when used in class definition - registers an offense and corrects for code that immediately follows accessor - registers an offense and corrects for code that immediately follows accessor with comment - does not register an offense and corrects when using `if` ... `else` branches - registers an offense and corrects for an attribute accessor and some comment line - accepts code that separates attribute accessors from the code with a newline - registers an offense and corrects for an attribute accessor and `rubocop:enable` comment line and other comment - accepts code that where the attr_accessor is the last line - registers an offense and corrects for an attribute accessor and `rubocop:disable` comment line - registers an offense and corrects for an attribute accessor and comment line - registers an offense and corrects for some attribute accessors and comment line - accepts code that separates an attribute accessor from the code and `rubocop:enable` comment line with a newline - when `AllowedMethods: []` - registers an offense for code that immediately ignored methods after accessor - when `AllowAliasSyntax: false` - registers an offense for code that immediately `alias` syntax after accessor - when `AllowAliasSyntax: true` - does not register an offense for code that immediately `alias` syntax after accessor - when `AllowedMethods: private` - does not register an offense for code that immediately ignored methods after accessor - -RuboCop::Cop::Style::NumericLiteralPrefix - hex literals - registers an offense for uppercase prefix - does not register offense for lowercase prefix - binary literals - registers an offense for uppercase prefix - does not register offense for lowercase prefix - octal literals - when config is zero_only - does not register offense for prefix `0` - registers an offense for prefix `0O` and `0o` - when config is zero_with_o - does not register offense for lowercase prefix - registers an offense for prefixes `0` and `0O` - decimal literals - does not register offense for no prefix - registers an offense for prefixes - -RuboCop::Formatter::AutoGenConfigFormatter - #finished - calls #report_summary - when any offenses are detected - does not report offenses - outputs report summary - when no offenses are detected - does not report offenses - #report_file_as_mark - when different severity offenses are detected - prints highest level mark - when a refactor convention offense is detected - prints "C" - when a refactor severity offense is detected - prints "R" - when no offenses are detected - prints "." - -RuboCop::StringInterpreter - .interpret - handles octal - handles extended unicode - handles unicode - handles hex - behaves like simple escape - handles \\r - behaves like simple escape - handles \\t - behaves like simple escape - handles \\s - behaves like simple escape - handles \\n - behaves like simple escape - handles \\e - behaves like simple escape - handles \\b - behaves like simple escape - handles \\a - behaves like simple escape - handles \\v - behaves like simple escape - handles \\f - -RuboCop::Cop::InternalAffairs::ExampleHeredocDelimiter - when unexpected heredoc delimiter is used at non RuboCop specific expectation - does not register an offense - when unexpected heredoc delimiter is used in multi-line heredoc - registers an offense - when expected heredoc delimiter is used at RuboCop specific expectation - does not register an offense - when unexpected heredoc delimiter is used in single-line heredoc - registers an offense - when unexpected heredoc delimiter is used but heredoc body contains an expected delimiter line - does not register an offense - -RuboCop::Server::Cache - .pid_running? - works properly when concurrency with server stopping and cleaning cache dir - .cache_path - when .rubocop.yml is empty - when cache root path is not specified path - does not raise an error - when `CacheRootDirectory` configure value is set - when cache root path is not specified path - contains the root from `CacheRootDirectory` configure value - when cache root path is specified path - contains the root from cache root path - when cache root path is not specified path and `XDG_CACHE_HOME` environment variable is spacified - contains the root from `CacheRootDirectory` configure value - when ERB pre-processing of the configuration file - when cache root path is not specified path - does not raise an error - when `RUBOCOP_CACHE_ROOT` environment variable is set - when cache root path is not specified path and `XDG_CACHE_HOME` environment variable is specified - contains the root from `RUBOCOP_CACHE_ROOT` - when cache root path is specified path - contains the root from cache root path - when cache root path is not specified path - contains the root from `RUBOCOP_CACHE_ROOT` - when cache root path is specified path - is the specified path - when `XDG_CACHE_HOME` environment variable is set - when cache root path is specified path - contains the root from cache root path - when cache root path is not specified path - contains the root from `XDG_CACHE_HOME` - when cache root path is not specified as default - is the default path +RuboCop::Cop::Style::StructInheritance + accepts extending DelegateClass + accepts assignment to ::Struct.new + registers an offense when extending instance of `Struct` when there is a comment before class declaration + registers an offense when extending instance of Struct + registers an offense when extending instance of Struct with do ... end + accepts assignment to block form of Struct.new + registers an offense when extending instance of Struct without `do` ... `end` and class body is empty and single line definition + accepts plain class + registers an offense when extending instance of ::Struct with do ... end + registers an offense when extending instance of ::Struct + accepts assignment to Struct.new + registers an offense when extending instance of Struct without `do` ... `end` and class body is empty -RuboCop::Cop::Style::BlockDelimiters - BracesRequiredMethods - BracesRequiredMethods methods - allows braces - registers an offense with do - other methods - autocorrects { and } to do and end - allows braces - EnforcedStyle: line_count_based - does not autocorrect {} if do-end would change the meaning - registers an offense for a single line block with do-end - autocorrects do-end for single line blocks to { and } - accepts a single line block with braces - does not autocorrect do-end if {} would change the meaning - accepts a multi-line block that needs braces to be valid ruby - accepts a multi-line block with do-end - Ruby >= 2.7 - registers an offense for a single line numblock with do-end - accepts a multi-line numblock that needs braces to be valid ruby - accepts a single line numblock with braces - accepts a multi-line numblock with do-end - with a single line do-end block with an inline `rescue` - autocorrects properly - when there are braces around a multi-line block - registers an offense when there is a comment after the closing brace and block body is empty - accepts a multi-line functional block with {} if it is an ignored method - registers an offense when combined with attribute assignment - autocorrects adjacent curly braces correctly - registers an offense when there is a comment after the closing brace and block body is not empty - accepts a multi-line functional block with {} if it is an ignored method by regex - registers an offense and keep chained block when there is a comment after the closing brace and block body is not empty - registers an offense in the simple case - does not autocorrect {} if do-end would introduce a syntax error - can handle special method names such as []= and done? - autocorrects { and } to do and end - accepts braces if do-end would change the meaning - registers an offense when there is a comment after the closing brace and using method chain - registers an offense for braces if do-end would not change the meaning - EnforcedStyle: always_braces - registers an offense for a multi-line block with do-end - accepts a single line block with braces - registers an offense for multi-lined do-end blocks when combined with attribute assignment - registers an offense for a single line block with do-end - accepts a multi-line functional block with do-end if it is an ignored method - registers an offense for multi-line chained do-end blocks - accepts a multi-line functional block with do-end if it is an ignored method by regex - does not autocorrect do-end if {} would change the meaning - autocorrects do-end with `ensure` to {} if it is a functional block - autocorrects do-end with `rescue` to {} if it is a functional block - accepts a multi-line block that needs braces to be valid ruby - when there are braces around a multi-line block - allows when combined with attribute assignment - allows when the block is being chained - allows in the simple case - EnforcedStyle: semantic - accepts a single line block with {} if used in an if statement - accepts a multi-line block with braces if the return value is assigned - allows {} if it is a known functional method - autocorrects do-end to {} if it is a functional block and does not change the meaning - accepts a single line block with {} if used in a logical or - accepts a multi-line block with braces when passed to a known functional method - autocorrects do-end with `ensure` to {} if it is a functional block - registers an offense for a multi-line block with braces if the return value is not used - accepts a multi-line block with braces when passed to a method - autocorrects do-end to {} with appropriate spacing - registers an offense for a multi-line block with do-end if the return value is passed to a method - registers an offense for a multi-line block with do-end if the return value is assigned - accepts a multi-line functional block with do-end if it is an ignored method by regex - accepts a multi-line functional block with do-end if it is an ignored method - accepts a multi-line block with braces when chained - accepts a multi-line block with braces if it is the return value of its scope - accepts a multi-line block with do-end if it is the return value of its scope - accepts a single line block with {} if used in an erange - allows {} if it is a known procedural method - autocorrects do-end to {} if it is a functional block - autocorrects do-end with `rescue` to {} if it is a functional block - registers an offense for a multi-line block with do-end if the return value is attribute-assigned - accepts a single line block with {} if used in an irange - accepts a single line block with {} followed by a safe navigation method call - accepts a single line block with {} if used in an array - accepts a single line block with {} if used in a logical and - accepts a multi-line functional block with do-end if it is a known procedural method - with a procedural one-line block - with AllowBracesOnProceduralOneLiners false or unset - accepts a single line block with do-end if it is procedural - registers an offense for a single line procedural block - with AllowBracesOnProceduralOneLiners true - accepts a single line procedural do-end block - accepts a single line procedural block with braces - with a procedural multi-line block - autocorrects { and } to do and end - autocorrects { and } to do and end with appropriate spacing - EnforcedStyle: braces_for_chaining - registers an offense for a single line block with do-end - autocorrects do-end with `rescue` to {} if it is a functional block - autocorrects do-end with `ensure` to {} if it is a functional block - accepts a multi-line block that needs braces to be valid ruby - allows chaining to } inside of Hash[] - disallows {} with no chain inside of Hash[] - accepts a multi-line block with do-end - accepts a single line block with braces - accepts a multi-line functional block with {} if it is an ignored method by regex - registers an offense for multi-line chained do-end blocks - accepts a multi-line functional block with {} if it is an ignored method - allows when :[] is chained - allows do/end inside Hash[] - Ruby >= 2.7 - accepts a multi-line numblock with do-end - registers an offense for a single line numblock with do-end - accepts a single line numblock with braces - accepts a multi-line numblock that needs braces to be valid ruby - with safe navigation - registers an offense for multi-line chained do-end blocks - when there are braces around a multi-line block - registers an offense when combined with attribute assignment - allows when the block is being chained - registers an offense in the simple case - allows when the block is being chained with attribute assignment +RuboCop::Cop::Lint::OrderedMagicComments + does not register an offense when using `encoding` magic comment is first line + registers an offense and corrects when `coding` magic comment does not precede all other magic comments + registers an offense and corrects when using `frozen_string_literal` magic comment is next of shebang + does not register an offense when using `encoding` magic comment only + does not register an offense when using `frozen_string_literal` magic comment only + registers an offense and corrects when an `encoding` magic comment does not precede all other magic comments + does not register an offense when using `encoding: Encoding::SJIS` Hash notation after`frozen_string_literal` magic comment + registers an offense and corrects when `-*- encoding : ascii-8bit -*-` magic comment does not precede all other magic comments + does not register an offense when using `encoding` magic comment is next of shebang -RuboCop::Cop::Layout::FirstMethodParameterLineBreak - accepts params listed on a single line - accepts single-line methods - registers an offense and corrects params with default values - registers an offense and corrects params on first line of singleton method - accepts params without parens - registers an offense and corrects params listed on the first line - accepts methods without params +RuboCop::Cop::Layout::SpaceAfterNot + accepts no space after ! + registers an offense and corrects a single space after ! + registers an offense and corrects multiple spaces after ! + accepts space after not keyword + registers an offense and corrects space after ! with the negated receiver wrapped in parentheses -RuboCop::Cop::Style::StderrPuts - registers an offense when using `::STDERR.puts('hello')` - registers an offense when using `$stderr.puts('hello')` - registers no offense when using `$stderr.puts` with no arguments - registers an offense when using `STDERR.puts('hello')` - registers no offense when using `STDERR.puts` with no arguments +RuboCop::Cop::Style::StringLiterals + configured with double quotes preferred + accepts single quotes at the start of regexp literals + accepts single quotes in interpolation + registers offense for opposite + correct + accepts %q and %Q quotes + accepts double quotes + accepts ' in a %w + registers offense for escaped single quote in single quotes + accepts single quotes in string with escaped non-' character + does not accept multiple escaped single quotes in single quotes + can handle a built-in constant parsed as string + accepts single quotes when they are needed + registers offense for single quotes when double quotes would be equivalent + accepts single quoted string with backslash + flags single quotes with plain # (not #@var or #{interpolation} or #$global + accepts heredocs + accepts % quotes + accepts escaped single quote in string with escaped non-' character + configured with single quotes preferred + registers an offense for words with non-ascii chars + accepts %q and %Q quotes + accepts double quotes when single quotes are used + accepts double quotes when new line is used + accepts heredocs + accepts single quotes + accepts % quotes + accepts double quotes in interpolation + accepts double quotes at the start of regexp literals + accepts double quotes when interpolating & quotes in multiple lines + accepts double quotes when control characters are used + detects unneeded double quotes within concatenated string + accepts single quotes in interpolation + can handle character literals + accepts " in a %w + does not register an offense for words with non-ascii chars and other control sequences + accepts double quotes with some other special symbols + accepts double quotes when interpolating an instance variable + accepts double quotes when interpolating a global variable + registers an offense for "\" + accepts double quotes when unicode control sequence is used + registers an offense for "\"" + accepts double quotes when interpolating a class variable + registers offense for double quotes when single quotes suffice + registers offense for correct + opposite + can handle a built-in constant parsed as string + accepts \\\n in a string + when ConsistentQuotesInMultiline is true + and EnforcedStyle is double_quotes + accepts continued strings using all double quotes + registers an offense for unneeded single quotes in continuation + doesn't register offense for single quotes with embedded double + registers an offense for mixed quote styles in a continued string + and EnforcedStyle is single_quotes + doesn't choke on heredocs with inconsistent indentation + accepts continued strings using all single quotes + registers an offense for strings with line breaks in them + doesn't register offense for double quotes with interpolation + registers an offense for unneeded double quotes in continuation + registers an offense for mixed quote styles in a continued string + accepts for double quotes with an escaped normal character + doesn't register offense for double quotes with embedded single + accepts for double quotes with an escaped special character + when configured with a bad value + fails -RuboCop::Cop::Style::IfUnlessModifierOfIfUnless - provides a good error message - conditional with modifier +RuboCop::Cop::Layout::MultilineMethodParameterLineBreaks + when there are no parameters + does not add any offenses + when second parameter starts on same line as end of first registers an offense and corrects - ternary with modifier + when there are multiple parameters on the first line + registers an offense and corrects starting from the 2nd argument + when parameter's default value starts on same line but ends on different line registers an offense and corrects - nested conditionals - accepts - `unless` / `else` with modifier + when many parameters are on multiple lines, three on same line + registers an offense and corrects + when many parameters including hash are on multiple lines, three on same line + registers an offense and corrects + when one parameter on same line + does not add any offenses + when two parameters are on next line + does not add any offenses + when many parameter are on multiple lines, two on same line registers an offense and corrects - conditional with modifier in body - accepts -RuboCop::Cop::Style::IfWithSemicolon - accepts without `else` branch - can handle modifier conditionals - registers an offense and corrects for one line if/;/end - when elsif is present - accepts second elsif block - accepts with `else` branch - accepts without `else` branch +RuboCop::Cop::Style::ImplicitRuntimeError + does not register an offense for `fail` with an error class + registers an offense for `raise` with a multiline string + registers an offense for `raise` without error class + does not register an offense for `fail` without arguments + registers an offense for `fail` with a multiline string + does not register an offense for `raise` with an error class + does not register an offense for `raise` without arguments + registers an offense for `fail` without error class -RuboCop::Cop::Layout::SpaceInsideArrayPercentLiteral - accepts non array percent literals - for W type and ["[", "]"] delimiters - registers an offense for unnecessary spaces - accepts literals with escaped spaces - accepts multi-line literals within a method - accepts literals without additional spaces - accepts literals with escaped and additional spaces - accepts newlines and additional following alignment spaces - registers an offense for multiple spaces between items - accepts multi-line literals - for w type and ["[", "]"] delimiters - accepts literals with escaped spaces - accepts multi-line literals within a method - accepts literals with escaped and additional spaces - registers an offense for multiple spaces between items - registers an offense for unnecessary spaces - accepts newlines and additional following alignment spaces - accepts multi-line literals - accepts literals without additional spaces - for w type and ["(", ")"] delimiters - accepts literals without additional spaces - accepts newlines and additional following alignment spaces - accepts literals with escaped spaces - registers an offense for multiple spaces between items - accepts literals with escaped and additional spaces - registers an offense for unnecessary spaces - accepts multi-line literals - accepts multi-line literals within a method - for W type and ["!", "!"] delimiters - registers an offense for multiple spaces between items - accepts literals with escaped and additional spaces - accepts multi-line literals within a method - accepts literals with escaped spaces - accepts newlines and additional following alignment spaces - accepts multi-line literals - registers an offense for unnecessary spaces - accepts literals without additional spaces - for I type and ["(", ")"] delimiters - accepts literals with escaped and additional spaces - accepts literals with escaped spaces - accepts multi-line literals within a method - accepts newlines and additional following alignment spaces - accepts multi-line literals - registers an offense for multiple spaces between items - registers an offense for unnecessary spaces - accepts literals without additional spaces - for W type and ["{", "}"] delimiters - accepts literals with escaped spaces - registers an offense for multiple spaces between items - registers an offense for unnecessary spaces - accepts multi-line literals within a method - accepts literals with escaped and additional spaces - accepts literals without additional spaces - accepts multi-line literals - accepts newlines and additional following alignment spaces - for I type and ["{", "}"] delimiters - accepts multi-line literals - accepts literals with escaped and additional spaces - registers an offense for unnecessary spaces - accepts literals without additional spaces - accepts newlines and additional following alignment spaces - registers an offense for multiple spaces between items - accepts literals with escaped spaces - accepts multi-line literals within a method - for i type and ["[", "]"] delimiters - accepts literals with escaped and additional spaces - registers an offense for unnecessary spaces - accepts literals with escaped spaces - accepts multi-line literals - accepts literals without additional spaces - registers an offense for multiple spaces between items - accepts newlines and additional following alignment spaces - accepts multi-line literals within a method - for I type and ["[", "]"] delimiters - accepts multi-line literals - registers an offense for multiple spaces between items - accepts literals with escaped spaces - accepts multi-line literals within a method - accepts newlines and additional following alignment spaces - accepts literals without additional spaces - accepts literals with escaped and additional spaces - registers an offense for unnecessary spaces - for i type and ["{", "}"] delimiters - accepts literals with escaped and additional spaces - registers an offense for multiple spaces between items - accepts newlines and additional following alignment spaces - accepts multi-line literals within a method - accepts literals with escaped spaces - accepts literals without additional spaces - accepts multi-line literals - registers an offense for unnecessary spaces - for w type and ["{", "}"] delimiters - registers an offense for unnecessary spaces - accepts literals with escaped spaces - accepts literals with escaped and additional spaces - registers an offense for multiple spaces between items - accepts multi-line literals - accepts multi-line literals within a method - accepts newlines and additional following alignment spaces - accepts literals without additional spaces - for i type and ["(", ")"] delimiters - registers an offense for unnecessary spaces - accepts newlines and additional following alignment spaces - accepts literals without additional spaces - accepts literals with escaped spaces - accepts multi-line literals - accepts literals with escaped and additional spaces - registers an offense for multiple spaces between items - accepts multi-line literals within a method - for w type and ["!", "!"] delimiters - registers an offense for unnecessary spaces - accepts literals without additional spaces - accepts multi-line literals within a method - accepts newlines and additional following alignment spaces - accepts literals with escaped spaces - accepts literals with escaped and additional spaces - registers an offense for multiple spaces between items - accepts multi-line literals - for I type and ["!", "!"] delimiters - registers an offense for unnecessary spaces - accepts literals without additional spaces - accepts literals with escaped and additional spaces - registers an offense for multiple spaces between items - accepts literals with escaped spaces - accepts newlines and additional following alignment spaces - accepts multi-line literals - accepts multi-line literals within a method - for W type and ["(", ")"] delimiters - accepts literals with escaped and additional spaces - accepts multi-line literals within a method - registers an offense for multiple spaces between items - registers an offense for unnecessary spaces - accepts literals without additional spaces - accepts literals with escaped spaces - accepts multi-line literals - accepts newlines and additional following alignment spaces - for i type and ["!", "!"] delimiters - accepts literals with escaped spaces - registers an offense for multiple spaces between items - accepts multi-line literals - accepts multi-line literals within a method - accepts literals without additional spaces - accepts newlines and additional following alignment spaces - registers an offense for unnecessary spaces - accepts literals with escaped and additional spaces +RuboCop::Cop::Lint::EachWithObjectArgument + registers an offense for bignum argument + accepts a variable argument + accepts a string argument + registers an offense for fixnum argument + registers an offense for float argument + accepts two arguments + when using safe navigation operator + registers an offense for fixnum argument + +RuboCop::Cop::Layout::BlockEndNewline + registers an offense and corrects when multiline block `}` is not on its own line and using multiple heredoc arguments + registers an offense and corrects when multiline block `}` is not on its own line + registers an offense and corrects when a multiline block ends with a method call with hash arguments + registers an offense and corrects when `}` of multiline block without processing is not on its own line + registers an offense and corrects when multiline block `}` is not on its own line and using multiple heredoc argument method chain + registers an offense and corrects when a multiline block ends with a hash + registers an offense and corrects when multiline block `}` is not on its own line and using method chain + accepts a one-liner + registers an offense and corrects when multiline block end is not on its own line + registers an offense and corrects when multiline block `}` is not on its own line and using heredoc argument with method chain + accepts multiline blocks with newlines before the end + registers an offense and corrects when multiline block `}` is not on its own line and using heredoc argument + Ruby 2.7 + registers an offense and corrects when multiline block `}` is not on its own line and using method chain + registers an offense and corrects when multiline block `}` is not on its own line and using heredoc argument + +RuboCop::Cop::InternalAffairs::CreateEmptyFile + does not register an offense when using `create_file(path, 'hello')` + does not register an offense when using `receiver.create_file(path, '')` + does not register an offense when using `create_file(path)` + registers an offense when using `create_file(path, '') + registers an offense when using `create_file(path, "") + does not register an offense when using `create_file(path, ['foo', 'bar'])` + +RuboCop::Cop::Layout::SpaceAroundEqualsInParameterDefault + when EnforcedStyle is no_space + registers an offense and corrects default value assignment with space + accepts default value assignment without space + registers an offense and corrects assignment of empty list with space + registers an offense and corrects assignment of empty string with space + when EnforcedStyle is space + accepts default value assignment with space + registers an offense and corrects assigning empty string without space + accepts default value assignment with spaces and unary + operator + registers an offense and corrects assignment of empty list without space + registers an offense and corrects default value assignment without space + registers an offense and corrects default value assignment where first is partially right without space + registers an offense and corrects missing space for arguments with unary operators RuboCop::Cop::Lint::LiteralInInterpolation + does not register an offense when space literal at the end of heredoc line accepts interpolation of xstr - accepts interpolation of irange where endpoints are not literals handles backslash in double quotes when autocorrecting + accepts interpolation of irange where endpoints are not literals accepts empty interpolation - handles backslash in single quotes when autocorrecting - handles nested interpolations when autocorrecting - handles double quotes in single quotes when autocorrecting accepts interpolation of erange where endpoints are not literals - does not register an offense when space literal at the end of heredoc line - behaves like literal interpolation - removes interpolation around %i[s1 s2] when there is more text - registers an offense only for final %i[s1 s2] in interpolation - removes interpolation around multiple %i[s1 s2] - registers an offense for %i[s1 s2] in interpolation and removes interpolation around it - when there is non-literal and literal interpolation - when literal interpolation is after non-literal - only removes interpolation around literal - when literal interpolation is before non-literal - only removes interpolation around literal - behaves like literal interpolation - removes interpolation around %i[ s1 s2 ] when there is more text - removes interpolation around multiple %i[ s1 s2 ] - registers an offense only for final %i[ s1 s2 ] in interpolation - registers an offense for %i[ s1 s2 ] in interpolation and removes interpolation around it - when there is non-literal and literal interpolation - when literal interpolation is before non-literal - only removes interpolation around literal - when literal interpolation is after non-literal - only removes interpolation around literal - behaves like non-special string literal interpolation - registers an offense for 'foo' and removes the interpolation and quotes around 'foo' - behaves like non-special string literal interpolation - registers an offense for "foo" and removes the interpolation and quotes around "foo" + handles double quotes in single quotes when autocorrecting + handles nested interpolations when autocorrecting + handles backslash in single quotes when autocorrecting behaves like literal interpolation - registers an offense for 1_123 in interpolation and removes interpolation around it - removes interpolation around multiple 1_123 - registers an offense only for final 1_123 in interpolation - removes interpolation around 1_123 when there is more text + registers an offense only for final 0xaabb in interpolation + removes interpolation around 0xaabb when there is more text + removes interpolation around multiple 0xaabb + registers an offense for 0xaabb in interpolation and removes interpolation around it when there is non-literal and literal interpolation - when literal interpolation is after non-literal - only removes interpolation around literal when literal interpolation is before non-literal only removes interpolation around literal - behaves like literal interpolation - removes interpolation around multiple :symbol - removes interpolation around :symbol when there is more text - registers an offense only for final :symbol in interpolation - registers an offense for :symbol in interpolation and removes interpolation around it - when there is non-literal and literal interpolation when literal interpolation is after non-literal only removes interpolation around literal - when literal interpolation is before non-literal - only removes interpolation around literal behaves like literal interpolation - removes interpolation around multiple -1 - registers an offense for -1 in interpolation and removes interpolation around it - registers an offense only for final -1 in interpolation - removes interpolation around -1 when there is more text + registers an offense only for final 1..2 in interpolation + removes interpolation around multiple 1..2 + registers an offense for 1..2 in interpolation and removes interpolation around it + removes interpolation around 1..2 when there is more text when there is non-literal and literal interpolation when literal interpolation is before non-literal only removes interpolation around literal when literal interpolation is after non-literal only removes interpolation around literal behaves like literal interpolation + removes interpolation around multiple {"a" => "b"} registers an offense for {"a" => "b"} in interpolation and removes interpolation around it - removes interpolation around {"a" => "b"} when there is more text registers an offense only for final {"a" => "b"} in interpolation - removes interpolation around multiple {"a" => "b"} + removes interpolation around {"a" => "b"} when there is more text when there is non-literal and literal interpolation when literal interpolation is after non-literal only removes interpolation around literal when literal interpolation is before non-literal only removes interpolation around literal behaves like literal interpolation - registers an offense for %w[] in interpolation and removes interpolation around it - removes interpolation around %w[] when there is more text - removes interpolation around multiple %w[] - registers an offense only for final %w[] in interpolation + removes interpolation around false when there is more text + removes interpolation around multiple false + registers an offense for false in interpolation and removes interpolation around it + registers an offense only for final false in interpolation when there is non-literal and literal interpolation when literal interpolation is before non-literal only removes interpolation around literal when literal interpolation is after non-literal only removes interpolation around literal behaves like literal interpolation - removes interpolation around 0xaabb when there is more text - registers an offense for 0xaabb in interpolation and removes interpolation around it - registers an offense only for final 0xaabb in interpolation - removes interpolation around multiple 0xaabb + registers an offense for %i[s1 s2] in interpolation and removes interpolation around it + registers an offense only for final %i[s1 s2] in interpolation + removes interpolation around %i[s1 s2] when there is more text + removes interpolation around multiple %i[s1 s2] when there is non-literal and literal interpolation when literal interpolation is after non-literal only removes interpolation around literal when literal interpolation is before non-literal only removes interpolation around literal - behaves like special keywords - accepts strings like __LINE__ - registers an offense and autocorrects interpolation after __LINE__ behaves like literal interpolation - registers an offense only for final ["a", "b"] in interpolation - removes interpolation around multiple ["a", "b"] - removes interpolation around ["a", "b"] when there is more text - registers an offense for ["a", "b"] in interpolation and removes interpolation around it + registers an offense for 0o377 in interpolation and removes interpolation around it + removes interpolation around 0o377 when there is more text + registers an offense only for final 0o377 in interpolation + removes interpolation around multiple 0o377 when there is non-literal and literal interpolation - when literal interpolation is after non-literal - only removes interpolation around literal when literal interpolation is before non-literal only removes interpolation around literal - behaves like special keywords - registers an offense and autocorrects interpolation after __ENCODING__ - accepts strings like __ENCODING__ - behaves like literal interpolation - removes interpolation around multiple false - registers an offense for false in interpolation and removes interpolation around it - registers an offense only for final false in interpolation - removes interpolation around false when there is more text - when there is non-literal and literal interpolation when literal interpolation is after non-literal only removes interpolation around literal + behaves like literal interpolation + removes interpolation around multiple 1 + registers an offense only for final 1 in interpolation + removes interpolation around 1 when there is more text + registers an offense for 1 in interpolation and removes interpolation around it + when there is non-literal and literal interpolation when literal interpolation is before non-literal only removes interpolation around literal - behaves like special keywords - accepts strings like __END__ - registers an offense and autocorrects interpolation after __END__ + when literal interpolation is after non-literal + only removes interpolation around literal behaves like literal interpolation - removes interpolation around multiple :"symbol" - removes interpolation around :"symbol" when there is more text - registers an offense only for final :"symbol" in interpolation - registers an offense for :"symbol" in interpolation and removes interpolation around it + registers an offense for %I[s1 s2] in interpolation and removes interpolation around it + removes interpolation around multiple %I[s1 s2] + registers an offense only for final %I[s1 s2] in interpolation + removes interpolation around %I[s1 s2] when there is more text when there is non-literal and literal interpolation when literal interpolation is after non-literal only removes interpolation around literal when literal interpolation is before non-literal only removes interpolation around literal + behaves like non-special string literal interpolation + registers an offense for "foo" and removes the interpolation and quotes around "foo" behaves like literal interpolation - registers an offense for 1 in interpolation and removes interpolation around it - removes interpolation around multiple 1 - registers an offense only for final 1 in interpolation - removes interpolation around 1 when there is more text + registers an offense only for final 1_123 in interpolation + removes interpolation around 1_123 when there is more text + registers an offense for 1_123 in interpolation and removes interpolation around it + removes interpolation around multiple 1_123 when there is non-literal and literal interpolation when literal interpolation is before non-literal only removes interpolation around literal when literal interpolation is after non-literal only removes interpolation around literal behaves like literal interpolation - removes interpolation around multiple nil - removes interpolation around nil when there is more text - registers an offense for nil in interpolation and removes interpolation around it - registers an offense only for final nil in interpolation + removes interpolation around multiple %w[v1 v2] + registers an offense only for final %w[v1 v2] in interpolation + registers an offense for %w[v1 v2] in interpolation and removes interpolation around it + removes interpolation around %w[v1 v2] when there is more text when there is non-literal and literal interpolation when literal interpolation is after non-literal only removes interpolation around literal when literal interpolation is before non-literal only removes interpolation around literal + behaves like non-special string literal interpolation + registers an offense for 'foo' and removes the interpolation and quotes around 'foo' behaves like literal interpolation registers an offense only for final [] in interpolation - removes interpolation around [] when there is more text removes interpolation around multiple [] registers an offense for [] in interpolation and removes interpolation around it + removes interpolation around [] when there is more text when there is non-literal and literal interpolation when literal interpolation is before non-literal only removes interpolation around literal when literal interpolation is after non-literal only removes interpolation around literal behaves like literal interpolation - registers an offense for 0o377 in interpolation and removes interpolation around it - removes interpolation around 0o377 when there is more text - registers an offense only for final 0o377 in interpolation - removes interpolation around multiple 0o377 + registers an offense for :"symbol" in interpolation and removes interpolation around it + removes interpolation around multiple :"symbol" + registers an offense only for final :"symbol" in interpolation + removes interpolation around :"symbol" when there is more text when there is non-literal and literal interpolation - when literal interpolation is after non-literal - only removes interpolation around literal when literal interpolation is before non-literal only removes interpolation around literal - behaves like literal interpolation - registers an offense for %I[s1 s2] in interpolation and removes interpolation around it - removes interpolation around %I[s1 s2] when there is more text - removes interpolation around multiple %I[s1 s2] - registers an offense only for final %I[s1 s2] in interpolation - when there is non-literal and literal interpolation when literal interpolation is after non-literal only removes interpolation around literal - when literal interpolation is before non-literal - only removes interpolation around literal behaves like literal interpolation - registers an offense only for final %i[s1 s2] in interpolation - removes interpolation around multiple %i[s1 s2] - removes interpolation around %i[s1 s2] when there is more text - registers an offense for %i[s1 s2] in interpolation and removes interpolation around it + removes interpolation around multiple %i[s1 s2] + registers an offense only for final %i[s1 s2] in interpolation + removes interpolation around %i[s1 s2] when there is more text + registers an offense for %i[s1 s2] in interpolation and removes interpolation around it when there is non-literal and literal interpolation - when literal interpolation is after non-literal - only removes interpolation around literal when literal interpolation is before non-literal only removes interpolation around literal + when literal interpolation is after non-literal + only removes interpolation around literal behaves like literal interpolation - registers an offense only for final 1...2 in interpolation - removes interpolation around multiple 1...2 - removes interpolation around 1...2 when there is more text - registers an offense for 1...2 in interpolation and removes interpolation around it + registers an offense only for final 1.2e-3 in interpolation + removes interpolation around multiple 1.2e-3 + registers an offense for 1.2e-3 in interpolation and removes interpolation around it + removes interpolation around 1.2e-3 when there is more text when there is non-literal and literal interpolation when literal interpolation is before non-literal only removes interpolation around literal when literal interpolation is after non-literal only removes interpolation around literal behaves like literal interpolation in words literal - removes interpolation of an array containing a symbol literal without space in %I[] - removes interpolation of a string literal without space in %I[] - accepts interpolation of an array literal containing a symbol with space in %I[] - removes interpolation of an array containing a string literal without space in %I[] - accepts interpolation of a string literal with space in %I[] - accepts interpolation of a symbol literal with space in %I[] - accepts interpolation of an array literal containing a string with space in %I[] - removes interpolation of a symbol literal without space in %I[] + accepts interpolation of an array literal containing a string with space in %W[] + accepts interpolation of a string literal with space in %W[] + accepts interpolation of an array literal containing a symbol with space in %W[] + removes interpolation of an array containing a symbol literal without space in %W[] + removes interpolation of a string literal without space in %W[] + accepts interpolation of a symbol literal with space in %W[] + removes interpolation of a symbol literal without space in %W[] + removes interpolation of an array containing a string literal without space in %W[] + behaves like special keywords + registers an offense and autocorrects interpolation after __LINE__ + accepts strings like __LINE__ behaves like literal interpolation removes interpolation around multiple %w[v1] - registers an offense for %w[v1] in interpolation and removes interpolation around it removes interpolation around %w[v1] when there is more text registers an offense only for final %w[v1] in interpolation + registers an offense for %w[v1] in interpolation and removes interpolation around it when there is non-literal and literal interpolation when literal interpolation is before non-literal only removes interpolation around literal when literal interpolation is after non-literal only removes interpolation around literal - behaves like literal interpolation - registers an offense for %w[v1 v2] in interpolation and removes interpolation around it - registers an offense only for final %w[v1 v2] in interpolation - removes interpolation around %w[v1 v2] when there is more text - removes interpolation around multiple %w[v1 v2] - when there is non-literal and literal interpolation - when literal interpolation is after non-literal - only removes interpolation around literal - when literal interpolation is before non-literal - only removes interpolation around literal + behaves like literal interpolation in words literal + accepts interpolation of an array literal containing a symbol with space in %I[] + removes interpolation of a symbol literal without space in %I[] + removes interpolation of a string literal without space in %I[] + removes interpolation of an array containing a symbol literal without space in %I[] + accepts interpolation of a string literal with space in %I[] + accepts interpolation of an array literal containing a string with space in %I[] + accepts interpolation of a symbol literal with space in %I[] + removes interpolation of an array containing a string literal without space in %I[] in string-like contexts - removes interpolation in symbols removes interpolation in regular expressions removes interpolation in backticks + removes interpolation in symbols behaves like literal interpolation - registers an offense for 1.2e-3 in interpolation and removes interpolation around it - registers an offense only for final 1.2e-3 in interpolation - removes interpolation around 1.2e-3 when there is more text - removes interpolation around multiple 1.2e-3 + removes interpolation around -1 when there is more text + removes interpolation around multiple -1 + registers an offense for -1 in interpolation and removes interpolation around it + registers an offense only for final -1 in interpolation when there is non-literal and literal interpolation + when literal interpolation is before non-literal + only removes interpolation around literal when literal interpolation is after non-literal only removes interpolation around literal + behaves like literal interpolation + registers an offense only for final %w[] in interpolation + removes interpolation around multiple %w[] + registers an offense for %w[] in interpolation and removes interpolation around it + removes interpolation around %w[] when there is more text + when there is non-literal and literal interpolation when literal interpolation is before non-literal only removes interpolation around literal + when literal interpolation is after non-literal + only removes interpolation around literal + behaves like special keywords + registers an offense and autocorrects interpolation after __ENCODING__ + accepts strings like __ENCODING__ + behaves like special keywords + accepts strings like __END__ + registers an offense and autocorrects interpolation after __END__ behaves like literal interpolation - removes interpolation around multiple 123_456_789_123_456_789 - removes interpolation around 123_456_789_123_456_789 when there is more text - registers an offense for 123_456_789_123_456_789 in interpolation and removes interpolation around it - registers an offense only for final 123_456_789_123_456_789 in interpolation + registers an offense only for final %i[ s1 s2 ] in interpolation + removes interpolation around %i[ s1 s2 ] when there is more text + registers an offense for %i[ s1 s2 ] in interpolation and removes interpolation around it + removes interpolation around multiple %i[ s1 s2 ] when there is non-literal and literal interpolation when literal interpolation is before non-literal only removes interpolation around literal when literal interpolation is after non-literal only removes interpolation around literal behaves like literal interpolation - registers an offense only for final 1..2 in interpolation - removes interpolation around 1..2 when there is more text - registers an offense for 1..2 in interpolation and removes interpolation around it - removes interpolation around multiple 1..2 + removes interpolation around multiple :symbol + registers an offense only for final :symbol in interpolation + registers an offense for :symbol in interpolation and removes interpolation around it + removes interpolation around :symbol when there is more text + when there is non-literal and literal interpolation + when literal interpolation is after non-literal + only removes interpolation around literal + when literal interpolation is before non-literal + only removes interpolation around literal + behaves like literal interpolation + removes interpolation around multiple true + removes interpolation around true when there is more text + registers an offense only for final true in interpolation + registers an offense for true in interpolation and removes interpolation around it when there is non-literal and literal interpolation when literal interpolation is before non-literal only removes interpolation around literal when literal interpolation is after non-literal only removes interpolation around literal - behaves like literal interpolation in words literal - accepts interpolation of an array literal containing a string with space in %W[] - removes interpolation of a symbol literal without space in %W[] - accepts interpolation of a string literal with space in %W[] - accepts interpolation of an array literal containing a symbol with space in %W[] - removes interpolation of an array containing a string literal without space in %W[] - accepts interpolation of a symbol literal with space in %W[] - removes interpolation of a string literal without space in %W[] - removes interpolation of an array containing a symbol literal without space in %W[] behaves like special keywords registers an offense and autocorrects interpolation after __FILE__ accepts strings like __FILE__ behaves like literal interpolation - removes interpolation around true when there is more text - registers an offense for true in interpolation and removes interpolation around it - removes interpolation around multiple true - registers an offense only for final true in interpolation + registers an offense only for final 123_456_789_123_456_789 in interpolation + removes interpolation around 123_456_789_123_456_789 when there is more text + removes interpolation around multiple 123_456_789_123_456_789 + registers an offense for 123_456_789_123_456_789 in interpolation and removes interpolation around it when there is non-literal and literal interpolation when literal interpolation is after non-literal only removes interpolation around literal when literal interpolation is before non-literal only removes interpolation around literal behaves like literal interpolation - removes interpolation around 2.0 when there is more text - registers an offense for 2.0 in interpolation and removes interpolation around it + removes interpolation around multiple nil + registers an offense for nil in interpolation and removes interpolation around it + removes interpolation around nil when there is more text + registers an offense only for final nil in interpolation + when there is non-literal and literal interpolation + when literal interpolation is after non-literal + only removes interpolation around literal + when literal interpolation is before non-literal + only removes interpolation around literal + behaves like literal interpolation + registers an offense for 1...2 in interpolation and removes interpolation around it + removes interpolation around 1...2 when there is more text + removes interpolation around multiple 1...2 + registers an offense only for final 1...2 in interpolation + when there is non-literal and literal interpolation + when literal interpolation is before non-literal + only removes interpolation around literal + when literal interpolation is after non-literal + only removes interpolation around literal + behaves like literal interpolation removes interpolation around multiple 2.0 + removes interpolation around 2.0 when there is more text registers an offense only for final 2.0 in interpolation + registers an offense for 2.0 in interpolation and removes interpolation around it when there is non-literal and literal interpolation when literal interpolation is before non-literal only removes interpolation around literal when literal interpolation is after non-literal only removes interpolation around literal + behaves like literal interpolation + registers an offense only for final ["a", "b"] in interpolation + removes interpolation around multiple ["a", "b"] + registers an offense for ["a", "b"] in interpolation and removes interpolation around it + removes interpolation around ["a", "b"] when there is more text + when there is non-literal and literal interpolation + when literal interpolation is after non-literal + only removes interpolation around literal + when literal interpolation is before non-literal + only removes interpolation around literal -RuboCop::Cop::Style::MapToHash - >= Ruby 2.6 - when the receiver is an array - registers an offense and corrects - for `collect.to_h` with block arity 1 - registers an offense and corrects - when the receiver is an hash - registers an offense and corrects - for `map.to_h` with block arity 2 - registers an offense and corrects - `collect.to_h` with a block on `to_h` - registers an offense but does not correct - `map.to_h` with a block on `to_h` - registers an offense but does not correct - when the receiver is an hash - registers an offense and corrects - when chained further - registers an offense and corrects - when the receiver is an array - registers an offense and corrects - for `collect.to_h` with block arity 2 - registers an offense and corrects - when chained further - registers an offense and corrects - for `map.to_h` with block arity 1 - registers an offense and corrects - `collect` without `to_h` - does not register an offense - `map` without `to_h` - does not register an offense - `map` and `map.to_h` with newlines - registers an offense and corrects with newline removal - `map` and `collect.to_h` with newlines - registers an offense and corrects with newline removal - -RuboCop::Formatter::SimpleTextFormatter - #report_file - behaves like report for severity - the file is under the current working directory - prints as relative path - when the offense is not corrected - prints message as-is - when the offense is marked as todo - prints [Todo] along with message - when the offense is correctable - prints message as-is - the file is outside of the current working directory - prints as absolute path - when the offense is automatically corrected - prints [Corrected] along with message - behaves like report for severity - the file is under the current working directory - prints as relative path - when the offense is automatically corrected - prints [Corrected] along with message - when the offense is not corrected - prints message as-is - when the offense is marked as todo - prints [Todo] along with message - the file is outside of the current working directory - prints as absolute path - when the offense is correctable - prints message as-is - behaves like report for severity - the file is outside of the current working directory - prints as absolute path - when the offense is marked as todo - prints [Todo] along with message - when the offense is not corrected - prints message as-is - when the offense is automatically corrected - prints [Corrected] along with message - the file is under the current working directory - prints as relative path - when the offense is correctable - prints message as-is - behaves like report for severity - when the offense is marked as todo - prints [Todo] along with message - when the offense is correctable - prints message as-is - when the offense is automatically corrected - prints [Corrected] along with message - the file is under the current working directory - prints as relative path - when the offense is not corrected - prints message as-is - the file is outside of the current working directory - prints as absolute path - behaves like report for severity - when the offense is not corrected - prints message as-is - when the offense is correctable - prints message as-is - the file is under the current working directory - prints as relative path - when the offense is automatically corrected - prints [Corrected] along with message - the file is outside of the current working directory - prints as absolute path - when the offense is marked as todo - prints [Todo] along with message - behaves like report for severity - the file is under the current working directory - prints as relative path - the file is outside of the current working directory - prints as absolute path - when the offense is correctable - prints message as-is - when the offense is not corrected - prints message as-is - when the offense is automatically corrected - prints [Corrected] along with message - when the offense is marked as todo - prints [Todo] along with message - #report_summary - when a offense detected and a offense autocorrectable - handles pluralization correctly - when 2 offenses detected - handles pluralization correctly - when no files inspected - handles pluralization correctly - when 2 offenses are corrected - handles pluralization correctly - when 2 offenses detected and 2 offenses autocorrectable - handles pluralization correctly - when an offense is corrected - prints about correction - when a file inspected and no offenses detected - handles pluralization correctly - when a offense detected - handles pluralization correctly - when 2 offenses are corrected and 2 offenses autocorrectable - handles pluralization correctly +RuboCop::Cop::Layout::EmptyLinesAroundAttributeAccessor + accepts code that separates an attribute accessor from the code and `rubocop:enable` comment line with a newline + registers an offense and corrects for code that immediately follows accessor with comment + registers an offense and corrects for an attribute accessor and `rubocop:disable` comment line + accepts code that separates an attribute accessor from the code with a newline + registers an offense and corrects for some attribute accessors and comment line + registers an offense and corrects for an attribute accessor and `rubocop:enable` comment line and other comment + accepts code when attribute method is method chained + registers an offense and corrects for code that immediately follows accessor + registers an offense and corrects for an attribute accessor and `rubocop:enable` comment line + accepts code that separates attribute accessors from the code and comment line with a newline + accepts code when used in class definition + registers an offense and corrects for an attribute accessor and comment line + accepts code that separates attribute accessors from the code with a newline + accepts code that where the attr_accessor is the last line + does not register an offense and corrects when using `if` ... `else` branches + registers an offense and corrects for an attribute accessor and some comment line + when `AllowedMethods: private` + does not register an offense for code that immediately ignored methods after accessor + when `AllowedMethods: []` + registers an offense for code that immediately ignored methods after accessor + when `AllowAliasSyntax: true` + does not register an offense for code that immediately `alias` syntax after accessor + when `AllowAliasSyntax: false` + registers an offense for code that immediately `alias` syntax after accessor -RuboCop::Cop::Layout::LineContinuationSpacing - EnforcedStyle: space - ignores heredocs and comments - registers no offense with one space in front of backslash - ignores empty code - registers an offense when no space in front of backslash - registers an offense when too much space in front of backslash - marks the offense correctly when offense is not in first line - ignores when too much space in front of backslash after `__END__` - EnforcedStyle: no_space - marks the offense correctly when offense is not in first line - ignores heredocs and comments - registers no offense with zero spaces in front of backslash - registers an offense when many spaces in front of backslash - registers an offense when one space in front of backslash - ignores when too much space in front of backslash after `__END__` - ignores empty code +RuboCop::Cop::Lint::NumberConversion + AllowedMethods + does not register an offense for an allowed method + registers an offense for other methods + does not register an offense + when `:to_f` is one of multiple method arguments + when using Complex() + when using Float() + when using Integer() with integer + when `#to_i` called without a receiver + AllowedPatterns + does not register an offense for an allowed method + registers an offense for other methods + registers an offense + when using `#to_f` for number literals + when `#to_i` called on a variable + when `#to_i` called on a variable on a array + when using `#to_r` + when using `#to_r` for number literals + when `#to_i` called on a hash value + when using `#to_f` + when `#to_i` called on a variable on a hash + when using `#to_c` for number literals + when using `#to_c` + when using `#to_i` for number literals + when using `#to_i` + to_method in symbol form + registers offense and autocorrects + does not register an offense when using `Float` constructor + does not register an offense when using `Complex` constructor + registers an offense when using nested number conversion methods + registers offense with try + registers offense with send + registers offense and autocorrects without parentheses + does not register an offense when using `Integer` constructor + IgnoredClasses + when using Time/DateTime with multiple method calls + when using DateTime + when using Time -RuboCop::Cop::Style::Semicolon - accepts semicolon after params if so configured - accepts one line empty module definitions - registers an offense for range (`1...42`) with semicolon - registers an offense for range (`1..42`) with semicolon - accepts one line method definitions - accepts one line empty method definitions - accept semicolons inside strings - registers an offense for a single expression - registers an offense for one line method with two statements - accepts one line empty class definitions - registers an offense for several expressions - registers an offense for semicolon at the end no matter what - registers an offense for a semicolon at the beginning of a line - accepts semicolon before end if so configured - with a multi-expression line without a semicolon - does not register an offense - Ruby >= 2.6 - does not register an offense for endless range without semicolon - registers an offense for endless range with semicolon (irange and erange) - registers an offense for endless range with semicolon (irange only) - registers an offense for endless range with semicolon in the method definition - when AllowAsExpressionSeparator is true - accepts one line method with two statements - accepts several expressions +RuboCop::Cop::Lint::SuppressedException + with AllowComments set to true + registers an offense for empty rescue on single line with a comment after it + does not register an offense for empty rescue with comment + Ruby 2.7 or higher + when empty rescue for `do` block with a numbered parameter + registers an offense for empty rescue without comment + does not register an offense for empty rescue with comment + when empty rescue for `def` + does not register an offense for empty rescue with comment + registers an offense for empty rescue without comment + when empty rescue for `defs` + registers an offense for empty rescue without comment + does not register an offense for empty rescue with comment + Ruby 2.5 or higher + when empty rescue for `do` block + registers an offense for empty rescue without comment + does not register an offense for empty rescue with comment + with AllowComments set to false + does not register an offense for rescue with body + registers an offense for empty rescue block + when empty rescue for `def` + registers an offense for empty rescue without comment + registers an offense for empty rescue with comment + with AllowNil set to false + registers an offense for rescue block with nil + registers an offense for inline nil rescue + with AllowNil set to true + does not register an offense for rescue block with nil + does not register an offense for inline nil rescue + Ruby 2.5 or higher + when empty rescue for `do` block + registers an offense for empty rescue with comment + registers an offense for empty rescue without comment + when empty rescue for defs + registers an offense for empty rescue without comment + registers an offense for empty rescue with comment -RuboCop::Cop::Lint::DuplicateMethods - doesn't register an offense for non-duplicate method in class_eval block - registers an offense for duplicate attr in class_eval block - registers an offense for duplicate class methods in class_eval block - accepts for attr_writer and getter in class - registers an offense for duplicate method in dynamic module - registers an offense when class << exp is used - registers an offense for duplicate attr_reader in dynamic class - registers an offense for duplicate alias_method in dynamic module - registers an offense for duplicate class methods in dynamic class - recognizes difference between instance and class methods in module - registers an offense when class << exp is used - understands nested modules - registers an offense for duplicate protected methods in dynamic class - doesn't register an offense for non-duplicate method in dynamic module - handles class_eval with implicit receiver - registers an offense for duplicate nested method in dynamic class - registers an offense for duplicate alias in dynamic module - accepts for attr_writer and getter in dynamic module - registers an offense for a duplicate class method in separate dynamic module blocks - doesn't register offense for non-duplicate class methods in dynamic class - accepts for attr_reader and setter in class_eval block - registers an offense for duplicate attr in class - doesn't register offense for non-duplicate class methods in module - registers an offense for duplicate attr_writer in dynamic class - does not register an offense for same method name defined in different methods - accepts for non-duplicate alias_method in dynamic class - understands nested modules - understands nested modules - recognizes difference between instance and class methods in class_eval block - registers an offense for duplicate class methods in module - registers 2 offenses for pair of duplicate methods in dynamic module - registers an offense for duplicate methods at top level - registers an offense for duplicate alias in class_eval block - does not register an offense for same method name defined in different self methods - registers an offense for duplicate private methods in dynamic class - registers an offense for duplicate nested method in self method of class - ignores method definitions in RSpec `describe` blocks - registers an offense for duplicate attr_writer in class - registers an offense for a duplicate class method in separate class blocks - registers an offense for duplicate alias_method in class_eval block - doesn't register an offense for different private methods in dynamic class - understands class << self - doesn't register an offense for different private methods in class - registers offenses for duplicate assignable attr in class_eval block - doesn't register an offense for non-duplicate alias in dynamic class - registers an offense for duplicate class methods with named receiver in module - does not register an offense for same method name defined in different methods - ignores Class.new blocks which are assigned to local variables - registers an offense for duplicate attr_writer in dynamic module - does not register for the same method in different scopes within `class << self` - accepts for non-duplicate alias_method in dynamic module - registers offenses for duplicate attr_accessor in dynamic class - accepts for attr_reader and setter in class - doesn't register an offense for non-duplicate method in class - understands nested modules - registers an offense for duplicate nested method in class_eval block - registers an offense for duplicate nested method in dynamic module - registers an offense for duplicate private methods in class_eval block - registers an offense for duplicate private self methods in module - registers an offense when class << exp is used - accepts for attr_reader and setter in module - registers an offense for duplicate private self methods in class - registers an offense for duplicate class methods in dynamic module - doesn't register offense for non-duplicate class methods in dynamic module - doesn't register an offense for non-duplicate alias in class_eval block - registers an offense for duplicate private methods in class - registers an offense for a duplicate class method in separate dynamic class blocks - registers 2 offenses for pair of duplicate methods in class_eval block - registers an offense for duplicate alias in dynamic class - properly registers and offense when deeply nested - registers an offense for a duplicate instance method in separate dynamic class blocks - registers an offense for duplicate attr in dynamic class - registers offenses for duplicate attr_accessor in dynamic module - accepts for attr_writer and getter in dynamic class - registers an offense for duplicate alias_method in dynamic class - registers an offense for duplicate alias in class - does not register an offense for same method name defined in different self methods - registers an offense when class << exp is used - doesn't register an offense for different private methods in dynamic module - doesn't register an offense for different private methods in module - registers an offense for duplicate private methods in dynamic module - doesn't register an offense for alias for gvar in dynamic module - does not register an offense for same method name defined in different methods - doesn't register an offense for alias for gvar in class_eval block - understands class << A - registers an offense for duplicate alias_method in module - registers an offense for duplicate alias in module - recognizes difference between instance and class methods in dynamic class - registers an offense for duplicate attr_reader in module - does not register an offense for same method name defined in different self methods - registers an offense for duplicate alias_method in class - understands class << self - registers 2 offenses for pair of duplicate methods in class - registers an offense for duplicate private self methods in dynamic class - registers an offense for duplicate class methods in class - registers an offense for duplicate method in module - recognizes difference between instance and class methods in class - doesn't register an offense for alias for gvar in module - registers offenses for duplicate attr_accessor in class_eval block - registers offenses for duplicate assignable attr in dynamic class - registers offenses for duplicate assignable attr in module - doesn't register an offense for non-duplicate alias in dynamic module - registers offenses for duplicate attr_accessor in class - registers offenses for duplicate assignable attr in dynamic module - registers 2 offenses for pair of duplicate methods in module - registers an offense for duplicate nested method in module - registers an offense for duplicate attr_reader in dynamic module - registers an offense for duplicate attr_writer in module - registers an offense for duplicate protected methods in dynamic module - registers an offense for duplicate nested method in self method of module - does not register an offense for same method name defined in different self methods - does not register an offense for same method name defined in different self methods - doesn't register offense for non-duplicate class methods in class_eval block - understands class << self - only registers an offense for the second instance of a duplicate instance method in separate files - registers an offense for duplicate method in class_eval block - registers 2 offenses for pair of duplicate methods in dynamic class - registers an offense for a duplicate instance method in separate class blocks - accepts for non-duplicate alias_method in class - accepts for non-duplicate alias_method in class_eval block - registers an offense for duplicate nested method in class - doesn't register an offense for non-duplicate alias in module - doesn't register an offense for non-duplicate alias in class - registers an offense for a duplicate instance method in separate class_eval block blocks - doesn't register an offense for non-duplicate method in module - accepts for attr_writer and getter in class_eval block - registers an offense for a duplicate instance method in separate dynamic module blocks - registers an offense for duplicate attr in module - registers an offense for duplicate nested method in self method of class_eval block - doesn't register an offense for non-duplicate method in dynamic class - registers an offense for duplicate method in dynamic class - registers an offense when class << exp is used - registers an offense for duplicate attr_reader in class - registers an offense for duplicate nested method in self method of dynamic class - registers an offense for duplicate protected methods in module - doesn't register an offense for different private methods in class_eval block - understands class << self - registers an offense for duplicate protected methods in class_eval block - understands class << self - accepts for non-duplicate alias_method in module - understands nested modules - recognizes difference between instance and class methods in dynamic module - accepts for attr_reader and setter in dynamic module - only registers an offense for the second instance of a duplicate instance method in separate files - registers an offense for duplicate nested method in self method of dynamic module - does not register an offense for same method name defined in different methods - only registers an offense for the second instance of a duplicate instance method in separate files - only registers an offense for the second instance of a duplicate instance method in separate files - registers an offense for duplicate class methods with `<<` and named receiver in module - registers an offense for duplicate class methods with `self` and named receiver in class - registers an offense for duplicate private self methods in dynamic module - registers an offense for duplicate class methods with named receiver in class - registers an offense for a duplicate class method in separate module blocks - registers an offense for duplicate attr in dynamic module - registers an offense for duplicate private methods in module - accepts for attr_reader and setter in dynamic class - registers an offense for duplicate protected methods in class - doesn't register an offense for alias for gvar in class - accepts for attr_writer and getter in module - registers an offense for a duplicate class method in separate class_eval block blocks - only registers an offense for the second instance of a duplicate instance method in separate files - registers an offense for a duplicate instance method in separate module blocks - registers an offense for duplicate class methods with `self` and named receiver in module - registers an offense for duplicate attr_reader in class_eval block - registers offenses for duplicate assignable attr in class - doesn't register an offense for alias for gvar in dynamic class - registers offenses for duplicate attr_accessor in module - registers an offense for duplicate private self methods in class_eval block - doesn't register offense for non-duplicate class methods in class - registers an offense for duplicate class methods with `<<` and named receiver in class - registers an offense for duplicate method in class - does not register an offense for same method name defined in different methods - registers an offense for duplicate attr_writer in class_eval block - when path is not in the project root - adds a message with absolute path - when path is in the project root - adds a message with relative path +RuboCop::Cop::Lint::EmptyClass + registers an offense for empty class metaclass + registers an offense for empty class + registers an offense for empty object metaclass + does not register an offense when empty has a parent + registers an offense when empty metaclass contains only comments + does not register an offense when class is not empty + does not register an offense when metaclass is not empty + when AllowComments is true + does not register an offense when empty class contains only comments + does not register an offense when empty metaclass contains only comments -RuboCop::Cop::Naming::BlockParameterName - does not register for block without parameters - does not register offense for valid parameter names - registers offense when param with prefix is less than minimum length - registers offense when param is less than minimum length - can register multiple offenses in one block - registers offense when param contains uppercase characters - registers offense when param ends in number - does not register for brace block without parameters - with AllowNamesEndingInNumbers - accept params that end in numbers - with AllowedNames - accepts specified block param names - registers unlisted offensive names - with ForbiddenNames - accepts param that uses a forbidden name's letters - registers offense for param listed as forbidden +RuboCop::Cop::Lint::RescueType + accepts rescuing a single exception + accepts rescue modifier + accepts rescuing nothing + accepts rescuing nothing within a method definition + behaves like offenses + begin rescue + rescuing from 'string' after another exception + registers an offense and autocorrects + rescuing from 'string' before another exception + registers an offense and autocorrects + rescuing from 'string' + registers an offense and autocorrects + def rescue ensure + rescuing from 'string' + registers an offense and autocorrects + def rescue + rescuing from 'string' + registers an offense and autocorrects + begin rescue ensure + rescuing from 'string' + registers an offense and autocorrects + behaves like offenses + begin rescue ensure + rescuing from 0.0 + registers an offense and autocorrects + def rescue + rescuing from 0.0 + registers an offense and autocorrects + def rescue ensure + rescuing from 0.0 + registers an offense and autocorrects + begin rescue + rescuing from 0.0 after another exception + registers an offense and autocorrects + rescuing from 0.0 before another exception + registers an offense and autocorrects + rescuing from 0.0 + registers an offense and autocorrects + behaves like offenses + def rescue ensure + rescuing from "#{string}" + registers an offense and autocorrects + begin rescue + rescuing from "#{string}" after another exception + registers an offense and autocorrects + rescuing from "#{string}" before another exception + registers an offense and autocorrects + rescuing from "#{string}" + registers an offense and autocorrects + def rescue + rescuing from "#{string}" + registers an offense and autocorrects + begin rescue ensure + rescuing from "#{string}" + registers an offense and autocorrects + behaves like offenses + def rescue ensure + rescuing from 0 + registers an offense and autocorrects + begin rescue + rescuing from 0 after another exception + registers an offense and autocorrects + rescuing from 0 + registers an offense and autocorrects + rescuing from 0 before another exception + registers an offense and autocorrects + def rescue + rescuing from 0 + registers an offense and autocorrects + begin rescue ensure + rescuing from 0 + registers an offense and autocorrects + behaves like offenses + def rescue + rescuing from nil + registers an offense and autocorrects + begin rescue + rescuing from nil + registers an offense and autocorrects + rescuing from nil before another exception + registers an offense and autocorrects + rescuing from nil after another exception + registers an offense and autocorrects + def rescue ensure + rescuing from nil + registers an offense and autocorrects + begin rescue ensure + rescuing from nil + registers an offense and autocorrects + behaves like offenses + def rescue + rescuing from :symbol + registers an offense and autocorrects + begin rescue + rescuing from :symbol after another exception + registers an offense and autocorrects + rescuing from :symbol + registers an offense and autocorrects + rescuing from :symbol before another exception + registers an offense and autocorrects + def rescue ensure + rescuing from :symbol + registers an offense and autocorrects + begin rescue ensure + rescuing from :symbol + registers an offense and autocorrects + behaves like offenses + begin rescue + rescuing from [] + registers an offense and autocorrects + rescuing from [] before another exception + registers an offense and autocorrects + rescuing from [] after another exception + registers an offense and autocorrects + def rescue + rescuing from [] + registers an offense and autocorrects + begin rescue ensure + rescuing from [] + registers an offense and autocorrects + def rescue ensure + rescuing from [] + registers an offense and autocorrects + behaves like offenses + def rescue + rescuing from {} + registers an offense and autocorrects + begin rescue ensure + rescuing from {} + registers an offense and autocorrects + begin rescue + rescuing from {} + registers an offense and autocorrects + rescuing from {} before another exception + registers an offense and autocorrects + rescuing from {} after another exception + registers an offense and autocorrects + def rescue ensure + rescuing from {} + registers an offense and autocorrects -RuboCop::Cop::Style::StringConcatenation - correctly handles nested concatenable parts - registers an offense and corrects for string concatenation as part of other expression - correctly handles strings with special characters - does not register an offense when using `+` with all non string arguments - registers an offense and corrects for string concatenation - inline block - registers an offense but does not correct - multiline - string continuation - does not register an offense - if condition - registers an offense but does not correct - multiline block - registers an offense but does not correct - simple expressions - registers an offense and corrects - nested interpolation - registers an offense and corrects - heredoc - registers an offense but does not correct - registers an offense but does not correct when string concatenation with multiline heredoc text - double quotes inside string surrounded single quotes - registers an offense and corrects with double quotes - double quotes inside string - registers an offense and corrects with double quotes - registers an offense and corrects with percentage quotes - empty quotes - registers offense and corrects - Mode = conservative - when first operand is string literal - registers offense - when first operand is not string literal - does not register offense +RuboCop::Cop::Layout::TrailingWhitespace + registers an offense for a blank line with space + registers an offense for a line ending with tab + is not fooled by heredoc containing __END__ within a doc comment + autocorrects unwanted space + registers an offense for trailing whitespace in a heredoc string + registers an offense for a tab in a heredoc + registers offenses before __END__ but not after + registers an offense for a line ending with space + is not fooled by __END__ within a documentation comment + is not fooled by heredoc containing __END__ + accepts a line without trailing whitespace + when `AllowInHeredoc` is set to true + accepts trailing whitespace in a heredoc string + registers an offense for trailing whitespace at the heredoc begin + when `AllowInHeredoc` is set to false + corrects a whitespace line in a heredoc string that is longer than the indentation + corrects by removing trailing whitespace used for indentation in a heredoc string + corrects safely trailing whitespace in a heredoc string + does not correct trailing whitespace in a static heredoc string -RuboCop::Cop::Metrics::ParameterLists - registers an offense when optargs count exceeds the maximum - accepts a lambda with more than 4 parameters - does not register an offense when method has no args - registers an offense for a method def with 5 parameters - does not register an offense when method has allowed amount of optargs - accepts a proc with more than 4 parameters - does not register an offense when method has allowed amount of args with block arg - accepts a method def with 4 parameters - When CountKeywordArgs is true - counts keyword arguments as well - When CountKeywordArgs is false - does not count keyword arguments - does not count keyword arguments without default values +RuboCop::Cop::Lint::RedundantStringCoercion + accepts #to_s with arguments in an interpolation + registers an offense and corrects `to_s` in interpolation + does not explode on empty interpolation + registers an offense and corrects `to_s` in an interpolation with several expressions + accepts interpolation without #to_s + registers an offense and corrects an implicit receiver -RuboCop::Cop::Layout::DotPosition - Leading dots style - registers an offense for correct + opposite - does not err on method call without a method name - registers an offense for trailing dot in multi-line call - does not err on method call on same line - does not err on method call with no dots - registers an offense for only dot line - accepts leading do in multi-line method call - with multiple offenses - registers all of them - when a method spans multiple lines - registers an offense - when using safe navigation operator - accepts leading do in multi-line method call - registers an offense for correct + opposite - when there is an intervening line comment - does not register offense - when the receiver has a heredoc argument - as the first argument - registers an offense - with another method on the same line - does not register an offense - with multiple heredocs - registers an offense - as the last argument - registers an offense - with a dynamic heredoc - registers an offense - when the receiver is a heredoc - registers an offense - when there is an intervening blank line - does not register offense - Trailing dots style - does not err on method call with no dots - registers an offense for leading dot in multi-line call - does not err on method call without a method name - does not err on method call on same line - accepts trailing dot in multi-line method call - does not err on method call with multi-line arguments - does not get confused by several lines of chained methods - when using safe navigation operator - accepts trailing dot in multi-line method call - registers an offense for correct + opposite - when the receiver has a heredoc argument - with a dynamic heredoc - registers an offense - as the first argument - registers an offense - as the last argument - registers an offense - with another method on the same line - does not register an offense - with multiple heredocs - registers an offense - when the receiver is a heredoc - registers an offense - when there is a heredoc with a following method - does not register an offense for a heredoc +RuboCop::Cop::Style::AsciiComments + registers an offense for a comment with non-ascii chars + accepts comments with only ascii chars + registers an offense for comments with mixed chars + when certain non-ascii chars are allowed + registers an offense for comments with non-allowed non-ascii chars + accepts comment with allowed non-ascii chars + +RuboCop::Cop::Layout::SpaceInsideStringInterpolation + when EnforcedStyle is no_space + does not touch spaces inside the interpolated expression + accepts empty interpolation + for ill-formatted string interpolations + finds interpolations in string-like contexts + registers offenses and autocorrects + for well-formatted string interpolations + accepts excess literal spacing + when interpolation starts or ends with a line break + ignores comments and whitespace when looking for line breaks + does not register an offense + for "space" style formatted string interpolations + registers offenses and autocorrects + when EnforcedStyle is space + accepts empty interpolation + for "no_space" style formatted string interpolations + registers offenses and autocorrects + for well-formatted string interpolations + does not register an offense for excess literal spacing + for ill-formatted string interpolations + registers offenses and autocorrects + +RuboCop::Cop::Layout::RedundantLineBreak + when InspectBlocks is true + for an expression that does not fit on a single line + accepts a method call on a multiple lines + with a longer max line length + accepts method call with a do keyword that would just surpass the max line length + accepts a method call followed by binary operations that are too long taken together + accepts an assignment containing a method definition + accepts an assignment containing a heredoc + accepts a complex method call on a multiple lines + registers an offense for a method call with a do keyword that is just under the max line length + for a block + accepts when it is difficult to convert to single line + for an expression that fits on a single line + registers an offense for a method call on multiple lines inside a block + accepts an assignment containing a case expression + registers an offense for a method call with a double and single quoted split string + registers an offense for a method call on multiple lines + registers an offense for a method call with a split operation + registers an offense for a method call as right hand side of an assignment + accepts a method call on multiple lines if there are comments on them + accepts a method call on a single line + accepts an assignment containing a begin-end expression + registers an offense for a method call with a single quoted split string + accepts a binary expression containing an if expression + registers an offense for a method call with a double quoted split string in parentheses + accepts an assignment containing an if expression + registers an offense for a method call with a double quoted split string without parentheses + registers an offense for a method call on multiple lines with backslash + accepts a method call with a block + with LineLength Max 100 + registers an offense for a method without parentheses on multiple lines + method chains + does not register an offense with a heredoc argument + properly corrects a method chain on multiple lines + registers an offense and corrects with a arguments on multiple lines + registers an offense and corrects with a string argument on multiple lines + when Layout/SingleLineBlockChain is enabled + accepts a method call chained onto a single line block + for a block + registers an offense when the method call has parentheses + registers an offense when the method call has no arguments + when Layout/SingleLineBlockChain is disabled + reports an offense for a method call chained onto a multiline block + reports an offense for a multiline block without a chained method call + when Layout/SingleLineBlockChain is enabled + reports an offense for a multiline block without a chained method call + when Layout/SingleLineBlockChain is disabled + reports an offense for a method call chained onto a single line block + when InspectBlocks is false + when Layout/SingleLineBlockChain is enabled + accepts a method call chained onto a single line block + for an expression that does not fit on a single line + accepts a method call on a multiple lines + with a longer max line length + registers an offense for a method call with a do keyword that is just under the max line length + accepts an assignment containing a method definition + accepts a method call followed by binary operations that are too long taken together + accepts a complex method call on a multiple lines + accepts method call with a do keyword that would just surpass the max line length + accepts an assignment containing a heredoc + for a block + accepts when it is difficult to convert to single line + when Layout/SingleLineBlockChain is disabled + reports an offense for a method call chained onto a single line block + for an expression that fits on a single line + accepts an assignment containing a begin-end expression + registers an offense for a method call with a single quoted split string + registers an offense for a method call on multiple lines with backslash + registers an offense for a method call with a double and single quoted split string + accepts an assignment containing an if expression + accepts a method call with a block + registers an offense for a method call on multiple lines + registers an offense for a method call with a double quoted split string in parentheses + accepts a method call on a single line + registers an offense for a method call on multiple lines inside a block + registers an offense for a method call with a double quoted split string without parentheses + accepts a binary expression containing an if expression + accepts a method call on multiple lines if there are comments on them + accepts an assignment containing a case expression + registers an offense for a method call as right hand side of an assignment + registers an offense for a method call with a split operation + with LineLength Max 100 + registers an offense for a method without parentheses on multiple lines + method chains + does not register an offense with a heredoc argument + properly corrects a method chain on multiple lines + registers an offense and corrects with a string argument on multiple lines + registers an offense and corrects with a arguments on multiple lines + for a block + accepts when the method call has parentheses + accepts when the method call has no arguments + when Layout/SingleLineBlockChain is disabled + accepts a multiline block without a chained method call + accepts a method call chained onto a multiline block + when Layout/SingleLineBlockChain is enabled + accepts a multiline block without a chained method call + +RuboCop::Cop::Style::RedundantConditional + registers an offense for if/elsif/else with negated boolean results + does not register an offense for if/else with non-boolean results + allows ternary with non-boolean results + registers an offense for if/elsif/else with boolean results + does not register an offense for if/elsif/else with non-boolean results + registers an offense for if/else with negated boolean results + registers an offense for ternary with boolean results + registers an offense for ternary with negated boolean results + registers an offense for if/else with boolean results RuboCop::Cop::Layout::ArrayAlignment when aligned with first parameter - accepts aligned array keys autocorrects array within array with too much indentation - registers an offense and corrects misaligned array elements - autocorrects misaligned array with the first element on a new row - autocorrects array within array with too little indentation accepts single line array - does not register an offense or try to correct parallel assignment - accepts several elements per line accepts aligned array with fullwidth characters - accepts the first element being on a new row - does not indent heredoc strings when autocorrecting - when aligned with fixed indentation - accepts single line array + does not register an offense or try to correct parallel assignment autocorrects misaligned array with the first element on a new row + accepts aligned array keys + accepts the first element being on a new row + registers an offense and corrects misaligned array elements + autocorrects array within array with too little indentation accepts several elements per line does not indent heredoc strings when autocorrecting - accepts aligned array with fullwidth characters - accepts the first element being on a new row + when aligned with fixed indentation does not register an offense or try to correct parallel assignment - autocorrects array within array with too little indentation - autocorrects array within array with too much indentation + accepts the first element being on a new row accepts aligned array keys + accepts aligned array with fullwidth characters + accepts single line array + autocorrects array within array with too much indentation + autocorrects array within array with too little indentation + does not indent heredoc strings when autocorrecting + accepts several elements per line registers an offense and corrects misaligned array elements + autocorrects misaligned array with the first element on a new row -RuboCop::Formatter::ProgressFormatter +RuboCop::Cop::Lint::EmptyConditionalBody + registers an offense for missing `if` body with `elsif` + registers an offense for missing `unless` body + does not register an offense for missing `unless` body with a comment + registers an offense for missing `if` and `elsif` body + registers an offense for missing all branches of `if` and `elsif` body + does not register an offense for missing `elsif` body with an inline comment + registers an offense for missing `elsif` body that is not the one with a comment + registers an offense for missing `if` and `else` body + registers an offense for missing `unless` and `else` body + registers an offense for missing `if` and `else` body with some indentation + registers an offense for missing `elsif` body + registers an offense for missing second `elsif` body without an inline comment + registers an offense for missing `if` body with present `else` body + registers an offense for missing all branches of `if` and multiple `elsif` body + registers an offense for missing `if` body with `else` + autocorrects properly when the if is assigned to a variable + does not register an offense for missing `if` body with a comment + does not register an offense for missing `elsif` body with a comment + registers an offense for missing `if` body + registers an offense for missing `unless` body with `else` + when AllowComments is false + registers an offense for missing `elsif` body with a comment + registers an offense for missing `if` body with a comment + registers an offense for missing `unless` body with a comment + +RuboCop::Cop::Lint::RedundantDirGlobSort + does not register an offense when not using `sort` for `Dir` + does not register an offense when using `sort` without a receiver + when Ruby 3.0 or higher + does not register an offense when using `Dir[*path].sort` + registers an offense and correction when using `Dir.glob.sort` + does not register an offense when using `Dir.glob(*path).sort` + does not register an offense when using `Dir['./b/*.txt', './a/*.txt'].sort` + does not register an offense when using `collection.sort` + registers an offense and correction when using `::Dir.glob.sort` + registers an offense and correction when using `Dir[].sort.each do` + does not register an offense when using `Dir.glob('./b/*.txt', './a/*.txt').sort` + registers an offense and correction when using `Dir[].sort.each(&do_something)` + does not register an offense when not using `sort` with `sort: false` option for `Dir` + when Ruby 2.7 or lower + does not register an offense and correction when using `::Dir.glob.sort` + does not register an offense and correction when using `Dir[].sort.each do` + does not register an offense and correction when using `Dir[].sort.each(&do_something)` + does not register an offense and correction when using `Dir.glob.sort` + +RuboCop::Cop::Naming::BinaryOperatorParameterName + does not register an offense for arg named _other + registers an offense and corrects for `#+` when argument is not named other + registers an offense and corrects for `#eql?` when argument is not named other + registers an offense and corrects when argument is referenced in method body + does not register an offense for []= + does not register an offense for === + does not register an offense for arg named other + registers an offense and corrects for `#equal?` when argument is not named other + does not register an offense for [] + works properly even if the argument not surrounded with braces + does not register an offense for non binary operators + registers an offense and corrects when assigned to argument in method body + does not register an offense for the match operator + does not register an offense for << + does not register an offense for multibyte character method name + +RuboCop::Cop::Style::Next + allows super nodes + does not blow up on empty body until block + does not crash with empty brackets + keeps comments when autocorrecting + allows empty blocks + handles `then` when autocorrecting + doesn't reindent heredoc bodies when autocorrecting + allows loops with conditions at the end with ternary op + does not blow up on empty body while block + handles nested autocorrections + does not crash with an empty body branch + does not blow up on empty body for block + behaves like iterators + registers an offense for if inside of each + registers an offense for if inside of times + allows loops with conditional return + registers an offense for if inside of select! + registers an offense for if inside of nested iterators + allows loops with if with else, nested in another condition + allows loops with if with else at the end + registers an offense for if inside of map + registers an offense when line break before condition + allows loops with conditional break + registers an offense for if inside of nested iterators + registers an offense for if inside of reject! + registers an offense for if inside of reject + registers an offense for if inside of collect + registers an offense for if inside of downto + autocorrects a misaligned end + reports an offense for if whose body has 3 lines + registers an offense for a condition at the end of an iterator when there is more in the iterator than the condition + registers an offense for if inside of for + registers an offense for if inside of each_with_object + allows loops with if being the entire body with else + registers an offense for if inside of loop + registers an offense for if inside of select + Ruby 2.7 + registers an offense for if inside of downto numblock + EnforcedStyle: skip_modifier_ifs + allows modifier if + EnforcedStyle: always + registers an offense for modifier if + behaves like iterators + registers an offense for unless inside of each + allows loops with unless with else at the end + registers an offense for unless inside of reject + registers an offense for unless inside of map + registers an offense for unless inside of for + registers an offense for unless inside of nested iterators + registers an offense for unless inside of select + registers an offense for unless inside of reject! + registers an offense for a condition at the end of an iterator when there is more in the iterator than the condition + allows loops with conditional return + registers an offense for unless inside of nested iterators + registers an offense for unless inside of times + reports an offense for unless whose body has 3 lines + allows loops with unless being the entire body with else + autocorrects a misaligned end + registers an offense when line break before condition + registers an offense for unless inside of collect + registers an offense for unless inside of select! + allows loops with unless with else, nested in another condition + registers an offense for unless inside of downto + registers an offense for unless inside of each_with_object + allows loops with conditional break + registers an offense for unless inside of loop + Ruby 2.7 + registers an offense for unless inside of downto numblock + EnforcedStyle: skip_modifier_ifs + allows modifier unless + EnforcedStyle: always + registers an offense for modifier unless + Invalid MinBodyLength + fails with an error + MinBodyLength: 3 + accepts if whose body has 1 line + +RuboCop::Cop::MessageAnnotator + with style guide url + when a base URL is specified + can accept relative paths if base has a full path + can use a path-based setting + combines correctly with a target-based setting + does not specify a URL if a cop does not have one + allows absolute URLs in the cop config + when a nested department is specified + returns style guide url when it is specified + when a department other than AllCops is specified + returns style guide url when it is specified + when StyleGuide is set in the config + adds style guide url + when StyleGuide is not set in the config + does not add style guide url + #annotate + with default options + returns the message + when the output format is JSON + returns the message unannotated + with options on + returns an annotated message + #urls + returns an empty array without StyleGuide URL + returns style guide url when it is specified + returns reference url when it is specified + returns multiple reference urls + returns style guide and reference url when they are specified + returns an empty array if the reference url is blank + +RuboCop::Cop::Layout::MultilineArrayBraceLayout + ignores implicit arrays + ignores empty arrays + ignores single-line arrays + behaves like multiline literal brace layout trailing comma + symmetrical style + opening brace on same line as first element + last element has a trailing comma + autocorrects closing brace on different line from last element + same_line style + opening brace on same line as first element + last element has a trailing comma + autocorrects closing brace on different line as last element + when comment present before closing brace + corrects closing brace without crashing + behaves like multiline literal brace layout + heredoc + ignores heredocs that could share a last line + detects heredoc structures that are safe to add to + symmetrical style + opening brace on same line as first element + autocorrects closing brace on different line from last element + detects closing brace on different line from last element + allows closing brace on same line as last element + allows closing brace on same line as last multiline element + with a chained call on the closing brace + but no comment after the last element + autocorrects the closing brace + and a comment after the last element + detects closing brace on separate line from last elementbut does not autocorrect the closing brace + opening brace on separate line from first element + allows closing brace on separate line from last element + detects closing brace on same line as last element + allows closing brace on separate line from last multiline element + new_line style + opening brace on same line as first element + autocorrects closing brace on same line as last element + detects closing brace on same line as last multiline element + allows closing brace on different line from multi-line element + allows closing brace on different line from last element + opening brace on separate line from first element + allows closing brace on separate line from last element + allows closing brace on separate line from last multiline element + detects closing brace on same line as last element + same_line style + opening brace on separate line from first element + allows closing brace on same line as last multiline element + allows closing brace on same line as last element + detects closing brace on different line from last element + opening brace on same line as first element + detects closing brace on different line from multiline element + autocorrects closing brace on different line as last element + allows closing brace on same line from last element + allows closing brace on same line as multi-line element + with a chained call on the closing brace + and a comment after the last element + detects closing brace on separate line from last elementbut does not autocorrect the closing brace + but no comment after the last element + autocorrects the closing brace + behaves like multiline literal brace layout method argument + when arguments to a method + and a comment after the last element + detects closing brace on separate line from last element + but no comment after the last element + autocorrects the closing brace + +RuboCop::Cop::Style::TrailingUnderscoreVariable + configured to not allow named underscore variables + registers an offense when multiple underscores are used as the last variables of parallel assignment + does not register an offense for an underscore preceded by a splat variable anywhere in the argument chain + does not register an offense for an underscore preceded by a splat variable + registers an offense for multiple underscore variables preceded by a splat underscore variable + does not register an offense for an underscore preceded by a splat variable and another underscore + registers an offense when the last variable of parallel assignment is an underscore + registers an offense for nested assignments with trailing underscores + does not register an offense for nested assignments without trailing underscores + does not register an offense for a named underscore variable preceded by a splat variable + does not register an offense for complex nested assignments without trailing underscores + registers an offense for a named splat underscore as the last variable + registers an offense for an underscore as the last param when there is also an underscore as the first param + does not register an offense for multiple named underscores preceded by a splat variable + does not register an offense for underscores at the beginning + does not register an offense for a named underscore preceded by a splat variable + registers an offense for complex nested assignments with trailing underscores + registers an offense for named variables that start with an underscore + does not register an offense for multiple underscores preceded by a splat variable + registers an offense for an underscore preceded by a named splat underscore + registers an offense for splat underscore as the last variable + registers an offense for an underscore variable preceded by a named splat underscore variable + does not register an offense when there are no underscores + registers an offense for multiple underscore variables preceded by a named splat underscore variable + registers an offense when underscore is the only variable in parallel assignment + does not register an offense for a named variable preceded by a names splat underscore variable + registers an offense when underscore is the second to last variable and blank is the last variable + autocorrect + with parentheses + removes assignment part when every assignment is to `_` + leaves parentheses but removes trailing underscores + leaves parentheses but removes trailing underscores and commas + removes assignment part when it is the only variable + configured to allow named underscore variables + does not register an offense for named variables that start with an underscore + does not register an offense for nested assignments without trailing underscores + does not register an offense for a named splat underscore as the last variable + does not register an offense for multiple underscore variables preceded by a named splat underscore variable + does not register an offense for a named variable preceded by a names splat underscore variable + does not register an offense for multiple named underscores preceded by a splat variable + registers an offense for nested assignments with trailing underscores + does not register an offense for an underscore variable preceded by a named splat underscore variable + registers an offense for splat underscore as the last variable + registers an offense for complex nested assignments with trailing underscores + does not register an offense for an underscore preceded by a splat variable anywhere in the argument chain + registers an offense for an underscore as the last param when there is also an underscore as the first param + registers an offense when multiple underscores are used as the last variables of parallel assignment + registers an offense for multiple underscore variables preceded by a splat underscore variable + registers an offense when the last variable of parallel assignment is an underscore + registers an offense when underscore is the second to last variable and blank is the last variable + does not register an offense for complex nested assignments without trailing underscores + does not register an offense for underscores at the beginning + does not register an offense for an underscore preceded by a splat variable and another underscore + does not register an offense for an underscore preceded by a splat variable + does not register an offense for multiple underscores preceded by a splat variable + registers an offense when underscore is the only variable in parallel assignment + does not register an offense when there are no underscores + does not register an offense for a named underscore variable preceded by a splat variable + autocorrect + with parentheses + leaves parentheses but removes trailing underscores and commas + leaves parentheses but removes trailing underscores + removes assignment part when every assignment is to `_` + removes assignment part when it is the only variable + +RuboCop::Cop::Bundler::InsecureProtocolSource + registers an offense when using `source :rubygems` + does not register an offense when using `source 'https://rubygems.org'` + registers an offense when using `source :rubyforge` + registers an offense when using `source :gemcutter` + when `AllowHttpProtocol: true` + does not register an offense when using `source 'http://rubygems.org'` + when `AllowHttpProtocol: false` + registers an offense when using `source 'http://rubygems.org'` + +RuboCop::Cop::Lint::SelfAssignment + registers an offense when using local var self-assignment + registers an offense when using multiple var self-assignment through array + registers an offense when using class var self-assignment + does not register an offense when using shorthand-or var assignment + does not register an offense when using local var assignment + does not register an offense when using shorthand-and var assignment + does not register an offense when using constant var assignment for constant from another scope + does not register an offense when using multiple var assignment through method call + registers an offense when using global var self-assignment + does not register an offense when using global var assignment + does not register an offense when using constant var or-assignment for constant from another scope + registers an offense when using shorthand-or var self-assignment + registers an offense when using constant var self-assignment + registers an offense when using instance var self-assignment + does not register an offense when using class var assignment + does not register an offense when using multiple var assignment through splat + registers an offense when using multiple var self-assignment + registers an offense when using shorthand-and var self-assignment + does not register an offense when using multiple var assignment + does not register an offense when using instance var assignment + +RuboCop::Cop::Layout::FirstArrayElementLineBreak + ignores elements listed on a single line + ignores properly formatted implicit arrays + elements listed on the first line + registers and corrects the offense + masgn implicit arrays + registers and corrects the offense + word arrays + registers and corrects the offense + array nested in a method call + registers an corrects the offense + send implicit arrays + registers and corrects the offense + +RuboCop::Cop::Style::StringMethods + registers an offense + when using safe navigation operator + registers an offense + +RuboCop::Cop::Naming::VariableNumber + when configured for normal + registers an offense for snake case numbering in a global variable name + registers an offense for snake case numbering in symbol + registers an offense for snake case numbering in method parameter + registers an offense for snake case numbering in method name + registers an offense for snake case numbering in method camel case parameter + does not register an offense for normal case numbering in symbol + behaves like offense + registers an offense for myAttribute_1 in normalcase + behaves like accepts + accepts emparejó in normalcase + behaves like accepts + accepts sha256 in normalcase + behaves like offense + registers an offense for @myAttribute_1 in normalcase + behaves like accepts + accepts local_ in normalcase + behaves like accepts + accepts local1 in normalcase + behaves like accepts + accepts _ in normalcase + behaves like accepts + accepts @__foo__ in normalcase + behaves like accepts + accepts _1 in normalcase + behaves like accepts + accepts user1_id in normalcase + behaves like offense_array + registers an offense for ["a_1", "a2"] in normalcase + behaves like accepts + accepts snake_case in normalcase + behaves like accepts + accepts localFOO1 in normalcase + behaves like accepts + accepts user_1_id in normalcase + behaves like accepts integer symbols + accepts integer symbol array literal + accepts integer symbol + behaves like offense + registers an offense for local_1 in normalcase + behaves like offense + registers an offense for sha_256 in normalcase + behaves like offense + registers an offense for @@local_1 in normalcase + behaves like offense + registers an offense for local_FOO_1 in normalcase + behaves like accepts + accepts foo10_bar in normalcase + behaves like offense + registers an offense for @local_1 in normalcase + behaves like offense + registers an offense for _myLocal_1 in normalcase + behaves like offense + registers an offense for localFOO_1 in normalcase + behaves like accepts + accepts target_u2f_device in normalcase + behaves like accepts + accepts _foo in normalcase + behaves like accepts + accepts @foo in normalcase + when CheckMethodNames is false + does not register an offense for snake case numbering in method name + when AllowedIdentifiers is set + does not register an offense for a global variable name that is allowed + does not register an offense for a symbol that is allowed + does not register an offense for a method name that is allowed + does not register an offense for a local variable name that is allowed + does not register an offense for a instance variable name that is allowed + does not register an offense for a class variable name that is allowed + when configured for non integer + registers an offense for snake case numbering in symbol + registers an offense for snake case numbering in method parameter + registers an offense for snake case numbering in method camel case parameter + registers an offense for normal case numbering in method name + registers an offense for normal case numbering in method parameter + registers an offense for snake case numbering in method name + registers an offense for normal case numbering in method camel case parameter + registers an offense for normal case numbering in symbol + behaves like accepts + accepts localone in non_integer + behaves like accepts + accepts _foo in non_integer + behaves like accepts + accepts local_one in non_integer + behaves like accepts + accepts @__foo__ in non_integer + behaves like accepts + accepts emparejó in non_integer + behaves like offense + registers an offense for _myLocal_1 in non_integer + behaves like offense + registers an offense for myAttribute_1 in non_integer + behaves like accepts integer symbols + accepts integer symbol + accepts integer symbol array literal + behaves like offense + registers an offense for @myAttribute_1 in non_integer + behaves like accepts + accepts @@foo in non_integer + behaves like offense + registers an offense for @myAttribute1 in non_integer + behaves like accepts + accepts _ in non_integer + behaves like accepts + accepts local_ in non_integer + behaves like offense + registers an offense for @local_1 in non_integer + behaves like offense + registers an offense for myAttribute1 in non_integer + behaves like accepts + accepts @foo in non_integer + behaves like accepts + accepts fooBar in non_integer + behaves like offense + registers an offense for @local1 in non_integer + behaves like offense_array + registers an offense for ["a_1", "aone"] in non_integer + behaves like offense + registers an offense for local1 in non_integer + behaves like accepts + accepts _1 in non_integer + behaves like offense + registers an offense for _myLocal1 in non_integer + behaves like offense + registers an offense for local_1 in non_integer + when AllowedPatterns is set + registers an offense for a local variable name that does not match an allowed pattern + registers an offense for a symbol that does not match an allowed pattern + does not register an offense for a local variable name that matches an allowed pattern + does not register an offense for a symbol that matches an allowed pattern + registers an offense for a method name that does not match an allowed pattern + registers an offense for a class variable name that does not match an allowed pattern + registers an offense for a instance variable name that does not match an allowed pattern + does not register an offense for a instance variable name that matches an allowed pattern + does not register an offense for a global variable name that matches an allowed pattern + does not register an offense for a class variable name that matches an allowed pattern + registers an offense for a global variable name that does not match an allowed pattern + does not register an offense for a method name that matches an allowed pattern + when CheckSymbols is false + does not register an offense for snake case numbering in symbol + when configured for snake_case + registers an offense for normal case numbering in a global variable name + registers an offense for normal case numbering in method name + does not register an offense for snake case numbering in symbol + registers an offense for normal case numbering in method camel case parameter + registers an offense for normal case numbering in symbol + registers an offense for normal case numbering in method parameter + behaves like accepts + accepts a_1_b in snake_case + behaves like accepts + accepts local_1 in snake_case + behaves like offense + registers an offense for @local1 in snake_case + behaves like offense + registers an offense for local1 in snake_case + behaves like accepts + accepts aB_1 in snake_case + behaves like offense + registers an offense for aB1 in snake_case + behaves like offense + registers an offense for @camelCase1 in snake_case + behaves like offense_array + registers an offense for ["a1", "a_2"] in snake_case + behaves like accepts + accepts _1 in snake_case + behaves like offense + registers an offense for _unused1 in snake_case + behaves like accepts + accepts _foo in snake_case + behaves like accepts + accepts local_12 in snake_case + behaves like offense + registers an offense for camelCase1 in snake_case + behaves like accepts + accepts emparejó in snake_case + behaves like accepts integer symbols + accepts integer symbol array literal + accepts integer symbol + behaves like accepts + accepts a_1_b_1 in snake_case + behaves like accepts + accepts _ in snake_case + behaves like accepts + accepts local_ in snake_case + behaves like accepts + accepts local_123 in snake_case + behaves like accepts + accepts @foo in snake_case + behaves like offense + registers an offense for @@local1 in snake_case + behaves like accepts + accepts @__foo__ in snake_case + +RuboCop::Cop::Lint::ElseLayout + registers an offense and corrects for elsifs + registers an offense and corrects for the entire else body being on the same line + accepts ternary ops + accepts empty braces + registers an offense and corrects for expr on same line as else + does not register an offense for an elsif with no body + registers and corrects an offense when using multiple `elsif`s + does not register an offense if the entire if is on a single line + accepts modifier forms + accepts proper else + +RuboCop::Cop::Style::RedundantInitialize + registers and corrects an offense for an `initialize` method with arguments that only calls `super` + does not register an offense for an empty `initialize` method with a kwsplat` + does not register an offense for an empty method not named `initialize` + does not register an offense for an `initialize` method with a default argument that calls `super` + does not register an offense for an `initialize` method that calls `super` with a different argument list + does not register an offense for an `initialize` method that calls `super` with no arguments + does not register an offense for an `initialize` method that calls another method before `super` + does not register an offense for an empty `initialize` method with a splat` + registers and corrects an offense for an `initialize` method that only calls `super` + registers and corrects an offense for an empty `initialize` method + does not register an offense for an `initialize` method that calls another method + does not register an offense for an empty `initialize` method with a argument forwarding` + registers an offense for an `initialize` method with a default keyword argument that does nothing + does not register an offense for an `initialize` method with only a comment + registers and corrects an offense for an `initialize` method with no arguments that calls `super` with no arguments + does not register an offense for a method not named `initialize` that only calls super + does not register an offense for an empty `initialize` method with a splat` and super + registers and corrects an offense for an `initialize` method with arguments that only calls `super` with explicit args + does not register an offense for an `initialize` method that calls another method after `super` + does not register an offense for an `initialize` method with a default keyword argument that calls `super` + registers an offense for an `initialize` method with a default argument that does nothing + when `AllowComments: false` + registers and corrects an offense for an `initialize` method with only a comment + +RuboCop::Cop::Layout::DefEndAlignment + when EnforcedStyleAlignWith is def + accepts matching foo def ... end + accepts matching defs ... end + registers an offense for mismatched def Test.test end and autocorrects + registers an offense for mismatched def test end and autocorrects + accepts matching def ... end + registers an offense for mismatched foo def test end and autocorrects + correct + opposite + registers an offense + when EnforcedStyleAlignWith is start_of_line + accepts matching defs ... end + accepts matching def ... end + accepts matching foo def ... end + registers an offense for mismatched foo def test end and autocorrects + registers an offense for mismatched def Test.test end and autocorrects + accepts matching def ... end + registers an offense for mismatched def test end and autocorrects + accepts matching foo bar def ... end + when using refinements and `private def` + does not register an offense + when including an anonymous module containing `private def` + does not register an offense + correct + opposite + registers an offense + +RuboCop::Cop::Lint::RedundantWithObject + an object is used as a block argument + registers an offense and corrects when using ary.each_with_object([]) do-end block + registers an offense and corrects when using `ary.each.with_object([]) { |v| v }` + registers an offense and corrects when using `ary.each_with_object { |v| v }` + registers an offense and corrects when using ary.each_with_object do-end block without parentheses + when missing argument to `each_with_object` + does not register an offense when block has 1 argument + does not register an offense when block has 2 arguments + Ruby 2.7 + registers an offense and corrects when using `ary.each_with_object { _1 }` + registers an offense and corrects when using `ary.each.with_object([]) { _1 }` + +RuboCop::Cop::VariableForce::Scope + #body_node + when the scope is block + returns the body node + when the scope is singleton class + returns the body node + when the scope is module + returns the body node + when the scope is top level + returns the body node + when the scope is instance method + returns the body node + when the scope is singleton method + returns the body node + when the scope is class + returns the body node + #each_node + inner scope boundary handling + when there's a method invocation with block + yields only the block node and the child send node + when there's a singleton method definition + yields only the defs node and the method host node + outer scope boundary handling + when the scope is module + yields the body nodes + when the scope is instance method + yields the argument and the body nodes + when the scope is top level + yields the body nodes + when the scope is singleton class + yields the body nodes + when the scope is block + yields the argument and the body nodes + when the scope is class + yields the body nodes + when the scope is singleton method + yields the argument and the body nodes + #include? + with child node the scope includes + is expected to equal true + with descendant node the scope does not include + is expected to equal false + with node of the scope itself + is expected to equal false + with ancestor node the scope does not include + is expected to equal false + with child node the scope does not include + is expected to equal false + .new + when begin node is passed + accepts that as top level scope + when lvasgn node is passed + accepts that as top level scope + #name + when the scope is instance method definition + returns the method name + when the scope is singleton method definition + returns the method name + +RuboCop::Cop::Naming::BlockParameterName + registers offense when param with prefix is less than minimum length + registers offense when param ends in number + does not register for brace block without parameters + does not register for block without parameters + registers offense when param contains uppercase characters + can register multiple offenses in one block + registers offense when param is less than minimum length + does not register offense for valid parameter names + with ForbiddenNames + registers offense for param listed as forbidden + accepts param that uses a forbidden name's letters + with AllowNamesEndingInNumbers + accept params that end in numbers + with AllowedNames + accepts specified block param names + registers unlisted offensive names + +RuboCop::Cop::Gemspec::RubyVersionGlobalsUsage + registers an offense when using `::RUBY_VERSION` + registers an offense when using `RUBY_VERSION` + does not register an offense when no `RUBY_VERSION` + +RuboCop::Formatter::AutoGenConfigFormatter #finished calls #report_summary when no offenses are detected does not report offenses when any offenses are detected - reports all detected offenses for all failed files + outputs report summary + does not report offenses #report_file_as_mark - when no offenses are detected - prints "." + when different severity offenses are detected + prints highest level mark when a refactor severity offense is detected prints "R" + when no offenses are detected + prints "." when a refactor convention offense is detected prints "C" - when different severity offenses are detected - prints highest level mark - #file_finished - when no offenses are detected - calls #report_as_with_mark - when any offenses are detected - calls #report_as_with_mark - -RuboCop::Cop::Lint::NonDeterministicRequireOrder - when not requiring files - does not register an offense - when requiring files - when Ruby 3.0 or higher - with `Dir.glob` - does not register an offense - with require block passed as parameter - does not register an offense - with top-level ::Dir - does not register an offense - with `sort: false` keyword option - does not register an offense - with `Dir[]` - does not register an offense - with extra logic - does not register an offense - with top-level ::Dir - does not register an offense - with require block passed as parameter - does not register an offense - with direct block glob - does not register an offense - with top-level ::Dir - does not register an offense - with require block passed as parameter - does not register an offense - with sorted index - does not register an offense - when Ruby 2.7 or lower - with unsorted index - registers an offense with extra logic - registers an offense and autocorrects to add .sort when the numblock has `require` - registers an offense and autocorrects to add .sort when the block has `require` - registers an offense and autocorrects to add .sort when the block has `require_relative` - with top-level ::Dir - registers an offense and corrects to add .sort - with require block passed as parameter - registers an offense an autocorrects to add sort - with require_relative block passed as parameter - registers an offense an autocorrects to add sort - with direct block glob - registers an offense and autocorrects to add .sort.each - with top-level ::Dir - registers an offense and corrects to add .sort.each - with require block passed as parameter - registers an offense and autocorrects to add sort - with require_relative block passed as parameter - registers an offense and autocorrects to add sort - with unsorted glob - registers an offense and autocorrects to add .sort - with top-level ::Dir - registers an offense and corrects to add .sort - with require block passed as parameter - registers an offense an autocorrects to add sort - with sorted glob - does not register an offense -RuboCop::Formatter::GitHubActionsFormatter - #finished - when offenses are detected - reports offenses as errors - when fail level is defined - reports offenses above or at fail level as errors - reports offenses below fail level as warnings - when message contains % - escapes message - when file is relative to the current directory - reports offenses as error with the relative path - when no offenses are detected - does not print anything +RuboCop::Cop::Style::ExplicitBlockArgument + registers an offense and corrects when multiple arguments are yielded + correctly corrects when method already has an explicit block argument + does not register an offense when arguments are yielded in a different order + registers an offense and corrects when `yield` is inside block of `super` + registers an offense and corrects when block just yields its arguments + does not register an offense when `yield` is not inside block + registers an offense and corrects when method contains multiple `yield`s + does not register an offense when `yield` arguments is not a prefix of block arguments + does not register an offense when code is called outside of a method + does not register an offense when `yield` is the sole block body + adds to the existing arguments when correcting + registers an offense and corrects when `yield` inside block has no arguments + does not add extra parens when correcting + correctly corrects when using safe navigation method call + correctly corrects when the method call has a trailing comma in its argument list + does not add extra parens to `super` when correcting + does not register an offense when there is more than one block argument and not all are yielded RuboCop::Cop::Lint::InheritException when class inherits from `Exception` - with enforced style set to `standard_error` + with enforced style set to `runtime_error` registers an offense and corrects when creating a subclass using Class.new registers an offense and corrects when inheriting a standard lib exception class that is not a subclass of `StandardError` does not register an offense - with enforced style set to `runtime_error` + with enforced style set to `standard_error` registers an offense and corrects - when creating a subclass using Class.new - registers an offense and corrects when inheriting a standard lib exception class that is not a subclass of `StandardError` does not register an offense + when creating a subclass using Class.new + registers an offense and corrects -RuboCop::Cop::Layout::EmptyComment - registers an offense and corrects using an empty comment next to code - does not register an offense when using comment text - registers an offense and corrects an empty comment without space next to code - registers an offense and corrects using single line empty comment - register offenses and correct multiple empty comments next to code - does not register an offense when using comment text with leading and trailing blank lines - registers an offense and corrects using multiline empty comments - register offenses and correct multiple aligned empty comments next to code - disallow margin comment - registers an offense and corrects using margin comment - allow margin comment (default) - does not register an offense when using margin comment - disallow border comment - registers an offense and corrects using border comment - registers an offense and corrects using single line empty comment - allow border comment (default) - does not register an offense when using border comment +RuboCop::Cop::InternalAffairs::NodeDestructuring + does not register an offense when receiver is named `array` + registers an offense when destructuring using a splat + when destructuring using `node.children` + registers an offense when receiver is named `send_node` + registers an offense when receiver is named `node` -RuboCop::Cop::Style::DisableCopsWithinSourceCodeDirective - registers an offense for disabling all cops - registers an offense for disabled cop within source code - registers an offense for enabled cop within source code - with AllowedCops - when using leading source comment +RuboCop::Cop::Style::CommentAnnotation + with default RequireColon configuration (colon + space) + accepts a keyword that is somewhere in a sentence + accepts upper case keyword with colon, space and note + accepts a keyword that is just the beginning of a sentence + accepts a comment that is obviously a code example + accepts upper case keyword alone + missing space after colon + registers an offense and adds space + upper case keyword with space but no note + registers an offense without autocorrection + lower case keyword + registers an offense and upcases + offenses in consecutive inline comments + registers each of them + with multiword keywords + registers an offense for each matching keyword + when a keyword is not in the configuration + accepts the word without colon + with configured keyword + registers an offense for a missing colon after the word + multiline comment + only registers an offense on the first line + missing colon + registers an offense and adds colon + upper case keyword with colon but no note + registers an offense without autocorrection + capitalized keyword + registers an offense and upcases + with RequireColon configuration set to false + accepts a comment that is obviously a code example + accepts a keyword that is just the beginning of a sentence + accepts upper case keyword with colon, space and note + accepts a keyword that is somewhere in a sentence + accepts upper case keyword alone + with configured keyword + registers an offense for containing a colon after the word + lower case keyword + registers an offense and upcases + with colon + registers an offense and removes colon + when a keyword is not in the configuration + accepts the word with colon + upper case keyword with colon but no note + registers an offense without autocorrection + upper case keyword with space but no note + registers an offense without autocorrection + offenses in consecutive inline comments + registers each of them + multiline comment + only registers an offense on the first line + +RuboCop::Cop::Layout::LineLength + accepts the first line if it is a shebang line + accepts a line that's 80 characters wide + highlights excessive characters + registers an offense for a line that's 81 characters wide + registers an offense for long line before __END__ but not after + affecting by IndentationWidth from Layout\Tab + with AllowURI option + accepts a line that's including URI with text + accepts a line that's including URI + accepts a line that's including URI in quotes with text + accepts a line that's including URI and exceeds by 1 char + behaves like with tabs indentation + registers an offense for a line that's including 2 tab with size 2 and 28 other characters + accepts a line that's including 1 tab with size 2 and 28 other characters + without AllowURI option + behaves like with tabs indentation + accepts a line that's including 1 tab with size 2 and 28 other characters + registers an offense for a line that's including 2 tab with size 2 and 28 other characters + when IgnoreCopDirectives is disabled + and the source is too long and has a trailing cop directive + highlights the excess source and cop directive + and the source is acceptable length + with a trailing RuboCop directive + registers an offense for the line + with an inline comment + highlights the excess comment + when AllowedPatterns option is set + only registers an offense for lines not matching the pattern + when AllowURI option is enabled + and the URL fits within the max allowed characters + registers an offense for the line + and the excessive characters include part of a URL in braces and another word + registers an offense for the line + and the excessive characters include part of a URL in double quotes + does not include the quote as part of the offense + and the URL does not have a http(s) scheme + rejects the line + and the scheme has been configured + does not register an offense + and the excessive characters include part of a URL and trailing whitespace + registers an offense for the line + and the URI is assigned does not register an offense - when an mix of cops are disabled - registers an offense and corrects - when an allowed cop is disabled + and all the excessive characters are part of a URL + accepts the line + and the URL is wrapped in single quotes + accepts the line + and the URL is wrapped in braces with title + accepts the line + and the URL is wrapped in braces + accepts the line + and the URL is wrapped in double quotes + accepts the line + and the excessive characters include a complete URL + registers an offense for the line + and an error other than URI::InvalidURIError is raised while validating a URI-ish string + does not crash + and the URI is an argument does not register an offense - when an non-allowed cop is disabled - registers an offense and corrects + and the excessive characters include part of a URL and another word + registers an offense for the line + when AllowHeredoc option is enabled + accepts long lines in heredocs + and only certain heredoc delimiters are permitted + rejects long lines in heredocs with not permitted delimiters + when the source has no AST + does not crash + when IgnoreCopDirectives is enabled + and the Rubocop directive is excessively long + accepts the line + and the source is too long + highlights only the non-directive part + and the source contains non-directive # as comment + highlights only the non-directive part + and the source contains non-directive #s as non-comment + registers an offense for the line + and the Rubocop directive causes an excessive line length + accepts the line + and has explanatory text + does not register an offense + when line is indented with tabs + accepts a short line + registers an offense for a long line + autocorrection + array + when two arrays on two lines allows outer to get broken first + adds an offense only to inner and does not autocorrect it + when already on two lines + does not add any offenses + when under limit + does not add any offenses + when over limit + adds an offense and autocorrects it + when has inside array + adds an offense only to outer and autocorrects it + hash + when over limit and already on multiple lines long key + adds an offense and does not autocorrect + when over limit because of a comment + adds an offense and does not autocorrect + when nested hashes on same line + adds an offense only to outer and autocorrects it + when over limit rocket symbol + adds an offense and autocorrects it + when over limit and keys already on multiple lines + adds an offense and does not autocorrect + when under limit + does not add any offenses + when over limit rocket + adds an offense and autocorrects it + when over limit + adds an offense and autocorrects it + when hash in method call + adds an offense only to outer and autocorrects it + method call + with a hash with a too long first item + when parenthesized + corrects + when not parenthesized + when there are multiple elements + moves the 2nd element to a new line + when on multiple lines + does not correct + when there is only one element + does not autocorrect + when the hash is parenthesized + corrects + with a heredoc argument + does not break up the line + does not break up the line when a heredoc is used as the first element of an array + does not break up the line when parentheses are omitted + and other arguments before the heredoc + can break up the line before the heredoc argument + and the heredoc is after the line should split + can break up the line before the heredoc argument + when two method calls + adds an offense only to outer and autocorrects it + with long argument list + registers an offense and autocorrects it + when nested method calls allows outer to get broken up first + adds offense and does not autocorrect + when under limit + does not add any offenses + when call with hash on same line + adds an offense only to outer and autocorrects it + when over limit + adds an offense and autocorrects it + when two together + does not add any offenses + when unparenthesized + when there are multiple arguments + splits the line after the first element + when there is one argument + does not autocorrect + long blocks + do/end + adds an offense for block without arguments and does correct it + adds an offense for block with arguments and does correct it + no spaces + adds an offense and does correct it + braces + adds an offense and does correct it + lambda syntax + when argument is not enclosed in parentheses + registers an offense and corrects + when argument is enclosed in parentheses + registers an offense and corrects + let block + adds an offense and does correct it + Ruby 2.7 + adds an offense for do-end block and does correct it + adds an offense for {} block does correct it + multiple assignment + when over limit at right hand side + registers and corrects an offense + no breakable collections + adds an offense and does not autocorrect it + semicolon + semicolons inside string literal + adds offense and autocorrects elsewhere + when over limit and many semicolons + adds offense and autocorrects it by breaking the semicolonbefore the hash + semicolon inside string literal + adds offense and autocorrects elsewhere + when over limit and semicolon at end of line + adds offense and autocorrects it by breaking the first semicolonbefore the hash + when over limit and one semicolon at the end + adds offense and does not autocorrectbefore the hash + when over limit and many spaces around semicolon + adds offense and autocorrects it by breaking the semicolonbefore the hash + when under limit + does not add any offenses + when over limit and many semicolons at the end + adds offense and does not autocorrectbefore the hash + when over limit + adds offense and autocorrects it by breaking the semicolonbefore the hash + method definition + when under limit + does not add any offenses + when over limit + adds an offense and autocorrects it + comments + when over limit with semicolon + adds offense and does not autocorrect + HEREDOC + when over limit with semicolon + adds offense and does not autocorrect + when AllowURI option is disabled + and all the excessive characters are part of a URL + registers an offense for the line -RuboCop::Cop::Style::RedundantEach - does not register an offense when any method is used between methods with `each` in the method name - registers an offense when using `each.each` - does not register an offense when using `each_with_index` - registers an offense when using `each.each(&:foo)` - does not register an offense when using `each_with_object` - does not register an offense when using `each.with_index` - registers an offense when using `reverse_each.each_with_index` - does not register an offense when using `each` as enumerator - registers an offense when using `reverse_each.each` - registers an offense when using `each.reverse_each` - does not register an offense when using only single `each` - does not register an offense when using `reverse_each(&:foo).each {...}` - registers an offense when using `reverse_each.each_with_object` - registers an offense when using a method starting with `each_` with `each_with_object` - does not register an offense when using `each {}.each_with_object([]) {}` - does not register an offense when using `each_with_index.reverse_each` - registers an offense when using a method starting with `each_` with `each_with_index` - registers an offense when using `each.each_with_object` - does not register an offense when using `reverse_each {}.each {}` - does not register an offense when using `each` with a symbol proc argument - does not register an offense when not chaining `each_` calls - does not register an offense when using `each` with a symbol proc for last argument - registers an offense when using `each.each_with_index` - does not register an offense when using `each_foo {}.each_with_object([]) {}` - does not register an offense when using `each_ancestor.each` - does not register an offense when using `each {}.each_with_index {}` - does not register an offense when using `each {}.reverse_each {}` - does not register an offense when using `each.with_object` +RuboCop::Cop::Lint::LambdaWithoutLiteralBlock + registers and corrects an offense when using lambda with a proc variable block argument + does not register an offense when using lambda with a symbol proc + registers and corrects an offense when using lambda with `&proc {}` block argument + does not register an offense when using `lambda.call` + registers and corrects an offense when using lambda with `&Proc.new {}` block argument + does not register an offense when using lambda with a literal block -RuboCop::Cop::Style::EvalWithLocation - does not register an offense if `eval` is called on another object - registers an offense when using `#eval` with a heredoc and an incorrect line number - does not register an offense when using eval with block argument - registers an offense when using `#eval` with `binding` only - registers an offense when using `#eval` with a string on a new line - registers an offense when using `#instance_eval` with a string argument in parentheses - registers an offense when using `instance_eval` with improper arguments - accepts `eval` with a code that is a variable - accepts `eval` with a heredoc, a filename and `__LINE__ + 1` - registers an offense when using `#eval` without lineno - accepts `eval` with a string, a filename and `__LINE__` - registers an offense when using `eval` with improper arguments - accepts `eval` with a string, a filename and `__LINE__` on a new line - registers an offense when using `#class_eval` without any arguments - registers an offense when using `#instance_eval` without any arguments - registers an offense when using `::Kernel.eval` without any arguments - registers an offense when using `#module_eval` without any arguments - registers an offense when using `#class_eval` with an incorrect lineno - registers an offense when using `module_eval` with improper arguments - registers an offense when using correct file argument but incorrect line - registers an offense when using `#eval` without any arguments - registers an offense when using `#eval` with an incorrect line number - registers an offense when using `class_eval` with improper arguments - registers an offense when using `Kernel.eval` without any arguments +RuboCop::Formatter::FuubarStyleFormatter + #with_color + when color is enabled + outputs coloring sequence code at the beginning and the end + when color is disabled + outputs nothing + #progressbar_color + when a convention offense is detected in a file + is yellow + when a offense is detected in a file and autocorrected + is green + when convention and error offenses are detected in a file + is red + when an error offense is detected in a file + is red + and then a convention offense is detected in the next file + is still red + when no offenses are detected in a file + is still green + initially + is green -RuboCop::Cop::Style::MultipleComparison - does not register an offense for comparing multiple int literals - does not register an offense for comparing an lvar - registers an offense and corrects when `a` is compared twice - does not register an offense for comparing multiple literal strings - registers an offense and corrects when `a` is compared three times - does not register an offense for Array#include? - registers an offense and corrects when multiple comparison is not part of a conditional - registers an offense and corrects when `a` is compared twice in `if` and `elsif` conditions - registers an offense and corrects when `a` is compared three times, once on the righthand side - does not register an offense for comparing lvars when a string is on the lefthand side - does not register an offense when comparing two sides of the disjunction is unrelated - does not register an offense for a == b || b == a - registers an offense and corrects when `a` is compared three times on the right hand side - does not register an offense for a duplicated condition - does not register an offense for comparing lvars - when `AllowMethodComparison: false` - registers an offense and corrects when using multiple method calls - when `AllowMethodComparison: true` - does not register an offense when using multiple method calls +RuboCop::Cop::Lint::LiteralAsCondition + registers an offense for literal {} in a when of a case without anything after case keyword + registers an offense for literal [1] in until + accepts literal 1 if it's not an and/or operand + registers an offense for literal {} in if + registers an offense for `!{}` + registers an offense for literal :sym in a when of a case without anything after case keyword + registers an offense for literal 1 in case + accepts literal :sym if it's not an and/or operand + accepts literal 2.0 in non-toplevel and/or + registers an offense for literal 1 in post-loop until + accepts literal :sym in non-toplevel and/or + registers an offense for literal :sym in case + accepts literal :"#{a}" in a when of a case with something after case keyword + registers an offense for `not :"#{a}"` + registers an offense for literal 2.0 in if + registers an offense for literal :sym in complex cond + registers an offense for literal 2.0 in complex ! + registers an offense for literal :"#{a}" in post-loop until + registers an offense for literal :sym in post-loop until + registers an offense for literal 1 in complex ! + registers an offense for literal 2.0 in post-loop while + registers an offense for literal {} in complex cond + registers an offense for `!1` + registers an offense for literal :sym in post-loop while + registers an offense for literal {} in post-loop while + registers an offense for literal :"#{a}" in until + registers an offense for literal :sym in while + accepts dstr literal in case + registers an offense for literal [1] in ! + registers an offense for literal :sym in && + registers an offense for literal :sym in if + registers an offense for literal 2.0 in complex cond + registers an offense for literal 1 in complex cond + accepts literal [1] if it's not an and/or operand + registers an offense for literal :"#{a}" in post-loop while + registers an offense for literal 1 in a when of a case without anything after case keyword + registers an offense for literal 2.0 in ! + accepts array literal in case, if it has nested non-literal element + accepts literal 1 in a when of a case with something after case keyword + registers an offense for literal {} in until + registers an offense for literal :sym in until + registers an offense for literal {} in && + registers an offense for literal :"#{a}" in && + registers an offense for literal [1] in && + accepts literal [1] in non-toplevel and/or + accepts literal :sym in a when of a case with something after case keyword + registers an offense for case with a primitive array condition + registers an offense for literal {} in while + registers an offense for literal 2.0 in until + registers an offense for literal 1 in && + registers an offense for `!:sym` + accepts `true` literal in post-loop `while` + registers an offense for literal :"#{a}" in a when of a case without anything after case keyword + registers an offense for literal :"#{a}" in while + registers an offense for literal 1 in ! + registers an offense for literal :"#{a}" in complex ! + accepts `false` literal in post-loop `until` + accepts literal :"#{a}" if it's not an and/or operand + registers an offense for literal :"#{a}" in complex cond + registers an offense for `!:"#{a}"` + registers an offense for literal [1] in if + accepts literal {} in a when of a case with something after case keyword + registers an offense for literal 2.0 in while + registers an offense for literal 2.0 in a when of a case without anything after case keyword + registers an offense for literal 2.0 in && + registers an offense for literal 2.0 in post-loop until + registers an offense for literal {} in post-loop until + accepts literal {} if it's not an and/or operand + registers an offense for `not [1]` + registers an offense for literal [1] in post-loop while + registers an offense for `not 2.0` + registers an offense for literal :"#{a}" in if + accepts `true` literal in `while` + registers an offense for literal {} in ! + accepts literal 1 in non-toplevel and/or + registers an offense for literal [1] in a when of a case without anything after case keyword + registers an offense for literal [1] in complex ! + registers an offense for `not {}` + accepts literal {} in non-toplevel and/or + accepts array literal in case, if it has non-literal elements + registers an offense for literal :sym in ! + registers an offense for `![1]` + registers an offense for literal 1 in while + registers an offense for literal 1 in until + registers an offense for literal 1 in post-loop while + registers an offense for literal :"#{a}" in case + registers an offense for literal [1] in complex cond + registers an offense for literal 2.0 in case + registers an offense for literal 1 in if + registers an offense for `not :sym` + registers an offense for `not 1` + accepts literal :"#{a}" in non-toplevel and/or + accepts literal 2.0 if it's not an and/or operand + registers an offense for literal [1] in post-loop until + registers an offense for literal {} in case + accepts `false` literal in `until` + registers an offense for literal [1] in while + accepts literal 2.0 in a when of a case with something after case keyword + registers an offense for literal :"#{a}" in ! + accepts literal [1] in a when of a case with something after case keyword + registers an offense for literal {} in complex ! + registers an offense for `!2.0` + registers an offense for literal [1] in case + registers an offense for literal :sym in complex ! + >= Ruby 2.7 + accepts literal [1] in a when of a case match + accepts an offense for literal [1] in case match with a match var + registers an offense for literal [1] in case match without a match var + >= Ruby 2.7 + registers an offense for case match with a primitive array condition + accepts array literal in case match, if it has nested non-literal element + accepts dstr literal in case match + accepts array literal in case match, if it has non-literal elements + accepts an offense for case match with a match var + >= Ruby 2.7 + accepts literal :"#{a}" in a when of a case match + accepts an offense for literal :"#{a}" in case match with a match var + registers an offense for literal :"#{a}" in case match without a match var + >= Ruby 2.7 + registers an offense for literal :sym in case match without a match var + accepts literal :sym in a when of a case match + accepts an offense for literal :sym in case match with a match var + >= Ruby 2.7 + accepts an offense for literal 1 in case match with a match var + accepts literal 1 in a when of a case match + registers an offense for literal 1 in case match without a match var + >= Ruby 2.7 + accepts an offense for literal 2.0 in case match with a match var + accepts literal 2.0 in a when of a case match + registers an offense for literal 2.0 in case match without a match var + >= Ruby 2.7 + accepts an offense for literal {} in case match with a match var + registers an offense for literal {} in case match without a match var + accepts literal {} in a when of a case match -RuboCop::Cop::Style::StringMethods - registers an offense - when using safe navigation operator - registers an offense +RuboCop::Cop::Style::WhenThen + registers an offense for when b, c; + accepts ; separating statements in the body of when + registers an offense for when b; + when inspecting a case statement with an empty branch + does not register an offense -RuboCop::Cop::Style::InPatternThen - >= Ruby 2.7 - registers an offense for `in b, c, d;` (array pattern) - registers an offense for `in b, c | d;` - registers an offense for `in b;` - accepts `;` separating statements in the body of `in` - registers an offense for `in b | c | d;` (alternative pattern) - when inspecting a case statement with an empty branch - does not register an offense +RuboCop::Cop::Layout::BeginEndAlignment + registers an offense for mismatched begin end and autocorrects + accepts matching begin ... end + accepts matching puts 1; begin ... end + when EnforcedStyleAlignWith is start_of_line + registers an offense for mismatched var << begin end and autocorrects + registers an offense for mismatched begin end and autocorrects + accepts matching puts 1; begin ... end + accepts matching var = begin ... end -RuboCop::Cop::Style::ConstantVisibility - does not register an offense when passing a string to the visibility declaration - registers an offense for module definitions - does not register an offense in the top level scope - IgnoreModules - registers an offense for constants - does not register an offense for class definitions - when defining a constant in a module - does not register an offense when using a visibility declaration - registers an offense when not using a visibility declaration - when defining a constant in a class - with a single-statement body - registers an offense when not using a visibility declaration - with a multi-statement body - registers an offense when there is no matching visibility declaration - does not register an offense when using a visibility declaration - registers an offense when not using a visibility declaration +RuboCop::Cop::Style::HashConversion + registers and corrects an offense when using `zip` with argument in `Hash[]` + reports different offense for Hash[a && b] + reports an offense for single-argument Hash[] + registers and corrects an offense when using multi-argument `Hash[]` as a method argument + registers and corrects an offense when using argumentless `zip` without parentheses in `Hash[]` + reports different offense for multi-argument Hash[] + does not try to correct multi-argument Hash with odd number of arguments + reports different offense for hash argument Hash[] as a method argument without parentheses + reports different offense for Hash[a || b] + reports different offense for hash argument Hash[] + reports different offense for Hash[(a || b)] + reports different offense for hash argument Hash[] as a method argument with parentheses + reports different offense for Hash[(a && b)] + registers and corrects an offense when using argumentless `zip` with parentheses in `Hash[]` + wraps complex statements in parens if needed + reports different offense for empty Hash[] + AllowSplatArgument: true + does not register an offense for unpacked array + AllowSplatArgument: false + reports uncorrectable offense for unpacked array -RuboCop::Cop::Style::DocumentDynamicEvalDefinition - registers an offense when using eval-type method with string interpolation without comment docs - does not register an offense when using eval-type method with interpolated string that is not heredoc with comment doc - does not register an offense when using eval-type method without string interpolation - registers an offense when using eval-type method with interpolated string that is not heredoc without comment doc - does not register an offense when using eval-type method with string interpolation with comment docs - block comment in heredoc - does not evaluate comments if there is no interpolation - does not register an offense for a matching block comment - does not register an offense when using other text - registers an offense if the comment does not match the method - does not register an offense when using multiple methods with split comments - does not register an offense when using multiple methods - does not register an offense when using inline comments - block comment outside heredoc - does not register an offense when using multiple methods - does not register an offense when using other text - registers an offense if the comment does not match the method - does not register an offense for a matching block comment after the heredoc - does not register an offense for a matching block comment before the heredoc - does not register an offense when using inline comments +RuboCop::Cop::Lint::BigDecimalNew + registers an offense and corrects using `BigDecimal.new()` + does not register an offense when using `BigDecimal()` + registers an offense and corrects using `::BigDecimal.new()` -RuboCop::Cop::Layout::SpaceAfterSemicolon - registers an offense and corrects semicolon without space after it - does not crash if semicolon is the last character of the file - inside block braces - when EnforcedStyle for SpaceInsideBlockBraces is space - registers an offense and corrects no space between a semicolon and a closing brace - behaves like common behavior - accepts a space between a semicolon and a closing brace - when EnforcedStyle for SpaceInsideBlockBraces is no_space - accepts no space between a semicolon and a closing brace - behaves like common behavior - accepts a space between a semicolon and a closing brace +RuboCop::Cop::Style::ClassVars + does not register an offense for class variable usage + registers an offense for class variable declaration + registers an offense for class variable set on class receiver + registers an offense for class variable set in class -RuboCop::Cop::Bundler::InsecureProtocolSource - does not register an offense when using `source 'https://rubygems.org'` - registers an offense when using `source :rubygems` - registers an offense when using `source :gemcutter` - registers an offense when using `source :rubyforge` - when `AllowHttpProtocol: true` - does not register an offense when using `source 'http://rubygems.org'` - when `AllowHttpProtocol: false` - registers an offense when using `source 'http://rubygems.org'` +RuboCop::Cop::Style::Send + with __send__ + and with a receiver + does not register an offense for an invocation with args + does not register an offense for an invocation without args + and without a receiver + does not register an offense for an invocation without args + does not register an offense for an invocation with args + with send + and without a receiver + registers an offense for an invocation with args + does not register an offense for an invocation without args + and with a receiver + does not register an offense for an invocation without args + registers an offense for an invocation with args + when using safe navigation operator + registers an offense for an invocation with args + with public_send + and without a receiver + does not register an offense for an invocation without args + does not register an offense for an invocation with args + and with a receiver + does not register an offense for an invocation with args + does not register an offense for an invocation without args -RuboCop::Cop::Layout::HashAlignment - accepts pairs that don't start a line - accepts several pairs per line - register no offense for yield without args - accepts single line hash - register no offense for superclass call without args - when `EnforcedStyle: with_fixed_indentation` of `ArgumentAlignment` - registers and corrects an offense when using misaligned keyword arguments - does not register an offense for an empty hash literal - does not register an offense using aligned hash literal - does not register an offense using aligned hash argument for `proc.()` - register and corrects an offense - when using hash value omission - register and corrects an offense - does not register and corrects an offense when using aligned keyword arguments - with different settings for => and : - accepts aligned entries - registers offenses and correct misaligned entries - with default configuration - registers an offense and corrects alignment when using double splat in braces - registers an offense and corrects separator alignment - registers an offense and corrects zero or multiple spaces - registers an offense and corrects misaligned mixed multiline hash keys - does not register an offense when value starts on next line - registers an offense and corrects misaligned hash keys - registers an offense and corrects multiline value starts in wrong place - registers an offense and corrects mixed hash styles - registers an offense and corrects table alignment - registers an offense and corrects alignment when using double splat in an explicit hash - accepts left-aligned hash keys with single spaces - with implicit hash as last argument - registers an offense and corrects right alignment of keys - accepts an empty hash - registers an offense and corrects misaligned hash keys - accepts aligned hash keys - with `EnforcedHashRocketStyle`: `table` - and a double splat argument after a hash key - registers an offense on the misaligned key and corrects - and a misaligned double splat argument - registers an offense and corrects - and misaligned keys +RuboCop::Cop::Style::Strip + registers an offense for str.lstrip.rstrip + registers an offense for str.rstrip.lstrip + +RuboCop::Cop::Style::EachForSimpleLoop + does not register offense if range startpoint is not constant + does not register offense for character range + does not register offense if range endpoint is not constant + with multiline block with parameters + autocorrects an offense + when using an exclusive end range + does not register offense for range not starting with zero and using param + autocorrects the source with multiline block + autocorrects the range not starting with zero + autocorrects the source with inline block + when using an inclusive end range + does not register offense for range not starting with zero and using param + autocorrects the source with multiline block + autocorrects the range not starting with zero + autocorrects the source with inline block + with inline block with parameters + autocorrects an offense + +RuboCop::Cop::Style::EmptyMethod + when configured with compact style + relation with Layout/LineLength + when that cop is disabled + corrects to long lines + when the correction would exceed the configured maximum + reports an offense but does not correct + with a non-empty class method definition + allows multi line method + allows single line method + allows multi line method with comment + with an empty class method definition + registers an offense for empty method + allows single line method + registers an offense for method with blank line + registers an offense for empty method with arguments + with an empty instance method definition + registers an offense for method with arguments without parens + registers an offense for empty method + allows single line method + registers an offense for method with blank line + registers an offense for method with arguments + registers an offense for method with closing paren on following line + with a non-empty instance method definition + allows multi line method with comment + allows multi line method + allows single line method + when configured with expanded style + relation with Layout/LineLength + still corrects even if the method is longer than the configured Max + with a non-empty instance method definition + allows multi line method + allows single line method + allows multi line method with a comment + with an empty instance method definition + allows multi line method + registers an offense for single line method + allows multi line method with blank line + when method is nested in class scope + registers an offense for single line method + with a non-empty class method definition + allows multi line method with comment + allows multi line method + allows single line method + with an empty class method definition + registers an offense for single line method + allows empty multi line method + allows multi line method with a blank line + +RuboCop::Cop::Lint::TripleQuotes + does not register an offense for implicit concatenation + heredocs + does not register an offense + quintuple quotes + registers an offense and corrects + string interpolation + does not register an offense + with nested extra quotes registers an offense and corrects - and aligned keys but a double splat argument after - does not register an offense on the `kwsplat` - when the only item is a kwsplat - does not register an offense - with `EnforcedColonStyle`: `table` - and aligned keys but a double splat argument after - does not register an offense on the `kwsplat` - when the only item is a kwsplat - does not register an offense - and misaligned keys + triple quotes + on one line registers an offense and corrects - when using hash value omission - and aligned keys - does not register an offense and corrects - and a misaligned double splat argument + when only quotes + registers an offense and corrects to a single empty quote + with only whitespace + does not register + on multiple lines registers an offense and corrects - and a double splat argument after a hash key - registers an offense on the misaligned key and corrects - always inspect last argument hash - registers offense and corrects misaligned keys in implicit hash - registers an offense and corrects misaligned keys in implicit hash for super - registers offense and corrects misaligned keys in explicit hash - registers an offense and corrects misaligned keys in implicit hash for yield - registers an offense and corrects misaligned keys in explicit hash for super - registers an offense and corrects misaligned keys in explicit hash for yield - when using hash value omission - registers offense and corrects misaligned keys in explicit hash - registers offense and corrects misaligned keys in implicit hash - always ignore last argument hash - accepts misaligned keys in implicit hash for super - accepts misaligned keys in explicit hash for super - accepts misaligned keys in implicit hash - accepts misaligned keys in explicit hash - accepts misaligned keys in explicit hash for yield - accepts misaligned keys in implicit hash for yield - with table alignment configuration - registers an offense and corrects misaligned hash rockets - accepts hashes that use different separators and double splats - accepts hashes that use different separators - accepts a multiline array of single line hashes - accepts aligned hash keys and values - registers an offense and corrects for misaligned hash keys - accepts pairs that don't start a line - accepts single line hash - accepts an empty hash - accepts a symbol only hash followed by a keyword splat - accepts several pairs per line - accepts a keyword splat only hash - registers an offense for misaligned hash values - when using hash value omission - accepts single line hash - accepts several pairs per line - accepts pairs that don't start a line - when using hash value omission - accepts aligned hash keys and values - ignore explicit last argument hash - registers an offense and corrects misaligned keys in implicit hash - accepts misaligned keys in explicit hash for super - accepts misaligned keys in explicit hash - accepts misaligned keys in explicit hash for yield - registers an offense and corrects misaligned keys in implicit hash for yield - registers an offense and corrects misaligned keys in implicit hash for super - when using hash value omission - registers an offense and corrects misaligned keys in implicit hash - accepts misaligned keys in explicit hash - with table+separator alignment configuration - accepts a single method argument entry with colon - with multiple preferred(key and table) alignment configuration - accepts aligned hash keys, by both - registers an offense and corrects misaligned hash values - registers an offense and corrects misaligned hash values, prefer key when least offenses - accepts aligned hash keys, by keys - registers an offense and corrects misaligned hash values, works separate for each hash - accepts aligned hash keys, by table - registers an offense and corrects misaligned hash keys with mixed hash style - accepts an empty hash - accepts aligned hash keys with mixed hash style - registers an offense and corrects misaligned hash values, prefer table when least offenses - table and key config - registers an offense and corrects misaligned hash values, prefer table because it is specified first - ignore implicit last argument hash - registers an offense and corrects misaligned keys in explicit hash for super - registers an offense and corrects misaligned keys in explicit hash - registers an offense and corrects misaligned keys in explicit hash for yield - accepts misaligned keys in implicit hash for yield - accepts misaligned keys in implicit hash - accepts misaligned keys in implicit hash for super - with separator alignment configuration - accepts hashes with different separators - registers an offense and corrects misaligned hash rockets - registers an offense and corrects misaligned hash values - accepts aligned hash keys - accepts pairs that don't start a line - accepts several pairs per line - registers an offense and corrects mixed indentation and spacing - doesn't break code by moving long keys too far left - accepts an empty hash - accepts single line hash - when using hash value omission - registers an offense and corrects mixed indentation and spacing - accepts aligned hash keys - when using hash value omission - accepts pairs that don't start a line - accepts single line hash - accepts several pairs per line - with invalid configuration - fails - when using hash value omission - accepts pairs that don't start a line - accepts several pairs per line - accepts single line hash - -RuboCop::Cop::Lint::NestedMethodDefinition - does not register offense for nested definition inside instance_eval - does not register offense for nested definition inside Struct.new - registers an offense for a nested method definition - does not register offense for nested definition inside class shovel - does not register offense for nested definition inside ::Class.new - registers an offense for a nested method definition inside lambda - does not register offense for nested definition inside module_eval - does not register offense for nested definition inside class_exec - does not register offense for nested definition inside ::Module.new - does not register offense for nested definition inside Class.new - registers an offense for a nested singleton method definition - does not register an offense for a lambda definition inside method - does not register offense for definition of method on local var - does not register offense for nested definition inside module_exec - does not register offense for nested definition inside class_eval - does not register offense for nested definition inside Module.new - registers an offense for a nested class method definition - does not register offense for nested definition inside instance_exec - does not register offense for nested definition inside ::Struct.new - when `AllowedMethods: [has_many]` - does not register offense for nested definition inside `has_many` - registers offense for nested definition inside `denied_method` - when `AllowedPatterns: [baz]` - registers offense for nested definition inside `do_qux` - does not register offense for nested definition inside `do_baz` -RuboCop::Cop::Layout::EmptyLinesAroundAccessModifier - Ruby 2.7 - ignores module_function with numblock argument - registers an offense for missing around line before public - registers an offense for missing around line before module_function - ignores public with numblock argument - registers an offense for missing around line before private - registers an offense for missing around line before protected - ignores protected with numblock argument - ignores private with numblock argument - EnforcedStyle is `only_before` - registers an offense for missing blank line before module_function - accepts blank line after public - accepts missing blank line after protected - does not register an offense when `end` immediately after private - accepts missing blank line after private - does not register an offense when `end` immediately after protected - registers an offense for blank line after private - registers an offense for blank line after protected - registers an offense for missing blank line before protected - registers an offense for missing blank line before public - registers an offense for missing blank line before private - accepts blank line after module_function - EnforcedStyle is `around` - accepts missing blank line when at the end of specifying a superclass - recognizes blank lines with DOS style line endings - ignores private with block argument - requires blank line when next line started with end - ignores comment line before protected - accepts missing blank line when specifying `self` that breaks the line - accepts missing blank line when at the end of specifying a superclass - ignores module_function inside a method call - recognizes blank lines with DOS style line endings - accepts missing blank line when at the end of specifying a superclass - ignores private with a right-hand-side condition - ignores private inside a method call - accepts only using access modifier - accepts missing blank line when at the end of block - accepts missing blank line when specifying `self` that breaks the line - requires blank line when next line started with end - accepts missing blank line when at the beginning of module - ignores module_function with block argument - accepts missing blank line when specifying a superclass that breaks the line - requires blank line before protected - recognizes blank lines with DOS style line endings - accepts missing blank line when at the beginning of sclass - accepts missing blank line when at the beginning of sclass - accepts missing blank line when at the end of block - accepts missing blank line when at the end of specifying a superclass - accepts missing blank line when specifying `self` that breaks the line - autocorrects blank line after #{access_modifier} with comment - accepts missing blank line when at the beginning of filewhen specifying a superclass that breaks the line - ignores protected inside a method call - accepts missing blank line when specifying a superclass that breaks the line - requires blank line when next line started with end - ignores module_function with a right-hand-side condition - accepts missing blank line when at the beginning of module - ignores protected deep inside a method call - ignores protected with a right-hand-side condition - ignores comment line before module_function - requires blank line after, but not before, private when at the beginning of class/module - accepts missing blank line when at the beginning of class - accepts missing blank line when at the beginning of class - requires blank line after, but not before, public when at the beginning of class/module - ignores an accessor with the same name as public above a method definition - ignores protected with block argument - accepts missing blank line when at the beginning of filewhen specifying a superclass that breaks the line - accepts missing blank line when at the beginning of sclass - requires blank line after public - accepts missing blank line when at the end of block - accepts missing blank line when specifying `self` that breaks the line - ignores an accessor with the same name as protected above a method definition - accepts missing blank line when at the beginning of file and preceded by a comment - accepts missing blank line when at the beginning of filewhen specifying a superclass that breaks the line - accepts missing blank line when at the beginning of file and preceded by a comment - autocorrects blank line after #{access_modifier} with comment - autocorrects blank line after #{access_modifier} with comment - requires blank line before module_function - requires blank line when next line started with end - ignores comment line before private - requires blank line after, but not before, module_function when at the beginning of class/module - accepts missing blank line when at the beginning of class - accepts missing blank line when at the end of specifying `self` - ignores public inside a method call - recognizes blank lines with DOS style line endings - requires blank line after protected - requires blank line before public - ignores public deep inside a method call - accepts missing blank line when at the end of specifying `self` - accepts missing blank line when at the beginning of filewhen specifying a superclass that breaks the line - accepts missing blank line when at the beginning of module - ignores public with block argument - requires blank line after module_function - requires blank line after, but not before, protected when at the beginning of class/module - accepts missing blank line when at the beginning of module - ignores module_function deep inside a method call - accepts missing blank line when at the beginning of class - ignores an accessor with the same name as module_function above a method definition - accepts only using access modifier - accepts only using access modifier - accepts missing blank line when at the beginning of file and preceded by a comment - accepts missing blank line when at the end of block - ignores an accessor with the same name as private above a method definition - accepts missing blank line when at the end of specifying `self` - accepts missing blank line when at the beginning of file and preceded by a comment - requires blank line before private - accepts missing blank line when at the beginning of sclass - accepts only using access modifier - ignores private deep inside a method call - ignores public with a right-hand-side condition - accepts missing blank line when specifying a superclass that breaks the line - accepts missing blank line when specifying a superclass that breaks the line - autocorrects blank line after #{access_modifier} with comment - requires blank line after private - accepts missing blank line when at the end of specifying `self` - ignores comment line before public - at the beginning of block - for blocks defined with {} - accepts missing blank line - accepts missing blank line with arguments - for blocks defined with do - requires blank line after, but not before, module_function - accepts missing blank line - accepts missing blank line with arguments - at the beginning of block - for blocks defined with {} - accepts missing blank line - accepts missing blank line with arguments - for blocks defined with do - accepts missing blank line with arguments - accepts missing blank line - requires blank line after, but not before, private - at the beginning of block - for blocks defined with {} - accepts missing blank line with arguments - accepts missing blank line - for blocks defined with do - accepts missing blank line with arguments - requires blank line after, but not before, protected - accepts missing blank line - at the beginning of block - for blocks defined with do - requires blank line after, but not before, public - accepts missing blank line with arguments - accepts missing blank line - for blocks defined with {} - accepts missing blank line with arguments - accepts missing blank line +RuboCop::Cop::Lint::RequireRangeParentheses + does not register an offense when using `nil..42` + does not register an offense when using `42..nil` + registers an offense when the end of the range (`..`) is line break + registers an offense when the end of the range (`...`) is line break + does not register an offense when the end of the range (`..`) is line break and is enclosed in parentheses + does not register an offense when begin and end of the range are on the same line + Ruby >= 2.6 + does not register an offense when using endless range only + Ruby >= 2.7 + does not register an offense when using beginless range only -RuboCop::Cop::Lint::BinaryOperatorWithIdenticalOperands - registers an offense for `/` with duplicate operands - registers an offense for `|` with duplicate operands - does not crash on operator without any argument - registers an offense for `!=` with duplicate operands - does not register an offense when using binary operator with different operands - does not register an offense when using arithmetic operator with numerics - registers an offense for `>=` with duplicate operands - registers an offense for `%` with duplicate operands - registers an offense for `>` with duplicate operands - registers an offense for `-` with duplicate operands - registers an offense for `<` with duplicate operands - registers an offense for `===` with duplicate operands - registers an offense for `<=` with duplicate operands - does not register an offense for `+` with duplicate operands - registers an offense for `&&` with duplicate operands - registers an offense for `||` with duplicate operands - registers an offense for `<=>` with duplicate operands - registers an offense for `^` with duplicate operands - registers an offense for `==` with duplicate operands - does not register an offense for `<<` with duplicate operands - registers an offense for `=~` with duplicate operands - does not register an offense for `*` with duplicate operands - does not register an offense for `>>` with duplicate operands - does not register an offense for `**` with duplicate operands +RuboCop::Cop::Layout::EmptyLinesAroundMethodBody + is not fooled by single line methods + registers an offense for class method body starting with a blank + accepts method body starting with a line with spaces + registers an offense for method body ending with a blank + registers an offense for class method body ending with a blank + registers an offense for method body starting with a blank -RuboCop::ConfigRegeneration - #options - when there is a blank todo file - is expected to eq {:auto_gen_config=>true} - when the todo file is malformed - is expected to eq {:auto_gen_config=>true} - when no todo file exists - is expected to eq {:auto_gen_config=>true} - it parses options from the generation comment - is expected to eq {:auto_gen_config=>true, :auto_gen_only_exclude=>true, :auto_gen_timestamp=>false, :exclude_limit=>"100", :offense_counts=>false} +RuboCop::Cop::Style::Encoding + does not register an offense when encoding is in the wrong place + does not register an offense when no encoding present + does not register an offense on a different magic comment type + does not register an offense when encoding is not at the top of the file + does not register an offense when encoding present but not UTF-8 + registers an offense when encoding present on 2nd line after shebang + registers an offense and corrects if there are multiple encoding magic comments + registers an offense when encoding present and UTF-8 + registers an offense and corrects the magic comment follows another magic comment + vim comments + registers an offense and corrects + emacs comment + registers an offense for encoding + only removes encoding if there are other editor comments -RuboCop::Cop::Style::MultilineInPatternThen - >= Ruby 2.7 - registers an offense for empty `in` statement with `then` - doesn't register an offense for singleline `in` statement with `then` - autocorrects when the body of `in` branch starts with `then` - does not register an offense for array `when` statement with `then` - does not register an offense when line break for multiple candidate values of `in` - doesn't register an offense for empty `in` statement without `then` - doesn't register an offense when `then` required for a body of `in` is used - doesn't register an offense for multiline `in` statement without `then` - doesn't register an offense for multiline `in` statement with `then` followed by other lines - registers an offense for multiline (one line in a body) `in` statement with `then` - registers an offense when one line for multiple candidate values of `in` - does not register an offense for hash `in` statement with `then` - registers an offense for multiline (two lines in a body) `in` statement with `then` +RuboCop::StringInterpreter + .interpret + handles octal + handles unicode + handles extended unicode + handles hex + behaves like simple escape + handles \\f + behaves like simple escape + handles \\a + behaves like simple escape + handles \\t + behaves like simple escape + handles \\r + behaves like simple escape + handles \\e + behaves like simple escape + handles \\n + behaves like simple escape + handles \\v + behaves like simple escape + handles \\b + behaves like simple escape + handles \\s -RuboCop::Cop::Style::RaiseArgs - when enforced style is compact - accepts a raise with msg argument - accepts exception constructor with keyword arguments and message argument - accepts a raise with an exception argument - with a raise with exception instantiation and message arguments - reports an offense - with a raise with 2 args and exception object is assigned to a local variable - reports an offense - with a raise with 2 args - reports an offense - with correct + opposite - reports an offense - reports multiple offenses - with a raise with 3 args - reports an offense - when used in a ternary expression - registers an offense and autocorrects - when used in a logical and expression - registers an offense and autocorrects - when used in a logical or expression - registers an offense and autocorrects - when enforced style is exploded - accepts a raise with `new` method without receiver - accepts a raise with 3 args - accepts a raise with splatted arguments - ignores a raise with an exception argument - accepts a raise with msg argument - accepts exception constructor with keyword arguments - accepts exception constructor with more than 1 argument - accepts a raise when exception object is assigned to a local variable - accepts a raise with 2 args - when exception type is in AllowedCompactTypes - accepts exception constructor with no arguments - with one argument - accepts exception constructor - with more than one argument - accepts exception constructor - when an exception object is assigned to a local variable - autocorrects to exploded style - with opposite + correct - reports multiple offenses - reports an offense for opposite + correct - with a raise with exception object - when used in a ternary expression - registers an offense and autocorrects - with one argument - reports an offense - when used in a logical or expression - registers an offense and autocorrects - with no arguments - reports an offense - when used in a logical and expression - registers an offense and autocorrects +RuboCop::Cop::Style::ParallelAssignment + registers an offense when assigning to same variables in same order + corrects when the expression is missing spaces + corrects when the right variable is an array + corrects parallel assignment in while statements + registers an offense when the right side has methods with/without blocks + corrects when the right variable is a symbol array + corrects when using single indentation + allows more right variables than left variables + corrects when the right variable is a word array + corrects when the number of left hand variables matches the number of right hand variables + corrects parallel assignment in if statements + registers an offense with attributes when assignments must be reordered to preserve meaning + registers an offense when the right side has mulitiple arrays + registers an offense when left hand side ends with an implicit variable + corrects parallel assignment in unless statements + corrects when the expression uses a modifier if statement + corrects when the expression uses a modifier while statement + corrects when using parallel assignment in singleton method + corrects when assigning to method returns + registers an offense when assignments must be reordered to preserve meaning + registers an offense when the right side has constants + corrects when using constants + registers an offense when the right side has mixed expressions + corrects when the expression uses a modifier until statement + registers an offense with indices of different variables + corrects parallel assignment in rescue statements within begin ... rescue + corrects parallel assignment inside rescue statements within method definitions + registers an offense when assigning to namespaced constants + registers an offense when right hand side has maps with blocks + corrects parallel assignment in until statements + registers an offense with indices and attributes when assignments must be reordered to preserve meaning + corrects when assignments must be reordered to avoid changing meaning + registers an offense when right hand side has namespaced constants + registers an offense with indices + corrects when assigning from multiple methods with blocks + corrects when the expression uses a modifier if statement inside a method + corrects when the expression uses a modifier rescue statement inside of a method + corrects when using nested indentation + registers an offense when the right side has multiple hashes + allows more left variables than right variables + corrects when the expression uses a modifier rescue statement + allows expanding an assigned var + corrects when the expression uses a modifier unless statement + corrects when the expression uses a modifier rescue statement as the only thing inside of a method + behaves like allowed + allows assignment of: a, = 1 + behaves like allowed + allows assignment of: a = a + behaves like allowed + allows assignment of: a, b = Float::INFINITY + using custom indentation width + works with standard correction + works with nesting + works with guard clauses + works with rescue + behaves like allowed + allows assignment of: CONSTANT, = 1, 2 + behaves like allowed + allows assignment of: a, b = foo() + behaves like allowed + allows assignment of: a, = a + behaves like allowed + allows assignment of: self.a, self.b = self.b, self.a + behaves like allowed + allows assignment of: self.a, self.b = b, a + behaves like allowed + allows assignment of: a = *'foo' + behaves like allowed + allows assignment of: a, b = foo.map { |e| e.id } + behaves like allowed + allows assignment of: a, = *foo + behaves like allowed + allows assignment of: a, b, c = *node, 1, 2 + behaves like allowed + allows assignment of: a = 1 + behaves like allowed + allows assignment of: a[0], a[1] = a[1], a[0] + behaves like allowed + allows assignment of: obj.attr1, obj.attr2 = obj.attr2, obj.attr1 + behaves like allowed + allows assignment of: begin_token, end_token = CONSTANT + behaves like allowed + allows assignment of: a, *b = [1, 2, 3] + behaves like allowed + allows assignment of: a, b, c = 1, 2, *node + behaves like allowed + allows assignment of: array = [1, 2, 3]; a, = array; + behaves like allowed + allows assignment of: obj.attr1, ary[0] = ary[0], obj.attr1 + behaves like allowed + allows assignment of: *a, b = [1, 2, 3] + behaves like allowed + allows assignment of: ary[0], ary[1], ary[2] = ary[1], ary[2], ary[0] + behaves like allowed + allows assignment of: a, = *'foo' + behaves like allowed + allows assignment of: a, b, c = b, c, a + behaves like allowed + allows assignment of: a, b = b, a + behaves like allowed + allows assignment of: a, b = (a + b), (a - b) + behaves like allowed + allows assignment of: foo = [1, 2, 3]; a, b, c = foo; + behaves like allowed + allows assignment of: a = 1; b = 2; + behaves like allowed + allows assignment of: a, = 1, 2, 3 + behaves like allowed + allows assignment of: a, b = *foo -RuboCop::Cop::Security::MarshalLoad - registers an offense for using Marshal.restore - registers an offense for using Marshal.load - does not register an offense for Marshal.dump - does not register an offense Marshal methods under another namespace - allows using dangerous Marshal methods for deep cloning +RuboCop::Cop::Layout::MultilineMethodArgumentLineBreaks + when many arguments including hash are on multiple lines, three on same line + registers an offense and corrects + when second argument starts on same line as end of first + registers an offense and corrects + when bracket hash assignment key on multiple lines + does not add any offenses + when one argument on same line + does not add any offenses + when many arguments are on multiple lines, three on same line + registers an offense and corrects + when there are multiple arguments on the first line + registers an offense and corrects starting from the 2nd argument + when many arguments are on multiple lines, two on same line + registers an offense and corrects + when two arguments are on next line + does not add any offenses + when bracket hash assignment on multiple lines + does not add any offenses + when argument starts on same line but ends on different line + registers an offense and corrects -RuboCop::Cop::Style::RedundantArgument - registers an offense and corrects when method called without parenthesis on literals - registers an offense and corrects when method called without parenthesis on variable - does not register an offense when method called with no receiver - works with double-quoted strings when configuration is single-quotes - does not register an offense when method called with no arguments - registers an offense and corrects when method called on literals - does not register an offense when method called with more than one arguments - registers an offense and corrects when method called on variable - does not register an offense when method called with different argument - non-builtin method - does not register an offense with other argument - registers an offense and corrects with configured argument +RuboCop::Cop::Lint::FloatComparison + registers an offense when comparing with float returning method + registers an offense when comparing with method on float receiver + does not register an offense when comparing with float using epsilon + does not register an offense when comparing with float method that can return numeric and returns integer + registers an offense when comparing with arightmetic operator on floats + registers an offense when comparing with float + registers an offense when comparing with float method that can return numeric and returns float -RuboCop::Cop::Lint::AmbiguousBlockAssociation - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts +RuboCop::Cop::Naming::MethodParameterName + does not register offense for valid parameter names on self.method + registers offense when parameter with prefix is less than minimum length + registers offense when parameter contains uppercase characters + registers offense when parameter ends in number + does not register offense for empty restarg + registers offense for offensive keyword parameters + registers offense when parameter ends in number on class method + does not register offense for empty kwrestarg + registers offense when parameter is less than minimum length + can register multiple offenses in one method definition + does not register offense for valid keyword parameters + registers offense for offensive default parameter + does not register offense for valid default parameters + does not register offense for valid parameter names + does not register for method without parameters + with AllowNamesEndingInNumbers + accept parameters that end in numbers + with AllowedNames + registers unlisted offensive names + accepts underscore param names + accepts param names prefixed with underscore + accepts specified block param names + when using argument forwarding does not register an offense - without parentheses - with assignment - registers an offense - as a hash key - registers an offense - with receiver - registers an offense - when using safe navigation operator - registers an offense - without receiver + with ForbiddenNames + accepts parameter that uses a forbidden name's letters + registers offense for parameter listed as forbidden + +RuboCop::Cop::Bundler::DuplicatedGem + when investigating Gemfiles + registers an offense when gem from default group is conditionally duplicated + does not register an offense when gem is duplicated within `if-else` statement + does not register an offense when gem is duplicated within `if-elsif` statement + does not register an offense when gem is duplicated within `case` statement + and no duplicate gems are present + does not register any offenses + and a duplicated gem is in a git/path/group/platforms block registers an offense - rspec expect {}.to change {} + and a gem is duplicated in default group registers an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - when AllowedPatterns is enabled - does not register an offense for an allowed method - registers an offense for other methods - behaves like accepts - does not register an offense - behaves like accepts - does not register an offense - when AllowedMethods is enabled - does not register an offense for an allowed method - registers an offense for other methods + and the file is empty + does not register any offenses + when investigating Ruby files + does not register any offenses -RuboCop::Cop::Layout::EmptyLinesAroundBeginBody - registers an offense for begin body starting in method - registers many offenses with complex begin-end - registers an offense for begin body starting with a blank - accepts begin block without empty line in a method - registers an offense for begin body ending in method - registers an offense for else body ending - registers an offense for begin body starting with rescue - registers an offense for rescue body ending - registers an offense for ensure body ending - accepts begin block without empty line - registers an offense for begin body ending with a blank +RuboCop::Formatter::TextUtil + pluralize + will pluralize -1 + will pluralize quantities greater than 1 + will pluralize negative quantities less than -1 + will not pluralize 1 + will pluralize fractions + will not change 0 to no + will change 0 to no when configured -RuboCop::Cop::Registry - can filter down to one type - exposes a mapping of cop names to cop classes - exposes the number of stored cops - exposes cop departments - exposes a list of cop names - can be cloned - can filter down to all but one type - when dismissing a cop class - allows re-listing - disallows it if done too late - allows it if done rapidly - #enabled - selects cops which are enabled in the config - overrides config if :only includes the cop - selects only safe cops if :safe passed - when new cops are introduced - does not include them - overrides config if :only includes the cop - when specifying `--enable-pending-cops` command-line option - includes them - when specifying `NewCops: disable` option in .rubocop.yml - includes them because command-line option takes precedence over .rubocop.yml - when specifying `--disable-pending-cops` command-line option - does not include them - when specifying `NewCops: enable` option in .rubocop.yml - does not include them because command-line option takes precedence over .rubocop.yml - when specifying `NewCops: disable` option in .rubocop.yml - does not include them - when specifying `NewCops: enable` option in .rubocop.yml - includes them - when specifying `NewCops: pending` option in .rubocop.yml - does not include them - #cops - exposes a list of cops - with cops having the same inner-most module - exposes both cops - names_for_department - returns array of cops for specified department - #department? - returns true for department name - returns false for other names - #qualified_cop_name - returns the provided name if no namespace is found - qualifies names with the correct namespace - emits a warning when namespace is incorrect - gives back already properly qualified names - raises an error when a cop name is ambiguous - qualifies names without a namespace - #contains_cop_matching? - returns false for cops not included in the store - can find cops matching a given name +RuboCop::Cop::Style::RedundantSortBy + autocorrects array.sort_by { |y| y } + autocorrects array.sort_by do |x| x end + autocorrects array.sort_by { |x| x } + Ruby 2.7 + autocorrects array.sort_by { |x| x } -RuboCop::Cop::Style::RedundantRegexpCharacterClass - with a character class containing a space meta-character - registers an offense and corrects - with a character class containing a single character before `{n,m}` quantifier - registers an offense and corrects - with an interpolated unnecessary-character-class regexp - registers an offense and corrects - with a character class containing a negated posix bracket expression - does not register an offense - with a character class containing escaped character requiring escape outside - registers an offense and corrects - with a negated character class with a single element - does not register an offense - with a character class containing set intersection - does not register an offense - with consecutive escaped square brackets inside a character class - does not register an offense - with a character class containing a single unicode character property - registers an offense and corrects - with a character class containing a single character before `+` quantifier - registers an offense and corrects - with a multi-line interpolation - ignores offenses in the interpolated expression - with consecutive escaped square brackets - does not register an offense - with a character class containing a posix bracket expression - does not register an offense - with multiple character classes containing single characters - registers an offense and corrects - with escaped square brackets surrounding a single character - does not register an offense - with a character class containing an unescaped-# - registers an offense and corrects - with a character class containing an escaped-b - does not register an offense - with a character class containing an escaped ] - registers an offense and corrects - with a character class containing a single range - does not register an offense - with a character class containing a single character inside a group - registers an offense and corrects - with a character class containing a single unicode code-point - registers an offense and corrects - with a regexp containing invalid g escape - registers an offense and corrects - with a redundant character class after an interpolation - registers an offense and corrects - with an array index inside an interpolation - does not register an offense - with a character class containing an escaped [ - registers an offense and corrects - with a character class containing multiple unicode code-points - does not register an offense and corrects - with a character class with first element an escaped ] - does not register an offense - with %r{} regexp - with multiple character classes containing single characters - registers an offense and corrects - with a character class containing a single character inside a group - registers an offense and corrects - with a character class containing a single character before `+` quantifier - registers an offense and corrects - with a character class containing a single character +RuboCop::Formatter::QuietFormatter + #report_file + the file is outside of the current working directory + prints as absolute path + when the offense is automatically corrected + prints [Corrected] along with message + when the offense is not corrected + prints message as-is + when the offense is correctable + prints message as-is + the file is under the current working directory + prints as relative path + #report_summary + when 2 offenses detected and 2 offenses correctable + handles pluralization correctly + when 2 offenses are corrected + handles pluralization correctly + when a offense detected + handles pluralization correctly + when a file inspected and no offenses detected + handles pluralization correctly + when 2 offenses are corrected and 2 offenses correctable + handles pluralization correctly + when an offense is corrected + prints about correction + when 2 offenses detected + handles pluralization correctly + when a offense detected and a offense correctable + handles pluralization correctly + when no files inspected + handles pluralization correctly + +RuboCop::Cop::Cop + will set default severity + initially has 0 offenses + will set custom severity if present + keeps track of offenses + will warn if custom severity is invalid + will report registered offenses + .qualified_cop_name + returns the cop name in a different namespace if the provided namespace is incorrect + returns the given cop name if it already has a namespace + adds namespace if the cop name is found in exactly one namespace + returns the given cop name if it already has a namespace even when the cop exists in multiple namespaces + returns the given cop name if it is not found in any namespace + raises an error if the cop name is in more than one namespace + when disabled by a comment + ignore_disable_comments is true + will not set offense as disabled + ignore_disable_comments is false + will set offense as disabled + for a cop with a name + registers offense with its name + .documentation_url + for a custom cop class + is expected to be nil + for a builtin cop class + is expected to eq "https://docs.rubocop.org/rubocop/cops_layout.html#layoutblockendnewline" + #autocorrect? + when the option is given + is expected to equal true + when cop does not support autocorrection + is expected to equal false + when disable_uncorrectable is enabled + is expected to equal true + when the cop is set to not autocorrect + is expected to equal false + when the option is not given + is expected to equal false + Registry + #departments + is expected to include :Style + is expected to include :Lint + contains every value only once + has departments + #with_department + has at least one cop per department + has each cop in exactly one type + returns 0 for an invalid type + with lint cops + has right department + has right name + #safe_autocorrect? + when cop is declared unsafe + is expected to equal false + when autocorrection of the cop is declared unsafe + is expected to equal false + when safety is undeclared + is expected to equal true + #relevant_file? + when the file matches the Include configuration + is expected to equal true + when the file is an anonymous source + is expected to equal true + when the file doesn't match the Include configuration + is expected to equal false + setting of Offense#corrected attribute + when cop does not support autocorrection + is not specified (set to nil) + when autocorrect is requested + is not specified (set to nil) + when disable_uncorrectable is enabled + is set to true + when cop supports autocorrection + when autocorrection is not needed + is set to false + when offense was corrected + is set to true + when offense was not corrected because of an error + is set to false + with style cops + has right name + has right department + with no submodule + has right name + has right department + +RuboCop::Cop::Style::AndOr + when style is conditionals + accepts "and" in if body + accepts || inside of conditional + accepts "or" in post-while body + accepts "and" in while body + registers an offense for "and" in if condition + registers an offense for "or" in until condition + accepts && inside of conditional + accepts "and" in post-while body + registers an offense for "and" in post-while condition + accepts "and" outside of conditional + accepts "or" in if body + registers an offense for "and" in until condition + accepts "or" in post-until body + accepts "or" in until body + registers an offense for "or" in if condition + accepts "and" in post-until body + accepts "or" outside of conditional + registers an offense for "or" in post-while condition + registers an offense for "and" in while condition + registers an offense for "and" in post-until condition + registers an offense for "or" in while condition + accepts || outside of conditional + registers an offense for "or" in post-until condition + accepts && outside of conditional + accepts "or" in while body + accepts "and" in until body + when style is always + autocorrects "or" with an assignment on the right + autocorrects "and" with && in method calls (2) + also warns on until (or) + registers an offense for "and" + autocorrects "and" with && and adds parentheses to expr + autocorrects "or" with || and doesn't add extra parentheses + autocorrects "or" with || in method calls + autocorrects "or" with an assignment on the left + autocorrects "or" inside def + also warns on non short-circuit (and) + also warns on non short-circuit (and) (unless) + autocorrects "and" with && in method calls (3) + warns on short-circuit (and) + also warns on non short-circuit (or) + also warns on non short-circuit (or) (unless) + warns on short-circuit (or) + autocorrects "and" inside def + autocorrects "and" with && in method calls + also warns on while (or) + autocorrects "or" with || and adds parentheses to expr + autocorrects "or" with || in method calls (4) + also warns on until (and) + autocorrects "and" with && in method calls (4) + also warns on while (and) + autocorrects "or" with || in method calls (3) + autocorrects "and" with && and doesn't add extra parentheses + autocorrects "or" with || in method calls (2) + autocorrects "and" with an Enumerable accessor on either side + registers an offense for "or" + with predicate method with arg without space on right + autocorrects "or" with || and adds parens + autocorrects "and" with && and adds parens + with `not` expression on left + autocorrects "and" with && and adds parens + within a nested begin node with one child only + autocorrects "and" with && and adds parens + with a file which contains __FILE__ + autocorrects "or" with || + when `or` precedes `and` registers an offense and corrects - with a character class containing a single character before `{n,m}` quantifier + with !obj.method arg on right + autocorrects "and" with && and adds parens + when `and` precedes `||` registers an offense and corrects - with a character class containing an escaped-# - registers an offense and corrects - with a character class containing an interpolation - does not register an offense - with a character class containing a character requiring escape outside - does not register an offense - with a character class containing a space - with an unnecessary-character-class after a comment + with !obj.method arg on left + autocorrects "and" with && and adds parens + when `or` precedes `&&` registers an offense and corrects - when using free-spaced mode - with a commented single-element character class - does not register an offense - with a single space character class - does not register an offense with /ix - does not register an offense with only /x - does not register an offense with /iux - when not using free-spaced mode + with !variable on left + doesn't crash and burn + when `and` precedes `or` registers an offense and corrects - with a character class containing a single character - registers an offense and corrects - with a character class containing a single negated unicode character property - registers an offense and corrects - with a character class containing a negated-space meta-character - registers an offense and corrects - with a character class containing two characters - does not register an offense - with a character class containing an escaped-0 - does not register an offense - -RuboCop::Cop::Style::RedundantReturn - reports an offense for def with only a return - reports an offense for def ending with return - does not blow up on empty method body - reports an offense for def ending with return with splat argument - does not blow up on empty if body - reports an offense for defs ending with return - accepts return in a non-final position - reports an offense for defs with only a return - autocorrects by removing redundant returns - when multi-value returns are not allowed - reports an offense for def ending with return - autocorrects by making an implicit hash explicit - reports an offense for defs with only a return - autocorrects by removing return when using an explicit hash - reports an offense for defs ending with return - reports an offense when multiple return values have a parenthesized return value - reports an offense for def with only a return - when return is inside a when-branch - registers an offense and autocorrects - when return is inside begin-end body - registers an offense and autocorrects - when return is inside an if-branch - registers an offense and autocorrects - when case nodes are empty - accepts empty when nodes - when rescue and return blocks present - registers an offense and autocorrects when rescue has else clause - registers an offense and autocorrects when inside function or rescue block - when return has no arguments - behaves like common behavior - registers an offense for return() and autocorrects replacing return() with nil - behaves like common behavior - registers an offense for return and autocorrects replacing return with nil - when multi-value returns are allowed - accepts def with only a return - accepts defs with only a return - accepts defs ending with return - accepts def ending with return + with `not` expression on right + autocorrects "and" with && and adds parens + with obj.method= arg on left + autocorrects "and" with && and adds parens + within a nested begin node + autocorrects "and" with && and adds parens + with obj.method = arg on left + autocorrects "and" with && and adds parens + with one predicate method without space on right and another method + autocorrects "and" with && and adds parens + autocorrects "or" with || and adds parens + with two predicate methods with args without spaces on right + autocorrects "or" with || and adds parens + autocorrects "and" with && and adds parens + when left hand side is a comparison method + autocorrects "and" with && and adds parens -RuboCop::Cop::Lint::FloatOutOfRange - does not register an offense for tiny little itty bitty floats - does not register an offense for respectably sized floats - does not register an offense for 0.0 - on floats so close to zero that nobody can tell the difference - registers an offense - on whopping big floats which tip the scales - registers an offense +RuboCop::Cop::Lint::MissingCopEnableDirective + when the maximum range size is finite + registers an offense when a department is disabled and never re-enabled + registers an offense when a cop is disabled and never re-enabled + does not register an offense when the disable department is re-enabled within the limit + registers an offense when a cop is disabled for too many lines + registers an offense when a department is disabled for too many lines + does not register an offense when the disable cop is re-enabled within the limit + when the maximum range size is infinite + registers an offense when a cop is disabled and never re-enabled + registers an offense when a department is disabled and never re-enabled + does not register an offense when the disable department is re-enabled + does not register an offense when the disable cop is re-enabled + when the cop is disabled in the config + reports no offense when re-disabling it until EOF -RuboCop::Cop::Lint::AmbiguousAssignment - does not register an offense when no mistype assignments - registers an offense when using `!` with `x` - does not register an offense when no mistype assignments - does not register an offense when no mistype assignments - registers an offense when using `*` with `@@x` - does not register an offense when no mistype assignments - registers an offense when using `+` with `$x` - does not register an offense when no mistype assignments - does not register an offense when no mistype assignments - does not register an offense when no mistype assignments - does not register an offense when no mistype assignments - registers an offense when using `!` with `@@x` - registers an offense when using `!` with `X` - registers an offense when using `-` with `@x` - does not register an offense when no mistype assignments - does not register an offense when no mistype assignments - registers an offense when using `-` with `X` - does not register an offense when no mistype assignments - registers an offense when using `+` with `X` - does not register an offense when no mistype assignments - registers an offense when using `+` with `@@x` - registers an offense when using `*` with `x` - registers an offense when using `-` with `$x` - registers an offense when using `-` with `x` - registers an offense when using `+` with `x` - registers an offense when using `*` with `$x` - registers an offense when using `-` with `@@x` - does not register an offense when no mistype assignments - registers an offense when using `*` with `@x` - does not register an offense when no mistype assignments - does not register an offense when no mistype assignments - does not register an offense when no mistype assignments - does not register an offense when no mistype assignments - registers an offense when using `!` with `$x` - does not register an offense when no mistype assignments - registers an offense when using `+` with `@x` - registers an offense when using `*` with `X` - registers an offense when using `!` with `@x` - does not register an offense when no mistype assignments - does not register an offense when no mistype assignments +RuboCop::Cop::Metrics::Utils::AbcSizeCalculator + #calculate + multiple assignment with method setters + is expected to eq "<3, 5, 0>" + with &&= + is expected to eq "<2, 0, 1>" + with &.foo + is expected to eq "<0, 4, 2>" + with repeated lvar receivers + is expected to eq "<3, 5, 3>" + with .foo = + is expected to eq "<1, 2, 0>" + with ||= + is expected to eq "<2, 0, 1>" + with a for + is expected to eq "<2, 1, 1>" + equivalent to multiple assignment with method setters + is expected to eq "<3, 5, 0>" + with a block + is expected to eq "<2, 3, 0>" + with += + is expected to eq "<2, 0, 0>" + same but with 7 arguments + is expected to eq "<9, 3, 0>" + when counting repeated calls + is expected to eq "<1, 4, 0>" + method with arguments + is expected to eq "<4, 0, 0>" + with a yield + is expected to eq "<0, 1, 0>" + same with extra condition + is expected to eq "<2, 9, 5>" + with a known iterating block + is expected to eq "<2, 4, 2>" + multiple calls with return + is expected to eq "<0, 3, 0>" + assignment with ternary operator + is expected to eq "<2, 6, 2>" + when discounting repeated calls + when root receiver is self/nil + is expected to eq "<2, 9, 1>" + when root receiver is a var + is expected to eq "<3, 9, 0>" + when some calls have arguments + is expected to eq "<1, 7, 0>" + with unused assignments + is expected to eq "<2, 1, 0>" + with []= + is expected to eq "<2, 1, 0>" + with ||= on a constant + is expected to eq "<1, 0, 1>" + if and arithmetic operations + is expected to eq "<2, 8, 4>" + elsif vs else if + elsif + is expected to eq "<0, 5, 3>" + else if + is expected to eq "<0, 5, 4>" + with += for setters + is expected to eq "<1, 2, 0>" + multiple assignment + is expected to eq "<3, 1, 0>" -RuboCop::Cop::Lint::ImplicitStringConcatenation - when inside an array - notes that the strings could be separated by a comma instead - on a string with interpolations - does register an offense - on a single string literal - does not register an offense - on adjacent string literals on different lines - does not register an offense - on adjacent string literals on the same line - registers an offense - when the string literals contain newlines - does not register an offense for a single string - registers an offense - when in a method call's argument list - notes that the strings could be separated by a comma instead +RuboCop::Cop::Layout::EmptyLineAfterMagicComment + registers offense when frozen_string_literal used with shareable_constant_value without empty line + accepts magic comment with shareable_constant_value + accepts magic comment with typed + registers an offense for code that immediately follows comment + registers an offense when code that immediately follows typed comment + registers an offense when multiple magic comments without empty line + accepts an empty source file + accepts code that separates the comment from the code with a newline + registers an offense for documentation immediately following comment + accepts magic comment followed by encoding + accepts a source file with only a magic comment -RuboCop::Cop::Lint::HeredocMethodCallPosition - correct cases - ignores if no call - accepts simple correct case - accepts chained correct case - incorrect cases - simple incorrect case with paren - detects - simple incorrect case - detects - chained case without args - detects - with trailing comma in method call - detects - chained case with multiple line args - detects - chained case no parens - detects - chained case with parens - detects +RuboCop::Cop::Lint::RedundantSafeNavigation + registers an offense and corrects when `&.` is used inside complex condition + does not register an offense when using `&.` with non-allowed method in condition + does not register an offense when using `&.respond_to?` with `nil` specific method as argument in condition + does not register an offense when using `&.` outside of conditions + registers an offense and corrects when `&.` is used inside `#{loop_type}` condition + registers an offense and corrects when `&.` is used inside `if` condition + registers an offense and corrects when `&.` is used inside `unless` condition + registers an offense and corrects when `&.` is used inside `#{loop_type}` condition -RuboCop::Cop::Style::StabbyLambdaParentheses - require_no_parentheses - registers an offense for a stabby lambda with parentheses - behaves like common - does not check a stabby lambda without arguments - does not check the old lambda syntax - does not check a method call named lambda - require_parentheses - does not register an offense for a stabby lambda with parentheses - registers an offense for a stabby lambda without parentheses - behaves like common - does not check a stabby lambda without arguments - does not check the old lambda syntax - does not check a method call named lambda +RuboCop::Cop::InternalAffairs::SingleLineComparison + registers and corrects an offense when comparing `loc.first_line` with `loc.last_line` + does not register an offense when comparing the same line + registers and corrects an offense when comparing `source_range.first_line` with `source_range.last_line` + registers and corrects an offense when negative comparing `last_line` with `first_line` + registers and corrects an offense when negative comparing `first_line` with `last_line` + registers and corrects an offense when comparing `loc.last_line` with `loc.line` + does not register an offense when the receivers are not a match + registers and corrects an offense when comparing `loc.line` with `loc.last_line` + registers and corrects an offense when comparing `first_line` with `last_line` + registers and corrects an offense when comparing `last_line` with `first_line` + registers and corrects an offense when comparing `loc.last_line` with `loc.first_line` + registers and corrects an offense when comparing `source_range.last_line` with `source_range.first_line` -RuboCop::Cop::Layout::HeredocArgumentClosingParenthesis - correct cases - accepts correct case with other param after - accepts double correct case nested - accepts hash correct case - accepts simple correct case - accepts method with heredoc argument of proc correct case - accepts double correct case - accepts when there is an argument between a heredoc argument and the closing paretheses - accepts double correct case new line - accepts method chain with heredoc argument correct case - accepts correct case with other param before - invocation after the HEREDOC - ignores random call - ignores random call after - ignores tr - incorrect cases - incorrect case with other param before - detects - incorrect case in array with double heredoc and spaced out comma - detects - incorrect case with other param before constructor and raise call - detects - simple incorrect case squiggles - detects - incorrect case with other param after - detects - complex chained incorrect case with multiple calls - detects and fixes the first - incorrect case in array with nested calls and double heredoc and spaced out comma - detects - simple incorrect case hash - detects - nested incorrect case - detects - simple incorrect case comma with spaces - detects - simple incorrect case - detects - double incorrect case - detects - double incorrect case new line chained calls - detects - simple incorrect case comma - detects - incorrect case with other param before constructor - detects - double case new line - detects and fixes - simple incorrect case comma with spaces and comma in heredoc - detects - incorrect case nested method call with comma - detects - simple incorrect case with call after - detects - incorrect case in array with spaced out comma - detects - simple incorrect case with call after trailing comma - detects - complex incorrect case with multiple calls - detects and fixes the second - detects and fixes the first +RuboCop::Cop::Style::NestedModifier + autocorrects if + unless + autocorrects unless + if + does not add redundant parentheses in autocorrection + adds parentheses when needed in autocorrection + adds parentheses to method arguments when needed in autocorrection + autocorrects unless + unless + autocorrects if + if + registers one offense for more than two modifiers + autocorrects unless with a comparison operator + if + while + behaves like not correctable + does not autocorrect when while is the outer modifier + does not autocorrect when while is the inner modifier + until + behaves like not correctable + does not autocorrect when until is the outer modifier + does not autocorrect when until is the inner modifier -RuboCop::Cop::Lint::AmbiguousOperator - with a splat operator in the first argument - with parentheses around the splatted argument - does not register an offense - without parentheses - without whitespaces on the right of the operator - registers an offense and corrects - with a whitespace on the right of the operator - does not register an offense - when using safe navigation operator with a unary operator - does not register an offense - with a block ampersand in the first argument - without parentheses - with a whitespace on the right of the operator - does not register an offense - without whitespaces on the right of the operator - registers an offense and corrects - with parentheses around the block argument - does not register an offense - with a keyword splat operator in the first argument - without parentheses - with a whitespace on the right of the operator - does not register an offense - without whitespaces on the right of the operator - registers an offense and corrects - with parentheses around the keyword splat operator - does not register an offense - with `+` unary operator in the first argument - with parentheses around the operator - does not register an offense - without parentheses - with a whitespace on the right of the operator - does not register an offense - without whitespaces on the right of the operator - registers an offense and corrects - without whitespaces on the right of the operator when a method with no arguments is used in advance - registers an offense and corrects - with `-` unary operator in the first argument - with parentheses around the operator - does not register an offense - without parentheses - without whitespaces on the right of the operator - registers an offense and corrects - with a whitespace on the right of the operator - does not register an offense +RuboCop::Cop::Style::EndBlock + reports an offense and corrects END block + does not report offenses for other blocks -RuboCop::Config - whether the cop is enabled - when a cop has configuration but no explicit Enabled setting - enables the cop by default - when an entire cop department is disabled - but an individual cop is enabled - the cop setting overrides the department - when configuration has no mention of a cop - enables the cop that is not mentioned - when all cops are disabled by default - disables the cop that is not mentioned - when all cops are explicitly enabled by default - enables the cop that is not mentioned - when an entire cop department is enabled - but an individual cop is disabled - still disables the cop - when an nested cop department is disabled - and an individual cop is not specified - the cop setting overrides the department - but an individual cop is enabled - the cop setting overrides the department - #check - when a deprecated configuration is detected - prints a warning message for the loaded path - #possibly_include_hidden? - returns true when Include config includes a toplevel dotfile - returns true when Include config includes a dotfile in a path - returns true when Include config only includes regular paths - returns true when Include config includes a regex - #for_department - always returns the department's config - accepts a Symbol - #patterns_to_exclude - when config file has AllCops => Exclude key - returns the Exclude value - #deprecation_check - when there is AllCops configuration - if there are is an Excludes key - yields - if there are is an Includes key - yields - if there are no Excludes or Includes keys - does not yield - when there is no AllCops configuration - does not yield - #allowed_camel_case_file? - when the passed path does not match allowed camel case patterns to include - is expected to equal false - when the passed path is a gemspec - is expected to equal true - when the passed path matches allowed camel case patterns to include - is expected to equal true - #file_to_exclude? - when the passed path does not match any of patterns to exclude - returns false - when the passed path matches any of patterns to exclude - returns true - #make_excludes_absolute - when config is in subdirectory - generates valid absolute directory - when config is in root directory - generates valid absolute directory - #patterns_to_include - when config file has AllCops => Include key - returns the Include value - #validate - when all cops are both Enabled and Disabled by default - raises validation error - when the configuration includes any common parameter - does not raise validation error - when the configuration includes the obsolete Style/WhileUntilModifier: MaxLineLength parameter - raises validation error - when the configuration includes multiple but config does not allow - raises validation error - when the configuration includes any unrecognized cop name - raises an validation error - when the configuration includes multiple invalid enforced styles - raises validation error - when the configuration includes an invalid enforced style - raises validation error - when the configuration includes an empty section - raises validation error - when the configuration includes an invalid EnforcedStyle - raises validation error - conflicting Safe settings - when the configuration includes an unsafe cop that is explicitly declared to have a safe autocorrection - raises validation error - when the configuration includes an unsafe cop without a declaration of its autocorrection - does not raise validation error - when the empty section is AllCops - raises validation error - when the configuration includes multiple valid enforced styles and one invalid style - raises validation error - when the configuration includes a valid enforced style - does not raise validation error - when the configuration includes the obsolete Style/IfUnlessModifier: MaxLineLength parameter - raises validation error - when the configuration includes an obsolete parameter - raises validation error - when the configuration includes any unrecognized parameter - prints a warning message - when the configuration includes obsolete parameters and cops - raises validation error - when the configuration includes multiple valid enforced styles - does not raise validation error - when the configuration includes an obsolete EnforcedStyle parameter - raises validation error - when the configuration includes Lint/Syntax cop - when the configuration matches the default - does not raise validation error - when the configuration does not match the default - raises validation error - when the configuration includes a valid EnforcedStyle - does not raise validation error - when the configuration includes an obsolete cop - raises validation error - when the configuration includes any unrecognized cop name and given `--ignore-unrecognized-cops` option - there are no unrecognized cops - does not print any warnings - there is unrecognized cop - prints a warning about the cop - when the configuration is in the base RuboCop config folder - is not validated - #for_badge - works if department has no config - takes into account the department - #file_to_include? - when the passed path does not match any of patterns to include - returns false - when the passed path matches any of patterns to include - returns true +RuboCop::Cop::Style::TrailingCommaInArguments + with a single argument spanning multiple lines + when EnforcedStyleForMultiline is consistent_comma + accepts a single argument with no trailing comma + with single line list of values + when EnforcedStyleForMultiline is consistent_comma + accepts method call without trailing comma with single element hash parameters at the end + accepts heredoc without trailing comma + accepts chained single-line method calls + registers an offense for trailing comma preceded by whitespace in a method call + registers an offense for trailing comma in a method call + accepts method call without parameters + registers an offense for trailing comma in a method call with hash parameters at the end + accepts method call without trailing comma when a line break before a method call + accepts method call without trailing comma + when using safe navigation operator + registers an offense for trailing comma in a method call + registers an offense for trailing comma in a method call with hash parameters at the end + when EnforcedStyleForMultiline is comma + accepts method call without trailing comma with single element hash parameters at the end + registers an offense for trailing comma in a method call + accepts method call without parameters + registers an offense for trailing comma in a method call with hash parameters at the end + accepts method call without trailing comma when a line break before a method call + registers an offense for trailing comma preceded by whitespace in a method call + accepts heredoc without trailing comma + accepts method call without trailing comma + accepts chained single-line method calls + when using safe navigation operator + registers an offense for trailing comma in a method call with hash parameters at the end + registers an offense for trailing comma in a method call + when EnforcedStyleForMultiline is no_comma + registers an offense for trailing comma in a method call + accepts method call without trailing comma + registers an offense for trailing comma in a method call with hash parameters at the end + registers an offense for trailing comma preceded by whitespace in a method call + accepts method call without parameters + accepts heredoc without trailing comma + accepts chained single-line method calls + accepts method call without trailing comma when a line break before a method call + accepts method call without trailing comma with single element hash parameters at the end + when using safe navigation operator + registers an offense for trailing comma in a method call + registers an offense for trailing comma in a method call with hash parameters at the end + with multi-line list of values + when EnforcedStyleForMultiline is comma + accepts a trailing comma in a method call with single line hashes + accepts no trailing comma in a method call with a multiline braceless hash at the end with more than one parameter on a line + accepts a method call with two parameters on the same line + accepts missing comma after heredoc with comments + accepts trailing comma in a method call with hash parameters at the end + registers an offense for no trailing comma in a method call with hash parameters at the end + does not break when a safe method call is chained on the offending simple one + does not break when a method call is chained on the offending one + accepts a multiline call with a single argument and trailing comma + does not break when a safe method call is chained on the offending more complex one + accepts an empty hash being passed as a method argument + when closing bracket is on same line as last value + accepts a method call with Hash as last parameter split on multiple lines + when EnforcedStyleForMultiline is no_comma + accepts comma inside a heredoc with method and comments inside + accepts comma inside a heredoc with comments inside + accepts a method call with hash parameters at the end and no trailing comma + accepts comma inside a modified heredoc parameter + accepts comma inside a heredoc in brackets + accepts comma inside a heredoc parameter at the end + autocorrects unwanted comma after modified heredoc parameter + registers an offense for trailing comma in a method call with hash parameters at the end + when there is string interpolation inside heredoc parameter + autocorrects unwanted comma inside string interpolation + accepts comma inside a heredoc parameter when on a single line + accepts comma inside a heredoc parameter + when EnforcedStyleForMultiline is consistent_comma + registers an offense for no trailing comma in a method call withtwo parameters on the same line + autocorrects missing comma after a heredoc + accepts no trailing comma in a method call with a block parameter at the end + registers an offense for no trailing comma in a method call with hash parameters at the end + accepts a multiline call with single argument on multiple lines + accepts a multiline call with a single argument and trailing comma + accepts a trailing comma in a method call with a single hash parameter to a receiver object + accepts a trailing comma in a method call with a single hash parameter + accepts a multiline call with arguments on a single line and trailing comma + accepts trailing comma in a method call with hash parameters at the end + accepts a trailing comma in a method call with single line hashes + when closing bracket is on same line as last value + registers an offense for a method call, with a Hash as the last parameter, split on multiple lines + with a single argument of anonymous function spanning multiple lines + when EnforcedStyleForMultiline is consistent_comma + accepts a single argument with no trailing comma -RuboCop::Cop::Bundler::GemFilename - with EnforcedStyle set to `gems.rb` - with gems.rb file path - does not register an offense - with non-root gems.locked file path - does not register an offense - with Gemfile file path - registers an offense - with non-root gems.rb file path - does not register an offense - with non-root Gemfile.lock file path - registers an offense - with non-root Gemfile file path - registers an offense - with Gemfile.lock file path - registers an offense - with default configuration (EnforcedStyle => `Gemfile`) - with non-root gems.rb file path - registers an offense - with non-root Gemfile.lock file path - does not register an offense - with gems.locked file path - registers an offense - with non-root Gemfile file path - does not register an offense - with Gemfile file path - does not register an offense - with non-root gems.locked file path - registers an offense - with Gemfile.lock file path - does not register an offense - with gems.rb file path - registers an offense +RuboCop::Cop::Style::MethodCalledOnDoEndBlock + with a single-line do..end block + accepts a single-line do..end block with a chained block + registers an offense for a chained call + with a multi-line do..end block + accepts a chained block + accepts it if there is no chained call + registers an offense for a chained call + when using safe navigation operator + registers an offense for a chained call + with a {} block + accepts a multi-line block with a chained call + accepts a single-line block with a chained call + Ruby 2.7 + registers an offense for a chained call -RuboCop::Cop::Style::HashTransformKeys - when using Ruby 2.5 or newer - flags Hash[_.map{...}] when transform_keys could be used - does not flag key transformation when receiver is array literal - does not flag each_with_object when both key & value are transformed - does not flag each_with_object when its receiver is array literal - does not flag `each_with_object` when its argument is used in the key - does not flag `each_with_object` when its receiver is `each_with_index` - flags _.map{...}.to_h when transform_keys could be used - correctly autocorrects _.map{...}.to_h without block - correctly autocorrects Hash[_.map{...}] - does not flag each_with_object when key transformation uses value - does not flag `_.map{...}.to_h` when its receiver is `each_with_index` - correctly autocorrects _.map{...}.to_h with block - does not flag `Hash[_.map{...}]` when its receiver is `each_with_index` - does not flag _.map{...}.to_h when both key & value are transformed - does not flag `Hash[_.map{...}]` when its receiver is an array literal - does not flag each_with_object when no transformation occurs - does not flag `_.map{...}.to_h` when its receiver is `zip` - flags _.map{...}.to_h when transform_keys could be used when line break before `to_h` - does not flag `Hash[_.map{...}]` when its receiver is `with_index` - does not flag Hash[_.map{...}] when both key & value are transformed - does not flag each_with_object when its argument is not modified - does not flag key transformation in the absence of to_h - does not flag `_.map{...}.to_h` when its receiver is `with_index` - does not flag `each_with_object` when its receiver is `with_index` - does not flag `Hash[_.map{...}]` when its receiver is `zip` - does not flag `each_with_object` when its receiver is `zip` - flags _.map {...}.to_h when transform_keys could be used when wrapped in another block - does not flag _.map {...}.to_h when key block argument is unused - with safe navigation operator - flags each_with_object when transform_keys could be used - with multiline block - flags each_with_object when transform_keys could be used - with inline block - flags each_with_object when transform_keys could be used - below Ruby 2.5 - does not flag even if transform_keys could be used - below Ruby 2.6 - does not flag _.to_h{...} - when using Ruby 2.6 or newer - flags _.to_h{...} when transform_keys could be used - does not flag `_.to_h{...}` when its receiver is an array literal - does not flag `_.to_h{...}` when its receiver is `zip` - does not flag `_.to_h{...}` when its receiver is `with_index` - does not flag `_.to_h{...}` when its receiver is `each_with_index` - does not flag `_.to_h{...}` when both key & value are transformed - does not flag _.to_h {...} when key block argument is unused +RuboCop::Cop::InternalAffairs::NumblockHandler + registers an offense for cops with forgotten numblock handlers + does not register an offense for cops with on_numblock alias + does not register an offense for cops with on_numblock method + does not register an offense for cops with on_numblock alias_method -RuboCop::Cop::Style::HashLikeCase - MinBranchesCount: 3 - does not register an offense when branches count is less than required - MinBranchesCount: 2 - does not register an offense when using `case-when` with literals of different types as conditions - does not register an offense when using `case-when` with literal bodies of different types - does not register an offense when using `case-when` with non-literals in conditions - does not register an offense when `case` has an `else` branch - registers an offense when using `case-when` with symbol conditions and literal bodies of the same type - registers an offense when using `case-when` with string conditions and literal bodies of the same type - does not register an offense when using `case-when` with non-literal bodies +RuboCop::Cop::Style::IfInsideElse + ignores unless inside else + catches an `if..else` nested inside an `else` and nested inside `if` branch code is empty + isn't offended by if..elsif..else + isn't offended if there is a statement following the if node + ignores nested ternary expressions + catches an if..else nested inside an else + catches an if node nested inside an else + handles a nested multiline `if...then...elsif...else...end` + isn't offended if there is a statement preceding the if node + ignores ternary inside if..else + handles a nested `if...then...end` + catches a modifier if nested inside an else after elsif + catches an if..elsif..else nested inside an else + handles a nested `if...then...else...end` + ignores if inside unless + handles a nested `if...then...elsif...else...end` + handles a nested `if...then...elsif...end` + when AllowIfModifier is false + catches a modifier if nested inside an else + when AllowIfModifier is true + accepts a modifier if nested inside an else -RuboCop::Cop::Style::ArgumentsForwarding - TargetRubyVersion >= 3.1 - registers an offense when using restarg and anonymous block arg - registers an offense when using restarg, kwargs, and anonymous block arg - TargetRubyVersion >= 2.7 - registers an offense when using restarg, kwargs and block arg - does not register an offense when different arguments are used - does not register an offense when using arguments forwarding - does not register an offense when different argument names are used - registers an offense when passing restarg and block arg in defs - does not register an offense when the block arg is overwritten - does not register an offense when body of method definition is empty - registers an offense when forwarding to a method in block - registers an offense when delegating - does not register an offense when referencing the restarg outside forwarding method arguments - registers an offense when the parentheses of arguments are omitted - does not register an offense when the restarg is overwritten - does not register an offense when using the restarg outside forwarding method arguments - does not register an offense when the kwarg is overwritten - registers an offense when using restarg and block arg - does not register an offense when assigning the restarg outside forwarding method arguments - AllowOnlyRestArgument: true - does not register an offense when using only kwrest arg - does not register an offense when using only rest arg - AllowOnlyRestArgument: false - registers an offense when using only rest arg - registers an offense when using only kwrest arg - TargetRubyVersion <= 2.6 - does not register an offense when using restarg with block arg +RuboCop::Cop::Style::SymbolLiteral + accepts string syntax when symbols have special chars in them + registers an offense for word-line symbols using string syntax + accepts string syntax when symbols have whitespaces in them + accepts string syntax when symbol start with a digit -RuboCop::Cop::Style::SelectByRegexp - with select - registers an offense if `to_h` is in the receiver chain but not the actual receiver - does not register an offense when the block uses an external variable in a regexp match - registers an offense and corrects when the receiver is a set - registers an offense and corrects for `blockvar =~ regexp` - does not register an offense when the block arity is not 1 - registers an offense and corrects with a multiline block - does not register an offense when the block param is a method argument - registers an offense and corrects for `match?` - registers an offense and corrects without a receiver - does not register an offense when the block does not match a regexp - does not register an offense when the receiver is `Hash[]` - does not register an offense when the receiver is `ENV` - registers an offense and corrects for `lvar =~ blockvar` - does not register an offense when given a proc - registers an offense and corrects for `Regexp#match?` - does not register an offense when the receiver is `to_h` - registers an offense and corrects for `blockvar =~ lvar` - does not register an offense when the receiver is a hash literal - registers an offense and corrects when the receiver is a range - does not register an offense when the receiver is `to_hash` - registers an offense and corrects when the receiver is an array - does not register an offense when the block has multiple expressions - does not register an offense when the receiver is `Hash.new` - registers an offense and corrects when there is no explicit regexp - does not register an offense when there is no block - registers an offense and corrects for `regexp =~ blockvar` - with `numblock`s - does not register an offense if there is more than one numbered param - does not register an offense when the param is a method argument - registers an offense and corrects for `regexp =~ blockvar` - does not register an offense when using `match?` without a receiver - registers an offense and corrects for `match?` - registers an offense and corrects for `Regexp#match?` - registers an offense and corrects for `blockvar =~ regexp` - with reject - does not register an offense when the receiver is `to_h` - does not register an offense when the receiver is `ENV` - does not register an offense when the block param is a method argument - does not register an offense when the block uses an external variable in a regexp match - registers an offense and corrects when there is no explicit regexp - registers an offense and corrects for `regexp =~ blockvar` - registers an offense and corrects for `blockvar =~ lvar` - registers an offense and corrects when the receiver is a set - registers an offense and corrects when the receiver is an array - does not register an offense when the receiver is a hash literal - does not register an offense when the block arity is not 1 - registers an offense and corrects for `match?` - registers an offense and corrects when the receiver is a range - registers an offense and corrects for `lvar =~ blockvar` - does not register an offense when the block has multiple expressions - registers an offense if `to_h` is in the receiver chain but not the actual receiver - does not register an offense when the receiver is `to_hash` - does not register an offense when there is no block - does not register an offense when given a proc - does not register an offense when the receiver is `Hash[]` - registers an offense and corrects without a receiver - registers an offense and corrects with a multiline block - does not register an offense when the block does not match a regexp - registers an offense and corrects for `blockvar =~ regexp` - registers an offense and corrects for `Regexp#match?` - does not register an offense when the receiver is `Hash.new` - with `numblock`s - registers an offense and corrects for `Regexp#match?` - does not register an offense when the param is a method argument - does not register an offense if there is more than one numbered param - does not register an offense when using `match?` without a receiver - registers an offense and corrects for `regexp =~ blockvar` - registers an offense and corrects for `match?` - registers an offense and corrects for `blockvar =~ regexp` - with find_all - registers an offense and corrects for `match?` - registers an offense and corrects when the receiver is a set - registers an offense and corrects for `blockvar =~ lvar` - registers an offense and corrects for `Regexp#match?` - does not register an offense when the receiver is `ENV` - does not register an offense when the block arity is not 1 - does not register an offense when given a proc - does not register an offense when the receiver is `to_h` - registers an offense and corrects when the receiver is a range - registers an offense and corrects for `regexp =~ blockvar` - registers an offense and corrects when the receiver is an array - registers an offense if `to_h` is in the receiver chain but not the actual receiver - registers an offense and corrects when there is no explicit regexp - does not register an offense when the receiver is a hash literal - registers an offense and corrects for `lvar =~ blockvar` - does not register an offense when the block param is a method argument - does not register an offense when the receiver is `to_hash` - registers an offense and corrects without a receiver - does not register an offense when the receiver is `Hash[]` - registers an offense and corrects with a multiline block - does not register an offense when the block does not match a regexp - does not register an offense when the block has multiple expressions - registers an offense and corrects for `blockvar =~ regexp` - does not register an offense when the receiver is `Hash.new` - does not register an offense when there is no block - does not register an offense when the block uses an external variable in a regexp match - with `numblock`s - does not register an offense if there is more than one numbered param - registers an offense and corrects for `Regexp#match?` - registers an offense and corrects for `blockvar =~ regexp` - registers an offense and corrects for `regexp =~ blockvar` - does not register an offense when the param is a method argument - registers an offense and corrects for `match?` - does not register an offense when using `match?` without a receiver +RuboCop::Cop::Lint::NextWithoutAccumulator + behaves like reduce/inject + given a inject block + registers an offense for a bare next + accepts next with a value + accepts next within a nested block + Ruby 2.7 + registers an offense for a bare next + given an unrelated block + accepts next with a value + accepts a bare next + behaves like reduce/inject + given a reduce block + accepts next within a nested block + accepts next with a value + registers an offense for a bare next + Ruby 2.7 + registers an offense for a bare next -RuboCop::Cop::Layout::MultilineMethodArgumentLineBreaks - when there are multiple arguments on the first line - registers an offense and corrects starting from the 2nd argument - when two arguments are on next line - does not add any offenses - when many arguments are on multiple lines, two on same line - registers an offense and corrects - when bracket hash assignment on multiple lines - does not add any offenses - when many arguments including hash are on multiple lines, three on same line - registers an offense and corrects - when many arguments are on multiple lines, three on same line - registers an offense and corrects - when one argument on same line - does not add any offenses - when argument starts on same line but ends on different line - registers an offense and corrects - when second argument starts on same line as end of first - registers an offense and corrects - when bracket hash assignment key on multiple lines - does not add any offenses +RuboCop::Cop::Lint::UriEscapeUnescape + registers an offense when using `::URI.escape('http://example.com')` + registers an offense when using `::URI.encode('http://example.com)` + registers an offense when using `URI.unescape(enc_uri)` + registers an offense when using `URI.escape('@?@!', '!?')` + registers an offense when using `URI.escape('http://example.com')` + registers an offense when using `URI.encode('http://example.com')` + registers an offense when using `::URI.unescape(enc_uri)` + registers an offense when using `URI.decode(enc_uri)` + registers an offense when using `::URI.decode(enc_uri)` -RuboCop::Cop::Style::CaseEquality - when AllowOnConstant is false - registers an offense and corrects for === when the receiver is a regexp - registers an offense and corrects for === when the receiver is a range - does not fail when the receiver is implicit - does not register an offense for === when the receiver is not a camel cased constant - registers an offense and does not correct for === when receiver is of some other type - registers an offense and corrects for === when the receiver is a constant - when AllowOnSelfClass is false - does not register an offense for === when the receiver is not a camel cased constant - registers an offense and corrects for === when the receiver is a regexp - does not fail when the receiver is implicit - registers an offense and corrects for === when the receiver is self.class - registers an offense and does not correct for === when receiver is of some other type - registers an offense and corrects for === when the receiver is a range - when AllowOnSelfClass is true - registers an offense and corrects for === when the receiver is self.klass - does not register an offense for === when the receiver is not a camel cased constant - does not register an offense for === when the receiver is self.class - registers an offense and corrects for === when the receiver is a regexp - registers an offense and corrects for === when the receiver is a range - does not fail when the receiver is implicit - registers an offense and does not correct for === when receiver is of some other type - when AllowOnConstant is true - does not fail when the receiver is implicit - does not register an offense for === when the receiver is not a camel cased constant - registers an offense and corrects for === when the receiver is a range - registers an offense and does not correct for === when receiver is of some other type - does not register an offense for === when the receiver is a constant - registers an offense and corrects for === when the receiver is a regexp +RuboCop::Cop::Layout::ClosingHeredocIndentation + does not register an offense for a << heredoc + accepts correctly indented closing heredoc when heredoc contents with blank line + registers an offense for incorrectly indented empty heredocs + does not register an offense for correctly indented empty heredocs + accepts correctly indented closing heredoc when aligned at the beginning of method definition + accepts correctly indented closing heredoc when aligned at the beginning of method definition and using `strip_indent` + accepts correctly indented closing heredoc when heredoc contents is after closing heredoc + accepts correctly indented closing heredoc + accepts correctly indented closing heredoc when heredoc contents is before closing heredoc + registers an offense for bad indentation of a closing heredoc + accepts correctly indented closing heredoc when aligned at the beginning of method definition and content is empty -RuboCop::TargetFinder - #find_files - can exclude symlinks as well as directories - does not search excluded top level directories - works also if a folder is named "**" - works also if a folder is named "," - works also if a folder is named "{}" - resolves symlinks when looking for excluded directories - prevents infinite loops when traversing symlinks - #find(..., :only_recognized_file_types) - returns absolute paths - does not find hidden files - when a file with a ruby filename is passed - picks all the ruby files - when some non-known Ruby files are specified in the configuration Include and they are not explicitly passed as arguments - includes them - when same paths are passed - does not return duplicated file paths - when some non-known Ruby files are specified in the configuration Include and they are explicitly passed as arguments - includes them - when a hidden directory path is passed - finds files under the specified directory - when some paths are specified in the configuration Exclude and they are explicitly passed as arguments - when it's forced to adhere file exclusion configuration - excludes them - normally - does not exclude them - when a pattern is passed - finds files which match the pattern - when input is passed on stdin - includes the file - when files with a ruby extension are passed - picks all the ruby files - when local AllCops/Include lists two patterns - picks two files - when a subdirectory AllCops/Include only lists one pattern - picks two files - when a non-ruby file is passed - doesn't pick the file - when a hidden directory path is passed - finds files under the specified directory - when files with ruby interpreters are passed - picks all the ruby files - when a directory path is passed - finds files under the specified directory - when no argument is passed - finds files under the current directory - #find(..., :all_file_types) - returns absolute paths - does not find hidden files - when a hidden directory path is passed - finds files under the specified directory - when a non-ruby file is passed - picks the file - when no argument is passed - finds files under the current directory - when a directory path is passed - finds files under the specified directory - when a file with a ruby filename is passed - picks all the ruby files - when some paths are specified in the configuration Exclude and they are explicitly passed as arguments - normally - does not exclude them - when it's forced to adhere file exclusion configuration - excludes them - when some non-known Ruby files are specified in the configuration Include and they are not explicitly passed as arguments - includes them - when a pattern is passed - finds files which match the pattern - when same paths are passed - does not return duplicated file paths - when files with ruby interpreters are passed - picks all the ruby files - when some non-known Ruby files are specified in the configuration Include and they are explicitly passed as arguments - includes them - when files with a ruby extension are passed - picks all the ruby files - when local AllCops/Include lists two patterns - picks all the ruby files - when a subdirectory AllCops/Include only lists one pattern - picks all the ruby files - when input is passed on stdin - includes the file - #target_files_in_dir - does not pick directories - picks files with extension .rb - does not pick files with no extension and no ruby shebang - picks ruby executable files with no extension - does not pick files specified to be excluded in config - picks files specified to be included in config - when an exception is raised while reading file - and debug mode is disabled - outputs nothing - and debug mode is enabled - outputs error message - w/ --fail-fast option - works with the expected number of .rb files +RuboCop::Cop::Style::ArrayCoercion + does not register an offense when splatting multiple variables into array + registers an offense and corrects when splatting variable into array + does not register an offense when splat is not in array + does not register an offense when converting variable into other named array variable with check + registers an offense and corrects when converting variable into array with check -RuboCop::Cop::InternalAffairs::MethodNameEndWith - registers offense if there is potentially usage of `bang_method?` - does not register offense if argument for end_with? is some other string - registers offense if there is potentially usage of `bang_method?` with safe navigation operator - registers an offense if there is potentially usage of `assignment_method?` - registers an offense if `method_name` is a variable and there is potentially usage of `assignment_method?` - registers offense if there is potentially usage of `predicate_method?` - Ruby >= 2.7 - registers offense if argument for Symbol#end_with? is '?' with safe navigation operator - registers offense if argument for Symbol#end_with? is '!' with safe navigation operator - registers offense if argument for Symbol#end_with? is '!' - registers offense if argument for Symbol#end_with? is '?' - does not register offense if argument for Symbol#end_with? is some other string - registers an offense if method_name is symbol - registers an offense if method_name is symbol with safe navigation operator +RuboCop::Cop::Lint::SendWithMixinArgument + registers an offense when using `send` with `prepend` + does not register an offense when using `extend` + does not register an offense when not using a mixin method + does not register an offense when using `include` + registers an offense when using `__send__` method + registers an offense when using `public_send` method + registers an offense when using `send` with `include` + does not register an offense when using `prepend` + registers an offense when using `send` with `extend` + when using namespace for module + registers an offense when using `send` with `include` + when specifying a mixin method as a string + registers an offense when using `send` with `extend` + registers an offense when using `send` with `include` + registers an offense when using `send` with `prepend` -RuboCop::Cop::Lint::ToEnumArguments - registers an offense when required keyword arg is missing - does not register an offense when method call has a receiver other than `self` - registers an offense when splat keyword arg is missing - registers an offense when enumerator is created for `__method__` with missing arguments - registers an offense when other values are passed for keyword arguments - registers an offense when required arg is missing - registers an offense when enumerator is created for another method - does not register an offense when not inside method definition - registers an offense when method is called on `self` - registers an offense when optional keyword arg is missing - does not register an offense when enumerator is created with `__callee__` and the correct arguments - registers an offense when optional arg is missing - registers an offense when arguments are swapped - does not register an offense when enumerator is created with `__method__` and the correct arguments - ignores the block argument - registers an offense when splat arg is missing - does not register an offense when enumerator is created with `:m` and the correct arguments - arguments forwarding - does not register an offense when enumerator is created with the correct arguments - registers an offense when enumerator is created with non matching arguments +RuboCop::Cop::Style::RedundantSort + does not register an offense when sort_by is not given a block + registers an offense when last is called on sort with comparator + does not register an offense for sort_by!(&:something).last + registers an offense when at(0) is called on sort_by + registers an offense when first is called on sort_by no block + registers an offense when at(-1) is called with sort + registers an offense when [](-1) is called on sort_by + registers an offense when first is called on sort_by with line breaks and `&&` operator + does not register an offense for sort!.first + does not register an offense when first is used without sort_by + registers an offense when [](0) is called on sort + registers an offense when last is called on sort_by no block + registers an offense when slice(-1) is called on sort_by + does not register an offense when first has an argument + registers an offense when first is called on sort_by with line breaks and `||` operator + does not register an offense when sort_by is used without first + registers an offense when slice(0) is called on sort_by + registers an offense when first is called on sort_by with line breaks and `and` operator + registers an offense when last is called on sort_by + does not register an offense when first is used before sort + registers an offense when [-1] is called on sort_by + registers an offense when [0] is called on sort_by + registers an offense when first is called on sort_by + registers an offense when first is called on sort_by with line breaks and `or` operator + registers an offense with `sort_by { a || b }` + registers an offense when [0] is called on sort + registers an offense when last is called with sort + does not register an offense when sort has an argument + registers an offense when slice(0) is called on sort + registers an offense when [-1] is called on sort + registers an offense when first is called on sort_by with line breaks + registers an offense when first is called with sort + >= Ruby 2.7 + when using numbered parameter + registers an offense and corrects when first is called on sort_by + registers an offense and corrects when last is called on sort with comparator + registers an offense and corrects when at(0) is called on sort_by + when not taking first or last element + does not register an offense when at(-2) is called on sort_by + does not register an offense when [-1] is called on sort with an argument + does not register an offense when [1] is called on sort -RuboCop::Cop::InternalAffairs::EmptyLineBetweenExpectOffenseAndCorrection - registers and corrects an offense when using no empty line between `expect_offense` and `expect_correction`with variable argument - does not register an offense when using empty line between `expect_offense` and `expect_correction` with heredoc argument - registers and corrects an offense when using no empty line between `expect_offense` and `expect_correction` with heredoc argument - does not register an offense when using empty line between `expect_offense` and `expect_no_corrections` - does not register an offense when using empty line between `expect_offense` and `expect_correction`with variable argument - registers and corrects an offense when using no empty line between `expect_offense` and `expect_no_corrections` - does not register an offense when using only `expect_offense` +RuboCop::Cop::Security::YAMLLoad + registers an offense and corrects a fully qualified ::YAML.load + registers an offense and corrects load with a literal string + does not register an offense for YAML.load under a different namespace + does not register an offense for YAML.dump + Ruby >= 3.1 + does not register an offense and corrects a fully qualified `::YAML.load` + does not register an offense and corrects load with a literal string -RuboCop::Cop::Gemspec::RubyVersionGlobalsUsage - registers an offense when using `::RUBY_VERSION` - registers an offense when using `RUBY_VERSION` - does not register an offense when no `RUBY_VERSION` - -RuboCop::Cop::Style::MutableConstant - Strict: true - freezes a heredoc - allows calls to freeze - behaves like string literal - Ruby 3.0 or higher - when the frozen string literal comment is true - registers an offense when using a multiline string with interpolation - does not register an offense when using a multiline string - registers an offense when using interpolated heredoc constant - behaves like mutable objects - when assigning with ||= - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows <<~HERE - foo - bar -HERE - to be ||= to a constant - allows <<~HERE - foo - bar -HERE - to be assigned to a constant - when the frozen string literal comment is missing - behaves like mutable objects - when assigning with ||= - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when the frozen string literal comment is false - behaves like mutable objects - when assigning with ||= - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - Ruby 2.7 or lower - when the frozen string literal comment is false - behaves like mutable objects - when assigning with ||= - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when the frozen string literal comment is true - does not register an offense when using interpolated heredoc constant - does not register an offense when using a multiline string - behaves like immutable objects - allows "#{a}" to be ||= to a constant - allows "#{a}" to be assigned to a constant - behaves like immutable objects - allows <<~HERE - foo - bar -HERE - to be ||= to a constant - allows <<~HERE - foo - bar -HERE - to be assigned to a constant - when the frozen string literal comment is missing - behaves like mutable objects - when assigning with ||= - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows ::Struct.new to be ||= to a constant - allows ::Struct.new to be assigned to a constant - behaves like mutable objects - when assigning with = - registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze - operators that produce unfrozen objects - registers an offense when operating on a constant and a string - registers an offense when operating on multiple strings - methods and operators that produce frozen objects - accepts operating on a constant and a float - accepts comparison operators - accepts operating on a constant and an interger - accepts checking fixed size - accepts operating on multiple integers - accepts operating on multiple floats - accepts assigning to an environment variable with a fallback - behaves like immutable objects - allows ::OTHER_CONST to be assigned to a constant - allows ::OTHER_CONST to be ||= to a constant - behaves like immutable objects - allows ::Namespace::OTHER_CONST to be ||= to a constant - allows ::Namespace::OTHER_CONST to be assigned to a constant - behaves like immutable objects - allows Struct.new to be assigned to a constant - allows Struct.new to be ||= to a constant - behaves like mutable objects - when assigning with = - registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze - behaves like mutable objects - when assigning with = - registers an offense for Something.new assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for Something.new assigned to a constant and corrects by adding .freeze - behaves like mutable objects - when assigning with = - registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows ENV['foo'] to be assigned to a constant - allows ENV['foo'] to be ||= to a constant - behaves like immutable objects - allows OTHER_CONST to be ||= to a constant - allows OTHER_CONST to be assigned to a constant - behaves like immutable objects - allows 1.5 to be ||= to a constant - allows 1.5 to be assigned to a constant - behaves like immutable objects - allows ::ENV['foo'] to be assigned to a constant - allows ::ENV['foo'] to be ||= to a constant - when assigning with multiple operator calls - registers an offense and corrects with parens and freeze - behaves like immutable objects - allows Namespace::OTHER_CONST to be assigned to a constant - allows Namespace::OTHER_CONST to be ||= to a constant - splat expansion - expansion of a range - registers an offense and corrects to use to_a.freeze - with parentheses - registers an offense and corrects to use to_a.freeze - behaves like immutable objects - allows Struct.new(:node) do - def assignment? - true - end -end - to be assigned to a constant - allows Struct.new(:node) do - def assignment? - true - end -end - to be ||= to a constant - behaves like immutable objects - allows Struct.new(:a, :b) to be assigned to a constant - allows Struct.new(:a, :b) to be ||= to a constant - when assigning with an operator - behaves like operator methods - registers an offense and corrects with parens and freeze - behaves like operator methods - registers an offense and corrects with parens and freeze - behaves like operator methods - registers an offense and corrects with parens and freeze - behaves like operator methods - registers an offense and corrects with parens and freeze - behaves like operator methods - registers an offense and corrects with parens and freeze - behaves like operator methods - registers an offense and corrects with parens and freeze - when assigning an array without brackets - adds brackets when autocorrecting - does not insert brackets for %w() arrays - behaves like immutable objects - allows 1 to be ||= to a constant - allows 1 to be assigned to a constant - behaves like mutable objects - when assigning with ||= - registers an offense for 'str' assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for 'str' assigned to a constant and corrects by adding .freeze - behaves like mutable objects - when assigning with = - registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows :sym to be ||= to a constant - allows :sym to be assigned to a constant - Strict: false - allows method call assignments - behaves like mutable objects - when assigning with ||= - registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze - Ruby 3.0 or higher - raises offense only for shareable_constant_value as none when set in the order of: literal, none and experimental_everything - raises offense when shareable_constant_value is specified as an inline comment - when assigning a regexp - does not register an offense - when assigning a range (erange) - does not register an offense when without parenthesis - does not register an offense when with parenthesis - when using shareable_constant_value - behaves like literals that are frozen - behaves like immutable objects - allows 'str' to be assigned to a constant - allows 'str' to be ||= to a constant - behaves like immutable objects - allows [1, 2, 3] to be assigned to a constant - allows [1, 2, 3] to be ||= to a constant - behaves like immutable objects - allows :sym to be ||= to a constant - allows :sym to be assigned to a constant - behaves like immutable objects - allows "top#{1 + 2}" to be ||= to a constant - allows "top#{1 + 2}" to be assigned to a constant - behaves like immutable objects - allows FOO - BAR to be assigned to a constant - allows FOO - BAR to be ||= to a constant - behaves like immutable objects - allows %w(a b c) to be ||= to a constant - allows %w(a b c) to be assigned to a constant - behaves like immutable objects - allows { a: 1, b: 2 } to be ||= to a constant - allows { a: 1, b: 2 } to be assigned to a constant - behaves like immutable objects - allows ENV['foo'] to be assigned to a constant - allows ENV['foo'] to be ||= to a constant - behaves like immutable objects - allows 'foo' + 'bar' to be ||= to a constant - allows 'foo' + 'bar' to be assigned to a constant - behaves like immutable objects - allows ::ENV['foo'] to be assigned to a constant - allows ::ENV['foo'] to be ||= to a constant - behaves like immutable objects - allows FOO + BAR to be ||= to a constant - allows FOO + BAR to be assigned to a constant - behaves like immutable objects - allows 1 to be assigned to a constant - allows 1 to be ||= to a constant - behaves like immutable objects - allows 1.5 to be assigned to a constant - allows 1.5 to be ||= to a constant - behaves like literals that are frozen - behaves like immutable objects - allows "top#{1 + 2}" to be ||= to a constant - allows "top#{1 + 2}" to be assigned to a constant - behaves like immutable objects - allows 'str' to be ||= to a constant - allows 'str' to be assigned to a constant - behaves like immutable objects - allows 1 to be assigned to a constant - allows 1 to be ||= to a constant - behaves like immutable objects - allows FOO - BAR to be assigned to a constant - allows FOO - BAR to be ||= to a constant - behaves like immutable objects - allows 1.5 to be ||= to a constant - allows 1.5 to be assigned to a constant - behaves like immutable objects - allows :sym to be ||= to a constant - allows :sym to be assigned to a constant - behaves like immutable objects - allows 'foo' + 'bar' to be assigned to a constant - allows 'foo' + 'bar' to be ||= to a constant - behaves like immutable objects - allows FOO + BAR to be assigned to a constant - allows FOO + BAR to be ||= to a constant - behaves like immutable objects - allows %w(a b c) to be ||= to a constant - allows %w(a b c) to be assigned to a constant - behaves like immutable objects - allows { a: 1, b: 2 } to be ||= to a constant - allows { a: 1, b: 2 } to be assigned to a constant - behaves like immutable objects - allows ENV['foo'] to be assigned to a constant - allows ENV['foo'] to be ||= to a constant - behaves like immutable objects - allows ::ENV['foo'] to be ||= to a constant - allows ::ENV['foo'] to be assigned to a constant - behaves like immutable objects - allows [1, 2, 3] to be ||= to a constant - allows [1, 2, 3] to be assigned to a constant - behaves like literals that are not frozen - behaves like mutable objects - when assigning with ||= - registers an offense for 'str' assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for 'str' assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows 1.5 to be ||= to a constant - allows 1.5 to be assigned to a constant - behaves like mutable objects - when assigning with = - registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze - behaves like mutable objects - when assigning with ||= - registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze - behaves like mutable objects - when assigning with ||= - registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows :sym to be ||= to a constant - allows :sym to be assigned to a constant - behaves like immutable objects - allows FOO - BAR to be ||= to a constant - allows FOO - BAR to be assigned to a constant - behaves like mutable objects - when assigning with ||= - registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows 'foo' + 'bar' to be assigned to a constant - allows 'foo' + 'bar' to be ||= to a constant - behaves like immutable objects - allows ::ENV['foo'] to be assigned to a constant - allows ::ENV['foo'] to be ||= to a constant - behaves like immutable objects - allows FOO + BAR to be assigned to a constant - allows FOO + BAR to be ||= to a constant - behaves like immutable objects - allows 1 to be assigned to a constant - allows 1 to be ||= to a constant - behaves like immutable objects - allows ENV['foo'] to be ||= to a constant - allows ENV['foo'] to be assigned to a constant - behaves like literals that are frozen - behaves like immutable objects - allows :sym to be assigned to a constant - allows :sym to be ||= to a constant - behaves like immutable objects - allows FOO + BAR to be ||= to a constant - allows FOO + BAR to be assigned to a constant - behaves like immutable objects - allows [1, 2, 3] to be ||= to a constant - allows [1, 2, 3] to be assigned to a constant - behaves like immutable objects - allows %w(a b c) to be assigned to a constant - allows %w(a b c) to be ||= to a constant - behaves like immutable objects - allows 1 to be assigned to a constant - allows 1 to be ||= to a constant - behaves like immutable objects - allows { a: 1, b: 2 } to be ||= to a constant - allows { a: 1, b: 2 } to be assigned to a constant - behaves like immutable objects - allows ::ENV['foo'] to be assigned to a constant - allows ::ENV['foo'] to be ||= to a constant - behaves like immutable objects - allows "top#{1 + 2}" to be ||= to a constant - allows "top#{1 + 2}" to be assigned to a constant - behaves like immutable objects - allows 1.5 to be ||= to a constant - allows 1.5 to be assigned to a constant - behaves like immutable objects - allows ENV['foo'] to be ||= to a constant - allows ENV['foo'] to be assigned to a constant - behaves like immutable objects - allows 'foo' + 'bar' to be ||= to a constant - allows 'foo' + 'bar' to be assigned to a constant - behaves like immutable objects - allows 'str' to be ||= to a constant - allows 'str' to be assigned to a constant - behaves like immutable objects - allows FOO - BAR to be assigned to a constant - allows FOO - BAR to be ||= to a constant - when assigning a range (irange) - does not register an offense when with parenthesis - does not register an offense when without parenthesis - splat expansion - expansion of a range - registers an offense and corrects to use to_a.freeze - with parentheses - registers an offense and corrects to use to_a.freeze - behaves like immutable objects - allows :sym to be assigned to a constant - allows :sym to be ||= to a constant - behaves like string literal - Ruby 2.7 or lower - when the frozen string literal comment is true - does not register an offense when using a multiline string - does not register an offense when using interpolated heredoc constant - behaves like immutable objects - allows <<~HERE - foo - bar -HERE - to be ||= to a constant - allows <<~HERE - foo - bar -HERE - to be assigned to a constant - behaves like immutable objects - allows "#{a}" to be assigned to a constant - allows "#{a}" to be ||= to a constant - when the frozen string literal comment is missing - behaves like mutable objects - when assigning with = - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when the frozen string literal comment is false - behaves like mutable objects - when assigning with = - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - Ruby 3.0 or higher - when the frozen string literal comment is false - behaves like mutable objects - when assigning with ||= - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when the frozen string literal comment is missing - behaves like mutable objects - when assigning with = - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when the frozen string literal comment is true - registers an offense when using interpolated heredoc constant - registers an offense when using a multiline string with interpolation - does not register an offense when using a multiline string - behaves like immutable objects - allows <<~HERE - foo - bar -HERE - to be assigned to a constant - allows <<~HERE - foo - bar -HERE - to be ||= to a constant - behaves like mutable objects - when assigning with = - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows ::ENV['foo'] to be ||= to a constant - allows ::ENV['foo'] to be assigned to a constant - behaves like mutable objects - when assigning with = - registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows FOO + BAR to be ||= to a constant - allows FOO + BAR to be assigned to a constant - behaves like immutable objects - allows 1 to be assigned to a constant - allows 1 to be ||= to a constant - when assigning an array without brackets - does not insert brackets for %w() arrays - adds brackets when autocorrecting - behaves like mutable objects - when assigning with ||= - registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze - behaves like mutable objects - when assigning with ||= - registers an offense for 'str' assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for 'str' assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows FOO - BAR to be ||= to a constant - allows FOO - BAR to be assigned to a constant - behaves like immutable objects - allows ENV['foo'] to be ||= to a constant - allows ENV['foo'] to be assigned to a constant - behaves like mutable objects - when assigning with ||= - registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze - Ruby 2.7 or lower - when using shareable_constant_values - behaves like literals that are not frozen - behaves like immutable objects - allows FOO - BAR to be assigned to a constant - allows FOO - BAR to be ||= to a constant - behaves like mutable objects - when assigning with ||= - registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows ::ENV['foo'] to be ||= to a constant - allows ::ENV['foo'] to be assigned to a constant - behaves like immutable objects - allows ENV['foo'] to be assigned to a constant - allows ENV['foo'] to be ||= to a constant - behaves like mutable objects - when assigning with ||= - registers an offense for 'str' assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for 'str' assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows :sym to be assigned to a constant - allows :sym to be ||= to a constant - behaves like mutable objects - when assigning with = - registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze - behaves like mutable objects - when assigning with = - registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows FOO + BAR to be assigned to a constant - allows FOO + BAR to be ||= to a constant - behaves like immutable objects - allows 1 to be assigned to a constant - allows 1 to be ||= to a constant - behaves like immutable objects - allows 'foo' + 'bar' to be ||= to a constant - allows 'foo' + 'bar' to be assigned to a constant - behaves like mutable objects - when assigning with ||= - registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows 1.5 to be assigned to a constant - allows 1.5 to be ||= to a constant - behaves like literals that are not frozen - behaves like immutable objects - allows ::ENV['foo'] to be ||= to a constant - allows ::ENV['foo'] to be assigned to a constant - behaves like immutable objects - allows :sym to be assigned to a constant - allows :sym to be ||= to a constant - behaves like immutable objects - allows ENV['foo'] to be ||= to a constant - allows ENV['foo'] to be assigned to a constant - behaves like mutable objects - when assigning with ||= - registers an offense for 'str' assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for 'str' assigned to a constant and corrects by adding .freeze - behaves like mutable objects - when assigning with = - registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows 1.5 to be ||= to a constant - allows 1.5 to be assigned to a constant - behaves like mutable objects - when assigning with = - registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze - behaves like mutable objects - when assigning with ||= - registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows 'foo' + 'bar' to be assigned to a constant - allows 'foo' + 'bar' to be ||= to a constant - behaves like immutable objects - allows 1 to be ||= to a constant - allows 1 to be assigned to a constant - behaves like immutable objects - allows FOO + BAR to be ||= to a constant - allows FOO + BAR to be assigned to a constant - behaves like immutable objects - allows FOO - BAR to be ||= to a constant - allows FOO - BAR to be assigned to a constant - behaves like mutable objects - when assigning with = - registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze - behaves like literals that are not frozen - behaves like immutable objects - allows FOO - BAR to be ||= to a constant - allows FOO - BAR to be assigned to a constant - behaves like mutable objects - when assigning with ||= - registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows 1.5 to be assigned to a constant - allows 1.5 to be ||= to a constant - behaves like immutable objects - allows 1 to be assigned to a constant - allows 1 to be ||= to a constant - behaves like mutable objects - when assigning with ||= - registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows FOO + BAR to be ||= to a constant - allows FOO + BAR to be assigned to a constant - behaves like immutable objects - allows :sym to be assigned to a constant - allows :sym to be ||= to a constant - behaves like mutable objects - when assigning with ||= - registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows ::ENV['foo'] to be assigned to a constant - allows ::ENV['foo'] to be ||= to a constant - behaves like mutable objects - when assigning with = - registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze - behaves like mutable objects - when assigning with = - registers an offense for 'str' assigned to a constant and corrects by adding .freeze - when assigning with ||= - registers an offense for 'str' assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows 'foo' + 'bar' to be assigned to a constant - allows 'foo' + 'bar' to be ||= to a constant - behaves like immutable objects - allows ENV['foo'] to be ||= to a constant - allows ENV['foo'] to be assigned to a constant - behaves like literals that are not frozen - behaves like mutable objects - when assigning with ||= - registers an offense for 'str' assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for 'str' assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows 1.5 to be ||= to a constant - allows 1.5 to be assigned to a constant - behaves like immutable objects - allows 'foo' + 'bar' to be assigned to a constant - allows 'foo' + 'bar' to be ||= to a constant - behaves like mutable objects - when assigning with ||= - registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows FOO - BAR to be ||= to a constant - allows FOO - BAR to be assigned to a constant - behaves like immutable objects - allows ::ENV['foo'] to be ||= to a constant - allows ::ENV['foo'] to be assigned to a constant - behaves like immutable objects - allows 1 to be ||= to a constant - allows 1 to be assigned to a constant - behaves like mutable objects - when assigning with ||= - registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze - behaves like mutable objects - when assigning with ||= - registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows ENV['foo'] to be ||= to a constant - allows ENV['foo'] to be assigned to a constant - behaves like mutable objects - when assigning with ||= - registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze - when assigning with = - registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze - behaves like immutable objects - allows :sym to be assigned to a constant - allows :sym to be ||= to a constant - behaves like immutable objects - allows FOO + BAR to be assigned to a constant - allows FOO + BAR to be ||= to a constant - when assigning a range (erange) without parenthesis - does not insert parenthesis to range enclosed in parentheses - adds parentheses when autocorrecting - when assigning a regexp - registers an offense - when assigning a range (irange) without parenthesis - does not insert parenthesis to range enclosed in parentheses - adds parentheses when autocorrecting - behaves like immutable objects - allows 1.5 to be ||= to a constant - allows 1.5 to be assigned to a constant - behaves like immutable objects - allows 'foo' + 'bar' to be assigned to a constant - allows 'foo' + 'bar' to be ||= to a constant - -RuboCop::Cop::Style::MapCompactWithConditionalBlock - With single line block - does not register offenses if `compact` is not chained to `map` - registers an offense and corrects to `select` with ternary expression - registers an offense and corrects to `reject` with ternary expression - registers an offense and corrects to `reject` with modifier form of `unless` condition - registers an offense and corrects to `select` with modifier form of `if` condition - With multiline block - registers an offense and corrects to `select` with modifier form of `if` condition - registers an offense and corrects to `reject` with ternary expression - registers an offense and corrects to `select` with guard clause of `if` and `next` has a value and return nil - registers an offense and corrects to `reject` with `unless` condition - registers an offense and corrects to `select` with multi-line `if` condition - registers an offense and corrects to `reject` with guard clause of `unless` - registers an offense and corrects to `reject` with guard clause of `unless` and `next` explicitly nil - registers an offense and corrects to `select` if `next value` in if_branch and `nil` in else_branch - registers an offense and corrects to `select` with guard clause of `if` and next explicitly nil - registers an offense and corrects to `reject` with modifier form of `unless` condition - does not register offenses if there are multiple guard clauses - does not register offenses if return value is not same as block argument - registers an offense and corrects to `select` with guard clause of `if` - does not register offenses if `compact` is not chained to `map` - does not register offenses if condition has elsif branch - registers an offense and corrects to `select` with guard clause of `if` and `next` has a value - registers an offense and corrects to `select` with `if` condition - registers an offense and corrects to `reject` with guard clause of `unless` and `next` has a value - registers an offense and corrects to `reject` with guard clause of `unless` and `next` has a value and return nil - registers an offense and corrects to `select` with ternary expression - registers an offense and corrects to `select` if condition has not else branch - registers an offense and corrects to `reject` if `next value` in else_branch and `nil` in if_branch - registers an offense and corrects to `reject` with `if` condition - -RuboCop::Cop::Style::SingleArgumentDig - >= Ruby 2.7 - when using dig with arguments forwarding - does not register an offense - dig over a variable as caller - with multiple arguments - does not register an offense - when using dig with splat operator - does not register an offense - when using multiple `dig` in a method chain - registers and corrects an offense - with single argument - registers an offense and corrects unsuitable use of dig - when without a receiver - does not register an offense - dig over literal - with single argument - registers an offense and corrects unsuitable use of dig - with multiple arguments - does not register an offense - when using dig with splat operator - does not register an offense - -RuboCop::Cop::VisibilityHelp - #node_visibility - with inline private with symbol - is expected to eq :private - with inline public - is expected to eq :public - without visibility block - is expected to eq :public - with visibility block private after public - is expected to eq :private - with visibility block public - is expected to eq :public - with inline private - is expected to eq :private - with visibility block private - is expected to eq :private - -RuboCop::Cop::Style::TrailingCommaInArguments - with a single argument spanning multiple lines - when EnforcedStyleForMultiline is consistent_comma - accepts a single argument with no trailing comma - with multi-line list of values - when EnforcedStyleForMultiline is comma - accepts a trailing comma in a method call with single line hashes - registers an offense for no trailing comma in a method call with hash parameters at the end - does not break when a safe method call is chained on the offending more complex one - accepts a multiline call with a single argument and trailing comma - does not break when a safe method call is chained on the offending simple one - accepts no trailing comma in a method call with a multiline braceless hash at the end with more than one parameter on a line - accepts an empty hash being passed as a method argument - accepts missing comma after heredoc with comments - does not break when a method call is chained on the offending one - accepts a method call with two parameters on the same line - accepts trailing comma in a method call with hash parameters at the end - when closing bracket is on same line as last value - accepts a method call with Hash as last parameter split on multiple lines - when EnforcedStyleForMultiline is consistent_comma - accepts a trailing comma in a method call with single line hashes - accepts no trailing comma in a method call with a block parameter at the end - accepts a trailing comma in a method call with a single hash parameter to a receiver object - accepts a multiline call with single argument on multiple lines - registers an offense for no trailing comma in a method call withtwo parameters on the same line - accepts a trailing comma in a method call with a single hash parameter - accepts a multiline call with arguments on a single line and trailing comma - registers an offense for no trailing comma in a method call with hash parameters at the end - accepts trailing comma in a method call with hash parameters at the end - autocorrects missing comma after a heredoc - accepts a multiline call with a single argument and trailing comma - when closing bracket is on same line as last value - registers an offense for a method call, with a Hash as the last parameter, split on multiple lines - when EnforcedStyleForMultiline is no_comma - accepts comma inside a heredoc with method and comments inside - accepts comma inside a heredoc in brackets - accepts comma inside a heredoc parameter at the end - registers an offense for trailing comma in a method call with hash parameters at the end - accepts a method call with hash parameters at the end and no trailing comma - accepts comma inside a heredoc with comments inside - accepts comma inside a modified heredoc parameter - autocorrects unwanted comma after modified heredoc parameter - when there is string interpolation inside heredoc parameter - autocorrects unwanted comma inside string interpolation - accepts comma inside a heredoc parameter - accepts comma inside a heredoc parameter when on a single line - with single line list of values - when EnforcedStyleForMultiline is consistent_comma - accepts method call without parameters - accepts chained single-line method calls - accepts method call without trailing comma with single element hash parameters at the end - accepts method call without trailing comma - registers an offense for trailing comma in a method call with hash parameters at the end - registers an offense for trailing comma in a method call - accepts heredoc without trailing comma - registers an offense for trailing comma preceded by whitespace in a method call - accepts method call without trailing comma when a line break before a method call - when using safe navigation operator - registers an offense for trailing comma in a method call - registers an offense for trailing comma in a method call with hash parameters at the end - when EnforcedStyleForMultiline is no_comma - registers an offense for trailing comma in a method call with hash parameters at the end - accepts method call without trailing comma when a line break before a method call - accepts heredoc without trailing comma - accepts method call without trailing comma - accepts method call without trailing comma with single element hash parameters at the end - registers an offense for trailing comma in a method call - accepts chained single-line method calls - registers an offense for trailing comma preceded by whitespace in a method call - accepts method call without parameters - when using safe navigation operator - registers an offense for trailing comma in a method call - registers an offense for trailing comma in a method call with hash parameters at the end - when EnforcedStyleForMultiline is comma - accepts method call without trailing comma - registers an offense for trailing comma in a method call - accepts chained single-line method calls - registers an offense for trailing comma in a method call with hash parameters at the end - accepts heredoc without trailing comma - registers an offense for trailing comma preceded by whitespace in a method call - accepts method call without parameters - accepts method call without trailing comma with single element hash parameters at the end - accepts method call without trailing comma when a line break before a method call - when using safe navigation operator - registers an offense for trailing comma in a method call with hash parameters at the end - registers an offense for trailing comma in a method call - with a single argument of anonymous function spanning multiple lines - when EnforcedStyleForMultiline is consistent_comma - accepts a single argument with no trailing comma - -RuboCop::Cop::Style::DoubleNegation - when `EnforcedStyle: forbidden` - does not register an offense for `not not` - registers an offense for `!!` when return location and using `rescue` and `ensure` - registers an offense for `!!` when return location and using `ensure` - does not register an offense for ! - registers an offense for `!!` when return location and using `rescue` - registers an offense and corrects for `!!` when return location - registers an offense and corrects for `!!` when using `return` keyword - registers an offense and corrects for `!!` when not a return location - registers an offense and corrects for `!!` - registers an offense for `!!` when return location and using `rescue`, `else`, and `ensure` - when `EnforcedStyle: allowed_in_returns` - does not register an offense for `!!` when return location and using `ensure` - registers an offense and corrects for `!!` with hash when not return locationand using `case`, `when`, and `else` - does not register an offense for `!!` when return location - registers an offense and corrects for `!!` with nested array at return location - does not register an offense for `!!` when return location and using `unless` - does not register an offense for `!!` with array when return location and using `if`, `elsif`, and `else` - registers an offense and corrects for `!!` with single-line array at return location - registers an offense and corrects for `!!` with nested hash at return location - does not register an offense for `!!` when using `return` keyword - does not register an offense for `!!` when return location and using `if`, `elsif`, and `else` - does not register an offense for `!!` with array when return location and using `case`, `when`, and `else` - registers an offense and corrects for `!!` - does not register an offense for `!!` when return location by `define_singleton_method` - does not register an offense for `!!` when return location and using `rescue`, `else`, and `ensure` - registers an offense and corrects for `!!` with complex array at return location - registers an offense and corrects for `!!` when not a return location - does not register an offense for `!!` when return location and using `case`, `when`, and `else` - does not register an offense for ! - does not register an offense for `not not` - registers an offense and corrects for `!!` with hash when not return locationand using `if`, `elsif`, and `else` - does not register an offense for `!!` with hash when return location and using `if`, `elsif`, and `else` - does not register an offense for `!!` when return location by `define_method` - registers an offense and corrects for `!!` with single-line hash at return location - does not register an offense for `!!` with hash when return location and using `case`, `when`, and `else` - registers an offense and corrects for `!!` with multi-line array at return location - registers an offense and corrects for `!!` with array when not return locationand using `if`, `elsif`, and `else` - does not register an offense for `!!` when return location and using `rescue` - registers an offense and corrects for `!!` with multi-line hash at return location - registers an offense and corrects for `!!` when not return locationand using `case`, `when`, and `else` - registers an offense and corrects for `!!` when not return location and using `unless` - registers an offense and corrects for `!!` with array when not return locationand using `case`, `when`, and `else` - does not register an offense for `!!` when return location and using `rescue` and `ensure` - registers an offense and corrects for `!!` when not return locationand using `if`, `elsif`, and `else` - Ruby >= 2.7 - registers an offense and corrects for `!!` when not return locationand using `case`, `in`, and `else` - Ruby >= 2.7 - does not register an offense for `!!` when return location and using `case`, `in`, and `else` - -RuboCop::Cop::Lint::PercentStringArray - with binary encoded source - accepts if tokens contain no quotes - adds an offense and corrects when tokens contain quotes - with invalid byte sequence in UTF-8 - accepts if tokens contain invalid byte sequence only - add an offense and corrects when tokens contain quotes - detecting quotes or commas in a %w/%W string - adds an offense and corrects when tokens contain both types of quotes - adds an offense and corrects when one token is quoted but there are no commas - accepts likely false positive %W(' " ! = # ,) - accepts likely false positive %w(#{a} b) - adds an offense and corrects when tokens contain quotes and are comma separated - adds an offense and corrects when tokens contain both types of quotes - adds an offense and corrects when there are no quotes but one comma - accepts likely false positive %W(' ") - adds an offense and corrects when tokens contain quotes and are comma separated - accepts likely false positive %w(' " ! = # ,) - accepts tokens without quotes or commas - adds an offense and corrects when there are no quotes but one comma - adds an offense and corrects when one token is quoted but there are no commas - accepts likely false positive :"#{a}" - accepts likely false positive %W(#{a} b) - accepts likely false positive %w(' ") - accepts tokens without quotes or commas - accepts likely false positive :"#{a}" - -RuboCop::Cop::Style::NegatedWhile - autocorrects by replacing while not with until - registers an offense for while with "not" condition - autocorrects by replacing until not with while - does not blow up for empty while condition - does not blow up for empty until condition - registers an offense for until with exclamation point condition - accepts a while where the condition is doubly negated - registers an offense for while with exclamation point condition - accepts a while where only part of the condition is negated - -RuboCop::Cop::Style::NonNilCheck - when allowing semantic changes - autocorrects by changing `x != nil` to `x` - corrects code that would not be modified if IncludeSemanticChanges were false - does not blow up when autocorrecting implicit receiver - registers an offense for `!x.nil?` - registers an offense for `not x.nil?` - does not register an offense for `!x` - does not register an offense for `x.nil?` - registers an offense for unless x.nil? - does not blow up with ternary operators - when `EnforcedStyle: comparison` of `Style/NilComparison` cop - `IncludeSemanticChanges: false` - does not register an offense for `foo != nil` - `IncludeSemanticChanges: true` - registers an offense for `foo != nil` - when not allowing semantic changes - does not register an offense for !x.nil? - registers an offense for != nil - does not register an offense if only expression in class predicate - does not register an offense if last expression in predicate - registers an offense but does not correct when the code was not modified - does not register an offense if last expression in class predicate - does not register an offense for != 0 - does not register an offense with implicit receiver - does not register an offense for not x.nil? - does not register an offense if only expression in predicate - -RuboCop::Cop::Style::TrailingCommaInArrayLiteral - with multi-line list of values - when EnforcedStyleForMultiline is comma - accepts a multiline array with a single item and trailing comma - accepts an empty array being passed as a method argument - accepts trailing comma - registers an offense for a literal with two of the values on the same line and a trailing comma - accepts literal with two of the values on the same line - accepts a multiline word array - when closing bracket is on same line as last value - accepts literal with no trailing comma - when EnforcedStyleForMultiline is no_comma - accepts a literal with no trailing comma - accepts HEREDOC with commas - autocorrects unwanted comma where HEREDOC has commas - registers an offense for trailing comma - when EnforcedStyleForMultiline is consistent_comma - accepts a multiline word array - accepts trailing comma - accepts a multiline array with a single item and trailing comma - accepts a multiline array with items on a single line andtrailing comma - registers an offense for literal with two of the values on the same line and no trailing comma - accepts two values on the same line - when closing bracket is on same line as last value - registers an offense for no trailing comma - with single line list of values - when EnforcedStyleForMultiline is consistent_comma - accepts empty literal - accepts rescue clause - accepts single element literal without trailing comma - accepts literal without trailing comma - registers an offense for trailing comma - when EnforcedStyleForMultiline is no_comma - accepts literal without trailing comma - accepts empty literal - accepts single element literal without trailing comma - registers an offense for trailing comma - accepts rescue clause - when EnforcedStyleForMultiline is comma - accepts literal without trailing comma - accepts empty literal - accepts single element literal without trailing comma - registers an offense for trailing comma - accepts rescue clause - -RuboCop::Cop::Metrics::PerceivedComplexity - when Max is 1 - registers an offense for and - counts only a single method - registers an offense for an if modifier - accepts a method with no decision points - registers an offense for && - does not count unknown block calls - registers an offense for a case/when block - registers an offense for || - registers an offense for an until block - registers an offense for or - registers an offense for elsif and else blocks - registers an offense for a `define_method` - accepts an empty method - counts known iterating block - counts else in a case with no argument - deals with nested if blocks containing && and || - accepts complex code outside of methods - registers an offense for a while block - accepts an empty `define_method` - registers an offense for a case/when block without an expression after case - registers an offense for a rescue block - registers an offense for a ternary operator - registers an offense for an unless modifier - registers an offense for a for block - when AllowedMethods is enabled - does not register an offense when using `define_method` - does not register an offense when defining a class method - does not register an offense when defining an instance method - when Max is 2 - counts stupid nested if and else blocks - when AllowedPatterns is enabled - does not register an offense when defining a class method - does not register an offense when defining an instance method - does not register an offense when using `define_method` - -RuboCop::Cop::Lint::DeprecatedConstants - registers and corrects an offense when using `TRUE` - registers and corrects an offense when using `::TRUE` - registers and corrects an offense when using `NIL` - registers and corrects an offense when using `::NIL` - does not register an offense when not using deprecated constant - does not register an offense when using `__ENCODING__ - registers and corrects an offense when using `::Triple::Nested::Constant` - registers and corrects an offense when using deprecated methods that have no alternative - registers and corrects an offense when using deprecated methods that have no deprecated version - registers and corrects an offense when using `::FALSE` - registers and corrects an offense when using `FALSE` - Ruby >= 3.0 - registers and corrects an offense when using `Random::DEFAULT` - registers and corrects an offense when using `::Random::DEFAULT` - Ruby <= 2.7 - does not register an offense when using `Random::DEFAULT` - Ruby <= 2.5 - does not register an offense when using `Net::HTTPServerException` - Ruby >= 2.6 - registers and corrects an offense when using `Net::HTTPServerException` - -RuboCop::Cop::Layout::SpaceAfterNot - accepts space after not keyword - registers an offense and corrects space after ! with the negated receiver wrapped in parentheses - registers an offense and corrects multiple spaces after ! - registers an offense and corrects a single space after ! - accepts no space after ! - -RuboCop::Cop::Style::MultilineIfThen - does not get confused by empty elsif branch - registers an offense for then in multiline elsif - does not raise an error for an implicit match if - does not get confused by a nested postfix unless - accepts table style if/then/elsif/ends - does not get confused by a then in a when - registers an offense for then in multiline if - does not raise an error for an implicit match unless - does not get confused by a postfix unless - does not get confused by a commented-out then - registers an offense for then in multiline unless - -RuboCop::Cop::Style::SafeNavigation - allows for empty if blocks with comments - allows calls using safe navigation - allows object checks in the condition of an elsif statement and a method call on that object in the body - allows an object check before a negated predicate - allows method call that is used in a negated regex comparison safe guarded by an object check - allows a method call safeguarded with a negative check for the object when using `unless` - allows an object check before a nil check on a short chain - allows an object check before a negated method call with a safe navigation - allows an object check before a method chain that is used in a comparison - allows a method call as a parameter when the parameter is safe guarded with an object check - allows an object check before a method chain longer than 2 methods - allows an object check before a method call that is used in a comparison - allows an object check before a method call that is used with `empty?` - allows an object check before hash access - allows a method call safeguarded with a negative check for the object when using `if` - allows chained method calls during assignment safe guardedby an object check - does not move comments that are inside an inner block - allows an object check before a long chain with a block - allows an object check before a nil check on a long chain - allows an object check before a negated predicate method chain - allows calls to methods not safeguarded by respond_to - allows an object check before a method call that is used in a negated regex comparison - allows calls on nil - allows an object check before a blank check - allows chained method calls during arithmetic operations safe guarded by an object check - allows method call that is used in a spaceship comparison safe guarded by an object check - allows a method chain that is used in a comparison safe guarded by an object check - allows method calls that do not get called using . safe guarded by an object check - allows a method call safeguarded when using `unless nil?` - allows method call that is used in a regex comparison safe guarded by an object check - allows an object check before a method call that is used in a regex comparison - allows an object check before a method call that is used in a spaceship comparison - allows method call that is used in a comparison safe guarded by an object check - behaves like all variable types - if expression - registers an offense for a single method call with params and a block inside of an unless negative check for the object - registers an offense for a single method call with a block inside of an unless negative check for the object - registers an offense for a single method call inside of an unless negative check for the object - registers an offense for a single method call with params and a block inside of a non-nil check for the object - registers an offense for a single method call with params inside of a non-nil check for the object - registers an offense for a single method call with a block inside of a check for the object - registers an offense for a single method call with params and a block inside of an unless nil check for the object - registers an offense for a single method call with a block inside of an unless nil check for the object - does not lose comments within if expression - only moves comments that fall within the expression - registers an offense for a single method call with params inside of an unless nil check for the object - registers an offense for a single method call inside of a check for the object - allows a single method call inside of a check for the object with an else - registers an offense for a single method call with params inside of an unless negative check for the object - registers an offense for a single method call with a block inside of a non-nil check for the object - registers an offense for a single method call inside of a non-nil check for the object - registers an offense for a single method call inside of an unless nil check for the object - registers an offense for a single method call with params and a block inside of a check for the object - registers an offense for a single method call with params inside of a check for the object - ternary expression - allows ternary expression - object check before method call - allows a non object check followed by a method call with params and a block - allows a nil object check followed by a method call with params - allows a nil object check followed by a method call with a block - allows a nil object check followed by a method call with params and a block - allows a non object check followed by a method call - allows a non object check followed by a method call with params - allows a non object check followed by a method call with a block - allows a nil object check followed by a method call - ConvertCodeThatCanStartToReturnNil true - registers an offense for an object check followed by a method call - registers an offense for a check for the object followed by a method call in the condition for an if expression - registers an offense for an object check followed by a method call with params - registers an offense for a non-nil object check followed by a method call with params and a block - registers an offense for a non-nil object check followed by a method call - corrects an object check followed by a method call and another check - registers an offense for a non-nil object check followed by a method call with a block - registers an offense for a non-nil object check followed by a method call with params - registers an offense for an object check followed by a method call with a block - registers an offense for an object check followed by a method call with params and a block - method chaining - registers an offense for an object check followed by chained method calls with blocks - MaxChainLength: 3 - allows an object check followed by 4 chained method calls - registers an offense for an object check followed by 3 chained method calls - with Lint/SafeNavigationChain disabled - allows an object check followed by chained method calls - allows an object check followed by chained method calls with blocks - MaxChainLength: 1 - registers an offense for an object check followed by 1 chained method calls - allows an object check followed by 2 chained method calls - ConvertCodeThatCanStartToReturnNil false - registers an offense for an object check followed by a method call with params - registers an offense for an object check followed by a method call with a block - registers an offense for an object check followed by a method call with params and a block - allows a non-nil object check followed by a method call with a block - registers an offense for an object check followed by a method calls that nil responds to - allows a non-nil object check followed by a method call - registers an offense for an object check followed by a method call - registers an offense for a check for the object followed by a method call in the condition for an if expression - allows a non-nil object check followed by a method call with params - allows a non-nil object check followed by a method call with params and a block - method chaining - corrects an object check followed by a chained method call - corrects an object check followed by a chained method call with a block - corrects an object check followed by a chained method call with a symbol proc - corrects an object check followed by a chained method call with params - modifier if - registers an offense for a method call that nil responds to safe guarded by an object check - registers an offense for a method call with params safeguarded with a negative nil check for the object - registers an offense when safe guard check and safe navigation method call are connected with `&&` condition - registers an offense for a method call safeguarded with a negative check for the object - registers an offense for a chained method call safeguarded with an unless nil check for the object - registers an offense for a chained method call safeguarded with a negative nil check for the object - registers an offense for a method call with params and a block safeguarded with a check for the object - registers an offense for a method call with params safeguarded with a nil check for the object - registers an offense for an object check followed by a method call with a comment at EOL - registers an offense for a chained method call safeguarded with a check for the object - registers an offense for a method call with a block safeguarded with a check for the object - registers an offense for a method call with a block safeguarded with a negative check for the object - registers an offense for a method call on an accessor safeguarded by a check for the accessed variable - registers an offense for a method call with params safeguarded with a negative check for the object - registers an offense for a method call with params and a block safeguarded with a negative check for the object - registers an offense for a method call with a block safeguarded with a nil check for the object - registers an offense for a method call with params and a block safeguarded with a negative nil check for the object - registers an offense for a method call with params safeguarded with a check for the object - registers an offense for a method call with params and a block safeguarded with a nil check for the object - registers an offense for a method call with a block safeguarded with a negative nil check for the object - registers an offense for a method call safeguarded with a check for the object - registers an offense for a method call safeguarded with a negative nil check for the object - registers an offense for a method call safeguarded with a nil check for the object - behaves like safe guarding logical break keywords - allows a method call being passed to yield safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to throw safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to return safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to raise safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to next safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to fail safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to break safe guarded by an object check - behaves like all variable types - modifier if - registers an offense for a method call with params and a block safeguarded with a negative check for the object - registers an offense for a method call safeguarded with a negative check for the object - registers an offense for a chained method call safeguarded with a negative nil check for the object - registers an offense for a method call with params safeguarded with a negative check for the object - registers an offense for an object check followed by a method call with a comment at EOL - registers an offense for a method call safeguarded with a check for the object - registers an offense for a method call safeguarded with a negative nil check for the object - registers an offense for a method call with params safeguarded with a nil check for the object - registers an offense for a chained method call safeguarded with a check for the object - registers an offense for a method call with params and a block safeguarded with a negative nil check for the object - registers an offense for a method call safeguarded with a nil check for the object - registers an offense for a method call with a block safeguarded with a negative nil check for the object - registers an offense for a method call that nil responds to safe guarded by an object check - registers an offense for a method call with params and a block safeguarded with a check for the object - registers an offense for a method call with a block safeguarded with a check for the object - registers an offense for a method call with params and a block safeguarded with a nil check for the object - registers an offense for a method call on an accessor safeguarded by a check for the accessed variable - registers an offense when safe guard check and safe navigation method call are connected with `&&` condition - registers an offense for a method call with params safeguarded with a check for the object - registers an offense for a method call with a block safeguarded with a nil check for the object - registers an offense for a method call with params safeguarded with a negative nil check for the object - registers an offense for a chained method call safeguarded with an unless nil check for the object - registers an offense for a method call with a block safeguarded with a negative check for the object - behaves like safe guarding logical break keywords - allows a method call being passed to next safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to return safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to throw safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to fail safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to raise safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to yield safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to break safe guarded by an object check - if expression - registers an offense for a single method call with params inside of an unless negative check for the object - registers an offense for a single method call inside of a check for the object - registers an offense for a single method call inside of an unless nil check for the object - registers an offense for a single method call with params and a block inside of an unless negative check for the object - only moves comments that fall within the expression - registers an offense for a single method call with params inside of a check for the object - allows a single method call inside of a check for the object with an else - does not lose comments within if expression - registers an offense for a single method call with params and a block inside of a check for the object - registers an offense for a single method call with a block inside of a check for the object - registers an offense for a single method call with a block inside of an unless negative check for the object - registers an offense for a single method call with a block inside of a non-nil check for the object - registers an offense for a single method call with a block inside of an unless nil check for the object - registers an offense for a single method call with params and a block inside of an unless nil check for the object - registers an offense for a single method call with params and a block inside of a non-nil check for the object - registers an offense for a single method call inside of an unless negative check for the object - registers an offense for a single method call with params inside of an unless nil check for the object - registers an offense for a single method call with params inside of a non-nil check for the object - registers an offense for a single method call inside of a non-nil check for the object - ternary expression - allows ternary expression - object check before method call - allows a nil object check followed by a method call with params and a block - allows a non object check followed by a method call with params - allows a non object check followed by a method call - allows a nil object check followed by a method call with params - allows a non object check followed by a method call with params and a block - allows a nil object check followed by a method call - allows a nil object check followed by a method call with a block - allows a non object check followed by a method call with a block - ConvertCodeThatCanStartToReturnNil true - registers an offense for a non-nil object check followed by a method call with params and a block - registers an offense for a non-nil object check followed by a method call with a block - registers an offense for a non-nil object check followed by a method call - corrects an object check followed by a method call and another check - registers an offense for an object check followed by a method call with a block - registers an offense for a check for the object followed by a method call in the condition for an if expression - registers an offense for an object check followed by a method call - registers an offense for a non-nil object check followed by a method call with params - registers an offense for an object check followed by a method call with params - registers an offense for an object check followed by a method call with params and a block - method chaining - registers an offense for an object check followed by chained method calls with blocks - MaxChainLength: 1 - registers an offense for an object check followed by 1 chained method calls - allows an object check followed by 2 chained method calls - with Lint/SafeNavigationChain disabled - allows an object check followed by chained method calls with blocks - allows an object check followed by chained method calls - MaxChainLength: 3 - allows an object check followed by 4 chained method calls - registers an offense for an object check followed by 3 chained method calls - ConvertCodeThatCanStartToReturnNil false - allows a non-nil object check followed by a method call with a block - allows a non-nil object check followed by a method call with params and a block - allows a non-nil object check followed by a method call - registers an offense for an object check followed by a method call with params - registers an offense for an object check followed by a method call - registers an offense for an object check followed by a method calls that nil responds to - registers an offense for an object check followed by a method call with a block - registers an offense for an object check followed by a method call with params and a block - allows a non-nil object check followed by a method call with params - registers an offense for a check for the object followed by a method call in the condition for an if expression - method chaining - corrects an object check followed by a chained method call - corrects an object check followed by a chained method call with params - corrects an object check followed by a chained method call with a block - corrects an object check followed by a chained method call with a symbol proc - respond_to? - allows method calls safeguarded by a respond_to check - allows method calls safeguarded by a respond_to check on adifferent variable but the same method - allows method calls safeguarded by a respond_to check to a different method - allows enumerable accessor method calls safeguarded by a respond_to check - allows method calls safeguarded by a respond_to check on adifferent variable and method - when Ruby <= 2.2 - does not register an offense when a method call that nil responds to safe guarded by an object check - behaves like all variable types - if expression - registers an offense for a single method call with params and a block inside of a check for the object - registers an offense for a single method call with a block inside of an unless nil check for the object - registers an offense for a single method call inside of an unless negative check for the object - registers an offense for a single method call with params inside of an unless nil check for the object - registers an offense for a single method call with params and a block inside of a non-nil check for the object - registers an offense for a single method call with a block inside of an unless negative check for the object - registers an offense for a single method call inside of a check for the object - registers an offense for a single method call with params inside of an unless negative check for the object - registers an offense for a single method call inside of an unless nil check for the object - registers an offense for a single method call with params inside of a non-nil check for the object - registers an offense for a single method call with params inside of a check for the object - registers an offense for a single method call with params and a block inside of an unless negative check for the object - registers an offense for a single method call with params and a block inside of an unless nil check for the object - registers an offense for a single method call with a block inside of a non-nil check for the object - registers an offense for a single method call inside of a non-nil check for the object - registers an offense for a single method call with a block inside of a check for the object - does not lose comments within if expression - allows a single method call inside of a check for the object with an else - only moves comments that fall within the expression - ternary expression - allows ternary expression - object check before method call - allows a non object check followed by a method call with params - allows a non object check followed by a method call with params and a block - allows a non object check followed by a method call - allows a nil object check followed by a method call with a block - allows a nil object check followed by a method call with params - allows a non object check followed by a method call with a block - allows a nil object check followed by a method call - allows a nil object check followed by a method call with params and a block - ConvertCodeThatCanStartToReturnNil true - registers an offense for a non-nil object check followed by a method call with params and a block - registers an offense for a non-nil object check followed by a method call with a block - registers an offense for an object check followed by a method call with params and a block - registers an offense for an object check followed by a method call - registers an offense for an object check followed by a method call with a block - registers an offense for an object check followed by a method call with params - registers an offense for a check for the object followed by a method call in the condition for an if expression - registers an offense for a non-nil object check followed by a method call - registers an offense for a non-nil object check followed by a method call with params - corrects an object check followed by a method call and another check - method chaining - registers an offense for an object check followed by chained method calls with blocks - with Lint/SafeNavigationChain disabled - allows an object check followed by chained method calls with blocks - allows an object check followed by chained method calls - MaxChainLength: 1 - registers an offense for an object check followed by 1 chained method calls - allows an object check followed by 2 chained method calls - MaxChainLength: 3 - allows an object check followed by 4 chained method calls - registers an offense for an object check followed by 3 chained method calls - ConvertCodeThatCanStartToReturnNil false - registers an offense for an object check followed by a method call with a block - allows a non-nil object check followed by a method call with params and a block - registers an offense for an object check followed by a method calls that nil responds to - registers an offense for a check for the object followed by a method call in the condition for an if expression - allows a non-nil object check followed by a method call - registers an offense for an object check followed by a method call with params - registers an offense for an object check followed by a method call - allows a non-nil object check followed by a method call with params - allows a non-nil object check followed by a method call with a block - registers an offense for an object check followed by a method call with params and a block - method chaining - corrects an object check followed by a chained method call with params - corrects an object check followed by a chained method call with a block - corrects an object check followed by a chained method call with a symbol proc - corrects an object check followed by a chained method call - modifier if - registers an offense for a chained method call safeguarded with a check for the object - registers an offense for a method call with a block safeguarded with a check for the object - registers an offense for a method call with params and a block safeguarded with a check for the object - registers an offense for a method call with params and a block safeguarded with a nil check for the object - registers an offense for a method call safeguarded with a negative check for the object - registers an offense for a method call safeguarded with a check for the object - registers an offense when safe guard check and safe navigation method call are connected with `&&` condition - registers an offense for a method call with params safeguarded with a negative check for the object - registers an offense for a method call safeguarded with a nil check for the object - registers an offense for a chained method call safeguarded with a negative nil check for the object - registers an offense for a method call with a block safeguarded with a negative check for the object - registers an offense for a chained method call safeguarded with an unless nil check for the object - registers an offense for a method call with params safeguarded with a check for the object - registers an offense for a method call that nil responds to safe guarded by an object check - registers an offense for a method call with a block safeguarded with a nil check for the object - registers an offense for a method call with params and a block safeguarded with a negative nil check for the object - registers an offense for a method call with params and a block safeguarded with a negative check for the object - registers an offense for an object check followed by a method call with a comment at EOL - registers an offense for a method call on an accessor safeguarded by a check for the accessed variable - registers an offense for a method call safeguarded with a negative nil check for the object - registers an offense for a method call with params safeguarded with a nil check for the object - registers an offense for a method call with params safeguarded with a negative nil check for the object - registers an offense for a method call with a block safeguarded with a negative nil check for the object - behaves like safe guarding logical break keywords - allows a method call being passed to throw safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to return safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to yield safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to fail safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to next safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to break safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to raise safe guarded by an object check - behaves like all variable types - modifier if - registers an offense for a method call with a block safeguarded with a negative check for the object - registers an offense for a chained method call safeguarded with an unless nil check for the object - registers an offense for a method call with params and a block safeguarded with a negative nil check for the object - registers an offense for a method call with params and a block safeguarded with a check for the object - registers an offense for a method call safeguarded with a check for the object - registers an offense for a method call safeguarded with a negative check for the object - registers an offense for a method call with params safeguarded with a nil check for the object - registers an offense for a chained method call safeguarded with a check for the object - registers an offense for a method call that nil responds to safe guarded by an object check - registers an offense for a method call with params and a block safeguarded with a negative check for the object - registers an offense for a method call safeguarded with a nil check for the object - registers an offense when safe guard check and safe navigation method call are connected with `&&` condition - registers an offense for a method call with params safeguarded with a negative check for the object - registers an offense for a method call on an accessor safeguarded by a check for the accessed variable - registers an offense for a method call with params safeguarded with a negative nil check for the object - registers an offense for a method call with params and a block safeguarded with a nil check for the object - registers an offense for a chained method call safeguarded with a negative nil check for the object - registers an offense for a method call with a block safeguarded with a negative nil check for the object - registers an offense for a method call with a block safeguarded with a check for the object - registers an offense for a method call with params safeguarded with a check for the object - registers an offense for a method call with a block safeguarded with a nil check for the object - registers an offense for an object check followed by a method call with a comment at EOL - registers an offense for a method call safeguarded with a negative nil check for the object - behaves like safe guarding logical break keywords - allows a method call being passed to throw safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to break safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to fail safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to yield safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to next safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to raise safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to return safe guarded by an object check - if expression - registers an offense for a single method call with params inside of a non-nil check for the object - registers an offense for a single method call with params inside of a check for the object - allows a single method call inside of a check for the object with an else - only moves comments that fall within the expression - registers an offense for a single method call inside of an unless nil check for the object - registers an offense for a single method call with a block inside of a check for the object - registers an offense for a single method call with params and a block inside of an unless nil check for the object - registers an offense for a single method call with params and a block inside of an unless negative check for the object - registers an offense for a single method call with params inside of an unless negative check for the object - registers an offense for a single method call with a block inside of an unless negative check for the object - registers an offense for a single method call with a block inside of an unless nil check for the object - registers an offense for a single method call inside of an unless negative check for the object - registers an offense for a single method call inside of a non-nil check for the object - registers an offense for a single method call with params and a block inside of a check for the object - registers an offense for a single method call with params inside of an unless nil check for the object - does not lose comments within if expression - registers an offense for a single method call with a block inside of a non-nil check for the object - registers an offense for a single method call with params and a block inside of a non-nil check for the object - registers an offense for a single method call inside of a check for the object - ternary expression - allows ternary expression - object check before method call - allows a non object check followed by a method call with params and a block - allows a non object check followed by a method call with params - allows a nil object check followed by a method call - allows a non object check followed by a method call - allows a nil object check followed by a method call with params - allows a non object check followed by a method call with a block - allows a nil object check followed by a method call with params and a block - allows a nil object check followed by a method call with a block - ConvertCodeThatCanStartToReturnNil true - registers an offense for a non-nil object check followed by a method call with params - registers an offense for an object check followed by a method call with params - registers an offense for a check for the object followed by a method call in the condition for an if expression - registers an offense for an object check followed by a method call with params and a block - registers an offense for a non-nil object check followed by a method call with params and a block - registers an offense for an object check followed by a method call - corrects an object check followed by a method call and another check - registers an offense for a non-nil object check followed by a method call - registers an offense for an object check followed by a method call with a block - registers an offense for a non-nil object check followed by a method call with a block - method chaining - registers an offense for an object check followed by chained method calls with blocks - with Lint/SafeNavigationChain disabled - allows an object check followed by chained method calls with blocks - allows an object check followed by chained method calls - MaxChainLength: 1 - allows an object check followed by 2 chained method calls - registers an offense for an object check followed by 1 chained method calls - MaxChainLength: 3 - allows an object check followed by 4 chained method calls - registers an offense for an object check followed by 3 chained method calls - ConvertCodeThatCanStartToReturnNil false - allows a non-nil object check followed by a method call with params - registers an offense for an object check followed by a method calls that nil responds to - registers an offense for an object check followed by a method call with params - allows a non-nil object check followed by a method call with params and a block - registers an offense for an object check followed by a method call with params and a block - allows a non-nil object check followed by a method call with a block - allows a non-nil object check followed by a method call - registers an offense for an object check followed by a method call - registers an offense for an object check followed by a method call with a block - registers an offense for a check for the object followed by a method call in the condition for an if expression - method chaining - corrects an object check followed by a chained method call with a symbol proc - corrects an object check followed by a chained method call - corrects an object check followed by a chained method call with params - corrects an object check followed by a chained method call with a block - behaves like all variable types - if expression - registers an offense for a single method call with a block inside of an unless nil check for the object - registers an offense for a single method call with a block inside of a check for the object - registers an offense for a single method call with params inside of a non-nil check for the object - registers an offense for a single method call with params inside of a check for the object - registers an offense for a single method call inside of an unless nil check for the object - registers an offense for a single method call inside of a check for the object - registers an offense for a single method call with params and a block inside of a non-nil check for the object - registers an offense for a single method call with a block inside of a non-nil check for the object - registers an offense for a single method call inside of a non-nil check for the object - registers an offense for a single method call with params and a block inside of an unless nil check for the object - registers an offense for a single method call with params inside of an unless nil check for the object - registers an offense for a single method call inside of an unless negative check for the object - allows a single method call inside of a check for the object with an else - does not lose comments within if expression - only moves comments that fall within the expression - registers an offense for a single method call with params and a block inside of an unless negative check for the object - registers an offense for a single method call with params and a block inside of a check for the object - registers an offense for a single method call with a block inside of an unless negative check for the object - registers an offense for a single method call with params inside of an unless negative check for the object - ternary expression - allows ternary expression - object check before method call - allows a nil object check followed by a method call with params and a block - allows a nil object check followed by a method call with a block - allows a non object check followed by a method call with params and a block - allows a non object check followed by a method call - allows a non object check followed by a method call with params - allows a non object check followed by a method call with a block - allows a nil object check followed by a method call - allows a nil object check followed by a method call with params - ConvertCodeThatCanStartToReturnNil false - allows a non-nil object check followed by a method call - registers an offense for an object check followed by a method call with params and a block - registers an offense for a check for the object followed by a method call in the condition for an if expression - allows a non-nil object check followed by a method call with params and a block - registers an offense for an object check followed by a method call - allows a non-nil object check followed by a method call with a block - allows a non-nil object check followed by a method call with params - registers an offense for an object check followed by a method call with params - registers an offense for an object check followed by a method call with a block - registers an offense for an object check followed by a method calls that nil responds to - method chaining - corrects an object check followed by a chained method call with params - corrects an object check followed by a chained method call with a block - corrects an object check followed by a chained method call - corrects an object check followed by a chained method call with a symbol proc - ConvertCodeThatCanStartToReturnNil true - corrects an object check followed by a method call and another check - registers an offense for a non-nil object check followed by a method call with params - registers an offense for a non-nil object check followed by a method call with a block - registers an offense for a check for the object followed by a method call in the condition for an if expression - registers an offense for an object check followed by a method call with params and a block - registers an offense for an object check followed by a method call with a block - registers an offense for a non-nil object check followed by a method call - registers an offense for an object check followed by a method call with params - registers an offense for a non-nil object check followed by a method call with params and a block - registers an offense for an object check followed by a method call - method chaining - registers an offense for an object check followed by chained method calls with blocks - MaxChainLength: 3 - registers an offense for an object check followed by 3 chained method calls - allows an object check followed by 4 chained method calls - MaxChainLength: 1 - allows an object check followed by 2 chained method calls - registers an offense for an object check followed by 1 chained method calls - with Lint/SafeNavigationChain disabled - allows an object check followed by chained method calls with blocks - allows an object check followed by chained method calls - modifier if - registers an offense for a method call with a block safeguarded with a negative check for the object - registers an offense for a method call with params and a block safeguarded with a nil check for the object - registers an offense for a method call that nil responds to safe guarded by an object check - registers an offense for a method call with params safeguarded with a check for the object - registers an offense for a method call with params and a block safeguarded with a check for the object - registers an offense for a method call safeguarded with a negative check for the object - registers an offense for a method call safeguarded with a nil check for the object - registers an offense for a method call on an accessor safeguarded by a check for the accessed variable - registers an offense for a method call with a block safeguarded with a check for the object - registers an offense for a method call with params and a block safeguarded with a negative check for the object - registers an offense for a method call with a block safeguarded with a negative nil check for the object - registers an offense for a method call with params and a block safeguarded with a negative nil check for the object - registers an offense for a chained method call safeguarded with a negative nil check for the object - registers an offense for a method call safeguarded with a check for the object - registers an offense for a method call safeguarded with a negative nil check for the object - registers an offense for a method call with a block safeguarded with a nil check for the object - registers an offense for a method call with params safeguarded with a negative check for the object - registers an offense when safe guard check and safe navigation method call are connected with `&&` condition - registers an offense for a chained method call safeguarded with a check for the object - registers an offense for an object check followed by a method call with a comment at EOL - registers an offense for a chained method call safeguarded with an unless nil check for the object - registers an offense for a method call with params safeguarded with a negative nil check for the object - registers an offense for a method call with params safeguarded with a nil check for the object - behaves like safe guarding logical break keywords - allows a method call being passed to break safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to return safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to yield safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to throw safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to fail safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to raise safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to next safe guarded by an object check - behaves like all variable types - if expression - registers an offense for a single method call with params inside of a non-nil check for the object - registers an offense for a single method call inside of a non-nil check for the object - allows a single method call inside of a check for the object with an else - registers an offense for a single method call with params inside of an unless nil check for the object - registers an offense for a single method call with params and a block inside of a non-nil check for the object - registers an offense for a single method call inside of an unless nil check for the object - only moves comments that fall within the expression - registers an offense for a single method call inside of an unless negative check for the object - does not lose comments within if expression - registers an offense for a single method call with params and a block inside of an unless negative check for the object - registers an offense for a single method call with a block inside of an unless negative check for the object - registers an offense for a single method call with params and a block inside of an unless nil check for the object - registers an offense for a single method call with params inside of a check for the object - registers an offense for a single method call with a block inside of an unless nil check for the object - registers an offense for a single method call inside of a check for the object - registers an offense for a single method call with a block inside of a non-nil check for the object - registers an offense for a single method call with params inside of an unless negative check for the object - registers an offense for a single method call with params and a block inside of a check for the object - registers an offense for a single method call with a block inside of a check for the object - ternary expression - allows ternary expression - modifier if - registers an offense for a method call with params and a block safeguarded with a negative check for the object - registers an offense for a method call safeguarded with a negative check for the object - registers an offense for a chained method call safeguarded with an unless nil check for the object - registers an offense for a method call with params and a block safeguarded with a negative nil check for the object - registers an offense for a method call safeguarded with a negative nil check for the object - registers an offense for a method call with a block safeguarded with a negative check for the object - registers an offense for an object check followed by a method call with a comment at EOL - registers an offense for a chained method call safeguarded with a check for the object - registers an offense for a method call that nil responds to safe guarded by an object check - registers an offense for a method call with params safeguarded with a check for the object - registers an offense for a method call with params safeguarded with a negative nil check for the object - registers an offense for a method call with params safeguarded with a negative check for the object - registers an offense for a method call with params and a block safeguarded with a check for the object - registers an offense for a method call with a block safeguarded with a negative nil check for the object - registers an offense for a method call with params safeguarded with a nil check for the object - registers an offense when safe guard check and safe navigation method call are connected with `&&` condition - registers an offense for a method call with params and a block safeguarded with a nil check for the object - registers an offense for a method call safeguarded with a nil check for the object - registers an offense for a method call safeguarded with a check for the object - registers an offense for a method call with a block safeguarded with a nil check for the object - registers an offense for a method call on an accessor safeguarded by a check for the accessed variable - registers an offense for a method call with a block safeguarded with a check for the object - registers an offense for a chained method call safeguarded with a negative nil check for the object - behaves like safe guarding logical break keywords - allows a method call being passed to raise safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to return safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to yield safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to throw safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to next safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to break safe guarded by an object check - behaves like safe guarding logical break keywords - allows a method call being passed to fail safe guarded by an object check - object check before method call - allows a nil object check followed by a method call with params and a block - allows a nil object check followed by a method call with params - allows a non object check followed by a method call - allows a non object check followed by a method call with a block - allows a non object check followed by a method call with params - allows a nil object check followed by a method call with a block - allows a non object check followed by a method call with params and a block - allows a nil object check followed by a method call - ConvertCodeThatCanStartToReturnNil false - registers an offense for an object check followed by a method call with params and a block - registers an offense for an object check followed by a method call with params - allows a non-nil object check followed by a method call - registers an offense for an object check followed by a method calls that nil responds to - allows a non-nil object check followed by a method call with params and a block - registers an offense for a check for the object followed by a method call in the condition for an if expression - registers an offense for an object check followed by a method call - allows a non-nil object check followed by a method call with params - registers an offense for an object check followed by a method call with a block - allows a non-nil object check followed by a method call with a block - method chaining - corrects an object check followed by a chained method call with params - corrects an object check followed by a chained method call - corrects an object check followed by a chained method call with a block - corrects an object check followed by a chained method call with a symbol proc - ConvertCodeThatCanStartToReturnNil true - registers an offense for a non-nil object check followed by a method call with params - registers an offense for a non-nil object check followed by a method call - registers an offense for an object check followed by a method call - registers an offense for an object check followed by a method call with a block - registers an offense for an object check followed by a method call with params - corrects an object check followed by a method call and another check - registers an offense for an object check followed by a method call with params and a block - registers an offense for a non-nil object check followed by a method call with a block - registers an offense for a check for the object followed by a method call in the condition for an if expression - registers an offense for a non-nil object check followed by a method call with params and a block - method chaining - registers an offense for an object check followed by chained method calls with blocks - MaxChainLength: 1 - allows an object check followed by 2 chained method calls - registers an offense for an object check followed by 1 chained method calls - MaxChainLength: 3 - allows an object check followed by 4 chained method calls - registers an offense for an object check followed by 3 chained method calls - with Lint/SafeNavigationChain disabled - allows an object check followed by chained method calls - allows an object check followed by chained method calls with blocks - -RuboCop::Cop::Layout::EmptyLinesAroundBlockBody - when EnforcedStyle is no_empty_lines for { } block - registers an offense for block body starting with a blank - is not fooled by single line blocks - registers an offense for block body starting with a blank passed to a multi-line method call - registers an offense for block body ending with a blank - accepts block body starting with a line with spaces - Ruby 2.7 - registers an offense for block body ending with a blank - when EnforcedStyle is empty_lines for { } block - registers an offense for block body not starting or ending with a blank - is not fooled by single line blocks - ignores block with an empty body - when EnforcedStyle is empty_lines for do end block - registers an offense for block body not starting or ending with a blank - is not fooled by single line blocks - ignores block with an empty body - when EnforcedStyle is no_empty_lines for do end block - is not fooled by single line blocks - registers an offense for block body ending with a blank - registers an offense for block body starting with a blank passed to a multi-line method call - registers an offense for block body starting with a blank - accepts block body starting with a line with spaces - Ruby 2.7 - registers an offense for block body ending with a blank - -RuboCop::Cop::Style::SymbolArray - when EnforcedStyle is percent - registers an offense for arrays of symbols - detects right value for MinSize to use for --auto-gen-config - autocorrects arrays of symbols with new line - autocorrects arrays of symbols with embedded newlines and tabs - does not register an offense if symbol contains whitespace - doesn't break when a symbol contains ) - registers an offense in a non-ambiguous block context - does not register an offense for array with non-syms - uses %I when appropriate - does not register an offense for array starting with %i - autocorrects arrays of one symbol - detects when the cop must be disabled to avoid offenses - when PreferredDelimiters is specified - autocorrects an array with delimiters - autocorrects an array using partial newlines - autocorrects an array in multiple lines - with non-default MinSize - does not autocorrect array of one symbol if MinSize > 1 - when EnforcedStyle is brackets - autocorrects multiline %i array - autocorrects an array has interpolations - does not register an offense for arrays of symbols - autocorrects an array starting with %i - registers an offense for array starting with %i - registers an offense for empty array starting with %i - -RuboCop::Cop::Layout::FirstMethodArgumentLineBreak - ignores kwargs listed on a single line when the arguments are used in `super` - registers an offense and corrects hash arg spanning multiple lines - ignores arguments listed on a single line - ignores methods without arguments - ignores arguments without parens - registers an offense and corrects hash arg without a line break before the first pair - args listed on the first line - registers an offense and corrects using `super` - registers an offense and corrects - registers an offense and corrects using safe navigation operator - -RuboCop::Cop::Style::FetchEnvVar - registers an offense when using `ENV && x` that is different from `if` condition in the body - registers an offense with using an `ENV` at multiple `if` condition in the body - registers an offense when using an `ENV` at `if` condition in the body - registers an offense when using `ENV || x` that is different from `if` condition in the body - when it is compared `==` with other object - does not register an offense - when the node is a assigned by `||=` - registers an offense - when it is used in an interpolation - registers an offense - when `ENV[]` is the right end of `||` chains - registers an offense - when it is a hash value - registers an offense - with negation - registers no offenses - when it is compared `!=` with other object - does not register an offense - when the node is a receiver of `||=` - does not register an offense - when it is an array element - registers an offense - when it is assigned to a variable - registers an offense when using single assignment - registers an offense when using multiple assignment - when it is an argument of a method - registers an offense - when the node is a assigned by `&&=` - registers an offense - when `ENV[]` is the LHS of `||` - registers no offenses - when using `fetch` instead of `[]` - registers no offenses - when it is evaluated with no default values - registers an offense - when it receives a message - registers no offenses - when it is used in a conditional expression - registers no offenses with `if` - registers no offenses with ternary operator - registers no offenses when using the same `ENV` var as `if` condition in the body with operator - registers an offense when using an `ENV` var that is different from `if` condition in the body - registers an offense with `case` - registers no offenses when using the same `ENV` var as `if` condition in the body with assignment method - registers no offenses when using the same `ENV` var as `if` condition in the body with other conditions - registers no offenses when using the same `ENV` var as `if` condition in the body - registers no offenses with `unless` - registers an offense with using an `ENV` var as `if` condition in the body with assignment method - registers no offenses when using the same `ENV` var as `if` condition in the body with predicate method - when it receives a message with safe navigation - registers no offenses - when it is a hash key - registers an offense - when the node is a receiver of `&&=` - does not register an offense - when the env val is excluded from the inspection by the config - registers no offenses - -RuboCop::Cop::Lint::UselessSetterCall - accepts exception assignments without exploding - is not confused by operators ending with = - with singleton method ending with setter call on local object - registers an offense and corrects - when a lvar contains an object passed as argument at the end of the method - accepts the setter call on the lvar - when a lvar contains a local object instantiated with literal - registers an offense and corrects for the setter call on the lvar - when a lvar does not contain any object passed as argument with multiple-assignment at the end of the method - registers an offense and corrects - when a lvar declared as an argument is no longer the passed object at the end of the method - registers an offense and corrects for the setter call on the lvar - with method ending with ivar assignment - accepts - with method ending with setter call on ivar - accepts - with method ending with square bracket setter on local object - registers an offense and corrects - when a lvar does not contain any object passed as argument by binary-operator-assignment at the end of the method - registers an offense and corrects - when a lvar contains an object passed as argument by multiple-assignment at the end of the method - accepts the setter call on the lvar - with method ending with setter call on local object - registers an offense and corrects - when a lvar possibly contains an object passed as argument by logical-operator-assignment at the end of the method - accepts the setter call on the lvar - when a lvar contains a non-local object returned by a method - accepts - with method ending with setter call on argument - accepts - -RuboCop::Formatter::EmacsStyleFormatter - #finished - does not report summary - #file_finished - displays parsable text - when the offense message contains a newline - strips newlines out of the error message - when the offense is marked as todo - prints [Todo] along with message - when the offense is automatically corrected - prints [Corrected] along with message - -RuboCop::Formatter::FormatterSet - responds to all formatter API methods - #custom_formatter_class - can handle top level namespaced constant name - returns constant represented by the passed string - can handle namespaced constant name - when non-existent constant name is passed - raises error - #builtin_formatter_class - returns class which matches single character alias name - returns class which matches passed alias name exactly - returns class which matches double character alias name - #close_output_files - does not close non file output - closes all output files - formatter API method - invokes the same method of all containing formatters - add_formatter - adds a formatter with specified formatter type - can add multiple formatters by being invoked multiple times - adds a formatter to itself - when output path is specified - adds a formatter outputs to the specified file - when parent directories don't exist - creates them - when output path is omitted - adds a formatter outputs to $stdout - -RuboCop::Cop::MessageAnnotator - #annotate - with options on - returns an annotated message - with default options - returns the message - when the output format is JSON - returns the message unannotated - with style guide url - when a base URL is specified - can accept relative paths if base has a full path - allows absolute URLs in the cop config - combines correctly with a target-based setting - can use a path-based setting - does not specify a URL if a cop does not have one - when a nested department is specified - returns style guide url when it is specified - when a department other than AllCops is specified - returns style guide url when it is specified - when StyleGuide is set in the config - adds style guide url - when StyleGuide is not set in the config - does not add style guide url - #urls - returns reference url when it is specified - returns an empty array without StyleGuide URL - returns style guide and reference url when they are specified - returns style guide url when it is specified - returns an empty array if the reference url is blank - returns multiple reference urls - -RuboCop::Cop::Lint::ErbNewArguments - <= Ruby 2.5 - does not register an offense when using `ERB.new` with non-keyword arguments - >= Ruby 2.6 - registers an offense when using `ERB.new` with non-keyword 2nd and 3rd arguments andkeyword 4th argument - registers an offense when using `ERB.new` with non-keyword 2nd argument - registers an offense when using `ERB.new` with non-keyword 2nd and 3rd arguments - registers an offense when using `ERB.new` with non-keyword 2nd, 3rd and 4th arguments - registers an offense when using `::ERB.new` with non-keyword 2nd, 3rd and 4th arguments - registers an offense when using `ERB.new` with non-keyword 2nd, 3rd and 4th arguments andkeyword 5th argument - does not register an offense when using `ERB.new` without optional arguments - does not register an offense when using `ERB.new` with keyword arguments - when using `ActionView::Template::Handlers::ERB.new` - does not register an offense when using `ERB.new` without arguments - -RuboCop::Cop::Lint::UselessMethodDefinition - does not register an offense when non-constructor contains only comments - does not register an offense for constructor containing additional code to `super` - does not register an offense for empty constructor - does not register an offense when method definition contains optional argument - does not register an offense when `super` arguments differ from method arguments - registers an offense and corrects for method containing only `super` call - does not register an offense for method containing additional code to `super` - does not register an offense for empty class level `initialize` method - does not register an offense when method definition contains optional keyword argument - does not register an offense for constructor with only comments - -RuboCop::Cop::Layout::SpaceInsideParens - when EnforcedStyle is space - accepts empty parentheses without spaces - registers an offense for space inside empty parens - accepts parentheses with line break - accepts parentheses with spaces - registers an offense for no spaces inside parens - registers an offense for no space around heredoc start - accepts parentheses with comment and line break - registers an offense in block parameter list with no spaces - when EnforcedStyle is compact - accepts parentheses with spaces - registers multiple offense for a missing and extra space between consecutive brackets - registers an offense for space between consecutive brackets - accepts two consecutive left parentheses - accepts parentheses with line break - registers an offense for no spaces inside parens - accepts parentheses with comment and line break - accepts two consecutive right parentheses - registers an offense for space inside empty parens - registers an offense for no space around heredoc start - accepts three consecutive left parentheses - accepts three consecutive right parentheses - registers an offense in block parameter list with no spaces - accepts empty parentheses without spaces - when EnforcedStyle is no_space - registers an offense for spaces inside parens - accepts parentheses in block parameter list - registers an offense for space around heredoc start - accepts parentheses with comment and line break - accepts parentheses with line break - accepts parentheses with no spaces - -RuboCop::Cop::Layout::SpaceAroundBlockParameters - when EnforcedStyleInsidePipes is space - registers an offense and corrects a lambda for no space after last parameter - accepts a block parameter without preceding space - registers an offense and corrects a lambda for multiple spacesafter last parameter - accepts a block with spaces in the right places - registers an offense and corrects spacing in lambda args - accepts line break after closing pipe - skips lambda without args - registers an offense and corrects missing space before first argument and after last argument - registers an offense and corrects space with parens at middle - accepts an empty block - registers an offense for no space before first parameter - registers an offense and corrects no space after last parameter - registers an offense and corrects multiple spaces before parameter - registers an offense and corrects extra space before first parameter - registers an offense and corrects multiple spaces after last parameter - accepts a lambda with spaces in the right places - registers an offense and corrects block arguments inside Hash#each - registers an offense and corrects a lambda for extra spacebefore first parameter - registers an offense and corrects no space after closing pipe - registers an offense and corrects a lambda for no space before first parameter - skips lambda without parens - accepts a block with parameters but no body - trailing comma - accepts space both before and after the last comma - accepts space after the last comma - registers an offense and corrects no space after the last comma - when EnforcedStyleInsidePipes is no_space - registers an offense and corrects space after last parameter - registers an offense and corrects multiple spaces before parameter - registers an offense and corrects a lambda for space before first parameter - registers an offense and corrects a lambda for space after the last parameter - registers an offense and corrects no space after closing pipe - registers an offense and corrects all types of spacing issues - accepts an empty block - skips lambda without parens - skips lambda without args - accepts a block parameter without preceding space - accepts a block with parameters but no body - accepts a block with spaces in the right places - accepts block parameters with surrounding space that includes line breaks - registers an offense and corrects all types of spacing issues for a lambda - accepts a lambda with spaces in the right places - registers an offense and corrects space before first parameter - registers an offense and corrects for space with parens - accepts line break after closing pipe - trailing comma - registers an offense for space before and after the last comma - registers an offense for space after the last comma +RuboCop::Cop::Layout::EmptyLineAfterMultilineCondition + registers an offense when no new line after `when` with multiline condition + does not register an offense for `when` with singleline condition + does not register an offense when new line after `rescue` with multiline exceptions + does not register an offense for `if` with single line condition + registers an offense when no new line after `if` with multiline condition + does not register an offense when new line after `while` with multiline condition + registers an offense when no new line after `while` with multiline condition + registers an offense when no new line after `until` with multiline condition + does not register an offense when new line after modifier `while` with multiline condition + does not register an offense when modifier `while` with multiline conditionis the last child of its parent + does not register an offense when new line after modifier `if` with multiline condition + registers an offense when no new line after `rescue` with multiline exceptions + does not register an offense when `if` at the top level + does not register an offense when modifier `if` with multiline conditionis the last child of its parent + registers an offense when no new line after modifier `if` with multiline condition + registers an offense when no new line after `elsif` with multiline condition + does not register an offense for `rescue` with singleline exceptions + does not register an offense for `while` with single line condition + registers an offense when no new line after modifier `while` with multiline condition + does not register an offense when new line after `when` with multiline condition + does not register an offense when new line after `if` with multiline condition + does not register an offense when new line after `elsif` with multiline condition RuboCop::Cop::Naming::RescuedExceptionsVariableName with default config - when the variable is reassigned - only corrects uses of the exception - only corrects the exception variable - with nested rescues - handles it - with variable being referenced - renames the variable references when autocorrecting - when the variable is reassigned using multiple assignment - only corrects uses of the exception - with implicit rescue - without `Exception` variable - does not register an offense - with `Exception` variable - registers an offense when using `exc` - does not register an offense when using `e` - does not register an offense when using `_e` - registers an offense when using `_exc` - with multiple branches - registers and corrects each offense with explicit rescue - with splat operator as `Exception` list + with lower letters class name + does not register an offense + with method as `Exception` does not register an offense with expected variable name registers an offense with unexpected variable name does not register an offense without variable name + without `Exception` variable + does not register an offense + shadowing an external variable + does not register an offense with `Exception` variable - registers an offense when using `exc` and renames its usage + does not register an offense when using `e` + does not register an offense when using `_e` registers an offense when using `exc` - registers an offense when using `_exc` registers offenses when using `foo` and `bar` in multiple rescues + registers an offense when using `exc` and renames its usage does not register an offense when using _e followed by e - does not register an offense when using `e` - does not register an offense when using `_e` - shadowing an external variable - does not register an offense - with lower letters class name - does not register an offense - with method as `Exception` + registers an offense when using `_exc` + with splat operator as `Exception` list does not register an offense without variable name - registers an offense with unexpected variable name does not register an offense with expected variable name + registers an offense with unexpected variable name + with implicit rescue without `Exception` variable does not register an offense + with `Exception` variable + does not register an offense when using `e` + does not register an offense when using `_e` + registers an offense when using `exc` + registers an offense when using `_exc` + with variable being referenced + renames the variable references when autocorrecting + when the variable is reassigned + only corrects the exception variable + only corrects uses of the exception + with multiple branches + registers and corrects each offense + when the variable is reassigned using multiple assignment + only corrects uses of the exception + with nested rescues + handles it with the `PreferredName` setup - registers an offense when using `_e` registers an offense when using `e` - registers offenses when using `foo` and `bar` in multiple rescues does not register an offense when using `_exception` does not register an offense when using `exception` + registers offenses when using `foo` and `bar` in multiple rescues + registers an offense when using `_e` -RuboCop::Cop::Style::NestedModifier - adds parentheses to method arguments when needed in autocorrection - autocorrects if + unless - autocorrects unless + if - does not add redundant parentheses in autocorrection - adds parentheses when needed in autocorrection - autocorrects unless with a comparison operator + if - autocorrects unless + unless - autocorrects if + if - registers one offense for more than two modifiers - while - behaves like not correctable - does not autocorrect when while is the inner modifier - does not autocorrect when while is the outer modifier - until - behaves like not correctable - does not autocorrect when until is the outer modifier - does not autocorrect when until is the inner modifier - -RuboCop::Cop::Lint::OrderedMagicComments - registers an offense and corrects when using `frozen_string_literal` magic comment is next of shebang - does not register an offense when using `encoding` magic comment is next of shebang - does not register an offense when using `encoding` magic comment is first line - does not register an offense when using `encoding` magic comment only - does not register an offense when using `frozen_string_literal` magic comment only - registers an offense and corrects when `coding` magic comment does not precede all other magic comments - does not register an offense when using `encoding: Encoding::SJIS` Hash notation after`frozen_string_literal` magic comment - registers an offense and corrects when `-*- encoding : ascii-8bit -*-` magic comment does not precede all other magic comments - registers an offense and corrects when an `encoding` magic comment does not precede all other magic comments - -RuboCop::Cop::Lint::LiteralAsCondition - registers an offense for `!2.0` - registers an offense for literal [1] in complex cond - registers an offense for literal :sym in ! - registers an offense for literal {} in until - registers an offense for literal {} in if - registers an offense for literal [1] in post-loop while - registers an offense for literal 2.0 in if - registers an offense for literal {} in while - registers an offense for literal 2.0 in post-loop while - registers an offense for literal 2.0 in complex cond - registers an offense for `!:sym` - accepts literal {} if it's not an and/or operand - registers an offense for `not {}` - registers an offense for literal :"#{a}" in ! - accepts literal 1 in a when of a case with something after case keyword - registers an offense for literal 1 in if - registers an offense for literal [1] in && - registers an offense for literal 1 in case - accepts array literal in case, if it has non-literal elements - registers an offense for literal 1 in until - registers an offense for literal :"#{a}" in if - accepts `true` literal in post-loop `while` - registers an offense for literal :"#{a}" in post-loop while - registers an offense for literal 1 in ! - registers an offense for literal :"#{a}" in until - accepts dstr literal in case - accepts literal [1] in a when of a case with something after case keyword - registers an offense for literal 2.0 in && - registers an offense for literal :"#{a}" in complex cond - accepts literal :"#{a}" in non-toplevel and/or - accepts literal :"#{a}" in a when of a case with something after case keyword - registers an offense for literal {} in case - registers an offense for literal 2.0 in while - registers an offense for literal [1] in if - registers an offense for literal 2.0 in ! - registers an offense for literal 1 in complex ! - registers an offense for literal :sym in post-loop while - registers an offense for literal 2.0 in until - registers an offense for literal {} in post-loop while - accepts `true` literal in `while` - registers an offense for `!1` - registers an offense for literal 2.0 in a when of a case without anything after case keyword - registers an offense for literal :"#{a}" in case - registers an offense for `![1]` - registers an offense for literal :sym in while - registers an offense for literal :"#{a}" in while - registers an offense for literal :"#{a}" in && - registers an offense for literal 1 in a when of a case without anything after case keyword - registers an offense for case with a primitive array condition - registers an offense for literal [1] in post-loop until - registers an offense for literal {} in complex ! - registers an offense for literal :"#{a}" in complex ! - registers an offense for literal {} in && - registers an offense for `not 1` - registers an offense for literal {} in a when of a case without anything after case keyword - registers an offense for literal 1 in post-loop while - accepts literal {} in non-toplevel and/or - registers an offense for `!:"#{a}"` - registers an offense for literal {} in complex cond - accepts literal 1 in non-toplevel and/or - registers an offense for literal {} in ! - accepts `false` literal in `until` - registers an offense for literal 1 in post-loop until - registers an offense for `not :sym` - registers an offense for `!{}` - registers an offense for literal :sym in complex ! - accepts literal [1] if it's not an and/or operand - registers an offense for literal :sym in a when of a case without anything after case keyword - registers an offense for literal {} in post-loop until - accepts literal 1 if it's not an and/or operand - registers an offense for literal [1] in a when of a case without anything after case keyword - registers an offense for literal :sym in case - registers an offense for literal :"#{a}" in post-loop until - registers an offense for literal 1 in while - registers an offense for literal 1 in complex cond - accepts literal 2.0 if it's not an and/or operand - registers an offense for literal 2.0 in case - registers an offense for literal [1] in case - registers an offense for literal 2.0 in complex ! - registers an offense for literal :sym in post-loop until - registers an offense for `not :"#{a}"` - registers an offense for `not 2.0` - registers an offense for literal [1] in until - registers an offense for literal :"#{a}" in a when of a case without anything after case keyword - accepts literal :sym in a when of a case with something after case keyword - accepts literal [1] in non-toplevel and/or - registers an offense for literal :sym in until - registers an offense for literal 2.0 in post-loop until - registers an offense for literal [1] in while - accepts literal {} in a when of a case with something after case keyword - accepts literal :sym in non-toplevel and/or - accepts literal 2.0 in non-toplevel and/or - registers an offense for literal 1 in && - accepts literal :"#{a}" if it's not an and/or operand - registers an offense for `not [1]` - registers an offense for literal :sym in if - accepts `false` literal in post-loop `until` - registers an offense for literal [1] in ! - accepts array literal in case, if it has nested non-literal element - registers an offense for literal :sym in complex cond - accepts literal :sym if it's not an and/or operand - registers an offense for literal [1] in complex ! - registers an offense for literal :sym in && - accepts literal 2.0 in a when of a case with something after case keyword - >= Ruby 2.7 - accepts literal 2.0 in a when of a case match - accepts an offense for literal 2.0 in case match with a match var - registers an offense for literal 2.0 in case match without a match var - >= Ruby 2.7 - registers an offense for case match with a primitive array condition - accepts an offense for case match with a match var - accepts array literal in case match, if it has nested non-literal element - accepts array literal in case match, if it has non-literal elements - accepts dstr literal in case match - >= Ruby 2.7 - registers an offense for literal :sym in case match without a match var - accepts an offense for literal :sym in case match with a match var - accepts literal :sym in a when of a case match - >= Ruby 2.7 - registers an offense for literal 1 in case match without a match var - accepts an offense for literal 1 in case match with a match var - accepts literal 1 in a when of a case match - >= Ruby 2.7 - accepts an offense for literal {} in case match with a match var - accepts literal {} in a when of a case match - registers an offense for literal {} in case match without a match var - >= Ruby 2.7 - accepts an offense for literal [1] in case match with a match var - registers an offense for literal [1] in case match without a match var - accepts literal [1] in a when of a case match - >= Ruby 2.7 - registers an offense for literal :"#{a}" in case match without a match var - accepts an offense for literal :"#{a}" in case match with a match var - accepts literal :"#{a}" in a when of a case match - -RuboCop::Cop::Lint::ConstantOverwrittenInRescue - does not register an offense when not overriding an exception with an exception result - registers an offense when overriding an exception with an exception result - does not register an offense when using `=>` but correctly assigning to variables - -RuboCop::Cop::Lint::NonLocalExitFromIterator - allows return in define_method - allows return with value - allows return in define_singleton_method - when lambda is inside of block followed by method chain - allows - when block is lambda - allows - when block is followed by method chain - and has no argument - allows - and has single argument - registers an offense - and has multiple arguments - registers an offense - when the return is within a nested method definition - allows return in a class method definition - allows return in an instance method definition - when block in middle of nest is followed by method chain - registers offenses - when block is not followed by method chain - allows - -RuboCop::Cop::Naming::PredicateName - with restricted prefixes - accepts method name when corrected name is invalid identifier - accepts method name that is an assignment - registers an offense when method name starts with "is" - accepts method name that starts with unknown prefix - registers an offense when method name starts with "has" - without method definition macros - does not register any offenses when using an internal affair macro - accepts method name when corrected name is invalid identifier - registers an offense when using `define_method` - without restricted prefixes - registers an offense when method name starts with "has" - registers an offense when method name starts with "is" - accepts method name when corrected name is invalid identifier - accepts method name that starts with unknown prefix - with method definition macros - registers an offense when using `define_method` - registers an offense when using an internal affair macro - accepts method name when corrected name is invalid identifier - with permitted predicate names - accepts method name which is in permitted list - -RuboCop::Cop::Style::SlicingWithRange - >= Ruby 2.7 - reports no offense for startless - >= Ruby 2.6 - reports no offense for array with range inside - reports no offense for excluding end - reports no offense for other methods - reports an offense for slicing to ..-1 - reports an offense for slicing from expression to ..-1 - <= Ruby 2.5 - reports no offense for array slicing with -1 - -RuboCop::Cop::Style::CharacterLiteral - accepts ? in a %w literal - registers an offense for literals like \n - accepts literals like ?\C-\M-d - autocorrects ?' to "'" - registers an offense for character literals - -RuboCop::Formatter::PacmanFormatter - #update_progress_line - when total_files less than columns in the terminal - updates the progress_line properly - when total_files is greater than columns in the terminal - updates the progress_line properly - when need to change the line - updates the progress_line properly - #step - character is a Pacdot - leaves the progress_line as it is - character is Pacman - removes the first • and puts a ᗧ - character is ghost - removes the first • and puts a ghosts - character is normal dot - removes the first • and puts a . - #next_step - when no offenses are detected - calls the step function with a dot - when a offense is detected in a file - calls the step function with a dot - -RuboCop::Cop::Gemspec::OrderedDependencies - behaves like ordered dependency - when add_development_dependency - when gems are not alphabetically sorted - registers an offense - when each individual group of line is sorted - does not register any offenses - When gems are alphabetically sorted - does not register any offenses - when dependency is separated by multiline comment - with TreatCommentsAsGroupSeparators: false - registers an offense - with TreatCommentsAsGroupSeparators: true - accepts - behaves like ordered dependency - when add_dependency - when each individual group of line is sorted - does not register any offenses - when gems are not alphabetically sorted - registers an offense - When gems are alphabetically sorted - does not register any offenses - when dependency is separated by multiline comment - with TreatCommentsAsGroupSeparators: false - registers an offense - with TreatCommentsAsGroupSeparators: true - accepts - When using a local variable in an argument of dependent gem - does not register any offenses - when different dependencies are consecutive - does not register any offenses - When using method call to gem names - does not register any offenses - behaves like ordered dependency - when add_runtime_dependency - When gems are alphabetically sorted - does not register any offenses - when each individual group of line is sorted - does not register any offenses - when dependency is separated by multiline comment - with TreatCommentsAsGroupSeparators: false - registers an offense - with TreatCommentsAsGroupSeparators: true - accepts - when gems are not alphabetically sorted - registers an offense - -RuboCop::Cop::Style::TrailingCommaInBlockArgs - curly brace block format - ignores commas in default argument strings - does not register an offense for default arguments - does not register an offense when more than one argument is present with no trailing comma - registers an offense when a trailing comma is not needed - does not register an offense when a trailing comma is required - preserves semicolons in block/local variables - does not register an offense for keyword arguments - does not register an offense when no arguments are present - when `lambda` has multiple arguments - registers an offense and corrects when a trailing comma isn't needed - does not register an offense when more than one argument is present with no trailing comma - do/end block format - does not register an offense for an empty block - does not register an offense when a trailing comma is required - does not register an offense when more than one argument is present with no trailing comma - ignores commas in default argument strings - does not register an offense when no arguments are present - preserves semicolons in block/local variables - does not register an offense for keyword arguments - registers an offense when a trailing comma is not needed - does not register an offense for default arguments - when `->` has multiple arguments - does not register an offense - -RuboCop::Cop::Style::QuotedSymbols - configured with `single_quotes` - behaves like enforce single quotes - accepts unquoted symbols - accepts double quotes when control characters are used - accepts single quotes with double quotes - accepts double quotes with line breaks - accepts double quotes with interpolation - registers an offense and corrects escape characters properly - registers an offense and corrects for double quotes without interpolation - accepts double quotes when interpolating an instance variable - accepts single quotes - accepts double quotes with escape sequences - accepts single quotes with line breaks - registers an offense and corrects for double quotes in hash keys - accepts double quotes with single quotes - accepts double quotes when interpolating a global variable - accepts double quotes when interpolating a class variable - accepts double quotes when unicode control sequence is used - registers an offense and corrects for an escaped quote within double quotes - accepts single quoted symbol with an escaped quote - accepts double quotes with some other special symbols - hash with hashrocket style - accepts properly quoted symbols - corrects wrong quotes - configured with `same_as_string_literals` - when Style/StringLiterals is configured with single_quotes - behaves like enforce single quotes - accepts single quotes with line breaks - registers an offense and corrects for an escaped quote within double quotes - accepts double quotes when interpolating an instance variable - accepts double quotes with single quotes - accepts double quotes with interpolation - registers an offense and corrects escape characters properly - accepts single quoted symbol with an escaped quote - accepts double quotes with some other special symbols - accepts double quotes when interpolating a class variable - accepts single quotes with double quotes - accepts double quotes when control characters are used - accepts double quotes when interpolating a global variable - registers an offense and corrects for double quotes without interpolation - accepts double quotes with escape sequences - accepts unquoted symbols - accepts double quotes with line breaks - accepts single quotes - registers an offense and corrects for double quotes in hash keys - accepts double quotes when unicode control sequence is used - hash with hashrocket style - corrects wrong quotes - accepts properly quoted symbols - when Style/StringLiterals is disabled - behaves like enforce single quotes - accepts double quotes when control characters are used - registers an offense and corrects for double quotes without interpolation - accepts double quotes with single quotes - accepts double quotes when interpolating a class variable - accepts double quotes when unicode control sequence is used - accepts double quotes when interpolating a global variable - registers an offense and corrects for double quotes in hash keys - registers an offense and corrects escape characters properly - accepts double quotes with line breaks - accepts double quotes with some other special symbols - accepts double quotes with interpolation - accepts unquoted symbols - accepts double quotes when interpolating an instance variable - accepts single quotes - accepts single quotes with line breaks - accepts single quoted symbol with an escaped quote - accepts single quotes with double quotes - accepts double quotes with escape sequences - registers an offense and corrects for an escaped quote within double quotes - hash with hashrocket style - corrects wrong quotes - accepts properly quoted symbols - when Style/StringLiterals is configured with double_quotes - behaves like enforce double quotes - accepts unquoted symbols - accepts double quotes with single quotes - registers an offense and corrects for an escaped quote within single quotes - accepts double quotes when interpolating a global variable - registers an offense and corrects escape characters properly - registers an offense for single quotes - accepts double quoted symbol with an escaped quote - accepts double quotes with line breaks - accepts double quotes when interpolating an instance variable - accepts double quotes when interpolating a class variable - accepts double quotes with interpolation - accepts double quotes with escape sequences - accepts single quotes with line breaks - accepts single quotes with double quotes - accepts double quotes - hash with hashrocket style - corrects wrong quotes - accepts properly quoted symbols - configured with `double_quotes` - behaves like enforce double quotes - accepts unquoted symbols - registers an offense and corrects for an escaped quote within single quotes - accepts double quotes - accepts double quoted symbol with an escaped quote - accepts double quotes when interpolating an instance variable - registers an offense and corrects escape characters properly - accepts double quotes with escape sequences - accepts double quotes with line breaks - accepts double quotes with single quotes - accepts double quotes with interpolation - registers an offense for single quotes - accepts double quotes when interpolating a global variable - accepts single quotes with line breaks - accepts single quotes with double quotes - accepts double quotes when interpolating a class variable - hash with hashrocket style - accepts properly quoted symbols - corrects wrong quotes - -RuboCop::Cop::Style::TrailingBodyOnModule - autocorrects with comment after body - registers offense when module definition uses semicolon - autocorrects when there are multiple semicolons - accepts regular module - registers offense with multi-line module - registers an offense when body trails after module definition - when module is not on first line of processed_source - autocorrects offense - -RuboCop::Cop::EnforceSuperclass - registers an offense for single-line definitions - registers an offense for top-level constant ::Class.new definition - registers an offense for models that subclass ::ActiveRecord::Base - registers an offense for model defined using top-level - registers an offense for models that subclass ActiveRecord::Base - registers an offense for Class.new definition - when MyModel subclasses ApplicationRecord - behaves like no offense - registers no offenses for `class MyModel < ApplicationRecord; end` - behaves like no offense - registers no offenses for `MyModel = ::Class.new(::ApplicationRecord) do -end -MyModel = ::Class.new(::ApplicationRecord) -` - behaves like no offense - registers no offenses for `MyModel = Class.new(ApplicationRecord) do -end -MyModel = Class.new(ApplicationRecord) -` - behaves like no offense - registers no offenses for `class MyModel < ::ApplicationRecord; end` - when ApplicationRecord subclasses ActiveRecord::Base - behaves like no offense - registers no offenses for `::ApplicationRecord = ::Class.new(::ActiveRecord::Base) do; end -` - behaves like no offense - registers no offenses for `::ApplicationRecord = Class.new(ActiveRecord::Base) do; end -` - behaves like no offense - registers no offenses for `ApplicationRecord = Class.new(ActiveRecord::Base) -` - behaves like no offense - registers no offenses for `class ApplicationRecord < ActiveRecord::Base; end` - behaves like no offense - registers no offenses for `class ::ApplicationRecord < ActiveRecord::Base; end` - behaves like no offense - registers no offenses for `ApplicationRecord = Class.new(ActiveRecord::Base) do; end -` - behaves like no offense - registers no offenses for `ApplicationRecord = Class.new(::ActiveRecord::Base) do; end -` - behaves like no offense - registers no offenses for `::ApplicationRecord = ::Class.new(::ActiveRecord::Base) -` - -RuboCop::Cop::Style::FileRead - registers an offense for and corrects the `File.open` with multiline read block (mode 'r') - registers an offense for and corrects `File.open(filename, 'r+b').read` - registers an offense for and corrects `File.open(filename, 'r+t').read` - registers an offense for and corrects the `File.open` with inline read block (mode 'rb') - registers an offense for and corrects the `File.open` with multiline read block (mode 'rt') - registers an offense for and corrects the `File.open` with multiline read block (mode 'rb') - registers an offense for and corrects `File.open(filename, 'rt').read` - registers an offense for and corrects `File.open(filename, 'r').read` - registers an offense for and corrects the `File.open` with multiline read block (mode 'r+b') - registers an offense for and corrects the `File.open` with inline read block (implicit text mode) - registers an offense for and corrects the `File.open` with symbolic read proc (mode 'r') - registers an offense for and corrects the `File.open` with symbolic read proc (mode 'r+b') - registers an offense for and corrects `File.open(filename, 'rb').read` - registers an offense for and corrects the `File.open` with multiline read block (mode 'r+t') - registers an offense for and corrects `File.open(filename, 'r+').read` - registers an offense for and corrects the `File.open` with symbolic read proc (mode 'r+t') - registers an offense for and corrects the `File.open` with inline read block (mode 'r') - registers an offense for and corrects the `File.open` with symbolic read proc (implicit text mode) - registers an offense for and corrects the `File.open` with symbolic read proc (mode 'r+') - registers an offense for and corrects the `File.open` with inline read block (mode 'r+t') - registers an offense for and corrects `::File.open(filename).read` - registers an offense for and corrects the `File.open` with inline read block (mode 'rt') - registers an offense for and corrects the `File.open` with inline read block (mode 'r+') - registers an offense for and corrects the `File.open` with symbolic read proc (mode 'rb') - does not register an offense when not reading from the block variable - registers an offense for and corrects the `File.open` with symbolic read proc (mode 'rt') - registers an offense for and corrects the `File.open` with multiline read block (mode 'r+') - registers an offense for and corrects `File.open(filename).read` - registers an offense for and corrects the `File.open` with inline read block (mode 'r+b') - registers an offense for and corrects the `File.open` with multiline read block (implicit text mode) +RuboCop::Formatter::MarkdownFormatter + outputs the result in Markdown + outputs the cached result in Markdown -RuboCop::Cop::Style::WhileUntilModifier - behaves like condition modifier cop - for a multiline 'while' - handles inline comments during autocorrection - accepts it if body spans more than one line - doesn't break when used as RHS of binary arithmetic - handles one-line usage - accepts an empty body - accepts it when condition has local variable assignment - doesn't break when used as RHS of class var assignment - corrects it when assignment is in body - doesn't break when used as RHS of instance var assignment - corrects it if result fits in one line - accepts it if single line would not fit on one line - doesn't break when used as RHS of constant assignment - doesn't break when used as RHS of local var assignment - when Layout/LineLength is disabled - registers an offense even for a long modifier statement - accepts multiline condition in modifier form - registers an offense - when there is a comment on the first line and some code after the end keyword - does not register an offense - behaves like condition modifier cop - for a multiline 'until' - doesn't break when used as RHS of instance var assignment - doesn't break when used as RHS of local var assignment - corrects it when assignment is in body - doesn't break when used as RHS of class var assignment - accepts it if body spans more than one line - accepts an empty body - doesn't break when used as RHS of binary arithmetic - accepts it when condition has local variable assignment - corrects it if result fits in one line - handles inline comments during autocorrection - doesn't break when used as RHS of constant assignment - handles one-line usage - accepts it if single line would not fit on one line - when there is a comment on the first line and some code after the end keyword - does not register an offense - accepts multiline condition in modifier form - registers an offense - when Layout/LineLength is disabled - registers an offense even for a long modifier statement +RuboCop::Cop::Util + #same_line? + returns false when two nodes are not on the same line + returns false if an argument is not a node or range + can use ranges + returns true when two nodes are on the same line + #to_supported_styles + when EnforcedStyle + is expected to eq "SupportedStyles" + when EnforcedStyleInsidePipes + is expected to eq "SupportedStylesInsidePipes" + #line_range + returns line range of the expression -RuboCop::Formatter::JUnitFormatter - #file_finished - displays a non-offense element in parsable text - displays an offense for `classname='test_2` in parsable text - displays end of parsable text - displays start of parsable text - displays an offense for `classname='test_1` in parsable text +RuboCop::Cop::Layout::MultilineArrayLineBreaks + when two elements on same line + registers an offense and corrects + when on same line + does not add any offenses + when nested arrays + registers an offense and corrects + when on same line, separate line from brackets + does not add any offenses -RuboCop::Cop::Migration::DepartmentName - when todo/enable comments have cop names without departments - registers offenses and corrects - registers offenses and corrects when using a legacy cop name - registers offenses and corrects when there is space around `:` - when only department name has given - does not register an offense - when an unexpected disable comment format - does not register an offense - when a disable comment contains an unexpected character for department name - accepts - when a disable comment contains a plain comment - accepts - when a disable comment has cop names with departments - accepts +RuboCop::Cop::Style::RedundantParentheses + accepts parentheses around operator keywords + registers an offense for parens around last expressions in method body + registers an offense for parens around last expressions in block body + accepts parentheses in super call with hash + accepts parentheses when enclosed in parentheses at `until-post` + registers an offense for parens around method body + accepts parentheses around a constant passed to when + registers an offense for parens around a literal hash value + accepts parentheses inside an erange + registers an offense for parens around an interpolated expression + registers an offense for parens around a receiver of a method call with an argument + accepts parentheses inside an irange + registers an offense and corrects when method arguments are unnecessarily parenthesized + accepts parentheses around a method call with unparenthesized arguments + accepts parentheses when enclosed in parentheses at `while-post` + registers an offense for parens around a float exponentiation base + accepts parentheses around an irange + accepts parentheses in yield call with hash + registers an offense for parens around a positive exponent + registers an offense and corrects for a parenthesized item in a hash where the comma is on a line with the closing parens + accepts parentheses when they touch the preceding keyword + registers an offense for parens around a negative exponent + accepts parentheses around an erange + registers an offense when there is space around the parentheses + registers an offense for parens around a variable after semicolon + accepts parentheses around the error passed to rescue + registers an offense and corrects an array of multiple heredocs + registers an offense for parens around a literal hash value and following newline + accepts parentheses when they touch the following keyword + registers an offense for parens around an integer exponentiation base + registers an offense for parens around a block body + registers an offense for parens around a literal in array and following newline + registers an offense for parens around a literal in array + behaves like keyword with return value + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a keyword + behaves like redundant + registers an offense for parentheses around a keyword + behaves like redundant + registers an offense for parentheses around a keyword + behaves like redundant + registers an offense for parentheses around a variable + behaves like redundant + registers an offense for parentheses around a literal + behaves like redundant + registers an offense for parentheses around a literal + behaves like redundant + registers an offense for parentheses around a method call + behaves like redundant + registers an offense for parentheses around a literal + behaves like redundant + registers an offense for parentheses around a literal + when parentheses are used like method argument parentheses + accepts parens around the arg + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a literal + behaves like redundant + registers an offense for parentheses around a literal + behaves like redundant + registers an offense for parentheses around a literal + behaves like redundant + registers an offense for parentheses around a keyword + behaves like redundant + registers an offense for parentheses around a method call + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a keyword + when the first argument in a method call begins with a hash literal + registers an offense if the argument list is parenthesized + accepts parentheses if the argument list is not parenthesized + when a hash literal is the second argument in a method call + registers an offense + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a literal + behaves like redundant + registers an offense for parentheses around a keyword + behaves like redundant + registers an offense for parentheses around a literal + behaves like redundant + registers an offense for parentheses around an unary operation + behaves like redundant + registers an offense for parentheses around a method call + behaves like redundant + registers an offense for parentheses around an unary operation + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a keyword + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a variable + behaves like redundant + registers an offense for parentheses around a constant + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a method call + behaves like redundant + registers an offense for parentheses around a method call + behaves like plausible + accepts parentheses when arguments are unparenthesized + pin operator + behaves like allowed parentheses + accepts parentheses on a method call on a class variable + behaves like allowed parentheses + accepts parentheses on a method call on an instance variable + behaves like allowed parentheses + accepts parentheses on a function call with arguments + behaves like redundant parentheses + registers an offense and corrects a global variable + behaves like allowed parentheses + accepts parentheses on a method call on a global variable + behaves like allowed parentheses + accepts parentheses on an int literal + behaves like redundant parentheses + registers an offense and corrects a class variable + behaves like redundant parentheses + registers an offense and corrects an instance variable + behaves like redundant parentheses + registers an offense and corrects a local variable + behaves like allowed parentheses + accepts parentheses on an expression + behaves like allowed parentheses + accepts parentheses on a function call with no arguments + behaves like allowed parentheses + accepts parentheses on a hash literal + behaves like allowed parentheses + accepts parentheses on an array literal + behaves like allowed parentheses + accepts parentheses on a range literal + behaves like allowed parentheses + accepts parentheses on a method call on a local variable + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around an unary operation + behaves like redundant + registers an offense for parentheses around a literal + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a keyword + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like keyword with return value + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a keyword + behaves like redundant + registers an offense for parentheses around a keyword + behaves like redundant + registers an offense for parentheses around a keyword + behaves like keyword with arguments + behaves like redundant + registers an offense for parentheses around a keyword + behaves like redundant + registers an offense for parentheses around a keyword + behaves like redundant + registers an offense for parentheses around a keyword + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a method call + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a method call + behaves like redundant + registers an offense for parentheses around a keyword + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a literal + behaves like keyword with arguments + behaves like redundant + registers an offense for parentheses around a keyword + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a keyword + behaves like redundant + registers an offense for parentheses around a keyword + behaves like redundant + registers an offense for parentheses around a literal + behaves like plausible + accepts parentheses when arguments are unparenthesized + literals in an array + when there is a comma on the same line as the closing parentheses + registers an offense and corrects when there is assignment + registers an offense and corrects when there is a subsequent item + registers an offense and corrects when there is no subsequent item + registers an offense and corrects when there is a trailing comma + behaves like redundant + registers an offense for parentheses around a literal + behaves like redundant + registers an offense for parentheses around a literal + behaves like keyword with return value + behaves like redundant + registers an offense for parentheses around a keyword + behaves like redundant + registers an offense for parentheses around a keyword + behaves like redundant + registers an offense for parentheses around a keyword + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a literal + behaves like plausible + accepts parentheses when arguments are unparenthesized + ternaries + when Style/TernaryParentheses has EnforcedStyle: require_parentheses_when_complex + behaves like plausible + accepts parentheses when arguments are unparenthesized + when Style/TernaryParentheses is not enabled + registers an offense for parens around constant ternary condition + when Style/TernaryParentheses has EnforcedStyle: require_no_parentheses + registers an offense for parens around ternary condition + when Style/TernaryParentheses has EnforcedStyle: require_parentheses + behaves like plausible + accepts parentheses when arguments are unparenthesized + behaves like redundant + registers an offense for parentheses around a variable + when a non-parenthesized call has an arg and a block + accepts parens around the arg + behaves like redundant + registers an offense for parentheses around a method call + behaves like redundant + registers an offense for parentheses around a literal + behaves like redundant + registers an offense for parentheses around a method call + behaves like redundant + registers an offense for parentheses around a keyword + behaves like redundant + registers an offense for parentheses around an unary operation -RuboCop::Cop::InternalAffairs::NodeTypePredicate - does not register an offense for a predicate node type check - comparison node type check - registers an offense and autocorrects +RuboCop::Cop::Style::NumberedParametersLimit + with Ruby >= 2.7 + does not register an offense for a normal block with too many parameters + sets Max properly for auto-gen-config + does not register an offense for a numblock with exactly `Max` parameters + does not register an offense for a numblock with fewer than `Max` parameters + when Max is 1 + uses the right offense message + when there are more than `Max` numbered parameters + registers an offense for a single line `numblock` + registers an offense for a multiline `numblock` + when configuring Max + does not register an offense when there are not too many numbered params -RuboCop::Cop::Lint::ShadowingOuterLocalVariable - when a block block argument has same name as an outer scope variable - registers an offense - when a block local variable has same name as an outer scope variablewith same branches of same `if` condition node not in the method definition - registers an offense - when the same variable name as a block variable is used in return value assignment of `if` - does not register an offense - when a block argument has a same name starts with "_" as an outer scope variable - does not register an offense - with Ractor.new - does not register an offense - when multiple block arguments have same name "_" - does not register an offense - when a block local variable has same name as an outer scope variablewith same branches of same `if` condition node - registers an offense - when a block local variable has same name as an outer scope variablewith different branches of same `case` condition node - does not register an offense - when a block local variable has same name as an outer scope variablewith same branches of same `unless` condition node - registers an offense - when an outer scope variable is reassigned in a block - does not register an offense - when a block local variable has same name as an outer scope variablewith different branches of same `unless` condition node - does not register an offense - when a method argument has same name as an outer scope variable - does not register an offense - when a block local variable has same name as an outer scope variablewith different branches of same `if` condition node - does not register an offense - when a block local variable has same name as an outer scope variablewith same branches of same nested `if` condition node - registers an offense - when a block local variable has same name as an outer scope variable - registers an offense - when a block argument has same name "_" as outer scope variable "_" +RuboCop::Cop::Style::OptionHash + registers an offense + when passing options hash to super + does not register an offense when call to super is in a nested block + does not register an offense when code exists before call to super does not register an offense - when a block argument has different name with outer scope variables + when the last argument is a non-options-hash optional hash does not register an offense - when a block argument has same name as an outer scope variable - registers an offense - when a splat block argument has same name as an outer scope variable - registers an offense - when an outer scope variable is referenced in a block + when there are no arguments does not register an offense - when multiple block arguments have a same name starts with "_" + permitted list + ignores if the method is permitted + when the last argument is an options hash named something else does not register an offense - when a block local variable has same name as an outer scope variablewith same branches of same `case` condition node - registers an offense - -RuboCop::Cop::Style::MultilineBlockChain - accepts a chain of blocks spanning one line - accepts a chain of calls followed by a multi-line block - accepts a multi-line block chained with calls on one line - with multi-line block chaining - registers an offense for a slightly more complicated case - registers an offense for a chain where the second block is single-line - registers an offense for a simple case - accepts a chain where the first block is single-line - registers two offenses for a chain of three blocks - Ruby 2.7 - registers an offense for a slightly more complicated case - -RuboCop::Cop::Naming::AccessorMethodName - accepts method set_something with two args - accepts singleton method set_something with no args - accepts method set_something with kwrestarg - registers an offense for method set_something with one arg - accepts method get_something with args - accepts method set_something with kwoptarg - registers an offense for singleton method get_something with no args - accepts method set_something with restarg - accepts method set_something with kwarg - accepts method set_something with optarg - accepts singleton method set_something with two args - registers an offense for method get_something with no args - accepts method set_something with no args - accepts method set_something with blockarg - accepts singleton method get_something with args - registers an offense for singleton method set_something with one args - >= Ruby 2.7 - accepts method set_something with arguments forwarding - -RuboCop::Cop::Layout::BlockEndNewline - registers an offense and corrects when multiline block `}` is not on its own line and using multiple heredoc arguments - registers an offense and corrects when a multiline block ends with a method call with hash arguments - registers an offense and corrects when a multiline block ends with a hash - registers an offense and corrects when multiline block `}` is not on its own line and using heredoc argument with method chain - registers an offense and corrects when multiline block `}` is not on its own line - registers an offense and corrects when `}` of multiline block without processing is not on its own line - registers an offense and corrects when multiline block `}` is not on its own line and using heredoc argument - registers an offense and corrects when multiline block `}` is not on its own line and using multiple heredoc argument method chain - accepts a one-liner - registers an offense and corrects when multiline block end is not on its own line - accepts multiline blocks with newlines before the end - registers an offense and corrects when multiline block `}` is not on its own line and using method chain - Ruby 2.7 - registers an offense and corrects when multiline block `}` is not on its own line and using method chain - registers an offense and corrects when multiline block `}` is not on its own line and using heredoc argument - -RuboCop::Cop::Lint::OrAssignmentToConstant - does not register an offense with plain assignment to a constant - does not register an offense with or-assignment to a local variable - does not register an offense with or-assignment to a class variable - does not register an offense with or-assignment to an attribute - does not register an offense with or-assignment to an instance variable - does not register an offense with or-assignment to a global variable - registers an offense with or-assignment to a constant - -RuboCop::Cop::Style::ExplicitBlockArgument - does not register an offense when `yield` arguments is not a prefix of block arguments - correctly corrects when method already has an explicit block argument - does not register an offense when code is called outside of a method - correctly corrects when the method call has a trailing comma in its argument list - registers an offense and corrects when block just yields its arguments - does not register an offense when `yield` is the sole block body - registers an offense and corrects when `yield` is inside block of `super` - registers an offense and corrects when `yield` inside block has no arguments - does not register an offense when `yield` is not inside block - does not add extra parens when correcting - registers an offense and corrects when multiple arguments are yielded - adds to the existing arguments when correcting - does not add extra parens to `super` when correcting - does not register an offense when arguments are yielded in a different order - does not register an offense when there is more than one block argument and not all are yielded - registers an offense and corrects when method contains multiple `yield`s - correctly corrects when using safe navigation method call - -RuboCop::Cop::Style::NegatedIf - does not blow up for ternary ops - does not blow up for empty unless condition - does not blow up on a negated ternary operator - does not blow up for empty if condition - with “prefix” style - does not register an offense for postfix - registers an offense for prefix - with “postfix” style - does not register an offense for prefix - registers an offense for postfix - with “both” style - accepts an if/else with negative condition - is not confused by negated elsif - accepts an if where only part of the condition is negated - autocorrects by replacing parenthesized if not with unless - registers an offense for if with exclamation point condition - registers an offense for if with "not" condition - accepts an if where the condition is doubly negated - -RuboCop::Cop::Style::PreferredHashMethods - with enforced `short` style - registers an offense for has_value? with one arg - accepts has_key? with no args - accepts has_value? with no args - registers an offense for has_key? with one arg - when using safe navigation operator - registers an offense for has_value? with one arg - with enforced `verbose` style - accepts key? with no args - registers an offense for value? with one arg - registers an offense for key? with one arg - accepts value? with no args - -RuboCop::Cop::Layout::SpaceAroundEqualsInParameterDefault - when EnforcedStyle is space - registers an offense and corrects default value assignment without space - accepts default value assignment with spaces and unary + operator - registers an offense and corrects missing space for arguments with unary operators - registers an offense and corrects assignment of empty list without space - registers an offense and corrects assigning empty string without space - accepts default value assignment with space - registers an offense and corrects default value assignment where first is partially right without space - when EnforcedStyle is no_space - registers an offense and corrects default value assignment with space - registers an offense and corrects assignment of empty list with space - registers an offense and corrects assignment of empty string with space - accepts default value assignment without space - -RuboCop::Cop::Layout::DefEndAlignment - when EnforcedStyleAlignWith is def - accepts matching defs ... end - registers an offense for mismatched def Test.test end and autocorrects - accepts matching def ... end - registers an offense for mismatched foo def test end and autocorrects - accepts matching foo def ... end - registers an offense for mismatched def test end and autocorrects - correct + opposite - registers an offense - when EnforcedStyleAlignWith is start_of_line - accepts matching foo def ... end - accepts matching foo bar def ... end - accepts matching def ... end - registers an offense for mismatched def test end and autocorrects - accepts matching def ... end - accepts matching defs ... end - registers an offense for mismatched foo def test end and autocorrects - registers an offense for mismatched def Test.test end and autocorrects - when including an anonymous module containing `private def` - does not register an offense - correct + opposite - registers an offense - when using refinements and `private def` - does not register an offense - -RuboCop::Cop::Style::CollectionMethods - registers an offense for member? with block - registers an offense for collect with an argument and proc param - registers an offense for find_all with proc param - accepts detect without a block - registers an offense for inject with an argument and proc param - accepts find_all without a block - registers an offense for find_all with block - registers an offense for detect with block - registers an offense for member? with proc param - registers an offense for detect with proc param - accepts collect without a block - registers an offense for member? with an argument and proc param - registers an offense for detect with an argument and proc param - registers an offense for collect with proc param - accepts member? without a block - registers an offense for find_all with an argument and proc param - registers an offense for collect with block - registers an offense for inject with proc param - registers an offense for inject with block - accepts inject without a block - for methods that do not accept a symbol as implicit block - does not register an offense for a final symbol param with extra args - does not register an offense for a final symbol param - Ruby 2.7 - registers an offense for inject with numblock - Ruby 2.7 - registers an offense for detect with numblock - Ruby 2.7 - registers an offense for find_all with numblock - Ruby 2.7 - registers an offense for collect with numblock - Ruby 2.7 - registers an offense for member? with numblock - for methods that accept a symbol as implicit block - registers an offense with a final symbol param - registers an offense with an argument and final symbol param - -RuboCop::Cop::VariableForce::Assignment - #name - returns the variable name - #meta_assignment_node - when it is &&= operator assignment - returns and_asgn node - when it is multiple assignment - returns masgn node - when it is += operator assignment - returns op_asgn node - when it is ||= operator assignment - returns or_asgn node - #operator - when it is &&= operator assignment - returns &&= - when it is += operator assignment - returns += - when it is ||= operator assignment - returns ||= - when it is multiple assignment - returns = - when it is normal assignment - returns = - .new - when an argument declaration node is passed - raises error - when an assignment node is passed - does not raise error - when any other type node is passed - raises error - -RuboCop::Cop::Naming::InclusiveLanguage - filepath - CheckFilepaths is false - does not register an offense - one offense in filename - registers an offense - offense in directory name - registers an offense for a director - multiple offenses in filename - registers an offense with all problematic words - allowed use - does not register an offense for an allowed use - offense after an allowed use - registers an offense at the correct location - symbols - when CheckSymbols is true - registers an offense - when CheckSymbols is false - does not register an offense - comments - registers an offense in a block comment - registers an offense in a single line comment - when CheckComments is false - does not register an offense - strings - registers an offense for an interpolated string - registers an offense for a multiline string - does not register offenses and not raise `ArgumentError` for invalid byte sequence in UTF-8 - registers an offense in a heredoc - when CheckStrings config is false - does not register offenses for strings - constants - when CheckConstants config is true - registers offenses for constants - when CheckConstants config is false - does not register offenses for constants - flagged term matching - registers an offense when using a flagged term - registers an offense for a partial word match - registers an offense when using a flagged term with mixed case - WholeWord: true - only flags when the term is a whole word - regex - registers an offense for a flagged term matched with a regexp - multiple offenses on a line - registers an offense for each word - disable default flagged term - ignores flagged terms that are set to nil - variables - when CheckVariables config is true - registers offenses for global variables - registers offenses for instance variables - registers offenses for class variables - when CheckVariables config is false - does not register offenses for variables - identifiers - when CheckIdentifiers config is true + when the argument name is in the list of suspicious names registers an offense - when CheckIdentifiers config is false - does not register offenses for identifiers - suggestions - flagged term with two suggestions - includes both suggestions in the offense message - flagged term with one suggestion - includes the suggestion in the offense message - flagged term with three or more suggestions - includes all suggestions in the message - -RuboCop::Cop::Style::SignalException - when enforced style is `semantic` - registers an offense for raise not in a begin/rescue/end - is not confused by nested begin/rescue - registers an offense for fail in def rescue section - accepts raise in def with multiple rescues - accepts `raise` and `fail` with explicit receiver - registers one offense for each raise - accepts raise in rescue section - registers an offense for fail in rescue section - registers an offense for raise in def body - registers an offense for raise in begin section - registers only offense for one raise that should be fail - registers an offense for fail in second rescue - accepts raise in def rescue section - registers an offense for `raise` and `fail` with `Kernel` as explicit receiver - registers an offense for `raise` and `fail` with `::Kernel` as explicit receiver - when enforced style is `raise` - registers an offense for fail in begin section - accepts `fail` if a custom `fail` instance method is defined - registers an offense for `fail` with `Kernel` as explicit receiver - registers an offense for fail in def body - accepts `fail` if a custom `fail` singleton method is defined - registers an offense for fail in rescue section - accepts `fail` with explicit receiver - when enforced style is `fail` - registers an offense for raise in def body - registers an offense for `raise` with `Kernel` as explicit receiver - registers an offense for raise in rescue section - accepts `raise` with explicit receiver - registers an offense for raise in begin section - -RuboCop::Cop::Lint::RegexpAsCondition - does not register an offense for a regexp literal outside conditions - registers an offense and corrects for a regexp literal in `if` condition - does not register an offense for a regexp literal with `=~` operator - -RuboCop::Cop::Lint::SuppressedException - with AllowComments set to false - registers an offense for empty rescue block - does not register an offense for rescue with body - when empty rescue for defs - registers an offense for empty rescue without comment - registers an offense for empty rescue with comment - Ruby 2.5 or higher - when empty rescue for `do` block - registers an offense for empty rescue without comment - registers an offense for empty rescue with comment - when empty rescue for `def` - registers an offense for empty rescue with comment - registers an offense for empty rescue without comment - with AllowNil set to false - registers an offense for rescue block with nil - registers an offense for inline nil rescue - with AllowNil set to true - does not register an offense for inline nil rescue - does not register an offense for rescue block with nil - with AllowComments set to true - does not register an offense for empty rescue with comment - registers an offense for empty rescue on single line with a comment after it - Ruby 2.7 or higher - when empty rescue for `do` block with a numbered parameter - does not register an offense for empty rescue with comment - registers an offense for empty rescue without comment - when empty rescue for `def` - does not register an offense for empty rescue with comment - registers an offense for empty rescue without comment - Ruby 2.5 or higher - when empty rescue for `do` block - does not register an offense for empty rescue with comment - registers an offense for empty rescue without comment - when empty rescue for `defs` - does not register an offense for empty rescue with comment - registers an offense for empty rescue without comment - -RuboCop::Cop::Lint::EmptyConditionalBody - registers an offense for missing `if` body with `elsif` - does not register an offense for missing `unless` body with a comment - does not register an offense for missing `elsif` body with a comment - registers an offense for missing `if` body - registers an offense for missing `unless` body - registers an offense for missing `if` and `elsif` body - does not register an offense for missing `elsif` body with an inline comment - registers an offense for missing `elsif` body that is not the one with a comment - registers an offense for missing `elsif` body - autocorrects properly when the if is assigned to a variable - registers an offense for missing `unless` body with `else` - registers an offense for missing `if` and `else` body with some indentation - registers an offense for missing all branches of `if` and multiple `elsif` body - registers an offense for missing `if` and `else` body - registers an offense for missing all branches of `if` and `elsif` body - does not register an offense for missing `if` body with a comment - registers an offense for missing `if` body with present `else` body - registers an offense for missing second `elsif` body without an inline comment - registers an offense for missing `unless` and `else` body - registers an offense for missing `if` body with `else` - when AllowComments is false - registers an offense for missing `if` body with a comment - registers an offense for missing `unless` body with a comment - registers an offense for missing `elsif` body with a comment - -RuboCop::Cop::Metrics::BlockLength - does not count blank lines - accepts a block with multiline receiver and less than 3 lines of body - does not count commented lines by default - accepts empty blocks - rejects a block with more than 5 lines - reports the correct beginning and end lines - properly counts nested blocks - rejects brace blocks too - accepts a block with less than 3 lines - when defining a Struct - does not register an offense - when defining a class - does not register an offense - when `CountAsOne` is not empty - folds array into one line - when using numbered parameter - does not count blank lines - reports the correct beginning and end lines - rejects a block with more than 5 lines - accepts a block with less than 3 lines - when CountComments is enabled - also counts commented lines - when methods to allow are defined - when ExcludedMethods is enabled - does not report an offense - that does not match - reports an offense - when AllowedMethods is enabled - behaves like allow an offense on an allowed method - still rejects other methods with long blocks - accepts the foo method with a long block - when a method is allowed, but receiver is a module - does not report an offense - behaves like allow an offense on an allowed method - accepts the foo method with a long block - still rejects other methods with long blocks - when receiver contains whitespaces - allows whitespaces - when AllowedPatterns is enabled - does not report an offense - that does not match - reports an offense - when IgnoredMethods is enabled - when regex - does not report an offense - that does not match - reports an offense - when string - does not report an offense - that does not match - reports an offense - when defining a module - does not register an offense -RuboCop::Cop::Layout::MultilineMethodCallBraceLayout - ignores calls with an empty brace - ignores calls without arguments - ignores single-line calls - ignores implicit calls - ignores calls with a multiline empty brace - behaves like multiline literal brace layout - same_line style - opening brace on same line as first element - allows closing brace on same line as multi-line element - autocorrects closing brace on different line as last element - allows closing brace on same line from last element - detects closing brace on different line from multiline element - with a chained call on the closing brace - but no comment after the last element - autocorrects the closing brace - and a comment after the last element - detects closing brace on separate line from last elementbut does not autocorrect the closing brace - opening brace on separate line from first element - allows closing brace on same line as last element - detects closing brace on different line from last element - allows closing brace on same line as last multiline element - heredoc - detects heredoc structures that are safe to add to - ignores heredocs that could share a last line - symmetrical style - opening brace on separate line from first element - detects closing brace on same line as last element - allows closing brace on separate line from last element - allows closing brace on separate line from last multiline element - opening brace on same line as first element - allows closing brace on same line as last multiline element - detects closing brace on different line from last element - autocorrects closing brace on different line from last element - allows closing brace on same line as last element - with a chained call on the closing brace - and a comment after the last element - detects closing brace on separate line from last elementbut does not autocorrect the closing brace - but no comment after the last element - autocorrects the closing brace - new_line style - opening brace on separate line from first element - detects closing brace on same line as last element - allows closing brace on separate line from last element - allows closing brace on separate line from last multiline element - opening brace on same line as first element - allows closing brace on different line from last element - allows closing brace on different line from multi-line element - autocorrects closing brace on same line as last element - detects closing brace on same line as last multiline element - when comment present before closing brace - corrects closing brace without crashing - behaves like multiline literal brace layout trailing comma - same_line style - opening brace on same line as first element - last element has a trailing comma - autocorrects closing brace on different line as last element - symmetrical style - opening brace on same line as first element - last element has a trailing comma - autocorrects closing brace on different line from last element - when EnforcedStyle is new_line - ignores single-line calls with multi-line receiver - still ignores single-line calls - ignores single-line calls with multi-line receiver with leading dot +RuboCop::Cop::Style::TopLevelMethodDefinition + does not register an offense when just called method on top-level + does not register an offense when define_method is not top-level + does not register an offense when using module + does not register an offense when defined within arbitrary block + registers an offense top-level methods + does not register an offense when using class + registers an offense top-level class methods + registers an offense when defining a top-level method after a class definition + does not register an offense when using Struct + top-level define_method + registers offense for multi-line block + registers offense for proc argument + registers offense with inline block + Ruby >= 2.7 + registers offense with inline numblock -RuboCop::Cop::InternalAffairs::UselessMessageAssertion - registers an offense for specs that assert using the MSG - does not register an offense for an assertion about the message - registers an offense for described_class::MSG in let - registers an offense for specs that expect offense using the MSG +RuboCop::Cop::Lint::EnsureReturn + registers an offense when returning multiple values in `ensure` + registers an offense and corrects for return in ensure + does not check when ensure block has no body + registers an offense and corrects for return with argument in ensure + does not register an offense for return outside ensure -RuboCop::Cop::Layout::TrailingWhitespace - registers an offense for a line ending with space - is not fooled by heredoc containing __END__ within a doc comment - registers an offense for a tab in a heredoc - registers an offense for a blank line with space - autocorrects unwanted space - accepts a line without trailing whitespace - registers an offense for a line ending with tab - is not fooled by heredoc containing __END__ - registers offenses before __END__ but not after - registers an offense for trailing whitespace in a heredoc string - is not fooled by __END__ within a documentation comment - when `AllowInHeredoc` is set to false - corrects by removing trailing whitespace used for indentation in a heredoc string - corrects a whitespace line in a heredoc string that is longer than the indentation - corrects safely trailing whitespace in a heredoc string - does not correct trailing whitespace in a static heredoc string - when `AllowInHeredoc` is set to true - accepts trailing whitespace in a heredoc string - registers an offense for trailing whitespace at the heredoc begin +RuboCop::Cop::Style::LineEndConcatenation + registers an offense for dynamic string concat at line end + registers an offense for string concat with << at line end + accepts string concat on the same line + accepts string concat at line end when % literals are involved + accepts string concat at line end when followed by comment + registers offenses only for the appropriate lines in chained concats + registers multiple offenses when there are chained << methods + autocorrects a + with trailing whitespace to \ + registers multiple offenses when there are chained concatenationscombined with << calls + registers an offense for string concat at line end + accepts string concat with a return value of method on a string + registers multiple offenses when there are chained concatenations + accepts string concat at line end when followed by a comment line + autocorrects only the lines that should be autocorrected + autocorrects a + with \ to just \ + registers an offense for string concat with << and \ at line ends + accepts string concat at line end for special strings like __FILE__ + registers an offense for dynamic string concat with << at line end + accepts string concat with a return value of method on an interpolated string -RuboCop::Cop::Lint::RandOne - behaves like offenses - Kernel.rand(-1.0) - registers an offense - behaves like offenses - rand(1.0) - registers an offense - behaves like offenses - Kernel.rand 1.0 - registers an offense - behaves like no offense - rand - does not register an offense - behaves like offenses - rand(-1.0) - registers an offense - behaves like offenses - ::Kernel.rand(1) - registers an offense - behaves like offenses - Kernel.rand(1) - registers an offense - behaves like no offense - Kernel.rand - does not register an offense - behaves like no offense - Kernel.rand 2 - does not register an offense - behaves like no offense - Kernel.rand(-1..1) - does not register an offense - behaves like no offense - rand(2) - does not register an offense - behaves like offenses - rand 1 - registers an offense - behaves like offenses - Kernel.rand(-1) - registers an offense - behaves like offenses - rand(-1) - registers an offense - behaves like no offense - rand(-1..1) - does not register an offense - behaves like no offense - ::Kernel.rand - does not register an offense +RuboCop::Cop::Layout::SpaceAfterColon + accepts colon in ternary followed by space + accepts if + accepts colons in strings + accepts hashes with a space after colons + registers an offense and corrects colon without space after it + accepts hash rockets + accepts required keyword arguments + registers an offense and corrects a keyword optional argument without a space + accepts colons in symbols + accepts colons denoting required keyword argument + Ruby >= 3.1 + does not register an offense colon without space after it when using hash value omission + accepts colons denoting hash value omission argument -RuboCop::Cop::Naming::HeredocDelimiterCase - when enforced style is lowercase - with a squiggly heredoc - registers an offense and corrects with a camel case delimiter - does not register an offense with a lowercase delimiter - registers an offense and corrects with an uppercase delimiter - with a non-interpolated heredoc - registers an offense and corrects with an uppercase delimiter - does not register an offense with a lowercase delimiter - registers an offense and corrects with a camel case delimiter - with an interpolated heredoc - registers an offense and corrects with a camel case delimiter - does not register an offense with a lowercase delimiter - registers an offense and corrects with an uppercase delimiter - when enforced style is uppercase - with a squiggly heredoc - registers an offense and corrects with a lowercase delimiter - registers an offense and corrects with a camel case delimiter - does not register an offense with an uppercase delimiter - with an interpolated heredoc - does not register an offense with an uppercase delimiter - registers an offense and corrects with a lowercase delimiter - registers an offense with a camel case delimiter - with a non-interpolated heredoc - when using double quoted delimiters - does not register an offense with an uppercase delimiter - registers an offense and corrects with a camel case delimiter - registers an offense and corrects with a lowercase delimiter - when using single quoted delimiters - registers an offense and corrects with a lowercase delimiter - does not register an offense with an uppercase delimiter - registers an offense and corrects with a camel case delimiter - when using non-word delimiters - does not register an offense - when using back tick delimiters - does not register an offense with an uppercase delimiter - registers an offense and corrects with a lowercase delimiter - registers an offense and corrects with a camel case delimiter +RuboCop::Cop::AlignmentCorrector + #correct + within string literals + does not insert whitespace + with large column deltas + with heredoc in backticks (<<``) + behaves like heredoc indenter + does not change indentation of here doc bodies and end markers + with plain heredoc (<<) + behaves like heredoc indenter + does not change indentation of here doc bodies and end markers + with single-line here docs + does not indent body and end marker + simple indentation + with a negative column delta + outdents + with a positive column delta + indents Changelog - parses correctly merges correctly + parses correctly Changelog::Entry - #body - when there is an issue referenced with [Fixes #x] the body - is expected to eq "Fix something" - when there is no issue referenced in the body - is expected to eq "Fix something" - when there is no body - is expected to eq "" - when there is an issue referenced with [Fix #x] the body - is expected to eq "Fix something" #content - when there is an issue referenced - generates correct content when there is no issue referenced generates correct content + when there is an issue referenced + generates correct content #ref_id when there is no body is expected to eq "x" - when there is an issue referenced with [Fix #x] the body - is expected to eq "123" when there is an issue referenced with [Fixes #x] the body is expected to eq "123" when there is no issue referenced in the body is expected to eq "x" + when there is an issue referenced with [Fix #x] the body + is expected to eq "123" + #body + when there is no body + is expected to eq "" + when there is no issue referenced in the body + is expected to eq "Fix something" + when there is an issue referenced with [Fixes #x] the body + is expected to eq "Fix something" + when there is an issue referenced with [Fix #x] the body + is expected to eq "Fix something" -RuboCop::Cop::Layout::SpaceBeforeFirstArg - for method calls without parentheses - accepts multiple space containing line break - registers an offense for method call with no spaces before the first arg - registers an offense and corrects method call with two spaces before the first arg - accepts a method call with one space before the first arg - accepts setter call - accepts + operator - when using safe navigation operator - registers an offense and corrects method call with two spaces before the first arg - when a vertical argument positions are aligned - registers an offense - when AllowForAlignment is false - registers an offense and corrects method calls with aligned first arguments - when AllowForAlignment is true - accepts method calls with aligned first arguments - for method calls with parentheses - accepts a method call without space - accepts a method call with space after the left parenthesis - -RuboCop::Cop::Lint::NumberedParameterAssignment - registers an offense when using `_10` lvar - registers an offense when using `_0` lvar - does not register an offense when index assignment - does not register an offense when using non numbered parameter - when Ruby 2.7 or lower - registers an offense when using `_9` numbered parameter - registers an offense when using `_1` numbered parameter - registers an offense when using `_4` numbered parameter - registers an offense when using `_5` numbered parameter - registers an offense when using `_6` numbered parameter - registers an offense when using `_2` numbered parameter - registers an offense when using `_8` numbered parameter - registers an offense when using `_7` numbered parameter - registers an offense when using `_3` numbered parameter - -RuboCop::Cop::Lint::UnderscorePrefixedVariableName - when an underscore-prefixed named capture variable is used - registers an offense - when an underscore-prefixed block argument is used - registers an offense - registers an offense - in a method calling `super` without arguments - when an underscore-prefixed argument is not used explicitly - does not register an offense - when an underscore-prefixed argument is used explicitly - registers an offense - when an underscore-prefixed variable is used - registers an offense - when an underscore-prefixed keyword block argument is used - registers an offense - when AllowKeywordBlockArguments is set - does not register an offense - when an underscore-prefixed variable is reassigned - does not register an offense - when non-underscore-prefixed variable is used - does not register an offense - in a method calling `super` with arguments - when an underscore-prefixed argument is used explicitly - registers an offense - when an underscore-prefixed argument is not used - does not register an offense - when an underscore-prefixed method argument is used - registers an offense - in a method calling `binding` without arguments - when an underscore-prefixed argument is not used explicitly - does not register an offense - when an underscore-prefixed argument is used explicitly - registers an offense - when an underscore-prefixed variable in top-level scope is used - registers an offense - in a method calling `binding` with arguments - when an underscore-prefixed argument is used explicitly - registers an offense - when an underscore-prefixed argument is not used - does not register an offense - when an underscore-prefixed variable is captured by a block - accepts - -RuboCop::Cop::Lint::ScriptPermission - with stdin - skips investigation - with file permission 0644 - registers an offense for script permission - if autocorrection is off - leaves the file intact - with file permission 0755 - accepts with blank - accepts without shebang line - accepts with shebang line - -RuboCop::Cop::Lint::SafeNavigationChain - TargetRubyVersion >= 2.3 - registers an offense for ordinary method chain exists after safe navigation method call with an argument - registers an offense for ordinary method call exists after safe navigation method call - registers an offense for safe navigation with < operator - accepts usages of safe navigation with `try` method - accepts usages of safe navigation with === operator - registers an offense for safe navigation with >= operator - accepts usages of safe navigation with self assignment method - accepts usages of safe navigation with | operator - accepts usages of method chain with safe navigation only with argument - accepts usages of safe navigation with `blank?` method - accepts usages of safe navigation with & operator - registers an offense for safe navigation with <= operator - accepts usages of safe navigation with == operator - accepts usages of safe navigation with `present?` method - registers an offense for safe navigation with > operator - accepts usages of safe navigation with `+@` method - accepts usages of ordinary method chain with argument - accepts usages of safe navigation at last only - accepts usages of safe navigation with `nil?` method - registers an offense for safe navigation on the right-hand side of the `-` - accepts usages of ordinary method chain - registers an offense for safe navigation with [] operator - accepts usages of method chain with safe navigation only - accepts usages of safe navigation with assignment method - registers an offense for safe navigation with []= operator - registers an offense for safe navigation on the right-hand side of the `+` - accepts usages of safe navigation at last only with argument - accepts usages of safe navigation with `in?` method - registers an offense for ordinary method chain exists after safe navigation method call with a block-pass - registers an offense for ordinary method chain exists after safe navigation method call - registers an offense for safe navigation on the right-hand side of the `*` - registers an offense for safe navigation with + operator - accepts usages of safe navigation with `-@` method - registers an offense for ordinary method chain exists after safe navigation method call with a block - accepts usages of safe navigation with `to_d` method - registers an offense for safe navigation on the right-hand side of the `/` - accepts usages of safe navigation with && operator - registers an offense for ordinary method call exists after safe navigation method call with an argument - accepts usages of safe navigation with || operator - proper highlighting - when in a method - when there are methods after - when used with a modifier if - when in a begin - when there are methods before - >= Ruby 2.7 - registers an offense for ordinary method chain exists after safe navigation method call with a block using numbered parameter - -RuboCop::Cop::Lint::UriRegexp - registers an offense and corrects using `URI.regexp` without argument - registers an offense and corrects using `::URI.regexp` with argument - does not register an offense when using `regexp` with variable receiver - registers an offense and corrects using `::URI.regexp` without argument - registers an offense and corrects using `URI.regexp` with argument - does not register an offense when using `regexp` without receiver - array argument - registers an offense and corrects using `URI.regexp` with %w arrays - registers an offense and corrects using `URI.regexp` with %i arrays - registers an offense and corrects using `URI.regexp` with literal arrays - -RuboCop::Cop::Lint::RequireRelativeSelfPath - registers an offense when using `require_relative` with self file path argument (with ext) - registers an offense when using `require_relative` with self file path argument - does not register an offense when using `require_relative` without argument - does not register an offense when the filename is the same but the extension does not match - does not register an offense when using `require_relative` without self file path argument - does not register an offense when using a variable as an argument of `require_relative` +RuboCop::Cop::Style::RedundantPercentQ + accepts %Q at the beginning of a section of a double quoted string with interpolation + accepts a heredoc string that contains %q + accepts %Q at the beginning of a double quoted string with interpolation + accepts %q at the beginning of a double quoted string with interpolation + accepts %q containing string interpolation + accepts %q at the beginning of a section of a double quoted string with interpolation + with %q strings + accepts a string with escaped backslash and non-backslash characters + accepts a string with single quotes and double quotes + registers an offense for only double quotes + autocorrects for strings that are concatenated with backslash + registers an offense for only single quotes + registers an offense for a string containing escaped backslashes + accepts regular expressions starting with %q + accepts a string with escaped non-backslash characters + registers an offense for no quotes + with %Q strings + accepts a string with double quotes and an escaped normal character + accepts a string with double quotes and an escaped special character + accepts regular expressions starting with %Q + registers an offense for static string with only double quotes + autocorrects for strings that are concatenated with backslash + accepts a dynamic %Q string with double quotes + registers an offense for dynamic string without quotes + registers an offense for static string without quotes + accepts a string with single quotes and double quotes RuboCop::Cop::Lint::DuplicateHashKey behaves like duplicated non literal key - does not register an offense for duplicated `{ :sym => some_method_call }` hash keys - behaves like duplicated non literal key - does not register an offense for duplicated `/.#{some_method_call}/` hash keys - behaves like duplicated literal key - registers an offense for duplicated `false` hash keys - behaves like duplicated non literal key - does not register an offense for duplicated `[some_method_call]` hash keys - behaves like duplicated non literal key does not register an offense for duplicated `some_method_call(x, y)` hash keys behaves like duplicated literal key - registers an offense for duplicated `!true` hash keys + registers an offense for duplicated `1` hash keys + when there is a duplicated key in the hash literal + registers an offense behaves like duplicated non literal key does not register an offense for duplicated `(x && false)` hash keys - when there are two duplicated keys in a hash - registers two offenses + behaves like duplicated non literal key + does not register an offense for duplicated `(x or false)` hash keys behaves like duplicated literal key - registers an offense for duplicated `(false <=> true)` hash keys + registers an offense for duplicated `(false && true)` hash keys behaves like duplicated non literal key - does not register an offense for duplicated `(x == false)` hash keys + does not register an offense for duplicated `"#{some_method_call}"` hash keys behaves like duplicated literal key - registers an offense for duplicated `(false or true)` hash keys - when there is a duplicated key in the hash literal - registers an offense - When there is no duplicated key in the hash - does not register an offense + registers an offense for duplicated `%r{abx}ixo` hash keys + behaves like duplicated non literal key + does not register an offense for duplicated `/.#{some_method_call}/` hash keys behaves like duplicated literal key registers an offense for duplicated `(1)` hash keys behaves like duplicated literal key - registers an offense for duplicated `(false && true)` hash keys - behaves like duplicated literal key - registers an offense for duplicated `%r{abx}ixo` hash keys - When a key is duplicated three times in a hash literal - registers two offenses + registers an offense for duplicated `"#{2}"` hash keys behaves like duplicated literal key - registers an offense for duplicated `{ :a => 1, :b => 2 }` hash keys + registers an offense for duplicated `!true` hash keys behaves like duplicated non literal key - does not register an offense for duplicated `"#{some_method_call}"` hash keys - behaves like duplicated literal key - registers an offense for duplicated `1` hash keys + does not register an offense for duplicated `some_method_call` hash keys behaves like duplicated literal key registers an offense for duplicated `[1, 2, 3]` hash keys behaves like duplicated non literal key does not register an offense for duplicated `%r{abx#{foo}}ixo` hash keys + When a key is duplicated three times in a hash literal + registers two offenses + behaves like duplicated literal key + registers an offense for duplicated `1.0` hash keys behaves like duplicated literal key registers an offense for duplicated `'str'` hash keys + When there is no duplicated key in the hash + does not register an offense behaves like duplicated literal key registers an offense for duplicated `/./` hash keys behaves like duplicated literal key - registers an offense for duplicated `nil` hash keys + registers an offense for duplicated `false` hash keys + behaves like duplicated non literal key + does not register an offense for duplicated `[some_method_call]` hash keys target ruby version >= 2.6 behaves like duplicated literal key registers an offense for duplicated `(42..)` hash keys behaves like duplicated non literal key - does not register an offense for duplicated `(x or false)` hash keys + does not register an offense for duplicated `(x == false)` hash keys behaves like duplicated literal key - registers an offense for duplicated `{ a: 1, b: 2 }` hash keys + registers an offense for duplicated `{ :a => 1, :b => 2 }` hash keys behaves like duplicated literal key - registers an offense for duplicated `"#{2}"` hash keys + registers an offense for duplicated `(false <=> true)` hash keys behaves like duplicated literal key - registers an offense for duplicated `1.0` hash keys - behaves like duplicated non literal key - does not register an offense for duplicated `some_method_call` hash keys + registers an offense for duplicated `(false or true)` hash keys behaves like duplicated non literal key does not register an offense for duplicated `{ some_method_call => :sym }` hash keys + behaves like duplicated literal key + registers an offense for duplicated `{ a: 1, b: 2 }` hash keys + when there are two duplicated keys in a hash + registers two offenses + behaves like duplicated literal key + registers an offense for duplicated `nil` hash keys + behaves like duplicated non literal key + does not register an offense for duplicated `{ :sym => some_method_call }` hash keys -RuboCop::Cop::Style::CombinableLoops - when for loop - does not register an offense when the same loops are interleaved with some code - does not register an offense when each branch contains the same single loop over the same collection - registers an offense when looping over the same data as previous loop - does not register an offense when the same loop method is used over different collections - when looping method - does not register an offense when different loop methods are used over the same collection - registers an offense when looping over the same data as previous loop - does not register an offense for when the same method with different arguments and safe navigation - does not register an offense when each branch contains the same single loop over the same collection - does not register an offense for when the same method with different arguments - does not register an offense when the same loop method is used over different collections - does not register an offense when the same loops are interleaved with some code - Ruby 2.7 - registers an offense when looping over the same data as previous loop in numblocks - -RuboCop::Cop::Lint::UselessTimes - registers an offense and corrects with 0.times with block arg - does not register an offense for an integer > 1 - registers an offense and corrects with 1.times - registers an offense and corrects with negative times with block arg - registers an offense and corrects with negative times - registers an offense and corrects with 1.times with method chain - registers an offense and corrects with 0.times - registers an offense and corrects when there is a blank line in the method definition - registers an offense and corrects with 1.times with block arg - registers an offense and corrects when 1.times with empty block argument - short-form method - registers an offense and corrects with 1.times - registers an offense and corrects with 0.times - registers an offense and corrects with negative times - does not register an offense for an integer > 1 - does not adjust surrounding space - multiline block - correctly handles a multiline block with 1.times - corrects a block that changes another lvar - does not try to correct a block if the block arg is changed - does not try to correct a block if the block arg is changed in parallel assignment - within indentation - corrects properly when replacing - corrects properly when removing multiline - corrects properly when removing single line - inline `Integer#times` calls - does not try to correct `1.times` - does not try to correct `0.times` +RuboCop::Cop::InternalAffairs::RedundantLetRuboCopConfigNew + does not register an offense when using `let(:config)` with arguments to `RuboCop::Config.new` + registers an offense when using `let(:config)` with no argument `RuboCop::Config.new` and `:config` is specified + registers an offense when using `let(:config)` and `:config` is already specified in `describe` + registers an offense when using `let(:config)` and `:config` is not specified in `describe` -RuboCop::Cop::Layout::EmptyLinesAroundClassBody - when EnforcedStyle is ending_only - ignores empty lines at the beginning of a class - registers an offense for an empty line at the end of a class - when EnforcedStyle is empty_lines - accepts singleton classes with an empty body - does not register offenses - accepts classes with an empty body - does not register offenses when specifying a superclass that breaks the line - registers an offense for class body not starting or ending with a blank - registers an offense for singleton class body not starting or ending with a blank - when EnforcedStyle is no_empty_lines - registers an offense for singleton class body ending with a blank - autocorrects singleton class body containing only a blank - registers an offense for class body starting with a blank - registers an offense for class body ending with a blank - when EnforcedStyle is empty_lines_except_namespace - when only child is module - requires no empty lines for namespace - registers offense for namespace body ending with a blank - registers offense for namespace body starting with a blank - when only child is class - requires no empty lines for namespace - registers offenses for namespaced class body not starting with a blank - autocorrects beginning and end - registers offenses for namespaced class body not ending with a blank - registers offense for namespace body ending with a blank - registers offense for namespace body starting with a blank - when has multiple child classes - registers offenses for namespace body starting and ending without a blank - requires empty lines for namespace - when EnforcedStyle is beginning_only - ignores empty lines at the beginning of a class - registers an offense for an empty line at the end of a class - when EnforcedStyle is empty_lines_special - when first child is an access modifier - with blank lines at the beginning and ending of class body - registers no offense - with no blank lines at the beginning and ending of class body - registers and corrects an offense - when first child is NOT a method - does not require blank line at the beginning of class body but requires blank line before first def definition and requires blank line at the end of class body - when class has a namespace - requires no empty lines for namespace and does not require blank line at the beginning of class body but requires blank line at the end of class body - source with constants - registers and autocorrects the offenses - source without blank lines - registers and autocorrects the offenses - source with blank lines - registers and autocorrects the offenses - source without blank lines - registers an offense for class not ending with a blank line - source with blank lines - registers an offense for class beginning with a blank line - source with comment before method definition - registers an offense for class beginning with a blank line - when namespace has multiple children - requires empty lines for namespace - class with constant and child class - registers and autocorrects the offenses - when first child is a method - requires blank line at the beginning and ending of class body - source without blank lines - registers an offense for class not beginning and ending with a blank line - when class has a namespace - requires no empty lines for namespace but requires blank line at the beginning and ending of class body - source with blank lines - autocorrects the offenses - source without blank lines - registers and autocorrects the offenses - class with only constants - registers and autocorrects the offenses - class with empty body - with empty line - does NOT register offenses - without empty line - does NOT register offenses +RuboCop::Cop::Layout::SpaceAfterComma + inside hash braces + when EnforcedStyle for SpaceInsideBlockBraces is no_space + accepts no space between a comma and a closing brace + behaves like common behavior + accepts a space between a comma and a closing brace + when EnforcedStyle for SpaceInsideBlockBraces is space + registers an offense for no space between a comma and a closing brace + behaves like common behavior + accepts a space between a comma and a closing brace + block argument commas without space + behaves like trailing comma + accepts the last comma + behaves like ends with an item + registers an offense and does autocorrection + method call arg commas without space + behaves like ends with an item + registers an offense and does autocorrection + array index commas without space + behaves like trailing comma + accepts the last comma + behaves like ends with an item + registers an offense and does autocorrection -RuboCop::Cop::Layout::SpaceInsideRangeLiteral - accepts complex range literal with space in it - registers an offense for space inside .. literal - accepts multiline range literal with no space in it - accepts no space inside .. literal - registers an offense for space inside ... literal - registers an offense in multiline range literal with space in it - accepts no space inside ... literal +RuboCop::Cop::Style::OrAssignment + when using `elsif` statement + does not register an offense + when using var = something unless var + registers an offense for instance variables + registers an offense for class variables + registers an offense for normal variables + does not register an offense if any of the variables are different + registers an offense for global variables + when `then` branch body is empty + registers an offense + when using unless var; var = something; end + registers an offense for normal variables + registers an offense for global variables + does not register an offense if any of the variables are different + registers an offense for class variables + registers an offense for instance variables + when using var = if var; var; else; something; end + does not register an offense if any of the variables are different + registers an offense with class variables + registers an offense with instance variables + registers an offense with global variables + registers an offense with normal variables + when using var = var ? var : something + registers an offense with normal variables + registers an offense with class variables + does not register an offense if any of the variables are different + registers an offense with instance variables + registers an offense with global variables -RuboCop::Cop::Style::TrailingUnderscoreVariable - configured to allow named underscore variables - registers an offense for splat underscore as the last variable - registers an offense for an underscore as the last param when there is also an underscore as the first param - registers an offense for complex nested assignments with trailing underscores - does not register an offense for an underscore variable preceded by a named splat underscore variable - does not register an offense for a named underscore variable preceded by a splat variable - does not register an offense for an underscore preceded by a splat variable and another underscore - does not register an offense for nested assignments without trailing underscores - does not register an offense for an underscore preceded by a splat variable - does not register an offense for a named splat underscore as the last variable - registers an offense when multiple underscores are used as the last variables of parallel assignment - does not register an offense when there are no underscores - does not register an offense for a named variable preceded by a names splat underscore variable - registers an offense when underscore is the only variable in parallel assignment - does not register an offense for an underscore preceded by a splat variable anywhere in the argument chain - does not register an offense for multiple underscore variables preceded by a named splat underscore variable - registers an offense when underscore is the second to last variable and blank is the last variable - does not register an offense for named variables that start with an underscore - registers an offense for nested assignments with trailing underscores - registers an offense for multiple underscore variables preceded by a splat underscore variable - does not register an offense for multiple underscores preceded by a splat variable - does not register an offense for multiple named underscores preceded by a splat variable - does not register an offense for underscores at the beginning - registers an offense when the last variable of parallel assignment is an underscore - does not register an offense for complex nested assignments without trailing underscores - autocorrect - with parentheses - leaves parentheses but removes trailing underscores and commas - removes assignment part when every assignment is to `_` - removes assignment part when it is the only variable - leaves parentheses but removes trailing underscores - configured to not allow named underscore variables - registers an offense for an underscore preceded by a named splat underscore - registers an offense for a named splat underscore as the last variable - registers an offense when multiple underscores are used as the last variables of parallel assignment - registers an offense for an underscore as the last param when there is also an underscore as the first param - does not register an offense for multiple named underscores preceded by a splat variable - registers an offense when underscore is the second to last variable and blank is the last variable - does not register an offense for a named underscore preceded by a splat variable - registers an offense for multiple underscore variables preceded by a splat underscore variable - does not register an offense for complex nested assignments without trailing underscores - registers an offense for complex nested assignments with trailing underscores - registers an offense when underscore is the only variable in parallel assignment - does not register an offense for an underscore preceded by a splat variable - registers an offense when the last variable of parallel assignment is an underscore - does not register an offense for a named variable preceded by a names splat underscore variable - does not register an offense when there are no underscores - registers an offense for an underscore variable preceded by a named splat underscore variable - registers an offense for multiple underscore variables preceded by a named splat underscore variable - registers an offense for nested assignments with trailing underscores - registers an offense for named variables that start with an underscore - does not register an offense for underscores at the beginning - does not register an offense for nested assignments without trailing underscores - does not register an offense for an underscore preceded by a splat variable anywhere in the argument chain - does not register an offense for multiple underscores preceded by a splat variable - does not register an offense for an underscore preceded by a splat variable and another underscore - registers an offense for splat underscore as the last variable - does not register an offense for a named underscore variable preceded by a splat variable - autocorrect - with parentheses - leaves parentheses but removes trailing underscores and commas - removes assignment part when it is the only variable - removes assignment part when every assignment is to `_` - leaves parentheses but removes trailing underscores +RuboCop::Cop::Lint::HashCompareByIdentity + registers an offense when using hash methods with `object_id` on receiver as a key + does not register an offense for hash methods without `object_id` as key + registers an offense when using hash method with `object_id` as a key -RuboCop::Cop::Style::NegatedUnless - does not blow up for empty if condition - does not blow up on a negated ternary operator - does not blow up for ternary ops - does not blow up for empty unless condition - with “prefix” style - does not register an offense for postfix - registers an offense for prefix - with “both” style - registers an offense for unless with exclamation point condition - registers an offense for unless with "not" condition - accepts an unless where only part of the condition is negated - accepts an unless/else with negative condition - accepts an unless where the condition is doubly negated - autocorrects by replacing parenthesized unless not with if - with “postfix” style - registers an offense for postfix - does not register an offense for prefix +RuboCop::Cop::InternalAffairs::RedundantContextConfigParameter + registers an offense when using `:config` parameter with other parameters + does not register an offense when using `:config` in other than `context` + does not register an offense when not using `:config` + does not register an offense when using `:ruby30` only + registers an offense when using `:config` parameter -RuboCop::Cop::Severity - overrides #to_s - redefines == to compare severities - has a few required attributes - is frozen - constructs from code - W - is expected to eq # - R - is expected to eq # - C - is expected to eq # - I - is expected to eq # - E - is expected to eq # - F - is expected to eq # - #code - refactor - is expected to eq "R" - convention - is expected to eq "C" - fatal - is expected to eq "F" - warning - is expected to eq "W" - info - is expected to eq "I" - error - is expected to eq "E" - Comparable - info - is expected to be < refactor - convention - is expected to be < warning - warning - is expected to be < error - refactor - is expected to be < convention - error - is expected to be < fatal - #level - info - is expected to eq 1 - error - is expected to eq 5 - fatal - is expected to eq 6 - refactor - is expected to eq 2 - convention - is expected to eq 3 - warning - is expected to eq 4 +RuboCop::Cop::Style::CommandLiteral + when PercentLiteralDelimiters is configured and a default exists + ignores the default when autocorrecting + heredoc commands + is ignored + when EnforcedStyle is set to percent_x + a single-line %x string without backticks + is accepted + a multi-line %x string without backticks + is accepted + a single-line %x string with backticks + is accepted + a multi-line %x string with backticks + is accepted + a single-line ` string with backticks + registers an offense without autocorrection + a single-line ` string without backticks + registers an offense and corrects to %x + a multi-line ` string with backticks + registers an offense without autocorrection + a multi-line ` string without backticks + registers an offense and corrects to %x + when PercentLiteralDelimiters only has a default + respects the configuration when autocorrecting + when EnforcedStyle is set to backticks + a single-line ` string with backticks + registers an offense without autocorrection + when configured to allow inner backticks + is accepted + a multi-line %x string with backticks + is accepted + when configured to allow inner backticks + registers an offense without autocorrection + a multi-line ` string without backticks + is accepted + a multi-line %x string without backticks + registers an offense and corrects to backticks + a single-line ` string without backticks + is accepted + a single-line %x string without backticks + registers an offense and corrects to backticks + a single-line %x string with backticks + is accepted + when configured to allow inner backticks + registers an offense without autocorrection + a multi-line ` string with backticks + registers an offense without autocorrection + when configured to allow inner backticks + is accepted + when EnforcedStyle is set to mixed + a single-line %x string with backticks + is accepted + when configured to allow inner backticks + registers an offense without autocorrection + a multi-line ` string without backticks + registers an offense and corrects to %x + a multi-line %x string without backticks + is accepted + a multi-line ` string with backticks + registers an offense without autocorrection + a multi-line %x string with backticks + is accepted + a single-line ` string without backticks + is accepted + a single-line ` string with backticks + registers an offense without autocorrection + when configured to allow inner backticks + is accepted + a single-line %x string without backticks + registers an offense and corrects to backticks + %x commands with other delimiters than parentheses + registers an offense + when PercentLiteralDelimiters is configured with curly braces + respects the configuration when autocorrecting -RuboCop::Cop::Layout::FirstHashElementIndentation - when the HashAlignment style is separator for => - registers an offense and corrects incorrectly indented } - registers an offense and corrects incorrectly indented first pair with => - accepts correctly indented first pair - when EnforcedStyle is align_braces - registers an offense for a hash that is a value of a multi pairs hashwhen the indent of its elements is not based on the hash key - accepts correctly indented first pair - accepts several pairs per line - accepts single line hash - accepts a first pair on the same line as the left brace - registers an offense and corrects incorrectly indented } - registers an offense for incorrectly indented hash that is the value of a single pair hash - accepts an empty hash - when 'special_inside_parentheses' style is used - registers an offense and corrects incorrect indentation - when 'consistent' style is used - registers an offense and corrects incorrect indentation - when the HashAlignment style is separator for : - registers an offense and corrects incorrectly indented } - registers an offense and corrects incorrectly indented first pair with : - accepts correctly indented first pair - when hash is method argument - and arguments are surrounded by parentheses - and EnforcedStyle is special_inside_parentheses - accepts special indentation for second argument - registers an offense for a hash that is a value of a multi pairs hashwhen the indent of its elements is not based on the hash key - registers an offense for incorrectly indented hash that is the value of a single pair hash - registers an offense and corrects 'align_braces' indentation - accepts special indentation for first argument - accepts normal indentation for hash within hash - accepts indent based on the left brace when the outer hash key and the left brace is not on the same line - accepts indent based on the preceding left parenthesiswhen the right brace and its following pair is on the same line - registers an offense and corrects 'consistent' indentation - when using safe navigation operator - registers an offense and corrects 'consistent' indentation - and EnforcedStyle is consistent - registers an offense and corrects incorrect indentation - accepts normal indentation for first argument - accepts indent based on the start of the line where the left brace iswhen the right brace and its following pair is on the same line - accepts indent based on the left brace when the outer hash key and the left brace is not on the same line - accepts normal indentation for second argument - registers an offense for a hash that is a value of a multi pairs hashwhen the indent of its elements is not based on the hash key - registers an offense for incorrectly indented hash that is the value of a single pair hash - and argument are not surrounded by parentheses - accepts indent based on the left brace when the outer hash key and the left brace is not on the same line - registers an offense for incorrectly indented multi-line hash with braces - accepts a correctly indented multi-line hash with braces - accepts indent based on the start of the line where the left brace iswhen the right brace and its following pair is on the same line - accepts single line hash with braces - registers an offense for the first inner hash member not based on the start of line when the outer hash pair has no following siblings - registers an offense for a hash that is a value of a multi pairs hashwhen the indent of its elements is not based on the hash key - accepts braceless hash - when hash is operand - accepts correctly indented first pair - registers an offense and corrects incorrectly indented first pair - registers an offense and corrects incorrectly indented } - when hash is right hand side in assignment - accepts several pairs per line - registers an offense and corrects incorrectly indented first pair - accepts single line hash - accepts a first pair on the same line as the left brace - accepts an empty hash - accepts correctly indented first pair - when indentation width is overridden for this cop - registers an offense and corrects incorrectly indented first pair - accepts correctly indented first pair - when hash is argument to setter - registers an offense and corrects incorrectly indented first pair - accepts correctly indented first pair +RuboCop::Cop::Lint::RaiseException + registers an offense and corrects for `fail` with `Exception` + registers an offense and corrects for `fail` with `Exception.new` and message + does not register an offense for `raise` without arguments + registers an offense and corrects for `raise` with `::Exception` and message + registers an offense and corrects for `raise` with `::Exception.new` + registers an offense and corrects for `raise` with `Exception` + registers an offense and corrects for `raise` with `Exception` and message + registers an offense and corrects for `raise` with `Exception.new(args*)` + registers an offense and corrects for `fail` with `Exception` and message + registers an offense and corrects for `raise` with `::Exception` + does not register an offense for `fail` without arguments + does not register an offense when raising Exception with explicit namespace + registers an offense and corrects for `raise` with `Exception.new` and message + when under namespace + does not register an offense when Exception without cbase specified + registers an offense and corrects when Exception with cbase specified -RuboCop::Cop::Layout::BlockAlignment - does not raise an error for nested block in a method call - accepts end aligned with an instance variable - registers an offense for mismatched block end with a constant - registers an offense for mismatched block end with an op-asgn (+=, -=) - accepts a block end that does not begin its line - registers an offense for mismatched block end with an instance variable - registers an offense for mismatched block end with a mass assignment - accepts end aligned with an and-asgn (&&=) - accepts end aligned with a variable - accepts end aligned with a global variable - registers an offense for mismatched block end with a method call - registers an offense for mismatched block end with a variable - accepts end aligned with an op-asgn (+=, -=) - registers an offense for mismatched block end with a class variable - registers an offense for mismatched block end with a global variable - registers an offense for mismatched end with a method call with arguments - accepts end aligned with a mass assignment - accepts end aligned with a class variable - accepts end aligned with the block when the block is a method argument - registers an offense for mismatched block end with an and-asgn (&&=) - accepts end aligned with a method call - accepts end aligned with a method call with arguments - accepts end aligned with a constant - registers an offense for mismatched end not aligned with the block that is an argument - accepts end aligned with an or-asgn (||=) - registers an offense for mismatched block end with an or-asgn (||=) - accepts end aligned with a call chain left hand side - when the block is terminated by } - mentions } (not end) in the message - when multiple similar-looking blocks have misaligned ends - registers an offense for each of them - Ruby 2.7 - registers an offense for mismatched block end with a mass assignment - accepts end aligned with a call chain left hand side - on an arithmetically negated method call - registers an offense and corrects - aligns end with the - operator - when there is an assignment chain - accepts end aligned with the first variable - registers an offense for an end aligned with the 2nd variable - on a logically negated method call - registers an offense and corrects - aligns end with the ! operator - when the block is a logical operand - accepts a correctly aligned block end - on a bit-flipped method call - registers an offense and corrects misaligned end brace - aligns end with the ~ operator - when the block has arguments - registers an offense for mismatched block end - and the block is an operand - accepts end aligned with a variable - when configured to align with do - errors when start_of_line aligned - allows when do aligned - when the method part is a call chain that spans several lines - accepts pretty alignment style - accepts two kinds of end alignment - accepts end indented as the start of the block - registers offenses for misaligned ends - on a splatted method call - aligns end with the splat operator - registers an offense and corrects misaligned end braces - when variables of a mass assignment spans several lines - registers an offense for end aligned with the block - accepts end aligned with the variables - when configured to align with start_of_line - allows when start_of_line aligned - errors when do aligned - when the block is defined on the next line - accepts end aligned with the block expression - registers an offenses for mismatched end alignment - when the block has no arguments - registers an offense for mismatched block end +RuboCop::Cop::Style::Dir + when using `#dirname` and `#realpath` + registers an offense + registers an offense with ::File + when using `#expand_path` and `#dirname` + registers an offense with ::File + registers an offense -RuboCop::Cop::Layout::EmptyLinesAroundMethodBody - registers an offense for class method body starting with a blank - accepts method body starting with a line with spaces - registers an offense for class method body ending with a blank - is not fooled by single line methods - registers an offense for method body starting with a blank - registers an offense for method body ending with a blank +RuboCop::Cop::Style::UnlessLogicalOperators + EnforcedStyle is `forbid_mixed_logical_operators` + registers an offense when using parentheses + does not register an offense when using only `||`s + does not register an offense when not using logical operator + does not register an offense when not used in unless + does not register an offense when using only `&&`s + registers an offense when using `&&` and `or` + does not register an offense when using if + does not register an offense when using only `and`s + registers an offense when using `||` and `or` + does not register an offense when using only `or`s + does not register an offense when using `||` operator and invoked method name includes "or" in the conditional branch + registers an offense when using `&&` and `||` + registers an offense when using `&&` and `and` + registers an offense when using `||` and `and` + does not register an offense when using `&&` operator and invoked method name includes "and" in the conditional branch + EnforcedStyle is `forbid_logical_operators` + registers an offense when using only `and` + registers an offense when using only `&&` + registers an offense when using only `or` + does not register an offense when not using logical operator + does not register an offense when not used in unless + does not register an offense when using if + registers an offense when using only `||` + registers an offense when using `&&` followed by || -RuboCop::Cop::VariableForce::VariableTable - #pop_scope - returns popped scope object - #declare_variable - returns the added variable - adds variable to current scope with its name as key - #push_scope - returns pushed scope object - #current_scope_level - decreases by popping scope - increases by pushing scope - #accessible_variables - when the current scope has some variables - returns all the variables - when the direct outer scope has some variables - and the current scope is not block - returns only the current scope variables - and the current scope is block - returns the current and direct outer scope variables - when there are no variables - returns empty array - #find_variable - when current scope is block - when a variable with the target name exists in current scope - and also exists in outer scope - returns the current scope variable - and does not exist in outer scope - returns the current scope variable - when a variable with the target name does not exist in current scope - but exists in the direct outer scope - returns the direct outer scope variable - and does not exist in all outer scopes - returns nil - but exists in a indirect outer scope - when the direct outer scope is block - returns the indirect outer scope variable - when the direct outer scope is not block - returns nil - when current scope is not block - when a variable with the target name does not exist in current scope - but exists in the direct outer scope - returns nil - and does not exist in all outer scopes - returns nil - when a variable with the target name exists in current scope - and also exists in outer scope - returns the current scope variable - and does not exist in outer scope - returns the current scope variable - #find_variable with an empty scope stack - returns nil +RuboCop::Cop::Style::PreferredHashMethods + with enforced `verbose` style + registers an offense for key? with one arg + accepts value? with no args + accepts key? with no args + registers an offense for value? with one arg + with enforced `short` style + registers an offense for has_key? with one arg + accepts has_key? with no args + accepts has_value? with no args + registers an offense for has_value? with one arg + when using safe navigation operator + registers an offense for has_value? with one arg -RuboCop::Cop::Style::EnvHome - registers and corrects an offense when using `::ENV['HOME']` - does not register an offense when using `ENV['HOME'] = '/home/foo'` - does not register an offense when using `Dir.home` - registers and corrects an offense when using `ENV.fetch('HOME', nil)` - does not register an offense when using `ENV.fetch('HOME', default)` - registers and corrects an offense when using `ENV['HOME']` - registers and corrects an offense when using `ENV.fetch('HOME')` +RuboCop::Cop::Metrics::BlockNesting + accepts `Max` levels of nesting + accepts if/elsif + nested `while` + registers an offense + nested `until` + registers an offense + nested modifier `while` + registers an offense + nested `case` + registers an offense + `Max + 2` levels of `if` nesting + registers an offense + when CountBlocks is true + nested multiline block + registers an offense + nested inline block + registers an offense + nested `for` + registers an offense + nested `rescue` + registers an offense + nested modifier `until` + registers an offense + `Max + 1` levels of `if` nesting + registers an offense + when CountBlocks is false + accepts nested multiline blocks + accepts nested inline blocks + Multiple nested `ifs` at same level + registers 2 offenses -RuboCop::Cop::Lint::UselessElseWithoutRescue - with `else` with `rescue` - accepts - with `else` without `rescue` +RuboCop::Cop::Style::UnlessElse + unless without else + does not register an offense + unless with nested if-else registers an offense + unless with else + registers an offense + and nested unless with else + registers offenses for both but corrects only the outer unless/else -RuboCop::Cop::Style::RedundantCondition - ternary expression (?:) - accepts expressions when the condition and if branch do not match - when condition and if_branch are same - registers an offense and corrects when the else branch contains an irange - registers an offense and corrects with ternary expression and the branches contains chained parenthesized method call - registers an offense and corrects - registers an offense and corrects with ternary expression and the branches contains parenthesized method call - registers an offense and corrects when the else branch contains an erange - registers an offense and corrects class vars - registers an offense and corrects brackets accesses - registers an offense and corrects when the else branch contains `and` - registers an offense and corrects functions - registers an offense and corrects when the else branch contains `rescue` - registers an offense and corrects nested vars - when inverted condition (unless) - registers no offense - when condition and else branch are same - registers an offense - accepts complex unless branches - when regular condition (if) - accepts different when the condition does not match the branch - accepts elsif - when condition and if_branch are same - does not register an offense when using assignment by hash key access - registers an offense and corrects when the branches contains parenthesized method call - accepts an elsif branch - autocorrects when using `<<` method higher precedence than `||` operator - registers an offense and corrects when defined inside method and the branches contains assignment - registers an offense and corrects when the branches contains method call with braced hash - registers an offense and corrects when the branches contains assignment - registers an offense and corrects when using operator method in `else` - registers an offense and corrects complex one liners - registers an offense and corrects when the else branch contains an irange - registers an offense and corrects when `if` condition and `then` branch are the same and it has no `else` branch - accepts when using ternary if in `else` branch - registers an offense and corrects when the branches contains method call with non-braced hash - registers an offense and corrects when using modifier if - does not register an offense when the branches are the same with different receivers - registers an offense and corrects when `raise` without argument parentheses in `else` - accepts complex else branches - registers an offense and corrects when a method without argument parentheses in `else` - does not register offenses when the branches contains hash key access - registers an offense and corrects - registers an offense and corrects when the branches contains assignment method - registers an offense and corrects modifier nodes offense - registers an offense and corrects when the branches contains arithmetic operation - registers an offense and correct when the branches are the same with the same receivers - does not register offenses when using `nil?` and the branches contains assignment - does not register offenses when using `nil?` and the branches contains method which has multiple arguments - does not register offenses when the branches contains assignment but target not matched - registers an offense and corrects multiline nodes - registers an offense and corrects when the branches contains method call +RuboCop::Cop::Layout::EmptyLinesAroundExceptionHandlingKeywords + accepts empty lines around begin body + accepts `def` and `rescue` are on the same line + accepts empty method definition + registers an offense for rescue section ending for method definition a blank + with complex method definition - registers many offenses + accepts empty begin + registers an offense for above rescue keyword with a blank + accepts `begin` and `rescue` are on the same line + with complex begin-end - registers many offenses + registers an offense for rescue section ending with a blank + accepts last `rescue` and `end` are on the same line + accepts `rescue` and `end` are on the same line + accepts no empty line + registers an offense for rescue section starting with a blank -RuboCop::Cop::Style::SelfAssignment - registers an offense for non-shorthand assignment / and @@x - registers an offense for non-shorthand assignment / and @x - registers an offense for non-shorthand assignment + and @@x - registers an offense for non-shorthand assignment & and x - registers an offense for non-shorthand assignment & and @x - registers an offense for non-shorthand assignment | and @x - registers an offense for non-shorthand assignment && and @@x - registers an offense for non-shorthand assignment * and x - registers an offense for non-shorthand assignment | and @@x - registers an offense for non-shorthand assignment - and @@x - registers an offense for non-shorthand assignment * and @x - registers an offense for non-shorthand assignment || and @x - registers an offense for non-shorthand assignment || and @@x - registers an offense for non-shorthand assignment && and x - registers an offense for non-shorthand assignment - and @x - registers an offense for non-shorthand assignment || and x - registers an offense for non-shorthand assignment & and @@x - registers an offense for non-shorthand assignment + and x - registers an offense for non-shorthand assignment - and x - registers an offense for non-shorthand assignment | and x - registers an offense for non-shorthand assignment ** and @@x - registers an offense for non-shorthand assignment && and @x - registers an offense for non-shorthand assignment + and @x - registers an offense for non-shorthand assignment ** and @x - registers an offense for non-shorthand assignment ** and x - registers an offense for non-shorthand assignment / and x - registers an offense for non-shorthand assignment * and @@x +RuboCop::Cop::VariableForce::Variable + #referenced? + when the variable is not assigned + is expected to be falsey + and the variable is referenced + is expected to be truthy + when the variable has an assignment + and the variable is not yet referenced + is expected to be falsey + and the variable is referenced + is expected to be truthy + .new + when non variable declaration node is passed + raises error -RuboCop::Cop::Style::RegexpLiteral - when EnforcedStyle is set to mixed - a multi-line `//` regex with slashes - registers an offense - a single-line `//` regex without slashes - is accepted - a single-line `//` regex with slashes - registers an offense - when configured to allow inner slashes - is accepted - a single-line %r regex with slashes - is accepted - when configured to allow inner slashes - registers an offense - a multi-line %r regex with slashes - is accepted - a multi-line `//` regex without slashes - registers an offense - a multi-line %r regex without slashes - is accepted - a single-line %r regex without slashes - registers an offense - %r regex with other delimiters than curly braces +RuboCop::Cop::Layout::IndentationConsistency + with for + registers an offense and corrects bad indentation in a for body + accepts an empty for + with top-level code + accepts an empty expression string interpolation + registers and corrects an offense when using access modifier and indented method definition at the top level + accepts when using access modifier at the top level + with module + registers an offense and corrects bad indentation of private methods + registers an offense and corrects bad indentation in a module body + accepts an empty module body + even when there are no public methods + registers an offense and corrects bad indentation of private methods + with def/defs + registers an offense and corrects bad indentation in a def body + registers an offense and corrects bad indentation in a defs body + accepts an empty def body + accepts an empty defs body + with while/until + registers an offense and corrects bad indentation in an until body + accepts an empty while + registers an offense and corrects bad indentation in a while body + registers an offense and corrects bad indentation in begin/end/while + with case + accepts indented when/else plus indented body + accepts case/when/else with then beginning a line + accepts case/when/else laid out as a table + registers an offense and corrects bad indentation in a case/when body + accepts correctly indented case/when/else + registers an offense and corrects bad indentation in a case/else body + with block + registers an offense and correct bad indentation in a do/end body + accepts an empty block body + registers an offense and corrects bad indentation in a {} body + accepts a correctly indented block body + does not autocorrect an offense within another offense + with class + with indented_internal_methods style configured + accepts different indentation in different visibility sections when using `Struct.new` + accepts different indentation in different visibility sections + with normal style configured + accepts an empty class body + registers an offense and corrects bad indentation in a class body + registers an offense and corrects bad indentation in def but not for outdented public, protected, and private + accepts indented public, protected, and private + with if statement + accepts an if/else branches with rescue clauses + accepts an if in assignment with end aligned with variable + registers an offense and corrects bad indentation in an else body + accepts if/elsif/else/end laid out as a table + accepts if/then/else/end laid out as another table + accepts an if/else in assignment with end aligned with variable + registers an offense and corrects bad indentation in an if body + accepts an empty if + accepts if/elsif/else/end with fullwidth characters + accepts an if/else in assignment on next line with end aligned with if + registers an offense and corrects bad indentation in an elsif body + accepts a one line if statement + accepts an if in assignment with end aligned with if + accepts an if/else in assignment with end aligned with variable and chaining with a block after the end + accepts a correctly aligned if/elsif/else/end + accepts an if/else in assignment with end aligned with if + accepts an if/else in assignment with end aligned with variable and chaining after the end + with unless + accepts an empty unless + registers an offense and corrects bad indentation in an unless body + +RuboCop::Cop::Lint::ConstantDefinitionInBlock + does not register an offense for a constant with an explicit self scope + registers an offense for a class defined within a block followed by another statement + registers an offense for a module defined within a block + does not register an offense for a constant with an explicit self scope followed by another statement + registers an offense for a class defined within a block + does not register an offense for a top-level class followed by another statement + does not register an offense for a top-level module followed by another statement + does not register an offense for a constant with an explicit top-level scope followed by another statement + does not register an offense for a constant with an explicit top-level scope + does not register an offense for a top-level constant followed by another statement + does not register an offense for a top-level constant + does not register an offense for a top-level module + does not register an offense for a top-level class + registers an offense for a module defined within a block followed by another statement + registers an offense for a constant defined within a block followed by another statement + registers an offense for a constant defined within a block + when `AllowedMethods: []` + registers an offense for a casign used within a block of `enums` method + registers an offense for a module defined within a block of `enums` method + registers an offense for a class defined within a block of `enums` method + when `AllowedMethods: [enums]` + does not register an offense for a casign used within a block of `enums` method + does not register an offense for a class defined within a block of `enums` method + does not register an offense for a module defined within a block of `enums` method + +RuboCop::Cop::Style::SymbolArray + when EnforcedStyle is percent + detects right value for MinSize to use for --auto-gen-config + doesn't break when a symbol contains ) + autocorrects arrays of one symbol + does not register an offense if symbol contains whitespace + does not register an offense for array with non-syms + uses %I when appropriate + does not register an offense for array starting with %i + registers an offense for arrays of symbols + registers an offense in a non-ambiguous block context + autocorrects arrays of symbols with embedded newlines and tabs + autocorrects arrays of symbols with new line + detects when the cop must be disabled to avoid offenses + when PreferredDelimiters is specified + autocorrects an array using partial newlines + autocorrects an array in multiple lines + autocorrects an array with delimiters + when EnforcedStyle is brackets + autocorrects an array starting with %i + does not register an offense for arrays of symbols + registers an offense for array starting with %i + autocorrects multiline %i array + registers an offense for empty array starting with %i + autocorrects an array has interpolations + with non-default MinSize + does not autocorrect array of one symbol if MinSize > 1 + +RuboCop::Cop::Style::MagicCommentFormat + kebab case style + accepts a magic comments in kebab case + accepts a source with no tokens + registers an offense for mixed case + accepts an empty source + does not register an offense for incorrect style in comments after the first statement + accepts a frozen string literal in snake case in emacs style + registers an offense for snake case + registers an offense for snake case in emacs style + does not register an offense for dashes in other comments + ValueCapitalization + when uppercase + registers an offense and corrects when the case does not match + when lowercase + registers an offense and corrects when the case does not match + when not set + does not change the case of magic comment directives + snake case style + registers an offense for mixed case + accepts an empty source + accepts a magic comments in snake case + does not register an offense for incorrect style in comments after the first statement + registers an offense for kebab case in emacs style + does not register an offense for dashes in other comments + accepts a source with no tokens + registers an offense for kebab case + accepts a frozen string literal in snake case in emacs style + all issues at once + registers and corrects multiple issues + invalid config + DirectiveCapitalization + raises an error + ValueCapitalization + raises an error + DirectiveCapitalization + when not set + does not change the case of magic comment directives + when lowercase + registers an offense and corrects when the case does not match + when uppercase + registers an offense and corrects when the case does not match + +RuboCop::Cop::Style::MethodDefParentheses + require_parentheses + accepts def with no args and no parens + reports an offense for def with parameters but no parens + reports an offense for correct + opposite + auto-adds required parens for a defs after a passing method + reports an offense for class def with parameters but no parens + auto-adds required parens for a defs + auto-adds required parens to argument lists on multiple lines + behaves like endless methods + endless methods + accepts parens without args + accepts parens with args + accepts parens for method calls inside an endless method + accepts parens with `forward-arg` + require_no_parentheses + behaves like endless methods + endless methods + accepts parens with `forward-arg` + accepts parens for method calls inside an endless method + accepts parens with args + accepts parens without args + behaves like no parentheses + accepts a class def with parameters with parens + reports an offense for class def with parameters with parens + auto-removes the parens for defs + reports an offense for def with parameters with parens + accepts a def with parameters but no parens + requires parens for anonymous block forwarding + requires parens for forwarding + accepts def with no args and no parens + reports an offense for def with no args and parens + reports an offense for opposite + correct + require_no_parentheses_except_multiline + when args are all on a single line + behaves like no parentheses + reports an offense for def with no args and parens + accepts def with no args and no parens + accepts a class def with parameters with parens + reports an offense for class def with parameters with parens + requires parens for forwarding + reports an offense for def with parameters with parens + reports an offense for opposite + correct + requires parens for anonymous block forwarding + auto-removes the parens for defs + accepts a def with parameters but no parens + behaves like endless methods + endless methods + accepts parens with `forward-arg` + accepts parens without args + accepts parens for method calls inside an endless method + accepts parens with args + when args span multiple lines + reports an offense for correct + opposite + auto-adds required parens to argument lists on multiple lines + +RuboCop::Cop::Lint::FloatOutOfRange + does not register an offense for tiny little itty bitty floats + does not register an offense for respectably sized floats + does not register an offense for 0.0 + on floats so close to zero that nobody can tell the difference registers an offense - when EnforcedStyle is set to slashes - a single-line %r regex with slashes - is accepted - when configured to allow inner slashes - registers an offense - a single-line `//` regex without slashes - is accepted - a multi-line `//` regex with slashes - registers an offense - when configured to allow inner slashes - is accepted - a multi-line %r regex without slashes - registers an offense - a multi-line %r regex with slashes - is accepted - when configured to allow inner slashes - registers an offense - a single-line `//` regex with slashes and interpolation + on whopping big floats which tip the scales + registers an offense + +RuboCop::Cop::Style::NumberedParameters + >= Ruby 2.7 + EnforcedStyle: disallow + does an offense when using numbered parameters even with single-line blocks + EnforcedStyle: allow_single_line + registers an offense when using numbered parameters with multi-line blocks + does not register an offense when using numbered parameters with single-line blocks + +RuboCop::Cop::Lint::NonLocalExitFromIterator + allows return in define_singleton_method + allows return in define_method + allows return with value + when block is not followed by method chain + allows + when the return is within a nested method definition + allows return in an instance method definition + allows return in a class method definition + when block is lambda + allows + when block is followed by method chain + and has multiple arguments registers an offense - when configured to allow inner slashes - is accepted - a single-line `%r//` regex with slashes - is accepted - when configured to allow inner slashes - preserves slashes after autocorrection - a single-line `//` regex with slashes + and has no argument + allows + and has single argument registers an offense - when configured to allow inner slashes - is accepted - a multi-line `//` regex without slashes - is accepted - a single-line %r regex without slashes + when block in middle of nest is followed by method chain + registers offenses + when lambda is inside of block followed by method chain + allows + +RuboCop::Cop::Style::DefWithParentheses + reports an offense for class def with empty parens + reports an offense for def with empty parens + accepts def with arg and parens + accepts def without arguments + accepts empty parentheses in one liners + Ruby >= 3.0 + reports an offense for endless method definition with empty parens + +RuboCop::Cop::Lint::UselessAccessModifier + behaves like at the end of the body + registers an offense for trailing `private` + behaves like method defined on a singleton class + outside a class + registers an offense if no method is defined + doesn't register an offense if a method is defined + registers an offense if no method is defined after the modifier + inside a class + doesn't register an offense if a method is defined + registers an offense even if a non-singleton-class method is defined + registers an offense if no method is defined after the modifier + doesn't register an offense if the modifier is the same as outside the meta-class + registers an offense if no method is defined + behaves like method defined with define_method + doesn't register an offense if a proc is passed + doesn't register an offense if a block is passed + doesn't register an offense if a lambda is passed + doesn't register an offense if a -> is passed + when an access modifier is followed by a class method defined on constant + registers an offense and corrects + behaves like conditionally defined method + doesn't register an offense for unless + doesn't register an offense for if + behaves like def in new block + doesn't register an offense if a method is defined in Module.new + registers an offense if no method is defined in Module.new + behaves like def in new block + registers an offense if no method is defined in ::Module.new + doesn't register an offense if a method is defined in ::Module.new + behaves like nested in a begin..end block + still flags repeated `public` + when an access modifier has no effect + registers an offense and corrects + behaves like methods defined in an iteration + doesn't register an offense for each + doesn't register an offense for map + when an access modifier is followed by attr_* + does not register an offense + behaves like repeated visibility modifiers + registers an offense when `protected` is repeated + behaves like repeated visibility modifiers + registers an offense when `public` is repeated + behaves like non-repeated visibility modifiers + doesn't register an offense when `protected` is not repeated + doesn't register an offense when `private` is not repeated + registers an offense and corrects even when `public` is not repeated + behaves like def in new block + doesn't register an offense if a method is defined in Struct.new + registers an offense if no method is defined in Struct.new + behaves like methods defined in an iteration + doesn't register an offense for each + doesn't register an offense for map + behaves like def in new block + doesn't register an offense if a method is defined in ::Class.new + registers an offense if no method is defined in ::Class.new + behaves like method defined on a singleton class + outside a class + registers an offense if no method is defined + registers an offense if no method is defined after the modifier + doesn't register an offense if a method is defined + inside a class + registers an offense if no method is defined after the modifier + registers an offense if no method is defined + doesn't register an offense if the modifier is the same as outside the meta-class + registers an offense even if a non-singleton-class method is defined + doesn't register an offense if a method is defined + behaves like method named by access modifier name + does not register an offense for `public` + behaves like def in new block + doesn't register an offense if a method is defined in Class.new + registers an offense if no method is defined in Class.new + when only a constant or local variable is defined after the modifier + registers an offense and corrects + registers an offense and corrects + behaves like nested modules + doesn't register an offense for nested modules + unused modifiers + registers an offense with a nested module + registers an offense when inside a nested module + registers an offense when outside a nested module + when there are consecutive access modifiers + registers an offense and corrects + when multiple class definitions in file but only one has offense + registers an offense and corrects + behaves like nested in a begin..end block + doesn't flag an access modifier from surrounding scope + still flags repeated `protected` + behaves like at the end of the body + registers an offense for trailing `public` + behaves like repeated visibility modifiers + registers an offense when `protected` is repeated + behaves like method named by access modifier name + does not register an offense for `public` + when private_class_method is used without arguments + registers an offense and corrects + behaves like nested modules + doesn't register an offense for nested classs + unused modifiers + registers an offense with a nested class + registers an offense when outside a nested class + registers an offense when inside a nested class + behaves like at the end of the body + registers an offense for trailing `private` + behaves like nested in a begin..end block + still flags repeated `private` + doesn't flag an access modifier from surrounding scope + behaves like method named by access modifier name + does not register an offense for `protected` + behaves like conditionally defined method + doesn't register an offense for if + doesn't register an offense for unless + behaves like nested in a begin..end block + still flags repeated `public` + behaves like nested modules + doesn't register an offense for nested classs + unused modifiers + registers an offense when outside a nested class + registers an offense when inside a nested class + registers an offense with a nested class + behaves like repeated visibility modifiers + registers an offense when `private` is repeated + behaves like method defined using instance_eval + registers an offense if no method is defined + doesn't register an offense if a method is defined + inside a class + registers an offense when a modifier is outside the block and a method is defined only inside the block + registers two offenses when a modifier is inside and outside the and no method is defined + behaves like methods defined in an iteration + doesn't register an offense for map + doesn't register an offense for each + behaves like repeated visibility modifiers + registers an offense when `public` is repeated + behaves like unused visibility modifiers + registers an offense and corrects when visibility is immediately changed without any intervening defs + behaves like method defined on a singleton class + inside a class + doesn't register an offense if the modifier is the same as outside the meta-class + registers an offense if no method is defined + registers an offense even if a non-singleton-class method is defined + doesn't register an offense if a method is defined + registers an offense if no method is defined after the modifier + outside a class + registers an offense if no method is defined + doesn't register an offense if a method is defined + registers an offense if no method is defined after the modifier + behaves like def in new block + registers an offense if no method is defined in Struct.new + doesn't register an offense if a method is defined in Struct.new + behaves like def in new block + registers an offense if no method is defined in ::Module.new + doesn't register an offense if a method is defined in ::Module.new + behaves like def in new block + doesn't register an offense if a method is defined in ::Class.new + registers an offense if no method is defined in ::Class.new + behaves like method defined on a singleton class + inside a class + doesn't register an offense if a method is defined + registers an offense even if a non-singleton-class method is defined + doesn't register an offense if the modifier is the same as outside the meta-class + registers an offense if no method is defined after the modifier + registers an offense if no method is defined + outside a class + registers an offense if no method is defined + registers an offense if no method is defined after the modifier + doesn't register an offense if a method is defined + behaves like unused visibility modifiers + registers an offense and corrects when visibility is immediately changed without any intervening defs + behaves like non-repeated visibility modifiers + doesn't register an offense when `protected` is not repeated + registers an offense and corrects even when `public` is not repeated + doesn't register an offense when `private` is not repeated + behaves like method defined using instance_eval + doesn't register an offense if a method is defined + registers an offense if no method is defined + inside a class + registers two offenses when a modifier is inside and outside the and no method is defined + registers an offense when a modifier is outside the block and a method is defined only inside the block + behaves like method defined with define_method + doesn't register an offense if a block is passed + doesn't register an offense if a proc is passed + doesn't register an offense if a lambda is passed + doesn't register an offense if a -> is passed + behaves like at the end of the body + registers an offense for trailing `public` + when using inline modifiers + does not register an offense + when an access modifier has no methods + registers an offense and corrects + behaves like def in new block + doesn't register an offense if a method is defined in ::Struct.new + registers an offense if no method is defined in ::Struct.new + behaves like at the top of the body + doesn't register an offense for `protected` + doesn't register an offense for `private` + registers an offense and corrects for `public` + behaves like nested in a begin..end block + doesn't flag an access modifier from surrounding scope + still flags repeated `protected` + behaves like method defined using class_eval + registers an offense if no method is defined + doesn't register an offense if a method is defined + inside a class + registers two offenses when a modifier is inside and outside the block and no method is defined + registers an offense when a modifier is outside the block and a method is defined only inside the block + behaves like method defined with define_method + doesn't register an offense if a -> is passed + doesn't register an offense if a block is passed + doesn't register an offense if a lambda is passed + doesn't register an offense if a proc is passed + behaves like conditionally defined method + doesn't register an offense for unless + doesn't register an offense for if + behaves like method defined with define_method + doesn't register an offense if a -> is passed + doesn't register an offense if a proc is passed + doesn't register an offense if a lambda is passed + doesn't register an offense if a block is passed + behaves like method named by access modifier name + does not register an offense for `private` + behaves like nested in a begin..end block + still flags repeated `private` + doesn't flag an access modifier from surrounding scope + behaves like def in new block + registers an offense if no method is defined in Module.new + doesn't register an offense if a method is defined in Module.new + behaves like nested modules + doesn't register an offense for nested modules + unused modifiers + registers an offense when outside a nested module + registers an offense with a nested module + registers an offense when inside a nested module + behaves like at the end of the body + registers an offense for trailing `protected` + when using ActiveSupport's `concerning` method + still points out redundant uses within the block + is aware that this creates a new scope + Ruby 2.7 + still points out redundant uses within the block + behaves like def in new block + registers an offense if no method is defined in Class.new + doesn't register an offense if a method is defined in Class.new + behaves like def in new block + registers an offense if no method is defined in ::Struct.new + doesn't register an offense if a method is defined in ::Struct.new + when class is empty save modifier + registers an offense and corrects + behaves like repeated visibility modifiers + registers an offense when `private` is repeated + when using ActiveSupport behavior when Rails is not eabled + reports offenses and corrects + when passing method as symbol + does not register an offense + behaves like conditionally defined method + doesn't register an offense for if + doesn't register an offense for unless + when private_class_method is used with arguments + does not register an offense + when using the class_methods method from ActiveSupport::Concern + is aware that this creates a new scope + behaves like methods defined in an iteration + doesn't register an offense for map + doesn't register an offense for each + when using a known method-creating method + still points out redundant uses within the module + is aware that this creates a new method + when a def is an argument to a method call + does not register an offense + behaves like method defined using class_eval + registers an offense if no method is defined + doesn't register an offense if a method is defined + inside a class + registers an offense when a modifier is outside the block and a method is defined only inside the block + registers two offenses when a modifier is inside and outside the block and no method is defined + behaves like at the top of the body + registers an offense and corrects for `public` + doesn't register an offense for `private` + doesn't register an offense for `protected` + behaves like method named by access modifier name + does not register an offense for `private` + behaves like method named by access modifier name + does not register an offense for `protected` + behaves like at the end of the body + registers an offense for trailing `protected` + +RuboCop::ConfigStore + .for + always uses config specified in command line + when no config specified in command line + gets config path and config from cache if available + searches for config path if not available in cache + when --force-default-config option is specified + uses default config without searching for config path + +RuboCop::Cop::Lint::NestedPercentLiteral + registers offense for repeated nested percent literals + registers no offense for percent modifier character in isolation + registers no offense for percents in the middle of literals + registers no offense for empty array + registers no offense for array + registers no offense for nestings under percent + registers offense for multiply nested percent literals + registers offense for nested percent literals + when handling invalid UTF8 byte sequence + registers no offense for array + registers offense for nested percent literal + +RuboCop::Cop::Lint::AmbiguousBlockAssociation + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + when AllowedMethods is enabled + does not register an offense for an allowed method + registers an offense for other methods + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + without parentheses + without receiver registers an offense - when EnforcedStyle is set to percent_r - a multi-line `//` regex with slashes + as a hash key registers an offense - a single-line `//` regex with slashes + with assignment registers an offense - a multi-line %r regex with slashes - is accepted - a single-line %r regex with slashes - is accepted - a single-line `//` regex without slashes + rspec expect {}.to change {} registers an offense - a multi-line %r regex without slashes - is accepted - a multi-line `//` regex without slashes + with receiver registers an offense - a single-line %r regex without slashes - is accepted - when regex contains slashes in interpolation - ignores the slashes that do not belong // regex - when `EnforcedStyle: require_parentheses` of `Style/MethodCallWithArgsParentheses` cop - when using `%r` regexp with `EnforcedStyle: mixed` - does not register an offense when using a regexp starts with a blank as a safe navigation method argument - does not register an offense when using a regexp starts with a blank as a method argument - registers an offense when not used as a method argument - registers an offense when used as a method argument - registers an offense when using a regexp starts with a blank - registers an offense when used as a safe navigation method argument - when using `%r` regexp with `EnforcedStyle: slashes` - does not register an offense when using a regexp starts with a blank as a method argument - registers an offense when using a regexp starts with a blank - registers an offense when used as a safe navigation method argument - registers an offense when used as a method argument - does not register an offense when using a regexp starts with a blank as a safe navigation method argument - registers an offense when not used as a method argument - when `EnforcedStyle: omit_parentheses` of `Style/MethodCallWithArgsParentheses` cop - when using `%r` regexp with `EnforcedStyle: mixed` - does not register an offense when used as a safe navigation method argument - does not register an offense when used as a method argument - registers an offense when not used as a method argument - when using `%r` regexp with `EnforcedStyle: slashes` - registers an offense when not used as a method argument - does not register an offense when used as a method argument - does not register an offense when used as a safe navigation method argument - when PercentLiteralDelimiters is configured with slashes - respects the configuration when autocorrecting - when PercentLiteralDelimiters is configured with brackets - respects the configuration when autocorrecting + when using safe navigation operator + registers an offense + behaves like accepts + does not register an offense + when AllowedPatterns is enabled + registers an offense for other methods + does not register an offense for an allowed method + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense + behaves like accepts + does not register an offense -RuboCop::Cop::Style::ClassCheck - when enforced style is kind_of? - registers an offense for is_a? and corrects to kind_of? - when enforced style is is_a? - registers an offense for kind_of? and corrects to is_a? +RuboCop::Cop::Metrics::BlockLength + accepts a block with less than 3 lines + does not count blank lines + rejects brace blocks too + properly counts nested blocks + reports the correct beginning and end lines + does not count commented lines by default + accepts empty blocks + rejects a block with more than 5 lines + accepts a block with multiline receiver and less than 3 lines of body + when CountComments is enabled + also counts commented lines + when `CountAsOne` is not empty + folds array into one line + when defining a Struct + does not register an offense + when using numbered parameter + does not count blank lines + rejects a block with more than 5 lines + reports the correct beginning and end lines + accepts a block with less than 3 lines + when defining a module + does not register an offense + when defining a class + does not register an offense + when methods to allow are defined + when IgnoredMethods is enabled + when regex + does not report an offense + that does not match + reports an offense + when string + does not report an offense + that does not match + reports an offense + when ExcludedMethods is enabled + does not report an offense + that does not match + reports an offense + when AllowedMethods is enabled + behaves like allow an offense on an allowed method + still rejects other methods with long blocks + accepts the foo method with a long block + when a method is allowed, but receiver is a module + does not report an offense + behaves like allow an offense on an allowed method + still rejects other methods with long blocks + accepts the foo method with a long block + when receiver contains whitespaces + allows whitespaces + when AllowedPatterns is enabled + does not report an offense + that does not match + reports an offense -RuboCop::Cop::Layout::ConditionPosition - registers an offense and corrects for condition on the next line - accepts condition on the same line - accepts condition on the same line - registers an offense and corrects for condition on the next line - accepts condition on a different line for modifiers - accepts ternary ops - accepts condition on the same line - accepts condition on a different line for modifiers - registers an offense and corrects for condition on the next line - accepts condition on a different line for modifiers - accepts condition on the same line - registers an offense and corrects for condition on the next line - registers an offense and corrects for elsif condition on the next line - accepts condition on a different line for modifiers +RuboCop::Cop::Metrics::CyclomaticComplexity + when Max is 2 + counts stupid nested if and else blocks + when Max is 1 + registers an offense for an unless modifier + counts repeated &. on same untouched local variable as 1 + registers an offense for &. + counts enumerating methods with blocks as +1 + registers an offense for &&= + registers an offense for || + registers an offense for a for block + accepts an empty method + accepts complex code outside of methods + registers an offense for a rescue block + accepts an empty `define_method` + registers an offense for and + registers an offense for an if modifier + registers an offense for an elsif block + counts only a single method + does not count blocks in general + registers an offense for or + accepts a method with no decision points + registers an offense for a case/when block + registers an offense for a ternary operator + registers an offense for a `define_method` + counts enumerating methods with block-pass as +1 + registers an offense for a while block + registers an offense for ||= + registers an offense for an until block + deals with nested if blocks containing && and || + registers an offense for && + Ruby 2.7 + counts enumerating methods with numblocks as +1 + when AllowedMethods is enabled + does not register an offense when defining a class method + does not register an offense when using `define_method` + does not register an offense when defining an instance method + when AllowedPatterns is enabled + does not register an offense when defining a class method + does not register an offense when using `define_method` + does not register an offense when defining an instance method -RuboCop::Cop::Lint::NoReturnInBeginEndBlocks - rejects a return statement inside a block when using /= - rejects a return statement inside a block when using **= - rejects a return statement inside a block when using ||= - accepts a block with no return when using /= - accepts a block with no return when using *= - rejects a return statement inside a block when using *= - accepts a block with no return when using += - accepts a block with no return when using = - accepts a block with no return when using **= - accepts a block with no return when using -= - rejects a return statement inside a block when using += - accepts a block with no return when using ||= - rejects a return statement inside a block when using -= - rejects a return statement inside a block when using = +RuboCop::Cop::Layout::SpaceAfterMethodName + accepts a defs without arguments + accepts an assignment def with arguments but no parentheses + accepts a def without arguments + registers offense and corrects class def with space before parenthesis + accepts class method def with arguments but no parentheses + registers an offense and corrects def with space before the parenthesis + registers offense and corrects assignment def with space before parenthesis + accepts a def with arguments but no parentheses -RuboCop::Cop::InternalAffairs::NodeDestructuring - does not register an offense when receiver is named `array` - registers an offense when destructuring using a splat - when destructuring using `node.children` - registers an offense when receiver is named `send_node` - registers an offense when receiver is named `node` +RuboCop::Cop::Layout::AssignmentIndentation + ignores comparison operators + allows assignments that do not start on a newline + allows a properly indented rhs + registers an offense for incorrectly indented rhs when multiple assignment + registers an offense for multi-lhs + registers an offense for incorrectly indented rhs + registers an offense for incorrectly indented rhs whenmultiple assignment with line breaks on each line + allows a properly indented rhs with fullwidth characters + when indentation width is overridden for this cop only + autocorrects indentation + allows a properly indented rhs -RuboCop::Cop::Lint::AmbiguousOperatorPrecedence - does not register an offense when there is only one operator in the expression - registers an offense when an expression with mixed boolean operators has no parens - does not register an offense when expressions are wrapped in parentheses by precedence - does not register an offense when boolean expressions are wrapped in parens - registers an offense when the entire expression is wrapped in parentheses - corrects a super long expression in reverse precedence order - registers an offense when an expression with mixed precedence has no parens - corrects a super long expression in precedence order - allows an operator with `or` - does not register an offense when all operators in the expression have the same precedence - does not register an offense when expressions are wrapped in parentheses by reverse precedence - registers an offense for expressions containing booleans and operators - allows an operator with `and` +RuboCop::Cop::Lint::RedundantSplatExpansion + accepts expanding a variable as a method parameter + allows assigning to an expanded range + allows assigning to a splat + allows splat expansion inside of an array + allows an array using a constructor + allows assigning to a splat variable + registers an offense and corrects an array literal being expanded in a rescue + allows assigning a variable to a splat expansion of a variable + allows expansions of an array that is assigned to a variable in rescue + allows expanding a method call on an array literal + when `AllowPercentLiteralArrayArgument: true` + does not register an offense when using percent string literal array + does not register an offense when using percent symbol literal array + when `AllowPercentLiteralArrayArgument: false` + registers an offense when using percent literal array + registers an offense when using percent symbol literal array + behaves like array splat expansion + method parameters + registers an offense and converts to a list of arguments + behaves like splat literal assignment + registers an offense and removes the splat from array + splat expansion of method parameters + registers an offense and corrects an array literal %i + registers an offense and corrects an array literal %I + behaves like array splat expansion + behaves like splat literal assignment + registers an offense and removes the splat from array + method parameters + registers an offense and converts to a list of arguments + behaves like array splat expansion + method parameters + registers an offense and converts to a list of arguments + behaves like splat literal assignment + registers an offense and removes the splat from array + behaves like array splat expansion + method parameters + registers an offense and converts to a list of arguments + behaves like splat literal assignment + registers an offense and removes the splat from array + behaves like splat expansion + behaves like splat literal assignment + registers an offense and converts to an array + method parameters + registers an offense and converts to an array + expanding Array.new call on array literal + when the array literal contains exactly one element + registers an offense and corrects + when the array literal contains more than one element + accepts + with ::Array.new + when the array literal contains exactly one element + registers an offense and corrects + behaves like splat expansion + method parameters + registers an offense and converts to an array + behaves like splat literal assignment + registers an offense and converts to an array + expanding Array.new call on method argument + registers an offense and corrects + behaves like splat expansion + method parameters + registers an offense and converts to an array + behaves like splat literal assignment + registers an offense and converts to an array + behaves like splat expansion + behaves like splat literal assignment + registers an offense and converts to an array + method parameters + registers an offense and converts to an array + splat expansion inside of an array + registers an offense and corrects expansion of %w to a list of words + registers an offense and corrects the expansion of an array literalinside of an array literal + registers an offense and corrects expansion of %W to a list of words + assignment to splat expansion + registers an offense and corrects an array using a constructor + registers and corrects an array using top-level const + behaves like array splat expansion + method parameters + registers an offense and converts to a list of arguments + behaves like splat literal assignment + registers an offense and removes the splat from array + arrays being expanded with %i variants using splat expansion + splat expansion inside of an array + registers an offense and corrects %i to a list of symbols + registers an offense and changes %I to a list of symbols + expanding an array literal in a when condition + registers an offense and corrects an array using %W + allows an array using a constructor + allows an array that is assigned to a variable + registers an offense and corrects %I to a list of symbols + registers an offense and corrects an array using %w + registers an offense and corrects an array using [] + registers an offense and corrects %i to a list of symbols + +RuboCop::TargetFinder + #find(..., :only_recognized_file_types) + returns absolute paths + does not find hidden files + when a pattern is passed + finds files which match the pattern + when a file with a ruby filename is passed + picks all the ruby files + when no argument is passed + finds files under the current directory + when input is passed on stdin + includes the file + when a hidden directory path is passed + finds files under the specified directory + when a directory path is passed + finds files under the specified directory + when a non-ruby file is passed + doesn't pick the file + when a hidden directory path is passed + finds files under the specified directory + when some non-known Ruby files are specified in the configuration Include and they are not explicitly passed as arguments + includes them + when same paths are passed + does not return duplicated file paths + when some non-known Ruby files are specified in the configuration Include and they are explicitly passed as arguments + includes them + when files with ruby interpreters are passed + picks all the ruby files + when some paths are specified in the configuration Exclude and they are explicitly passed as arguments + when it's forced to adhere file exclusion configuration + excludes them + normally + does not exclude them + when files with a ruby extension are passed + picks all the ruby files + when local AllCops/Include lists two patterns + picks two files + when a subdirectory AllCops/Include only lists one pattern + picks two files + #find(..., :all_file_types) + returns absolute paths + does not find hidden files + when a non-ruby file is passed + picks the file + when a file with a ruby filename is passed + picks all the ruby files + when a directory path is passed + finds files under the specified directory + when files with a ruby extension are passed + picks all the ruby files + when local AllCops/Include lists two patterns + picks all the ruby files + when a subdirectory AllCops/Include only lists one pattern + picks all the ruby files + when files with ruby interpreters are passed + picks all the ruby files + when some paths are specified in the configuration Exclude and they are explicitly passed as arguments + normally + does not exclude them + when it's forced to adhere file exclusion configuration + excludes them + when same paths are passed + does not return duplicated file paths + when some non-known Ruby files are specified in the configuration Include and they are not explicitly passed as arguments + includes them + when input is passed on stdin + includes the file + when some non-known Ruby files are specified in the configuration Include and they are explicitly passed as arguments + includes them + when a pattern is passed + finds files which match the pattern + when a hidden directory path is passed + finds files under the specified directory + when no argument is passed + finds files under the current directory + #target_files_in_dir + does not pick directories + does not pick files with no extension and no ruby shebang + picks files specified to be included in config + picks ruby executable files with no extension + picks files with extension .rb + does not pick files specified to be excluded in config + when an exception is raised while reading file + and debug mode is enabled + outputs error message + and debug mode is disabled + outputs nothing + w/ --fail-fast option + works with the expected number of .rb files + #find_files + can exclude symlinks as well as directories + resolves symlinks when looking for excluded directories + prevents infinite loops when traversing symlinks + works also if a folder is named "**" + works also if a folder is named "{}" + works also if a folder is named "," + does not search excluded top level directories + +RuboCop::Cop::Lint::DuplicateRescueException + registers an offense when multiple duplicate exceptions exist + registers an offense when duplicate exception exists within rescues with `else` branch + registers an offense when duplicate exception exists + does not register an offense when there are no duplicate exceptions + registers an offense when duplicate exception splat exists + registers an offense when duplicate exception exists within rescues with empty `rescue` branch + +RuboCop::Cop::Layout::LineEndStringConcatenationIndentation + when EnforcedStyle is aligned + accepts single line string literal concatenation + registers an offense for aligned strings in an if/elsif/else statement + registers an offense for unaligned strings in hash literal values + accepts a multiline string literal + accepts indented strings in implicit return statement of a method definition + accepts an empty heredoc string with interpolation + accepts indented strings in ordinary statement + accepts a heredoc string ... + accepts indented strings in implicit return statement of a singleton method definition + accepts aligned strings in method call + accepts indented strings in implicit return statement of a block + registers an offense for third part of a string if it is aligned only with the first + accepts a heredoc string with interpolation + accepts indented strings in implicit return statement of a method definition after other statement + accepts string literal with line break concatenated with other string + registers an offense for indented string + for assignment with x ||= + accepts aligned strings + registers an offense for indented strings + for assignment with x = + accepts aligned strings + registers an offense for indented strings + for assignment with X = + accepts aligned strings + registers an offense for indented strings + for assignment with x += + accepts aligned strings + registers an offense for indented strings + for assignment with @x = + registers an offense for indented strings + accepts aligned strings + for assignment with $x = + accepts aligned strings + registers an offense for indented strings + when EnforcedStyle is indented + accepts indented strings + accepts indented strings in implicit return statement of a method definition + accepts single line string literal concatenation + registers an offense for aligned strings in an if/elsif/else statement + registers an offense for aligned string + accepts indented strings in implicit return statement of a block + accepts indented strings in implicit return statement of a singleton method definition + accepts a heredoc string with interpolation + registers an offense for aligned strings in hash literal values + registers an offense for unaligned third part of string + accepts indented strings in implicit return statement of a method definition after other statement + accepts string literal with line break concatenated with other string + accepts a heredoc string ... + accepts a multiline string literal + accepts an empty heredoc string with interpolation + accepts indented strings in ordinary statement + for assignment with x += + registers an offense for aligned strings + accepts indented strings + for assignment with x = + accepts indented strings + registers an offense for aligned strings + when IndentationWidth is 1 + accepts indented strings + for assignment with x ||= + registers an offense for aligned strings + accepts indented strings + for assignment with @x = + accepts indented strings + registers an offense for aligned strings + for assignment with $x = + registers an offense for aligned strings + accepts indented strings + for assignment with X = + accepts indented strings + registers an offense for aligned strings + +RuboCop::Formatter::ClangStyleFormatter + #report_file + displays text containing the offending source line + when the source line is blank + does not display offending source line + when the offending source spans multiple lines + displays the first line with ellipses + when the source contains multibyte characters + displays text containing the offending source line + when the offense is correctable + prints message as-is + when the offense is not corrected + prints message as-is + when the offense is automatically corrected + prints [Corrected] along with message + +RuboCop::Cop::Lint::DuplicateMethods + understands nested modules + registers an offense when class << exp is used + doesn't register offense for non-duplicate class methods in module + registers offenses for duplicate attr_accessor in class + doesn't register an offense for non-duplicate method in class_eval block + registers an offense when class << exp is used + registers an offense for duplicate private methods in class_eval block + registers an offense for duplicate alias in class_eval block + does not register an offense for same method name defined in different methods + registers an offense for duplicate attr in dynamic class + doesn't register offense for non-duplicate class methods in dynamic module + registers an offense for duplicate attr_reader in dynamic module + does not register an offense for same method name defined in different self methods + understands class << A + understands class << self + registers an offense for duplicate alias_method in module + registers an offense for duplicate class methods in dynamic class + accepts for attr_reader and setter in dynamic class + accepts for attr_writer and getter in dynamic module + registers an offense for duplicate nested method in dynamic class + does not register for the same method in different scopes within `class << self` + registers offenses for duplicate attr_accessor in dynamic class + registers an offense for duplicate private methods in dynamic class + registers an offense for duplicate alias_method in class + ignores Class.new blocks which are assigned to local variables + understands nested modules + registers an offense for duplicate alias in class + does not register an offense for same method name defined in different methods + registers an offense for duplicate class methods with `self` and named receiver in module + doesn't register an offense for different private methods in class_eval block + registers an offense for a duplicate class method in separate dynamic module blocks + only registers an offense for the second instance of a duplicate instance method in separate files + does not register an offense for same method name defined in different methods + does not register an offense for same method name defined in different methods + registers an offense for duplicate alias_method in class_eval block + only registers an offense for the second instance of a duplicate instance method in separate files + registers offenses for duplicate assignable attr in module + doesn't register an offense for alias for gvar in dynamic module + registers an offense for a duplicate class method in separate class_eval block blocks + doesn't register offense for non-duplicate class methods in dynamic class + registers an offense for duplicate methods at top level + accepts for attr_reader and setter in dynamic module + registers an offense for duplicate attr_reader in class_eval block + accepts for non-duplicate alias_method in class + handles class_eval with implicit receiver + does not register an offense for same method name defined in different methods + registers an offense for duplicate nested method in self method of class_eval block + doesn't register an offense for non-duplicate method in dynamic module + registers an offense for duplicate class methods with named receiver in module + doesn't register an offense for alias for gvar in class_eval block + registers an offense for duplicate private self methods in dynamic module + registers an offense for a duplicate class method in separate dynamic class blocks + registers an offense for duplicate protected methods in dynamic class + registers an offense when class << exp is used + registers an offense when class << exp is used + accepts for attr_reader and setter in module + accepts for non-duplicate alias_method in dynamic module + recognizes difference between instance and class methods in class + registers an offense for duplicate attr in class + registers an offense when class << exp is used + doesn't register an offense for alias for gvar in dynamic class + does not register an offense for same method name defined in different self methods + doesn't register an offense for different private methods in class + registers an offense for duplicate method in module + registers an offense for duplicate attr_writer in class + registers an offense for duplicate private methods in dynamic module + registers an offense for duplicate nested method in dynamic module + registers 2 offenses for pair of duplicate methods in module + registers an offense for duplicate class methods with `<<` and named receiver in module + recognizes difference between instance and class methods in dynamic class + registers an offense for a duplicate instance method in separate dynamic class blocks + registers an offense for duplicate alias in module + registers an offense for duplicate private self methods in class + doesn't register an offense for non-duplicate alias in dynamic module + registers an offense for duplicate method in class + registers an offense for duplicate method in dynamic module + doesn't register an offense for non-duplicate alias in module + registers an offense for a duplicate class method in separate module blocks + does not register an offense for same method name defined in different self methods + registers an offense for duplicate alias_method in dynamic class + registers an offense for a duplicate instance method in separate class_eval block blocks + understands class << self + registers an offense for duplicate attr_writer in dynamic class + registers an offense for duplicate protected methods in dynamic module + registers an offense for duplicate protected methods in module + registers an offense for duplicate private self methods in class_eval block + registers offenses for duplicate attr_accessor in dynamic module + doesn't register an offense for alias for gvar in module + does not register an offense for same method name defined in different self methods + only registers an offense for the second instance of a duplicate instance method in separate files + recognizes difference between instance and class methods in dynamic module + registers an offense for duplicate class methods with `self` and named receiver in class + recognizes difference between instance and class methods in module + registers an offense for duplicate attr_reader in module + registers an offense for a duplicate instance method in separate module blocks + only registers an offense for the second instance of a duplicate instance method in separate files + registers an offense for duplicate protected methods in class + registers offenses for duplicate assignable attr in class_eval block + registers an offense for duplicate nested method in class + registers an offense for duplicate alias in dynamic module + understands class << self + doesn't register an offense for non-duplicate alias in class_eval block + accepts for non-duplicate alias_method in module + ignores method definitions in RSpec `describe` blocks + understands class << self + registers an offense for duplicate private self methods in module + registers an offense for duplicate nested method in self method of dynamic module + does not register an offense for same method name defined in different self methods + registers 2 offenses for pair of duplicate methods in class + registers 2 offenses for pair of duplicate methods in dynamic class + accepts for attr_writer and getter in class + doesn't register an offense for non-duplicate method in dynamic class + registers an offense for duplicate attr_writer in module + registers an offense for duplicate class methods in module + registers an offense for duplicate attr in class_eval block + doesn't register an offense for different private methods in dynamic module + doesn't register an offense for non-duplicate method in class + registers an offense for a duplicate instance method in separate class blocks + registers an offense for duplicate class methods in class + registers an offense for duplicate nested method in class_eval block + recognizes difference between instance and class methods in class_eval block + registers an offense for duplicate method in class_eval block + accepts for attr_reader and setter in class + accepts for attr_writer and getter in module + registers offenses for duplicate attr_accessor in module + only registers an offense for the second instance of a duplicate instance method in separate files + understands nested modules + registers an offense for duplicate alias in dynamic class + understands nested modules + accepts for attr_writer and getter in dynamic class + properly registers and offense when deeply nested + registers an offense for duplicate protected methods in class_eval block + registers 2 offenses for pair of duplicate methods in dynamic module + accepts for non-duplicate alias_method in class_eval block + understands nested modules + registers an offense for duplicate nested method in self method of module + registers an offense for duplicate private self methods in dynamic class + doesn't register offense for non-duplicate class methods in class + doesn't register an offense for alias for gvar in class + doesn't register offense for non-duplicate class methods in class_eval block + registers offenses for duplicate attr_accessor in class_eval block + registers an offense for duplicate private methods in module + understands class << self + registers an offense for duplicate nested method in module + registers offenses for duplicate assignable attr in dynamic class + registers offenses for duplicate assignable attr in dynamic module + registers an offense for duplicate alias_method in dynamic module + registers an offense for duplicate nested method in self method of class + accepts for attr_writer and getter in class_eval block + registers 2 offenses for pair of duplicate methods in class_eval block + accepts for non-duplicate alias_method in dynamic class + registers an offense for duplicate attr_reader in dynamic class + doesn't register an offense for different private methods in dynamic class + registers an offense for duplicate method in dynamic class + accepts for attr_reader and setter in class_eval block + registers an offense for duplicate attr in dynamic module + registers an offense for a duplicate class method in separate class blocks + registers an offense for duplicate class methods with `<<` and named receiver in class + registers offenses for duplicate assignable attr in class + registers an offense for duplicate attr_reader in class + doesn't register an offense for non-duplicate alias in dynamic class + registers an offense for duplicate attr_writer in dynamic module + registers an offense for duplicate attr_writer in class_eval block + doesn't register an offense for non-duplicate alias in class + registers an offense for duplicate class methods in dynamic module + registers an offense for duplicate nested method in self method of dynamic class + registers an offense for duplicate class methods with named receiver in class + registers an offense for duplicate class methods in class_eval block + registers an offense for duplicate private methods in class + doesn't register an offense for different private methods in module + registers an offense for duplicate attr in module + registers an offense for a duplicate instance method in separate dynamic module blocks + doesn't register an offense for non-duplicate method in module + when path is not in the project root + adds a message with absolute path + when path is in the project root + adds a message with relative path + +RuboCop::Cop::Style::EnvHome + registers and corrects an offense when using `::ENV['HOME']` + registers and corrects an offense when using `ENV['HOME']` + does not register an offense when using `ENV['HOME'] = '/home/foo'` + registers and corrects an offense when using `ENV.fetch('HOME')` + registers and corrects an offense when using `ENV.fetch('HOME', nil)` + does not register an offense when using `ENV.fetch('HOME', default)` + does not register an offense when using `Dir.home` RuboCop::Cop::Style::PerlBackrefs - autocorrects $' to Regexp.last_match.post_match autocorrects "#$1" to "#{Regexp.last_match(1)}" - autocorrects $LAST_PAREN_MATCH to Regexp.last_match(-1) - autocorrects $MATCH to Regexp.last_match(0) autocorrects `#$1` to `#{Regexp.last_match(1)}` + autocorrects /#$1/ to /#{Regexp.last_match(1)}/ + autocorrects $MATCH to Regexp.last_match(0) + autocorrects $LAST_PAREN_MATCH to Regexp.last_match(-1) + autocorrects $` to Regexp.last_match.pre_match + autocorrects $' to Regexp.last_match.post_match + autocorrects $+ to Regexp.last_match(-1) autocorrects $& to Regexp.last_match(0) autocorrects $PREMATCH to Regexp.last_match.pre_match autocorrects $9 to Regexp.last_match(9) + autocorrects puts $1 to puts Regexp.last_match(1) autocorrects $1 to ::Regexp.last_match(1) in namespace - autocorrects /#$1/ to /#{Regexp.last_match(1)}/ autocorrects $POSTMATCH to Regexp.last_match.post_match - autocorrects $` to Regexp.last_match.pre_match - autocorrects puts $1 to puts Regexp.last_match(1) - autocorrects $+ to Regexp.last_match(-1) -RuboCop::Cop::Layout::EmptyLinesAroundArguments - when extra lines - registers and autocorrects offense when args start on definition line - registers and autocorrects offense for empty line before arg - registers and autocorrects offense for empty line between args - registers and autocorrects offense when empty line between normal arg & block arg - registers and autocorrects offenses when multiple empty lines are detected - registers autocorrects empty line whetn args start on definition line - registers and autocorrects offense on correct lines for multi-offense example - registers and autocorrects offense on correct line for single offense example - registers and autocorrects offense for empty line after arg - when using safe navigation operator - registers and autocorrects offense for empty line before arg - when no extra lines - accepts listed args starting on definition line - accepts method with no arguments that trails off block - accepts method with argument that trails off block - accepts when blank line is inserted between method with arguments and receiver - accepts multiline style argument for method call without selector - accepts block argument with empty line - accepts multiple listed mixed args - accepts one line methods - accepts method with argument that trails off heredoc - with multiple arguments - ignores empty lines inside of method arguments - with one argument - ignores empty lines inside of method arguments +RuboCop::Cop::AnnotationComment + #annotation? + when it includes a keyword + is expected to be falsey + when given a keyword followed by a space + is expected to equal true + when given a keyword followed by a colon + is expected to equal true + when the keyword is not capitalized properly + is expected to equal true + when annotated with a non keyword + is expected to be falsey + when the keyword is multiple words + is expected to equal true + when given as the first word of a sentence + is expected to be falsey + #correct? + when there is duplication in the keywords + when the longer keyword is given first + behaves like correct + is expected to be truthy + behaves like correct + is expected to be truthy + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey + when the shorter keyword is given first + behaves like incorrect + is expected to be falsey + behaves like correct + is expected to be truthy + behaves like incorrect + is expected to be falsey + behaves like correct + is expected to be truthy + when a colon is required + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey + behaves like correct + is expected to be truthy + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey + behaves like correct + is expected to be truthy + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey + behaves like correct + is expected to be truthy + behaves like incorrect + is expected to be falsey + when no colon is required + behaves like incorrect + is expected to be falsey + behaves like correct + is expected to be truthy + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey + behaves like correct + is expected to be truthy + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey + behaves like correct + is expected to be truthy + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey + behaves like incorrect + is expected to be falsey -RuboCop::Cop::Style::SymbolLiteral - accepts string syntax when symbol start with a digit - accepts string syntax when symbols have special chars in them - accepts string syntax when symbols have whitespaces in them - registers an offense for word-line symbols using string syntax +RuboCop::Cop::Lint::ReturnInVoidContext + with a setter method containing a return without a value + accepts + when return is in top scope + accepts + with a class method called initialize containing a return + accepts + with an initialize method containing a return without a value + accepts + with a setter method containing a return with a value + registers an offense + with an initialize method containing a return with a value + registers an offense + with a non initialize method containing a return + accepts -RuboCop::Cop::Lint::IncompatibleIoSelectWithFiberScheduler - registers an offense when using `IO.select` with write argument and using return value but does not autocorrect - does not register an offense when using `IO.select` with multiple write arguments - registers and corrects an offense when using `IO.select` with single write argument - registers and corrects an offense when using `IO.select` with single read and timeout arguments - registers and corrects an offense when using `IO.select` with single read as `self` and timeout arguments - registers and corrects an offense when using `IO.select` with single write and timeout arguments - registers and corrects an offense when using `::IO.select` with single read argument - registers and corrects an offense when using `::IO.select` with single read and timeout arguments - registers and corrects an offense when using `IO.select` with single read argument and specify the first argument only - registers an offense when using `IO.select` with read argument and using return value but does not autocorrect - registers and corrects an offense when using `IO.select` with single read argument - registers and corrects an offense when using `IO.select` with single write as `self` and timeout arguments - does not register an offense when using `Enumerable#select` - registers and corrects an offense when using `IO.select` with single write, `nil`, and timeout arguments - does not register an offense when using `IO.select` with read and write arguments - registers and corrects an offense when using `IO.select` with multiple read argument and specify the first argument only - does not register an offense when using `IO.select` with multiple read arguments - registers and corrects an offense when using `IO.select` with single read, `nil`, and timeout arguments +RuboCop::Cop::Lint::ConstantOverwrittenInRescue + does not register an offense when not overriding an exception with an exception result + registers an offense when overriding an exception with an exception result + does not register an offense when using `=>` but correctly assigning to variables -RuboCop::Cop::Style::Lambda - when using safe navigation operator - does not break - with default `line_count_dependent` style - with a single line lambda literal - does not register an offense - with a multiline lambda literal as an argument - registers an offense - with a multiline lambda literal - without arguments - registers an offense - with arguments +RuboCop::Runner + #run with cops autocorrecting each-other + with two pairs of conflicting cops + with three cop cycle + if there is an offense in an inspected file + aborts because of an infinite loop + with display options + --display-only-safe-correctable + returns false + ommits unsafe correctable `Style/FrozenStringLiteral` + --display-only-correctable + returns false + ommits uncorrectable `Layout/LineLength` + if there is an offense in an inspected file + aborts because of an infinite loop + with two conflicting cops + if there are multiple offenses in an inspected file + aborts because of an infinite loop + if there is an offense in an inspected file + aborts because of an infinite loop + #run when interrupted + with SIGINT + returns false + #run + if there are no offenses in inspected files + returns true + if there is an offense in an inspected file + returns false + sends the offense to a formatter + if -s/--stdin is used with an offense + sends the offense to a formatter + returns false + if a cop crashes + does not call ResultCache#save + +RuboCop::Cop::Style::MissingElse + UnlessElse enabled + given an if-statement + with an else-clause containing only the literal nil + doesn't register an offense + with an else-clause with side-effects + doesn't register an offense + with no else-clause registers an offense - when calling a lambda method without a block + with a completely empty else-clause + doesn't register an offense + given an unless-statement + with an else-clause containing only the literal nil + doesn't register an offense + with an else-clause with side-effects + doesn't register an offense + with a completely empty else-clause + doesn't register an offense + with no else-clause + doesn't register an offense + >= Ruby 2.7 does not register an offense - with a single line lambda method call - without arguments + given a case statement + with a completely empty else-clause + doesn't register an offense + with no else-clause registers an offense - with arguments + with an else-clause containing only the literal nil + doesn't register an offense + with an else-clause with side-effects + doesn't register an offense + configured to warn only on empty case + given an if-statement + with no else-clause + doesn't register an offense + with a completely empty else-clause + doesn't register an offense + with an else-clause containing only the literal nil + doesn't register an offense + with an else-clause with side-effects + doesn't register an offense + given a case statement + with an else-clause with side-effects + doesn't register an offense + with an else-clause containing only the literal nil + doesn't register an offense + with no else-clause registers an offense - with a multiline do-end lambda as a parenthesized kwarg - registers an offense + with a completely empty else-clause + doesn't register an offense >= Ruby 2.7 - when using numbered parameter - with a multiline lambda method call - does not register an offense - with a single line lambda literal - does not register an offense - with a single line lambda method call - registers an offense - with a multiline lambda method call does not register an offense - unusual lack of spacing - without spacing before arguments - registers an offense - without spacing after arguments + given an unless-statement + with a completely empty else-clause + doesn't register an offense + with an else-clause containing only the literal nil + doesn't register an offense + with an else-clause with side-effects + doesn't register an offense + with no else-clause + doesn't register an offense + UnlessElse disabled + >= Ruby 2.7 + does not register an offense + given an unless-statement + with an else-clause with side-effects + doesn't register an offense + with a completely empty else-clause + doesn't register an offense + with an else-clause containing only the literal nil + doesn't register an offense + with no else-clause registers an offense - with a multiline lambda literal - with no parentheses and bad spacing - registers an offense - with no arguments and no spacing - registers an offense - without parentheses - registers an offense - with no parentheses and many args - registers an offense - with no arguments and bad spacing - registers an offense - with empty arguments - registers an offense - without any spacing + given a case statement + with no else-clause registers an offense - with a multiline braces lambda literal as a keyword argument - registers an offense - with a multiline do-end lambda literal as a keyword argument - registers an offense - with enforced `literal` style - with a multiline lambda method call - with arguments + with an else-clause with side-effects + doesn't register an offense + with a completely empty else-clause + doesn't register an offense + with an else-clause containing only the literal nil + doesn't register an offense + given an if-statement + with an else-clause with side-effects + doesn't register an offense + with no else-clause registers an offense - without arguments + with an else-clause containing only the literal nil + doesn't register an offense + with a completely empty else-clause + doesn't register an offense + configured to warn only on empty if + given an if-statement + with an else-clause containing only the literal nil + doesn't register an offense + with no else-clause registers an offense - with a single line lambda method call - with arguments + with a completely empty else-clause + doesn't register an offense + with an else-clause with side-effects + doesn't register an offense + given an unless-statement + with a completely empty else-clause + doesn't register an offense + with an else-clause containing only the literal nil + doesn't register an offense + with no else-clause registers an offense - without arguments + with an else-clause with side-effects + doesn't register an offense + >= Ruby 2.7 + does not register an offense + given a case statement + with an else-clause containing only the literal nil + doesn't register an offense + with an else-clause with side-effects + doesn't register an offense + with a completely empty else-clause + doesn't register an offense + with no else-clause + doesn't register an offense + EmptyElse enabled and set to warn on empty + given an if-statement + with an else-clause with side-effects + doesn't register an offense + with a completely empty else-clause + doesn't register an offense + with an else-clause containing only the literal nil + doesn't register an offense + with no else-clause registers an offense - with enforced `lambda` style - with a multiline lambda literal - without arguments + given a case statement + with an else-clause with side-effects + doesn't register an offense + with an else-clause containing only the literal nil + doesn't register an offense + with a completely empty else-clause + doesn't register an offense + with no else-clause registers an offense - with arguments + given an unless-statement + with no else-clause registers an offense - with a single line lambda literal - without argument parens and spaces + with an else-clause with side-effects + doesn't register an offense + with an else-clause containing only the literal nil + doesn't register an offense + with a completely empty else-clause + doesn't register an offense + >= Ruby 2.7 + does not register an offense + EmptyElse enabled and set to warn on nil + >= Ruby 2.7 + does not register an offense + given a case statement + with an else-clause containing only the literal nil + doesn't register an offense + with no else-clause registers an offense - without arguments + with an else-clause with side-effects + doesn't register an offense + with a completely empty else-clause + doesn't register an offense + given an unless-statement + with a completely empty else-clause + doesn't register an offense + with an else-clause containing only the literal nil + doesn't register an offense + with an else-clause with side-effects + doesn't register an offense + with no else-clause registers an offense - with arguments + given an if-statement + with no else-clause registers an offense + with a completely empty else-clause + doesn't register an offense + with an else-clause containing only the literal nil + doesn't register an offense + with an else-clause with side-effects + doesn't register an offense -RuboCop::Cop::Layout::MultilineMethodParameterLineBreaks - when there are multiple parameters on the first line - registers an offense and corrects starting from the 2nd argument - when many parameters including hash are on multiple lines, three on same line - registers an offense and corrects - when many parameters are on multiple lines, three on same line - registers an offense and corrects - when second parameter starts on same line as end of first - registers an offense and corrects - when many parameter are on multiple lines, two on same line - registers an offense and corrects - when there are no parameters - does not add any offenses - when two parameters are on next line - does not add any offenses - when parameter's default value starts on same line but ends on different line - registers an offense and corrects - when one parameter on same line - does not add any offenses +RuboCop::Cop::Lint::ImplicitStringConcatenation + on a single string literal + does not register an offense + on adjacent string literals on the same line + registers an offense + on adjacent string literals on different lines + does not register an offense + when the string literals contain newlines + registers an offense + does not register an offense for a single string + when in a method call's argument list + notes that the strings could be separated by a comma instead + on a string with interpolations + does register an offense + when inside an array + notes that the strings could be separated by a comma instead -RuboCop::Cop::Layout::MultilineBlockLayout - registers an offense and corrects for missing newline in {} block w/o params - doesn't move end keyword in a way which causes infinite loop in combination with Style/BlockEndNewLine - registers an offense and corrects line-break within arguments - does not remove a trailing comma when only one argument is present - registers an offense for missing newline in do/end block w/o params - registers an offense and corrects a line-break within arguments - autocorrects in more complex case with lambda and assignment, and aligns the next line two spaces out from the start of the block - considers the extra space required to join the lines together - registers offenses when there are not too many parameters to fit on one line - does not register an offense for one-line {} blocks - registers an offense and corrects for missing newline in {} block with params - does not register offenses when there is a newline for {} block - registers an offense and corrects for missing newline in do/end block with params - does not register offenses when there is a newline for do/end block - does not register offenses when there are too many parameters to fit on one line - registers an offense and corrects a line break within destructured arguments - registers an offense and corrects line-break before arguments - registers an offense and corrects line-break before arguments with empty block - registers an offense and corrects for missing newline before opening parenthesis `(` for block body - does not error out when the block is empty - does not register an offense for one-line do/end blocks - registers an offense and corrects a do/end block with a mult-line body - autocorrects nested parens correctly - registers offenses and corrects for lambdas - registers offenses and corrects for new lambda literal syntax - Ruby 2.7 - registers an offense and corrects for missing newline in do/end block with params - registers an offense and corrects for missing newline in {} block w/o params +RuboCop::Cop::Layout::SpaceAroundKeyword + behaves like accept around + accepts `{}` around keyword in `{a: begin end}` + behaves like missing after + registers an offense for missing space after keyword in `defined?1` and autocorrects + behaves like missing after + registers an offense for missing space after keyword in `unless""; end` and autocorrects + behaves like accept before + accepts `>` before keyword in `a>begin end` + behaves like accept around + accepts `{}` around keyword in `"#{begin end}"` + behaves like accept before + accepts `/` before keyword in `a/begin end` + behaves like accept before + accepts `*` before keyword in `a*begin end` + behaves like accept after + accepts `[` after keyword in `super[1]` + behaves like accept before + accepts `&&` before keyword in `a&&begin end` + behaves like accept before + accepts `||` before keyword in `a||begin end` + behaves like missing before + registers an offense for missing space before keyword in `1or 2` + behaves like missing after + registers an offense for missing space after keyword in `END{}` and autocorrects + behaves like missing before + registers an offense for missing space before keyword in `begin ""ensure end` + behaves like missing before + registers an offense for missing space before keyword in `if a; "b"end` + behaves like missing after + registers an offense for missing space after keyword in `a rescue""` and autocorrects + behaves like accept around + accepts `,` around keyword in `a 1,next,1` + behaves like accept before + accepts `<` before keyword in `a= Ruby 3.0 + behaves like accept after + accepts `=>` after keyword in `a =>""` + behaves like accept before + accepts `=>` before keyword in `""=> a` + behaves like missing before + registers an offense for missing space before keyword in `until 1do end` + behaves like accept after + accepts `.` after keyword in `begin end.inspect` + behaves like missing before + registers an offense for missing space before keyword in `a "b"do end` + behaves like missing after + registers an offense for missing space after keyword in `until 1 do"x" end` and autocorrects + behaves like accept around + accepts `;` around keyword in `test do;end` + behaves like missing after + registers an offense for missing space after keyword in `begin rescue; else"" end` and autocorrects + behaves like accept after + accepts `(` after keyword in `return(1)` + >= Ruby 2.7 + behaves like missing before + registers an offense for missing space before keyword in `case a; in "pattern"unless "condition"; else "" end` + behaves like missing after + registers an offense for missing space after keyword in `case a; in "pattern" if"condition"; else "" end` and autocorrects + behaves like missing after + registers an offense for missing space after keyword in `case a; in b; else"" end` and autocorrects + behaves like missing before + registers an offense for missing space before keyword in `case a; in b; ""else end` + behaves like missing before + registers an offense for missing space before keyword in `case a; in "pattern"if "condition"; else "" end` + behaves like missing after + registers an offense for missing space after keyword in `case a; in "pattern" unless"condition"; else "" end` and autocorrects + behaves like accept after + accepts `[` after keyword in `yield[1]` + behaves like missing before + registers an offense for missing space before keyword in `a do "a"end` + behaves like missing before + registers an offense for missing space before keyword in `case ""when a; end` + behaves like accept before + accepts `-` before keyword in `a-begin end` + behaves like accept after + accepts `(` after keyword in `super(1)` + behaves like missing after + registers an offense for missing space after keyword in `yield""` and autocorrects + >= Ruby 2.7 + behaves like missing after + registers an offense for missing space after keyword in `case""; in 1; end` and autocorrects + behaves like missing after + registers an offense for missing space after keyword in `if a; else"" end` and autocorrects + behaves like accept around + accepts `[]` around keyword in `[begin end]` + behaves like accept after + accepts `.` after keyword in `yield.method` + behaves like missing before + registers an offense for missing space before keyword in `""rescue a` + behaves like accept around + accepts `{}` around keyword in `loop {next}` + behaves like missing after + registers an offense for missing space after keyword in `1 or(2)` and autocorrects + behaves like missing after + registers an offense for missing space after keyword in `begin ensure"" end` and autocorrects + behaves like missing before + registers an offense for missing space before keyword in `if a; ""else end` + behaves like accept after + accepts `#` after keyword in `next#comment` + behaves like missing after + registers an offense for missing space after keyword in `case"" when 1; end` and autocorrects + behaves like accept before + accepts `+` before keyword in `a+begin; end.method` + behaves like missing before + registers an offense for missing space before keyword in `while 1do end` + behaves like missing after + registers an offense for missing space after keyword in `a do|x| end` and autocorrects + behaves like accept around + accepts `[]` around keyword in `a[begin end]` + behaves like accept before + accepts `==` before keyword in `a==begin end` + behaves like accept before + accepts `=` before keyword in `a=begin end` + behaves like accept after + accepts `(` after keyword in `defined?(1)` + &. + behaves like accept after + accepts `&.` after keyword in `yield&.foo` + behaves like accept after + accepts `&.` after keyword in `super&.foo` + behaves like accept after + accepts `(` after keyword in `not(1)` + behaves like accept before + accepts `+` before keyword in `a+begin end` + behaves like missing after + registers an offense for missing space after keyword in `case a; when b; else"" end` and autocorrects + behaves like missing after + registers an offense for missing space after keyword in `BEGIN{}` and autocorrects + behaves like missing after + registers an offense for missing space after keyword in `for x in [] do"x" end` and autocorrects + behaves like missing after + registers an offense for missing space after keyword in `break""` and autocorrects + behaves like accept after + accepts `{` after keyword in `loop{}` + behaves like missing before + registers an offense for missing space before keyword in `1and 2` + behaves like missing after + registers an offense for missing space after keyword in `not""` and autocorrects + behaves like missing before + registers an offense for missing space before keyword in `1while ""` + behaves like accept around + accepts `()` around keyword in `(next)` + behaves like missing after + registers an offense for missing space after keyword in `if a; elsif""; end` and autocorrects + >= Ruby 2.7 + behaves like missing after + registers an offense for missing space after keyword in `a in""` and autocorrects + behaves like missing after + registers an offense for missing space after keyword in `case a; in""; end` and autocorrects + behaves like missing before + registers an offense for missing space before keyword in `""in a` + behaves like accept before + accepts `!` before keyword in `!yield.method` + behaves like missing before + registers an offense for missing space before keyword in `for x in [] do "x"end` + behaves like missing after + registers an offense for missing space after keyword in `super{}` and autocorrects + behaves like accept before + accepts `**` before keyword in `a**begin end` + behaves like missing after + registers an offense for missing space after keyword in `1 while""` and autocorrects + behaves like missing after + registers an offense for missing space after keyword in `1 and(2)` and autocorrects + behaves like accept after + accepts `\` after keyword in `test do\ +end` + behaves like missing after + registers an offense for missing space after keyword in `return""` and autocorrects + behaves like accept before + accepts `!` before keyword in `!super.method` + behaves like missing after + registers an offense for missing space after keyword in `1 until""` and autocorrects + behaves like accept before + accepts `=*` before keyword in `a=*begin end` + behaves like missing after + registers an offense for missing space after keyword in `if a then"" end` and autocorrects + behaves like missing before + registers an offense for missing space before keyword in `begin "a"end` + behaves like accept after + accepts `\n` after keyword in `test do +end` + behaves like missing after + registers an offense for missing space after keyword in `while 1 do"x" end` and autocorrects + behaves like accept after + accepts `+` after keyword in `+begin end` + behaves like accept after + accepts `(` after keyword in `yield(1)` + behaves like missing after + registers an offense for missing space after keyword in `begin+1 end` and autocorrects + behaves like missing before + registers an offense for missing space before keyword in `while 1 do "x"end` + behaves like accept after + accepts `(` after keyword in `next(1)` + behaves like accept before + accepts `!` before keyword in `!yield` + behaves like missing before + registers an offense for missing space before keyword in `1until ""` + behaves like missing before + registers an offense for missing space before keyword in `if ""then a end` + behaves like accept after + accepts `::` after keyword in `super::ModuleName` + behaves like missing after + registers an offense for missing space after keyword in `super""` and autocorrects + behaves like accept before + accepts `|` before keyword in `loop { |x|break }` + behaves like accept after + accepts `rescue` after keyword in `begin; rescue(Error); end` + behaves like missing before + registers an offense for missing space before keyword in `for x in []do end` + behaves like accept after + accepts `(` after keyword in `break(1)` -RuboCop::Cop::Style::OperatorMethodCall - does not register an offense when using `foo ^ bar` - registers an offense when using `foo.<<(bar)` - registers an offense when chaining `foo.bar.!~(baz).round(2)` - registers an offense when chaining `foo.bar.>(baz).round(2)` - registers an offense when using `foo.> bar` - registers an offense when using `foo.| bar` - does not register an offense when using `foo ~ bar` - registers an offense when using `foo.&(bar)` - does not register an offense when using `foo.!@bar` - registers an offense when using `foo.>(bar)` - does not register an offense when using `foo | bar` - registers an offense when using `foo.===(bar)` - registers an offense when chaining `foo.bar.<=>(baz).round(2)` - registers an offense when using `foo.+ bar` - does not register an offense when using `foo == bar` - does not register an offense when using `foo.~@bar` - does not register an offense when using `foo % bar` - registers an offense when using `foo.- bar` - registers an offense when chaining `foo.bar.&(baz).round(2)` - registers an offense when using `foo.%(bar)` - registers an offense when using `foo.!=(bar)` - registers an offense when using `foo.=~(bar)` - registers an offense when using `foo./(bar)` - registers an offense when chaining `foo.bar.>>(baz).round(2)` - does not register an offense when using `foo ** bar` - registers an offense when using `foo.!~(bar)` - registers an offense when chaining `foo.bar.-(baz).round(2)` - registers an offense when using `foo.<(bar)` - registers an offense when using `foo.|(bar)` - registers an offense when chaining `foo.bar.|(baz).round(2)` - registers an offense when using `foo.<=(bar)` - does not register an offense when using `foo > bar` - registers an offense when chaining `foo.bar.+(baz).round(2)` - registers an offense when using `foo.** bar` - does not register an offense when using `foo ! bar` - registers an offense when using `foo.== bar` - registers an offense when using `foo.==(bar)` - registers an offense when using `foo.-(bar)` - does not register an offense when using `Foo.+(bar)` - registers an offense when chaining `foo.bar.!=(baz).round(2)` - registers an offense when using `foo.!= bar` - does not register an offense when using `foo << bar` - registers an offense when chaining `foo.bar./(baz).round(2)` - registers an offense when using `foo.~(bar)` - does not register an offense when using `foo >> bar` - registers an offense when using `foo.>>(bar)` - registers an offense when chaining `foo.bar.<<(baz).round(2)` - does not register an offense when using `foo * bar` - does not register an offense when using `foo === bar` - registers an offense when using `foo.<=> bar` - registers an offense when chaining `foo.bar.==(baz).round(2)` - does not register an offense when using `foo <=> bar` - registers an offense when chaining `foo.bar.~(baz).round(2)` - does not register an offense when using `foo / bar` - registers an offense when using `foo.<< bar` - does not register an offense when using `foo.-@bar` - does not register an offense when using `foo !~ bar` - does not register an offense when using `obj.!` - does not register an offense when using `foo & bar` - does not register an offense when using `foo.+@bar.to_s` - registers an offense when using `foo.=~ bar` - registers an offense when chaining `foo.bar.%(baz).round(2)` - registers an offense when using `foo.>=(bar)` - registers an offense when using `foo.<= bar` - registers an offense when chaining `foo.bar.===(baz).round(2)` - registers an offense when using `foo./ bar` - registers an offense when using `foo.>= bar` - registers an offense when using `foo.<=>(bar)` - does not register an offense when using `foo <= bar` - registers an offense when chaining `foo.bar.<=(baz).round(2)` - registers an offense when using `foo.& bar` - registers an offense when using `foo.^(bar)` - does not register an offense when using `foo < bar` - registers an offense when using `foo.!~ bar` - does not register an offense when using `foo >= bar` - registers an offense when using `foo.=== bar` - registers an offense when using `foo.+(bar)` - registers an offense when using `foo.~ bar` - does not register an offense when using `foo =~ bar` - registers an offense when chaining `foo.bar.=~(baz).round(2)` - does not register an offense when using `foo.+@bar` - registers an offense when using `foo.>> bar` - registers an offense when using `foo.% bar` - registers an offense when chaining `foo.bar.**(baz).round(2)` - registers an offense when chaining `foo.bar.!(baz).round(2)` - registers an offense when using `foo.**(bar)` - registers an offense when chaining `foo.bar.>=(baz).round(2)` - registers an offense when chaining `foo.bar.^(baz).round(2)` - does not register an offense when using `foo - bar` - registers an offense when using `foo.< bar` - does not register an offense when using `foo != bar` - registers an offense when using `foo.^ bar` - does not register an offense when using `foo.`bar` - does not register an offense when using `foo + bar` - registers an offense when using `foo.* bar` - registers an offense when chaining `foo.bar.<(baz).round(2)` - registers an offense when using `foo.!(bar)` - registers an offense when chaining `foo.bar.*(baz).round(2)` - registers an offense when using `foo.*(bar)` - registers an offense when using `foo.! bar` +RuboCop::Cop::Style::ConstantVisibility + registers an offense for module definitions + does not register an offense in the top level scope + does not register an offense when passing a string to the visibility declaration + when defining a constant in a module + does not register an offense when using a visibility declaration + registers an offense when not using a visibility declaration + when defining a constant in a class + with a single-statement body + registers an offense when not using a visibility declaration + with a multi-statement body + does not register an offense when using a visibility declaration + registers an offense when there is no matching visibility declaration + registers an offense when not using a visibility declaration + IgnoreModules + registers an offense for constants + does not register an offense for class definitions -RuboCop::Cop::Style::KeywordParametersOrder - registers an offense and corrects when multiple `kwoptarg`s are interleaved with `kwarg`sand last argument is `kwrestarg` and argument parentheses omitted - registers an offense and corrects when multiple `kwoptarg` are before `kwarg` and argument parentheses omitted - registers an offense and corrects when `kwoptarg` is before `kwarg` and argument parentheses omitted - registers an offense and corrects when multiple `kwoptarg`s are interleaved with `kwarg`sand last argument is `blockarg` and argument parentheses omitted - registers an offense and corrects when multiple `kwoptarg`s are interleaved with `kwarg`s - registers an offense and corrects when `kwoptarg` is before `kwarg` - does not register an offense when there are no `kwoptarg`s before `kwarg`s - when using block keyword parameters - does not register an offense when there are no `kwoptarg`s before `kwarg`s - registers an offense and corrects when `kwoptarg` is before `kwarg` +RuboCop::Cop::Style::WhileUntilDo + accepts multi-line while without do + accepts do in single-line until + registers an offense for do in multiline while + registers an offense for do in multiline until + accepts do in single-line while + accepts multi-line until without do -RuboCop::Cop::Style::WordArray - when EnforcedStyle is array - autocorrects a %w() array which uses string with hyphen - autocorrects a %W() array which uses string with hyphen - registers an offense for a %w() array - autocorrects a %W() array which uses string interpolation - registers an offense for an empty %w() array - doesn't fail on strings which are not valid UTF-8 - doesn't fail with `encoding: binary - autocorrects a %W() array which uses escapes - autocorrects a %w() array which uses single quotes - does not register an offense for arrays of double quoted strings - autocorrects multiline %w() array - does not register an offense for arrays of strings with hyphens - does not register an offense for arrays of single quoted strings - does not register an offense for arrays of strings with spaces - with non-default MinSize - does not autocorrect arrays of one symbol if MinSize > 1 - when EnforcedStyle is percent - uses %W when autocorrecting strings with embedded newlines and tabs - registers an offense for arrays of strings containing hyphens - autocorrects an array of words using partial newlines - registers an offense for arrays of double quoted strings - registers an offense for arrays of single quoted strings - registers an offense in a non-ambiguous block context - does not register an offense for array starting with %w - does not register an offense on non-word strings - keeps the line breaks in place after autocorrect - registers an offense for strings with newline and tab escapes - detects right value of MinSize to use for --auto-gen-config - does not register an offense for a %w() array containing non word characters - registers an offense for a %w() array containing spaces - autocorrects an array of words - does not register an offense for array with empty strings - doesn't fail in wacky ways when multiple cop instances are used - does not register an offense for an array with comments in it - detects when the cop must be disabled to avoid offenses - registers an offense for arrays with character constants - does not register an offense for array of non-words - autocorrects an array with one element - does not register offense for array with allowed number of strings - registers an offense for an array with comments outside of it - autocorrects an array of words and character constants - autocorrects an array of words in multiple lines - corrects properly when there is an extra trailing comma - does not register an offense for array containing non-string - when the default external encoding is US-ASCII - registers an offense for arrays of unicode word characters - when the default external encoding is UTF-8 - registers an offense for arrays of unicode word characters - with a WordRegex configuration which accepts almost anything - uses %w for strings which only appear to have an escape - uses %W when autocorrecting strings with non-printable chars - with a custom WordRegex configuration - registers an offense for arrays of email addresses - with a treacherous WordRegex configuration - doesn't break when words contain delimiters - doesn't break when words contain whitespace - when PreferredDelimiters is specified - autocorrects an array with delimiters - when the WordRegex configuration is not a Regexp - still parses the code without raising an error +RuboCop::Cop::Naming::VariableName + when configured for camelCase + accepts assigning to camel case constant + accepts assignment with indexing of self + accepts with non-ascii characters + accepts local variables marked as unused + registers an offense for default method arguments + registers an offense for keyword rest arguments + registers an offense for snake case in local variable name + registers an offense for opposite + correct + registers an offense for camel case when invoking method args + registers an offense for rest arguments + accepts camel case in class variable name + accepts screaming snake case constants + registers an offense for snake case in method parameter + accepts screaming snake case globals + accepts camel case in instance variable name + accepts camel case in local variable name + accepts camel case local variables marked as unused + registers an offense for block arguments + accepts one symbol size local variables + registers an offense for keyword arguments + when AllowedPatterns is set + does not register an offense for a method name that matches the allowed pattern + does not register an offense for a local variable name that matches the allowed pattern + does not register an offense for a class variable name that matches the allowed pattern + does not register an offense for a symbol that matches the allowed pattern + does not register an offense for a global variable name that matches the allowed pattern + does not register an offense for a instance variable name that matches the allowed pattern + when AllowedIdentifiers is set + does not register an offense for a class variable name that is allowed + does not register an offense for a instance variable name that is allowed + does not register an offense for a local variable name that is allowed + does not register an offense for a global variable name that is allowed + does not register an offense for a symbol that is allowed + does not register an offense for a method name that is allowed + when configured for snake_case + accepts screaming snake case constants + accepts local variables marked as unused + registers an offense for default method arguments + registers an offense for keyword arguments + accepts screaming snake case globals + accepts assignment with indexing of self + registers an offense for method arguments + registers an offense for camel case in local variable name + registers an offense for rest arguments + registers an offense for camel case when invoking method args + accepts assigning to camel case constant + accepts one symbol size local variables + registers an offense for correct + opposite + registers an offense for camel case local variables marked as unused + registers an offense for camel case in class variable name + registers an offense for camel case in instance variable name + registers an offense for keyword rest arguments + registers an offense for block arguments + when AllowedIdentifiers is set + does not register an offense for a method name that is allowed + does not register an offense for a symbol that is allowed + does not register an offense for a global variable name that is allowed + does not register an offense for a class variable name that is allowed + does not register an offense for a local variable name that is allowed + does not register an offense for a instance variable name that is allowed + when AllowedPatterns is set + does not register an offense for a method name that matches the allowed pattern + does not register an offense for a symbol that matches the allowed pattern + does not register an offense for a class variable name that matches the allowed pattern + does not register an offense for a global variable name that matches the allowed pattern + does not register an offense for a instance variable name that matches the allowed pattern + does not register an offense for a local variable name that matches the allowed pattern -RuboCop::Cop::Style::HashConversion - reports different offense for hash argument Hash[] as a method argument with parentheses - reports an offense for single-argument Hash[] - reports different offense for Hash[(a || b)] - reports different offense for Hash[(a && b)] - reports different offense for Hash[a && b] - does not try to correct multi-argument Hash with odd number of arguments - reports different offense for empty Hash[] - registers and corrects an offense when using `zip` with argument in `Hash[]` - registers and corrects an offense when using argumentless `zip` without parentheses in `Hash[]` - reports different offense for hash argument Hash[] as a method argument without parentheses - reports different offense for hash argument Hash[] - reports different offense for Hash[a || b] - wraps complex statements in parens if needed - reports different offense for multi-argument Hash[] - registers and corrects an offense when using multi-argument `Hash[]` as a method argument - registers and corrects an offense when using argumentless `zip` with parentheses in `Hash[]` - AllowSplatArgument: false - reports uncorrectable offense for unpacked array - AllowSplatArgument: true - does not register an offense for unpacked array +RuboCop::Cop::Layout::HashAlignment + register no offense for superclass call without args + accepts single line hash + accepts pairs that don't start a line + accepts several pairs per line + register no offense for yield without args + always inspect last argument hash + registers an offense and corrects misaligned keys in implicit hash for yield + registers an offense and corrects misaligned keys in explicit hash for yield + registers an offense and corrects misaligned keys in explicit hash for super + registers an offense and corrects misaligned keys in implicit hash for super + registers offense and corrects misaligned keys in implicit hash + registers offense and corrects misaligned keys in explicit hash + when using hash value omission + registers offense and corrects misaligned keys in explicit hash + registers offense and corrects misaligned keys in implicit hash + always ignore last argument hash + accepts misaligned keys in implicit hash + accepts misaligned keys in explicit hash + accepts misaligned keys in implicit hash for yield + accepts misaligned keys in explicit hash for yield + accepts misaligned keys in implicit hash for super + accepts misaligned keys in explicit hash for super + with invalid configuration + fails + with default configuration + registers an offense and corrects alignment when using double splat in an explicit hash + registers an offense and corrects misaligned mixed multiline hash keys + registers an offense and corrects mixed hash styles + does not register an offense when value starts on next line + registers an offense and corrects separator alignment + registers an offense and corrects alignment when using double splat in braces + registers an offense and corrects table alignment + registers an offense and corrects zero or multiple spaces + registers an offense and corrects misaligned hash keys + accepts left-aligned hash keys with single spaces + registers an offense and corrects multiline value starts in wrong place + with implicit hash as last argument + registers an offense and corrects misaligned hash keys + registers an offense and corrects right alignment of keys + accepts an empty hash + accepts aligned hash keys + with table alignment configuration + accepts pairs that don't start a line + accepts an empty hash + accepts single line hash + registers an offense and corrects misaligned hash rockets + registers an offense for misaligned hash values + accepts a keyword splat only hash + accepts aligned hash keys and values + accepts a symbol only hash followed by a keyword splat + registers an offense and corrects for misaligned hash keys + accepts several pairs per line + accepts a multiline array of single line hashes + accepts hashes that use different separators + accepts hashes that use different separators and double splats + when using hash value omission + accepts single line hash + accepts pairs that don't start a line + accepts several pairs per line + when using hash value omission + accepts aligned hash keys and values + with `EnforcedColonStyle`: `table` + and aligned keys but a double splat argument after + does not register an offense on the `kwsplat` + and a misaligned double splat argument + registers an offense and corrects + and misaligned keys + registers an offense and corrects + when using hash value omission + and aligned keys + does not register an offense and corrects + when the only item is a kwsplat + does not register an offense + and a double splat argument after a hash key + registers an offense on the misaligned key and corrects + with table+separator alignment configuration + accepts a single method argument entry with colon + when using hash value omission + accepts pairs that don't start a line + accepts several pairs per line + accepts single line hash + ignore implicit last argument hash + accepts misaligned keys in implicit hash for super + registers an offense and corrects misaligned keys in explicit hash + registers an offense and corrects misaligned keys in explicit hash for super + accepts misaligned keys in implicit hash for yield + accepts misaligned keys in implicit hash + registers an offense and corrects misaligned keys in explicit hash for yield + with `EnforcedHashRocketStyle`: `table` + and a misaligned double splat argument + registers an offense and corrects + and aligned keys but a double splat argument after + does not register an offense on the `kwsplat` + and a double splat argument after a hash key + registers an offense on the misaligned key and corrects + and misaligned keys + registers an offense and corrects + when the only item is a kwsplat + does not register an offense + when `EnforcedStyle: with_fixed_indentation` of `ArgumentAlignment` + does not register an offense for an empty hash literal + registers and corrects an offense when using misaligned keyword arguments + register and corrects an offense + does not register an offense using aligned hash literal + does not register an offense using aligned hash argument for `proc.()` + when using hash value omission + register and corrects an offense + does not register and corrects an offense when using aligned keyword arguments + with multiple preferred(key and table) alignment configuration + registers an offense and corrects misaligned hash keys with mixed hash style + accepts an empty hash + accepts aligned hash keys, by keys + registers an offense and corrects misaligned hash values + accepts aligned hash keys with mixed hash style + accepts aligned hash keys, by table + registers an offense and corrects misaligned hash values, prefer key when least offenses + registers an offense and corrects misaligned hash values, prefer table when least offenses + registers an offense and corrects misaligned hash values, works separate for each hash + accepts aligned hash keys, by both + table and key config + registers an offense and corrects misaligned hash values, prefer table because it is specified first + with different settings for => and : + registers offenses and correct misaligned entries + accepts aligned entries + with separator alignment configuration + registers an offense and corrects misaligned hash rockets + doesn't break code by moving long keys too far left + accepts an empty hash + accepts aligned hash keys + accepts single line hash + accepts several pairs per line + accepts hashes with different separators + registers an offense and corrects mixed indentation and spacing + accepts pairs that don't start a line + registers an offense and corrects misaligned hash values + when using hash value omission + accepts single line hash + accepts several pairs per line + accepts pairs that don't start a line + when using hash value omission + accepts aligned hash keys + registers an offense and corrects mixed indentation and spacing + ignore explicit last argument hash + accepts misaligned keys in explicit hash for super + accepts misaligned keys in explicit hash for yield + registers an offense and corrects misaligned keys in implicit hash + accepts misaligned keys in explicit hash + registers an offense and corrects misaligned keys in implicit hash for yield + registers an offense and corrects misaligned keys in implicit hash for super + when using hash value omission + accepts misaligned keys in explicit hash + registers an offense and corrects misaligned keys in implicit hash -RuboCop::Cop::Lint::TopLevelReturnWithArgument - Code segment containing semi-colon separated statements - expects no offense from the return with arguments and multi-line code - expects an offense from the return with arguments and multi-line code - Code segment with only top-level return statement - expects no offense from the return without arguments - expects offense from the return with arguments - expects multiple offenses from the return with arguments statements - Code segment with method-level return statements - expects offense when method-level & top-level return co-exist - Code segment with block level returns other than the top-level return - expects no offense from the return without arguments - expects offense from the return with arguments - Code segment with inline if along with top-level return - expects no offense from the return without arguments - expects multiple offense from the return with arguments +RuboCop::PathUtil + #relative_path + supports custom base paths + builds paths relative to PWD by default as a stop-gap + #match_path? + matches dir/** for hidden file + does not match invalid UTF-8 paths + does not match file in a subdirectory + matches strings to the full path + matches glob expressions + does not match dir/** for file in hidden dir + matches regexps + #absolute? + returns a falsey value for a path beginning with a directory name + returns a truthy value for a path beginning with slash -RuboCop::Cop::Style::MethodCallWithArgsParentheses - allowing parens in string interpolation - accepts parens for camel-case method names - when EnforcedStyle is require_parentheses (default) - register an offense for superclass call without parens - autocorrects parenthesized args for local methods by removing space - accepts parens in method call with args - accepts parens in method call with do-end blocks - autocorrects calls where the argument node is a number - autocorrects calls with multiple args by adding needed braces - accepts no parens in method call without args - accepts no parens for operators - autocorrects calls where the argument node is a constant - autocorrects calls where arg is method call - autocorrects partially parenthesized args by adding needed braces - autocorrects calls where multiple args are method calls - accepts no parens for unary operators - register an offense for method call without parens - autocorrects call with multiple args by adding braces - register no offense for superclass call with parens - register no offense for superclass call without args - autocorrects fully parenthesized args by removing space - register an offense for yield without parens - accepts no parens for setter methods - register an offense for methods starting with capital without parens - register an offense for non-receiver method call without parens - register no offense for yield without args - when inspecting macro methods - in a module body - does not register an offense - in a class body - does not register an offense - when using safe navigation operator - register an offense for method call without parens - with AllowedMethods - allow method listed in AllowedMethods - AllowedPatterns - ignored methods listed in AllowedPatterns - behaves like endless methods - endless methods - with arguments - requires method calls to have parens - without arguments - does not register an offense for `defs` when there are parens - does not register an offense when there are parens - does not register an offense when there are no parens - does not register an offense when there are arguments - does not register an offense for `defs` when there are arguments - when EnforcedStyle is omit_parentheses - accepts parens in chaining with operators - accepts no parens in method call without args - register an offense for parens in do-end blocks - accepts parens in camel case method without args - accepts parens in blocks with braces - accepts parens in splat calls - autocorrects single-line calls - autocorrects complex multi-line calls - accepts parens in block passing calls - register an offense for parens in string interpolation - accepts parens in ternary condition calls - accepts parens in args splat - accepts parens in default keyword argument value calls - accepts parens in argument calls with braced blocks - register an offense in multi-line inheritance - autocorrects multi-line calls with trailing whitespace - accepts special lambda call syntax - accepts parens in super method calls as arguments - accepts parens in yield argument method calls - accepts parens in single-line inheritance - accepts parens in calls with hash as arg - register an offense for multi-line method calls - register an offense for %r regex literal as arguments - accepts parens in nested method args - accepts parens in default argument value calls - accepts parens in implicit #to_proc - accepts parens in chaining with safe operators - accepts parens in calls with args with logical operators - accepts parens in super without args - accepts parens in calls with logical operators - accepts parens in slash regexp literal as argument - register an offense for parens in method call without args - accepts parens in assignment in conditions - register an offense for camel-case methods with arguments - accepts parens in chained method calls - register an offense in assignments - accepts parens in literals with unary operators as first argument - accepts parens in range literals - accepts parens in method args - accepts no parens in method call with args - accepts parens in args with ternary conditions - accepts parens in operator method calls - register an offense for parens in the last chain - register an offense in complex conditionals - register an offense for yield call with parens - accepts parens in super calls with braced blocks - register an offense for hashes in keyword values - register an offense for superclass call with parens - allowing parenthesis in chaining - register offense for multi-line chaining without previous parens - accepts no parens in the last call if previous calls with parens - register offense for single-line chaining without previous parens - accepts parens in the last call if any previous calls with parentheses - forwarded arguments in 3.0 - accepts parens for forwarded arguments - allowing parens in camel-case methods - accepts parens for camel-case method names - behaves like endless methods - endless methods - without arguments - does not register an offense for `defs` when there are arguments - registers an offense for `defs` when there are parens - registers an offense when there are parens - does not register an offense when there are arguments - does not register an offense when there are no parens - with arguments - requires method calls to have parens - forwarded arguments in 2.7 - accepts parens for forwarded arguments - numbered parameters in 2.7 - accepts parens for braced numeric block calls - hash value omission in 3.1 - registers an offense using assignment with parentheses call expr follows - registers an offense when last argument is a hash value omission - registers and corrects an offense when explicit hash value with parentheses and using modifier form - registers an offense when with parentheses call expr follows - does not register an offense when hash value omission with parentheses and using modifier form - does not register an offense when without parentheses call expr follows - allowing parens in multi-line calls - accepts parens for multi-line calls - when inspecting macro methods with IncludedMacros - for a macro in both IncludedMacros and AllowedMethods - allows - in a class body - finds offense - in a module body - finds offense - behaves like endless methods - endless methods - with arguments - requires method calls to have parens - without arguments - does not register an offense when there are no parens - does not register an offense for `defs` when there are parens - does not register an offense when there are arguments - does not register an offense when there are parens - does not register an offense for `defs` when there are arguments - for a macro not on the included list - allows +RuboCop::Cop::Style::NegatedIfElseCondition + registers an offense and corrects a multiline ternary + works with comments and multiple statements + does not register an offense when `if` with `!!` condition + registers an offense and corrects when negating condition with `!` for `if-else` + works with duplicate nodes + registers an offense when using negated condition and `if` branch body is empty + does not register an offense when the `else` branch is empty + does not register an offense when negating condition for `if-elsif` + does not register an offense when only part of the condition is negated + works with comments when neither branch is a begin node + registers an offense and corrects when negating condition with `not` for ternary + works with comments when one branch is a begin and the other is not + registers an offense and corrects when negating condition with `not` for `if-else` + does not register an offense when `if` with negated condition has no `else` branch + does not register an offense when both branches are empty + moves comments to correct branches during autocorrect + registers an offense and corrects nested `if-else` with negated condition + correctly moves comments at the end of branches + behaves like negation method + registers an offense and corrects when negating condition with `!~` in parentheses for `if-else` + registers an offense and corrects when negating condition with `!~` in parentheses for ternary + registers an offense and corrects when negating condition with `!~` for ternary + registers an offense and corrects when negating condition with `!~` in begin-end for ternary + registers an offense and corrects when negating condition with `!~` for `if-else` + registers an offense and corrects when negating condition with `!~` in begin-end for `if-else` + behaves like negation method + registers an offense and corrects when negating condition with `!=` for ternary + registers an offense and corrects when negating condition with `!=` in parentheses for `if-else` + registers an offense and corrects when negating condition with `!=` in parentheses for ternary + registers an offense and corrects when negating condition with `!=` in begin-end for `if-else` + registers an offense and corrects when negating condition with `!=` for `if-else` + registers an offense and corrects when negating condition with `!=` in begin-end for ternary -RuboCop::Cop::RangeHelp - source indicated by #range_by_whole_lines - with end of one line - without include_final_newline - is expected to eq "puts 'example'" - with include_final_newline - is expected to eq "puts 'example'\n" - with parts of two lines - with include_final_newline - is expected to eq "puts 'example'\nputs 'another example'\n" - without include_final_newline - is expected to eq "puts 'example'\nputs 'another example'" - when source doesn't end with a newline - with include_final_newline - is expected to eq "newline_at_end" - is expected to eq 30 - without include_final_newline - is expected to eq "newline_at_end" - with parts of four lines - without include_final_newline - is expected to eq "puts 'example'\nputs 'another example'\n\nsomething_else" - with include_final_newline - is expected to eq "puts 'example'\nputs 'another example'\n\nsomething_else\n" - with a whole line except newline selected - without include_final_newline - is expected to eq "puts 'example'" - with include_final_newline - is expected to eq "puts 'example'\n" - when part of a single line is selected - without include_final_newline - is expected to eq "puts 'example'" - with include_final_newline - is expected to eq "puts 'example'\n" - with a whole line plus beginning of next line - without include_final_newline - is expected to eq "puts 'example'\nputs 'another example'" - with include_final_newline - is expected to eq "puts 'example'\nputs 'another example'\n" - with beginning of one line - with include_final_newline - is expected to eq "puts 'another example'\n" - without include_final_newline - is expected to eq "puts 'another example'" - source indicated by #range_with_surrounding_space - when passing range as a positional argument - behaves like works with various `side`s - when side is :left - is expected to eq " a(2)" - when side is :right - is expected to eq "a(2) " - when side is :both - is expected to eq " a(2) " - when passing range as a kwarg - behaves like works with various `side`s - when side is :right - is expected to eq "a(2) " - when side is :left - is expected to eq " a(2)" - when side is :both - is expected to eq " a(2) " - source indicated by #range_with_surrounding_comma - when side is :both - is expected to eq ",Error," - when side is :right - is expected to eq "Error," - when side is :left - is expected to eq ",Error" - #range_with_comments_and_lines - returns a range that includes related comments and whole lines +RuboCop::Formatter::SimpleTextFormatter + #report_summary + when a offense detected + handles pluralization correctly + when 2 offenses detected and 2 offenses autocorrectable + handles pluralization correctly + when a file inspected and no offenses detected + handles pluralization correctly + when a offense detected and a offense autocorrectable + handles pluralization correctly + when no files inspected + handles pluralization correctly + when an offense is corrected + prints about correction + when 2 offenses are corrected and 2 offenses autocorrectable + handles pluralization correctly + when 2 offenses detected + handles pluralization correctly + when 2 offenses are corrected + handles pluralization correctly + #report_file + behaves like report for severity + when the offense is not corrected + prints message as-is + when the offense is correctable + prints message as-is + the file is under the current working directory + prints as relative path + when the offense is marked as todo + prints [Todo] along with message + when the offense is automatically corrected + prints [Corrected] along with message + the file is outside of the current working directory + prints as absolute path + behaves like report for severity + when the offense is correctable + prints message as-is + the file is under the current working directory + prints as relative path + when the offense is marked as todo + prints [Todo] along with message + the file is outside of the current working directory + prints as absolute path + when the offense is not corrected + prints message as-is + when the offense is automatically corrected + prints [Corrected] along with message + behaves like report for severity + when the offense is correctable + prints message as-is + when the offense is automatically corrected + prints [Corrected] along with message + when the offense is marked as todo + prints [Todo] along with message + the file is under the current working directory + prints as relative path + when the offense is not corrected + prints message as-is + the file is outside of the current working directory + prints as absolute path + behaves like report for severity + the file is outside of the current working directory + prints as absolute path + when the offense is marked as todo + prints [Todo] along with message + when the offense is automatically corrected + prints [Corrected] along with message + when the offense is not corrected + prints message as-is + the file is under the current working directory + prints as relative path + when the offense is correctable + prints message as-is + behaves like report for severity + the file is under the current working directory + prints as relative path + when the offense is not corrected + prints message as-is + when the offense is correctable + prints message as-is + when the offense is marked as todo + prints [Todo] along with message + the file is outside of the current working directory + prints as absolute path + when the offense is automatically corrected + prints [Corrected] along with message + behaves like report for severity + the file is outside of the current working directory + prints as absolute path + the file is under the current working directory + prints as relative path + when the offense is automatically corrected + prints [Corrected] along with message + when the offense is marked as todo + prints [Todo] along with message + when the offense is correctable + prints message as-is + when the offense is not corrected + prints message as-is -RuboCop::Cop::Lint::SafeNavigationConsistency - allows || without safe navigation - registers an offense and corrects assignment - registers an offense and corrects when there is code before or after the condition - registers and corrects multiple offenses - registers an offense and corrects using safe navigation in conditions on the right hand side - registers an offense and corrects using safe navigation on the right of && - registers an offense and corrects using unsafe navigation and the safe navigation appears in a group - allows calls to methods that nil responds to - registers an offense and corrects using safe navigation on the right of || - registers an offense and corrects unsafe navigation that appears before safe navigation - allows safe navigation when different variables are used - registers an offense and corrects using safe navigation on the left of && - registers an offense and corrects using unsafe navigation with grouped conditions - allows && without safe navigation - registers an offense but does not correct non dot method calls - registers an offense and corrects using unsafe navigation with both && and || - registers a single offense and corrects when safe navigation is used multiple times - registers an offense and corrects using safe navigation on the left of || - registers an offense and corrects using safe navigation inside of separated conditions +RuboCop::Cop::Style::HashLikeCase + MinBranchesCount: 2 + does not register an offense when using `case-when` with literals of different types as conditions + does not register an offense when using `case-when` with literal bodies of different types + does not register an offense when using `case-when` with non-literal bodies + registers an offense when using `case-when` with symbol conditions and literal bodies of the same type + does not register an offense when using `case-when` with non-literals in conditions + does not register an offense when `case` has an `else` branch + registers an offense when using `case-when` with string conditions and literal bodies of the same type + MinBranchesCount: 3 + does not register an offense when branches count is less than required -RuboCop::Cop::Layout::SpaceInsidePercentLiteralDelimiters - accepts execute-string literals - accepts other percent literals - for W type and ["{", "}"] delimiters - accepts spaces between entries - accepts literals without additional spaces - registers an offense for unnecessary spaces +RuboCop::Cop::InternalAffairs::RedundantDescribedClassAsSubject + does not register an offense when using `subject(:cop)` with multiple arguments to `described_class.new` + registers an offense when using `subject(:cop)` and `:config` is already specified in `describe` + registers an offense when using `subject(:cop)` and `:config` is not specified in `describe` + registers an offense when using `subject(:cop)` with no argument `described_class.new` and `:config` is specified + +RuboCop::Cop::Layout::EmptyComment + does not register an offense when using comment text with leading and trailing blank lines + registers an offense and corrects an empty comment without space next to code + register offenses and correct multiple aligned empty comments next to code + registers an offense and corrects using multiline empty comments + registers an offense and corrects using an empty comment next to code + does not register an offense when using comment text + registers an offense and corrects using single line empty comment + register offenses and correct multiple empty comments next to code + allow margin comment (default) + does not register an offense when using margin comment + disallow margin comment + registers an offense and corrects using margin comment + allow border comment (default) + does not register an offense when using border comment + disallow border comment + registers an offense and corrects using single line empty comment + registers an offense and corrects using border comment + +RuboCop::Cop::Lint::InterpolationCheck + registers an offense and corrects for interpolation in single quoted string + does not register an offense for properly interpolation strings + does not register an offense for interpolation in nested strings + does not register an offense for interpolation in a regexp + does not register offense for strings in %w() + registers an offense for interpolation in single quoted split string + does not crash for \xff + does not register an offense for an escaped interpolation + registers an offense for interpolation in double + single quoted split string + does not register an offense for escaped crab claws in dstr + registers an offense and corrects when including interpolation and double quoted string in single quoted string + +RuboCop::Cop::Style::HashTransformValues + when using Ruby 2.6 or newer + does not flag `_.to_h{...}` when its receiver is `each_with_index` + flags _.to_h{...} when transform_values could be used + does not flag `_.to_h{...}` when its receiver is `zip` + does not flag `_.to_h{...}` when its receiver is an array literal + register and corrects an offense _.to_h{...} when value is a hash literal and is not enclosed in braces + does not flag `_.to_h{...}` when both key & value are transformed + does not flag `_.to_h{...}` when its receiver is `with_index` + register and corrects an offense _.to_h{...} when value is a hash literal and is enclosed in braces + does not flag _.to_h {...} when value block argument is unused + when using Ruby 2.4 or newer + flags _.map {...}.to_h when transform_values could be used + correctly autocorrects _.map{...}.to_h with block + does not flag each_with_object when both key & value are transformed + does not flag each_with_object when value transformation uses key + does not flag `_.map{...}.to_h` when its receiver is `each_with_index` + does not flag `_.map{...}.to_h` when its receiver is `with_index` + does not flag `each_with_object` when its receiver is `each_with_index` + does not flag value transformation when receiver is array literal + does not flag `Hash[_.map{...}]` when its receiver is `zip` + does not flag `Hash[_.map{...}]` when its receiver is `each_with_index` + does not flag `_.map{...}.to_h` when its receiver is `zip` + does not flag `Hash[_.map{...}]` when its receiver is an array literal + does not flag _.map {...}.to_h when value block argument is unused + flags _.map {...}.to_h when transform_values could be used when line break before `to_h` + does not flag `each_with_object` when its receiver is `zip` + does not flag `each_with_object` when its receiver is `with_index` + does not flag value transformation in the absence of to_h + does not flag _.map{...}.to_h when both key & value are transformed + does not flag Hash[_.map{...}] when both key & value are transformed + does not flag `Hash[_.map{...}]` when its receiver is `with_index` + flags _.map {...}.to_h when transform_values could be used when wrapped in another block + does not flag each_with_object when its argument is not modified + does not flag each_with_object when receiver is array literal + flags Hash[_.map{...}] when transform_values could be used + does not flag each_with_object when no transformation occurs + does not flag `each_with_object` when its argument is used in the value + with inline block + flags each_with_object when transform_values could be used + with multiline block + flags each_with_object when transform_values could be used + with safe navigation operator + flags each_with_object when transform_values could be used + below Ruby 2.6 + does not flag _.to_h{...} + below Ruby 2.4 + does not flag even if transform_values could be used + +RuboCop::Cop::Style::TrailingBodyOnClass + registers offense with multi-line class + registers an offense when body trails after class definition + autocorrects with comment after body + accepts class inheritance + accepts regular class + when class is not on first line of processed_source + autocorrect offense + +RuboCop::Cop::Style::SingleLineBlockParams + allows an unused parameter to have a leading underscore + does not report if no block arguments are present + finds wrong argument names in calls with different syntax + finds incorrectly named parameters with leading underscores + reports an offense if the arguments names are wrong and not all arguments are given + ignores :reduce symbols + ignores do..end blocks + does not report when destructuring is used + allows calls with proper argument names + reports an offense if the names are in reverse order + does not report if the right names are used but not all arguments are given + reports an offense if the names are partially correct + +RuboCop::Cop::Layout::SpaceInsideArrayPercentLiteral + accepts non array percent literals + for w type and ["!", "!"] delimiters accepts multi-line literals - registers an offense for spaces before final delimiter - registers an offense for literals with escaped and other spaces - accepts newlines and additional following alignment spaces - registers an offense for spaces after first delimiter - accepts multi-line literals within a method - accepts literals with escaped spaces - with space in blank percent literals - registers and corrects an offense - with newline in blank percent literals - registers and corrects an offense - with spaces in blank percent literals - registers and corrects an offense - for W type and ["[", "]"] delimiters - registers an offense for literals with escaped and other spaces - accepts literals without additional spaces - accepts spaces between entries - accepts literals with escaped spaces registers an offense for unnecessary spaces - accepts newlines and additional following alignment spaces - registers an offense for spaces before final delimiter accepts multi-line literals within a method - registers an offense for spaces after first delimiter - accepts multi-line literals - with newline in blank percent literals - registers and corrects an offense - with spaces in blank percent literals - registers and corrects an offense - with space in blank percent literals - registers and corrects an offense - for x type and ["(", ")"] delimiters accepts newlines and additional following alignment spaces - registers an offense for spaces before final delimiter - registers an offense for spaces after first delimiter - accepts multi-line literals within a method - registers an offense for unnecessary spaces - accepts multi-line literals - registers an offense for literals with escaped and other spaces + accepts literals with escaped and additional spaces accepts literals without additional spaces accepts literals with escaped spaces - accepts spaces between entries - with newline in blank percent literals - registers and corrects an offense - with spaces in blank percent literals - registers and corrects an offense - with space in blank percent literals - registers and corrects an offense + registers an offense for multiple spaces between items for i type and ["(", ")"] delimiters + accepts literals with escaped spaces accepts multi-line literals within a method + registers an offense for unnecessary spaces accepts literals without additional spaces - registers an offense for literals with escaped and other spaces - registers an offense for spaces after first delimiter + registers an offense for multiple spaces between items accepts newlines and additional following alignment spaces - registers an offense for spaces before final delimiter + accepts literals with escaped and additional spaces + accepts multi-line literals + for w type and ["{", "}"] delimiters registers an offense for unnecessary spaces - accepts spaces between entries + registers an offense for multiple spaces between items accepts literals with escaped spaces accepts multi-line literals - with spaces in blank percent literals - registers and corrects an offense - with space in blank percent literals - registers and corrects an offense - with newline in blank percent literals - registers and corrects an offense - for w type and ["(", ")"] delimiters - registers an offense for unnecessary spaces - registers an offense for literals with escaped and other spaces + accepts literals without additional spaces + accepts literals with escaped and additional spaces + accepts multi-line literals within a method + accepts newlines and additional following alignment spaces + for W type and ["!", "!"] delimiters accepts newlines and additional following alignment spaces accepts literals without additional spaces - registers an offense for spaces before final delimiter - registers an offense for spaces after first delimiter + registers an offense for unnecessary spaces + registers an offense for multiple spaces between items accepts literals with escaped spaces - accepts multi-line literals within a method - accepts spaces between entries accepts multi-line literals - with space in blank percent literals - registers and corrects an offense - with newline in blank percent literals - registers and corrects an offense - with spaces in blank percent literals - registers and corrects an offense - for I type and ["[", "]"] delimiters - registers an offense for literals with escaped and other spaces + accepts literals with escaped and additional spaces + accepts multi-line literals within a method + for I type and ["{", "}"] delimiters + accepts multi-line literals within a method accepts newlines and additional following alignment spaces + registers an offense for multiple spaces between items accepts literals with escaped spaces - accepts spaces between entries - registers an offense for unnecessary spaces accepts multi-line literals - accepts literals without additional spaces - registers an offense for spaces before final delimiter - accepts multi-line literals within a method - registers an offense for spaces after first delimiter - with spaces in blank percent literals - registers and corrects an offense - with newline in blank percent literals - registers and corrects an offense - with space in blank percent literals - registers and corrects an offense - for x type and ["[", "]"] delimiters registers an offense for unnecessary spaces - registers an offense for spaces before final delimiter - accepts spaces between entries - accepts newlines and additional following alignment spaces + accepts literals with escaped and additional spaces accepts literals without additional spaces + for I type and ["[", "]"] delimiters + accepts literals without additional spaces + accepts multi-line literals + accepts literals with escaped and additional spaces accepts multi-line literals within a method - registers an offense for literals with escaped and other spaces - registers an offense for spaces after first delimiter + registers an offense for multiple spaces between items accepts literals with escaped spaces - accepts multi-line literals - with space in blank percent literals - registers and corrects an offense - with newline in blank percent literals - registers and corrects an offense - with spaces in blank percent literals - registers and corrects an offense - for x type and ["{", "}"] delimiters + registers an offense for unnecessary spaces + accepts newlines and additional following alignment spaces + for i type and ["{", "}"] delimiters + registers an offense for unnecessary spaces + accepts literals with escaped and additional spaces + registers an offense for multiple spaces between items accepts literals with escaped spaces - accepts multi-line literals accepts literals without additional spaces accepts multi-line literals within a method - registers an offense for spaces after first delimiter - registers an offense for literals with escaped and other spaces + accepts multi-line literals accepts newlines and additional following alignment spaces - registers an offense for unnecessary spaces - registers an offense for spaces before final delimiter - accepts spaces between entries - with space in blank percent literals - registers and corrects an offense - with spaces in blank percent literals - registers and corrects an offense - with newline in blank percent literals - registers and corrects an offense - for W type and ["(", ")"] delimiters + for I type and ["!", "!"] delimiters accepts multi-line literals - registers an offense for literals with escaped and other spaces accepts literals without additional spaces - accepts multi-line literals within a method - registers an offense for spaces after first delimiter - registers an offense for unnecessary spaces + accepts literals with escaped and additional spaces accepts literals with escaped spaces + registers an offense for multiple spaces between items + registers an offense for unnecessary spaces accepts newlines and additional following alignment spaces - accepts spaces between entries - registers an offense for spaces before final delimiter - with spaces in blank percent literals - registers and corrects an offense - with newline in blank percent literals - registers and corrects an offense - with space in blank percent literals - registers and corrects an offense - for I type and ["{", "}"] delimiters - accepts spaces between entries + accepts multi-line literals within a method + for W type and ["(", ")"] delimiters accepts literals without additional spaces accepts literals with escaped spaces - registers an offense for spaces before final delimiter - registers an offense for spaces after first delimiter registers an offense for unnecessary spaces + accepts literals with escaped and additional spaces + registers an offense for multiple spaces between items accepts multi-line literals within a method + accepts newlines and additional following alignment spaces accepts multi-line literals - registers an offense for literals with escaped and other spaces + for w type and ["(", ")"] delimiters accepts newlines and additional following alignment spaces - with newline in blank percent literals - registers and corrects an offense - with spaces in blank percent literals - registers and corrects an offense - with space in blank percent literals - registers and corrects an offense - for i type and ["!", "!"] delimiters - registers an offense for spaces after first delimiter - registers an offense for literals with escaped and other spaces - accepts literals with escaped spaces + accepts literals with escaped and additional spaces + accepts literals without additional spaces + registers an offense for unnecessary spaces accepts multi-line literals + accepts literals with escaped spaces + registers an offense for multiple spaces between items accepts multi-line literals within a method - registers an offense for spaces before final delimiter - accepts spaces between entries + for W type and ["{", "}"] delimiters + registers an offense for unnecessary spaces + registers an offense for multiple spaces between items + accepts newlines and additional following alignment spaces + accepts literals without additional spaces + accepts multi-line literals within a method + accepts literals with escaped spaces + accepts multi-line literals + accepts literals with escaped and additional spaces + for I type and ["(", ")"] delimiters + accepts literals without additional spaces + accepts multi-line literals within a method + accepts literals with escaped and additional spaces + registers an offense for unnecessary spaces + accepts newlines and additional following alignment spaces + registers an offense for multiple spaces between items + accepts multi-line literals + accepts literals with escaped spaces + for i type and ["[", "]"] delimiters + registers an offense for multiple spaces between items + accepts multi-line literals + registers an offense for unnecessary spaces + accepts newlines and additional following alignment spaces + accepts literals with escaped and additional spaces + accepts literals with escaped spaces + accepts multi-line literals within a method + accepts literals without additional spaces + for w type and ["[", "]"] delimiters + accepts newlines and additional following alignment spaces + registers an offense for unnecessary spaces + registers an offense for multiple spaces between items + accepts literals without additional spaces + accepts literals with escaped and additional spaces + accepts multi-line literals within a method + accepts multi-line literals + accepts literals with escaped spaces + for W type and ["[", "]"] delimiters + accepts literals with escaped spaces + registers an offense for unnecessary spaces + accepts literals without additional spaces + registers an offense for multiple spaces between items + accepts multi-line literals within a method + accepts multi-line literals + accepts newlines and additional following alignment spaces + accepts literals with escaped and additional spaces + for i type and ["!", "!"] delimiters + accepts literals with escaped and additional spaces + accepts literals without additional spaces + accepts literals with escaped spaces + accepts multi-line literals within a method + accepts multi-line literals + registers an offense for unnecessary spaces + accepts newlines and additional following alignment spaces + registers an offense for multiple spaces between items + +RuboCop::Cop::Style::OneLineConditional + when AlwaysCorrectToMultiline is true + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + does not register an offense for unless/then/else/end with empty else + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct for if-then-elsif-then-else-end + registers and corrects an offense with multi-line construct for unless/then/else/end + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end that contains method calls with parenthesized arguments + does not register an offense for if/then/else/end with empty else + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end that contains unparenthesized operator method calls + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct when one of the branches of if/then/else/end contains `next` keyword + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct for if/then/else/end when `then` without body + registers and corrects an offense with multi-line construct for if/then/else/end + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end that contains method calls with unparenthesized arguments + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct for if-then-elsif-then-elsif-then-else-end + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + does not register an offense for if/then/end + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct without adding parentheses when if/then/else/end is preceded by an operator + does not register an offense for unless/then/end + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `not a` constructs inside inner branches + behaves like if/then/else/end with keyword + registers and corrects an offense with multi-line construct when one of the branches of if/then/else/end contains `break` keyword + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `super b` constructs inside inner branches + when IndentationWidth differs from default + registers and corrects an offense with multi-line construct for if/then/else/end + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `yield a` constructs inside inner branches + behaves like if/then/else/end with keyword + registers and corrects an offense with multi-line construct when one of the branches of if/then/else/end contains `self` keyword + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `puts 1` constructs inside inner branches + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `a and b` constructs inside inner branches + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `defined? :A` constructs inside inner branches + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `a ? b : c` constructs inside inner branches + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `a = b` constructs inside inner branches + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with multi-line construct without adding parentheses for if/then/else/end with `a or b` constructs inside inner branches + behaves like if/then/else/end with keyword + registers and corrects an offense with multi-line construct when one of the branches of if/then/else/end contains `raise` keyword + behaves like if/then/else/end with keyword + registers and corrects an offense with multi-line construct when one of the branches of if/then/else/end contains `retry` keyword + when AlwaysCorrectToMultiline is false + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator for if/then/else/end + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct for if-then-elsif-then-else-end + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator and adding parentheses for if/then/else/end that contains method calls with unparenthesized arguments + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator for if/then/else/end when `then` without body + does not register an offense for if/then/else/end with empty else + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + does not register an offense for unless/then/end + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator for unless/then/else/end + registers and corrects an offense with multi-line construct for if-then-elsif-then-end + registers and corrects an offense with ternary operator without adding parentheses for if/then/else/end that contains method calls with parenthesized arguments + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + does not register an offense for if/then/end + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator when one of the branches of if/then/else/end contains `next` keyword + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator without adding parentheses for if/then/else/end that contains unparenthesized operator method calls + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + does not register an offense for unless/then/else/end with empty else + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + registers and corrects an offense with multi-line construct for if-then-elsif-then-elsif-then-else-end + registers and corrects an offense with ternary operator and adding parentheses when if/then/else/end is preceded by an operator + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `a or b` constructs inside inner branches + behaves like if/then/else/end with keyword + registers and corrects an offense with ternary operator when one of the branches of if/then/else/end contains `self` keyword + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `not a` constructs inside inner branches + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `yield a` constructs inside inner branches + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `puts 1` constructs inside inner branches + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `a ? b : c` constructs inside inner branches + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `a and b` constructs inside inner branches + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `a = b` constructs inside inner branches + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `super b` constructs inside inner branches + behaves like if/then/else/end with keyword + registers and corrects an offense with ternary operator when one of the branches of if/then/else/end contains `retry` keyword + behaves like if/then/else/end with constructs changing precedence + registers and corrects an offense with ternary operator and adding parentheses inside for if/then/else/end with `defined? :A` constructs inside inner branches + behaves like if/then/else/end with keyword + registers and corrects an offense with ternary operator when one of the branches of if/then/else/end contains `break` keyword + behaves like if/then/else/end with keyword + registers and corrects an offense with ternary operator when one of the branches of if/then/else/end contains `raise` keyword + +RuboCop::Cop::Lint::RedundantCopEnableDirective + registers an offense and corrects when the first cop is unnecessarily enabled + registers offense and corrects unnecessary enable + registers correct offense when combined with necessary enable, no white-space after comma + registers offense and corrects redundant enabling of same cop + registers correct offense when combined with necessary enable + registers multiple offenses and corrects the same comment + when all department enabled + registers an offense and corrects when the first department is unnecessarily enabled + registers offense and corrects redundant enabling of same department + registers offense and corrects redundant enabling of department of same cop + registers correct offense when combined with necessary enable + registers multiple offenses and corrects the same comment + registers offense and corrects unnecessary enable + registers offense and corrects redundant enabling of cop of same department + when last cop is unnecessarily enabled + registers an offense and corrects when there is no space between the cops and the comma + registers an offense and corrects + when middle cop is unnecessarily enabled + registers an offense and corrects when there is extra white space + registers an offense and corrects + when all cops are unnecessarily enabled + on separate lines + registers an offense and corrects when there is extra white space + on the same line + registers an offense and corrects + when cop is disabled in the configuration + registers no offense when enabling the cop + registers an offense if enabling it twice + all switch + registers offense and corrects unnecessary enable all + when at least one cop was disabled + does not register offense + +RuboCop::Cop::Lint::FlipFlop + registers an offense for exclusive flip-flops + registers an offense for inclusive flip-flops + +RuboCop::Cop::Layout::LineContinuationLeadingSpace + EnforcedStyle: leading + registers an offense when 1st line has multiple trailing spaces + registers offense in the right location when 1st line is not the string + registers an offense when 1st line has one trailing space + marks the correct range when string is a block method argument + registers offenses when 1st and 2nd line has trailing spaces + marks the correct range when string is a positional method argument + puts the offense message in correct position also on indented line + interpolated strings + registers no offense for correctly formatted multiline interpolated string + registers offenses when 1st line has trailing spaces and 2nd line is interpolated + registers no offense on interpolated string alone + registers offenses when 1st line has leading spaces and 1st line is interpolated + registers an offense for incorrectly formatted multiline interpolated string + registers no offense for correctly formatted multiline interpolation + registers no offense on doubly interpolated string alone + EnforcedStyle: trailing + registers an offense when 2nd line has multiple leading spaces + registers offenses when 2nd and 3rd line has leading spaces + registers offense in the right location when 1st line is not the string + marks the correct range when string is a block method argument + puts the offense message in correct position also on indented line + marks the correct range when string is a positional method argument + registers an offense when 2nd line has one leading space + interpolated strings + registers no offense for correctly formatted multiline interpolated string + registers an offense for incorrectly formatted multiline interpolated string + registers no offense on doubly interpolated string alone + registers offenses when 2nd line has leading spaces and 2nd line is interpolated + registers offenses when 2nd line has leading spaces and 1st line is interpolated + registers no offense on interpolated string alone + registers no offense for correctly formatted multiline interpolation + +RuboCop::Cop::Layout::AccessModifierIndentation + when EnforcedStyle is set to indent + registers an offense and corrects misaligned module_function in module + registers an offense and corrects misaligned access modifiers in nested classes + accepts indented access modifiers with arguments in nested classes + registers an offense and corrects misaligned private in class defined with Class.new + registers an offense and corrects misaligned private in module defined with Module.new + registers an offense and corrects access modifiers in arbitrary blocks + registers an offense and corrects misaligned protected + accepts an empty class + registers an offense and corrects misaligned private in module + accepts methods with a body + registers an offense and corrects misaligned private in a singleton class + registers an offense and corrects opposite + correct alignment + registers an offense and corrects correct + opposite alignment + registers an offense and corrects misaligned private + accepts properly indented private in module defined with Module.new + accepts properly indented protected + accepts properly indented private + when 4 spaces per indent level are used + accepts properly indented private + when indentation width is overridden for this cop only + accepts properly indented private + when EnforcedStyle is set to outdent + registers an offense and corrects private indented to method depth in singleton class + accepts private with argument indented to method depth in a class + registers an offense and corrects private indented to method depth in a module + accepts module fn with argument indented to method depth in a module + accepts private with argument indented to method depth in module defined with Module.new + accepts private indented to the containing class indent level + accepts private def indented to method depth in module defined with Module.new + accepts private def indented to method depth in a class + accepts private def indented to method depth in class defined with Class.new + registers an offense and corrects private indented to method depth in class defined with Class.new + registers an offense and corrects misaligned access modifiers in nested classes + registers an offense and corrects private indented to method depth in module defined with Module.new + accepts private with argument indented to method depth in a module + accepts private with argument indented to method depth in class defined with Class.new + accepts module fn def indented to method depth in a module + accepts private with argument indented to method depth in singleton class + accepts private def indented to method depth in singleton class + registers offense and corrects private indented to method depth in a class + registers an offense and corrects module_function indented to method depth in a module + accepts protected indented to the containing class indent level + accepts private def indented to method depth in a module + +RuboCop::Cop::Style::RedundantCapitalW + registers an offense for misused %W + registers no offense for normal arrays of strings with interpolation + does not register an offense for array with one element + does not register an offense for array with empty strings + registers an offense for misused %W with different bracket + does not register an offense for array containing non-string + registers no offense for %W with interpolation + does not register an offense for array of non-words + registers no offense for %W with special characters + registers no offense for normal arrays of strings + registers no offense for %w without interpolation + registers no offense for %w with interpolation-like syntax + registers no offense for arrays with character constants + +RuboCop::Cop::Lint::RedundantCopDisableDirective + .check + autocorrecting whitespace + when there is a blank line before inline comment + removes the comment and preceding whitespace + nested inside a namespace + preserves indentation + inline comment + removes the comment and preceding whitespace + when there is only whitespace before the comment + leaves the whitespace + when the comment is the first line of the file + followed by code + removes the comment + followed by a newline + removes the comment and newline + followed by another comment + removes the comment and newline + when the comment is not the first line of the file + preserves whitespace before the comment + with a disabled department + removes redundant department + removes cop duplicated by department on previous line + removes cop duplicated by department + removes cop duplicated by department and leaves free text as a comment + does not remove correct department + removes entire comment + when there are disabled lines + and there are no offenses + and a comment disables + comment is not at the beginning of the file + and not all cops have offenses + returns an offense + multiple cops, with abbreviated names + one of them has offenses + returns an offense + multiple cops, and the leftmost one has no offenses + returns an offense + an unknown cop + returns an offense + multiple cops + returns an offense + misspelled cops + returns an offense + one cop + returns an offense + all cops + returns an offense + itself and all cops + disabled on different ranges + returns no offense + multiple cops, and one of them has offenses + returns an offense + itself and another cop + disabled on different ranges + returns no offense + and the other cop is disabled a second time + returns no offense + disabled on the same range + returns no offense + when using a directive comment after a non-directive comment + returns an offense + a cop that is disabled in the config + returns an offense + when that cop was previously enabled + returns no offense + if that cop has offenses + returns an offense + and there are two offenses + and a comment disables + one cop twice + returns an offense + one cop and then all cops + returns an offense + and there is an offense + and a comment disables + all cops + returns no offense + that cop + returns no offense + that cop but on other lines + returns an offense + when there are no disabled lines + returns no offense + +RuboCop::CLI --autocorrect + does not crash `Layout/ArgumentAlignment` and offenses and accepts `Layout/FirstArgumentIndentation` when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `EnforcedStyle: consistent_relative_to_receiver` of `Layout/FirstArgumentIndentation` + can correct MethodDefParentheses and other offense + corrects `Style/InverseMethods` offenses when specifying `IncludeSemanticChanges: false` of `Style/NonNilCheck` and `EnforcedStyle: comparison` of `Style/NilComparison` + corrects HeredocArgumentClosingParenthesis offenses and ignores TrailingCommaInArguments offense + corrects when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `Layout/HashAlignment` + corrects Style/BlockDelimiters offenses when specifyingLayout/SpaceInsideBlockBraces together + does not correct Style/IfUnlessModifier offense disabled by a comment directive and does not fire Lint/RedundantCopDisableDirective offense even though that directive would make the modifier form too long + corrects `EnforcedStyle: hash_rockets` of `Style/HashSyntax` with `Layout/HashAlignment` + consistently quotes symbol keys in a hash using `Lint/SymbolConversion` with `EnforcedStyle: consistent` and `Style/QuotedSymbols` + corrects `EnforcedStyle: line_count_based` of `Style/BlockDelimiters` with `Style/CommentedKeyword` and `Layout/BlockEndNewline` + corrects Style/Next and Style/SafeNavigation offenses + corrects `EnforcedStyle: require_parentheses` of `Style/MethodCallWithArgsParentheses` with `Style/NestedParenthesizedCalls` + can correct single line methods + can be disabled for any cop in configuration + corrects `Style/IfUnlessModifier` with `Style/SoleNestedConditional` + corrects `Style/RedundantBegin` with `Style/MultilineMemoization` + can correct HashSyntax when --only is used + corrects when specifying `EnforcedStyle: with_first_argument` of `Layout/ArgumentAlignment` and `EnforcedColonStyle: separator` of `Layout/HashAlignment` + can correct two problems with blocks + corrects IndentationWidth and IndentationConsistency offenseswhen using `EnforcedStyle: outdent` and `EnforcedStyle: indented_internal_methods` + handles different SpaceInsideBlockBraces and SpaceInsideHashLiteralBraces + does not crash when using Lint/SafeNavigationWithEmpty and Layout/EmptyLinesAroundBlockBody + honors Exclude settings in individual cops + corrects `EnforcedStyle: require_parentheses` of `Style/MethodCallWithArgsParentheses` with `Style/RescueModifier` + corrects `EnforcedStyle: require_parentheses` of `Style/MethodCallWithArgsParentheses` with `Layout/SpaceBeforeFirstArg` + can correct a problems and the problem it creates + corrects `Lint/Lambda` and `Lint/UnusedBlockArgument` offenses + does not hang SpaceAfterPunctuation and SpaceInsideParens + corrects SymbolProc and SpaceBeforeBlockBraces offenses + does not crash `Layout/ArgumentAlignment` and offenses and accepts `Layout/FirstArgumentIndentation` when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `EnforcedStyle: special_for_inner_method_call` of `Layout/FirstArgumentIndentation` + corrects when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `EnforcedStyle: consistent` of `Layout/FirstArgumentIndentation` + corrects Style/BlockDelimiters offenses when specifyingLayout/SpaceBeforeBlockBraces with `EnforcedStyle: no_space` together + can correct SpaceAfterComma and HashSyntax offenses + does not correct SpaceAroundOperators in a hash that would be changed back + can correct empty line inside special form of nested modules + corrects `Layout/SpaceAroundOperators` and `Layout/ExtraSpacing` offenses when using `ForceEqualSignAlignment: true` + corrects when specifying `EnforcedStyle: with_first_argument` of `Layout/ArgumentAlignment` and `EnforcedHashRocketStyle: separator` of `Layout/HashAlignment` + corrects InitialIndentation offenses + corrects `EnforcedStyle: require_parentheses` of `Style/MethodCallWithArgsParentheses` with `Lint/AmbiguousOperator` + corrects IndentationWidth, RedundantBegin, and RescueEnsureAlignment offenses + corrects when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `Layout/HashAlignment` and `Layout/FirstHashElementIndentation` + corrects Lint/ParenthesesAsGroupedExpression and offenses and accepts Style/RedundantParentheses + does not say [Corrected] if correction is not possible + corrects `Lint/UnusedMethodArgument` with `Style/ExplicitBlockArgument` + can correct indentation and another thing + properly corrects when `Style/SoleNestedConditional` and one of `Style/NegatedIf` or `Style/NegatedUnless` detect offenses + corrects when specifying `EnforcedStyle: with_first_argument` of `Layout/ArgumentAlignment` and `EnforcedColonStyle: separator` of `Layout/HashAlignment` (`EnforcedColonStyle` is array) + corrects Tab and IndentationConsistency offenses + registers an offense and corrects when using `Layout/ArgumentAlignment`, `Layout/FirstArgumentIndentation`, and `Layout/FirstMethodArgumentLineBreak` and specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `EnforcedStyle: consistent` of `Layout/FirstArgumentIndentation` + corrects `Naming/RescuedExceptionsVariableName` and `, `Style/RescueStandardError`and `Lint/OverwriteByRescue` offenses + corrects indentation for a begin/rescue/else/ensure/end block properly + can correct MethodCallWithoutArgsParentheses and EmptyLiteral offenses + indents the elements of a hash in hash based on the parent hash key when the parent hash is a method argument and has following other sibling pairs + corrects RedundantBegin offenses and fixes indentation etc + can correct HashSyntax and SpaceAroundOperators offenses + corrects TrailingCommaIn(Array|Hash)Literal and Multiline(Array|Hash)BraceLayout offenses + does not hang SpaceAfterPunctuation and SpaceInsideArrayLiteralBrackets + corrects `Layout/DotPosition` and `Layout/SingleLineBlockChain` offenses + does not crash when using `Layout/CaseIndentation` and `Layout/ElseAlignment` + corrects IndentationWidth and IndentationConsistency offenses + corrects `Layout/DotPosition` and `Style/RedundantSelf` offenses + corrects `Style/SoleNestedConditional` with `Style/InverseMethods` and `Style/IfUnlessModifier` + can correct WordArray and SpaceAfterComma offenses + does not crash `Layout/ArgumentAlignment` and offenses and accepts `Layout/FirstArgumentIndentation` when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `EnforcedStyle: special_for_inner_method_call_in_parentheses` of `Layout/FirstArgumentIndentation` + corrects `EnforcedStyle: require_parentheses` of `Style/MethodCallWithArgsParentheses` with `EnforcedStyle: conditionals` of `Style/AndOr` + properly autocorrects when `Style/TernaryParentheses` requires parentheses that `Style/RedundantParentheses` would otherwise remove + corrects RedundantCopDisableDirective offenses + corrects only IndentationWidth without crashing + can change block comments and indent them + corrects IndentationWidth and IndentationConsistency offenseswithout correcting `Style/TrailingBodyOnClass` + corrects code with indentation problems + can correct two empty lines at end of class body + plays nicely with default cops in complex ExtraSpacing scenarios + corrects Layout/RedundantLineBreak and Layout/SingleLineBlockChain offenses + breaks line at the beginning of trailing class/module body without removing a semicolon in the bodywhen using `Style/TrailingBodyOnClass` and `Style/TrailingBodyOnModule` + says [Correctable] if correction is unsafe + can correct IndentHash offenses with separator style + corrects Style/InverseMethods and Style/Not offenses + does not correct ExtraSpacing in a hash that would be changed back + can correct two problems in the same place + does not crash Lint/SafeNavigationWithEmpty and offenses and accepts Style/SafeNavigation when checking `foo&.empty?` in a conditional + avoids adding extra spaces when both `Style/Semicolon` and `Style/SingleLineMethods`both apply + corrects `Style/TernaryParentheses` offenses and accepts `Lint/ParenthesesAsGroupedExpression` + corrects LineEndConcatenation offenses leaving the RedundantInterpolation offense unchanged + can correct TrailingEmptyLines and TrailingWhitespace offenses + corrects properly when both `Style/MapToHash` and `Style/HashTransformKeys`or `Style/HashTransformValues` registers + space_inside_bracket cops + when array style is compact & reference style is no_space + corrects SpaceInsideArrayLiteralBrackets and SpaceInsideReferenceBrackets + when array style is compact & reference style is space + corrects SpaceInsideArrayLiteralBrackets and SpaceInsideReferenceBrackets + when array style is space & reference style is no space + corrects SpaceInsideArrayLiteralBrackets and SpaceInsideReferenceBrackets + when array style is no_space & reference style is space + corrects SpaceInsideArrayLiteralBrackets and SpaceInsideReferenceBrackets + when BlockDelimiters has braces_for_chaining style + corrects SpaceBeforeBlockBraces, SpaceInsideBlockBraces offenses + trailing comma cops + when the style is `comma` + corrects TrailingCommaInLiteral and TrailingCommaInArguments without producing a double comma + when the style is `consistent_comma` + corrects TrailingCommaInLiteral and TrailingCommaInArguments without producing a double comma + when BlockDelimiters has semantic style + corrects SpaceBeforeBlockBraces, SpaceInsideBlockBraces offenses + caching + with an offense in the cache + corrects offenses + with no offenses in the cache + doesn't correct offenses + when BlockDelimiters has line_count_based style + corrects SpaceBeforeBlockBraces, SpaceInsideBlockBraces offenses + +RuboCop::Cop::Lint::UnmodifiedReduceAccumulator + behaves like reduce/inject + does not affect inject called without a block + does not affect inject called with no block args + given a inject block + does not register an offense when returning accumulator[element] + registers an offense when called with no argument + does not register an offense when shovelling the accumulator + registers an offense when returning an expression with the element + registers an offense for every violating return value + does not register an offense when mutating the element with the accumulator + does not register an offense when or-assigning the accumulator + registers an offense for values returned with `next` + allows break with no value + does not look inside inner blocks + does not register an offense when and-assigning the accumulator + does not register an offense when returning a method called with the accumulator + registers an offense when returning accumulator[element]= + allows the element to be the return value if the accumulator is returned in any branch + registers an offense when returning an index of the accumulator + registers an offense for values returned with `break` + does not register an offense when calling a method on the accumulator with the element + registers an offense when returning an index setter on the accumulator + does not register an offense when op-assigning the accumulator + registers an offense when returning the element + does not register an offense with the accumulator in heredoc + does not register an offense with the accumulator in interpolation + registers an offense with the element in interpolation + registers an offense with the element in heredoc + does not register an offense when returning the accumulator in an expression + registers an offense when mutating the accumulator with the element but not returning it + does not register an offense when assigning the accumulator + does not register an offense when mutating the element with the another value + does not register an offense when returning a literal + does not register an offense if the return value cannot be determined + does not register an offense when returning the accumulator + does not register an offense when returning a method called on the accumulator + does not register an offense when comparing + does not register an offense when returning the accumulator in a boolean statement + argument count + registers an offense when there are more than two arguments but the element is returned + ignores when there is a splat argument + ignores when there are not enough block arguments + numblocks + registers an offense when returning the element + does not register an offense when when returning the accumulator + behaves like reduce/inject + does not affect reduce called without a block + does not affect reduce called with no block args + given a reduce block + does not register an offense when calling a method on the accumulator with the element + registers an offense when returning accumulator[element]= + allows the element to be the return value if the accumulator is returned in any branch + does not register an offense when comparing + registers an offense for values returned with `break` + registers an offense when returning an index setter on the accumulator + does not register an offense when returning the accumulator in a boolean statement + registers an offense when returning an index of the accumulator + registers an offense for every violating return value + registers an offense with the element in heredoc + registers an offense when returning the element + does not register an offense when assigning the accumulator + does not register an offense when returning a method called with the accumulator + does not register an offense with the accumulator in heredoc + does not register an offense when mutating the element with the accumulator + does not register an offense when returning the accumulator + does not register an offense when returning a method called on the accumulator + does not register an offense when returning accumulator[element] + allows break with no value + registers an offense when returning an expression with the element + does not register an offense when and-assigning the accumulator + does not register an offense when op-assigning the accumulator + does not register an offense when returning a literal + does not register an offense with the accumulator in interpolation + does not register an offense if the return value cannot be determined + does not register an offense when shovelling the accumulator + does not look inside inner blocks + does not register an offense when or-assigning the accumulator + registers an offense with the element in interpolation + registers an offense when called with no argument + does not register an offense when mutating the element with the another value + does not register an offense when returning the accumulator in an expression + registers an offense for values returned with `next` + registers an offense when mutating the accumulator with the element but not returning it + numblocks + does not register an offense when when returning the accumulator + registers an offense when returning the element + argument count + ignores when there are not enough block arguments + ignores when there is a splat argument + registers an offense when there are more than two arguments but the element is returned + +RuboCop::Cop::Layout::EmptyLinesAroundModuleBody + when EnforcedStyle is empty_lines + registers an offense for module body not starting or ending with a blank + registers an offense for module body not ending with a blank + accepts modules with an empty body + autocorrects beginning and end + when EnforcedStyle is empty_lines_special + when first child is a method + requires blank line at the beginning and ending of module body + when module has a namespace + requires no empty lines for namespace but requires blank line at the beginning and ending of module body + source with blank lines + autocorrects the offenses + source without blank lines + registers and autocorrects the offenses + source without blank lines + registers an offense for module not beginning and ending with a blank line + module with constant and child module + registers and autocorrects the offenses + module with only constants + registers and autocorrects the offenses + module with empty body + with empty line + does NOT register offenses + without empty line + does NOT register offenses + when namespace has multiple children + requires empty lines for namespace + when first child is an access modifier + with no blank lines at the beginning and ending of module body + registers and corrects an offense + with blank lines at the beginning and ending of module body + registers no offense + when first child is NOT a method + does not require blank line at the beginning of module body but requires blank line before first def definition and requires blank line at the end of module body + source with comment before method definition + registers an offense for module beginning with a blank line + when module has a namespace + requires no empty lines for namespace and does not require blank line at the beginning of module body but requires blank line at the end of module body + source with constants + registers and autocorrects the offenses + source with blank lines + registers and autocorrects the offenses + source without blank lines + registers and autocorrects the offenses + source without blank lines + registers an offense for module not ending with a blank line + source with blank lines + registers an offense for module beginning with a blank line + when EnforcedStyle is empty_lines_except_namespace + when has multiple child modules + requires empty lines for namespace + registers offenses for namespace body starting and ending without a blank + when only child is module + registers offense for namespace body ending with a blank + registers offenses for namespaced module body not starting with a blank + autocorrects beginning and end + requires no empty lines for namespace + registers offense for namespace body starting with a blank + registers offenses for namespaced module body not ending with a blank + when only child is class + registers offense for namespace body ending with a blank + registers offense for namespace body starting with a blank + requires no empty lines for namespace + when EnforcedStyle is no_empty_lines + registers an offense for module body starting with a blank + autocorrects beginning and end + registers an offense for module body ending with a blank + +RuboCop::Cop::Lint::SafeNavigationConsistency + registers an offense and corrects using safe navigation on the left of || + registers an offense and corrects using unsafe navigation and the safe navigation appears in a group + registers an offense and corrects using safe navigation on the right of && + registers an offense and corrects using safe navigation on the right of || + registers an offense and corrects using safe navigation in conditions on the right hand side + allows safe navigation when different variables are used + allows calls to methods that nil responds to + registers an offense and corrects using safe navigation inside of separated conditions + allows && without safe navigation + registers an offense and corrects unsafe navigation that appears before safe navigation + registers a single offense and corrects when safe navigation is used multiple times + registers an offense and corrects when there is code before or after the condition + allows || without safe navigation + registers and corrects multiple offenses + registers an offense and corrects assignment + registers an offense and corrects using safe navigation on the left of && + registers an offense and corrects using unsafe navigation with both && and || + registers an offense and corrects using unsafe navigation with grouped conditions + registers an offense but does not correct non dot method calls + +RuboCop::Cop::Naming::AccessorMethodName + accepts singleton method set_something with no args + accepts singleton method get_something with args + accepts method set_something with kwarg + accepts method set_something with two args + accepts method get_something with args + accepts method set_something with blockarg + accepts method set_something with optarg + registers an offense for singleton method set_something with one args + accepts method set_something with kwoptarg + registers an offense for method set_something with one arg + registers an offense for singleton method get_something with no args + accepts method set_something with no args + accepts method set_something with kwrestarg + accepts method set_something with restarg + registers an offense for method get_something with no args + accepts singleton method set_something with two args + >= Ruby 2.7 + accepts method set_something with arguments forwarding + +RuboCop::Cop::Bundler::GemComment + when investigating Ruby files + does not register any offenses + when investigating Gemfiles + and the gem is permitted + does not register any offenses + when the "OnlyFor" option is set + including "version_specifiers" + when a gem is uncommented and has options but no version specifiers + does not register an offense + when a gem is uncommented and has a version specifier along with other options + registers an offense + when a gem is commented + does not register an offense + when a gem is uncommented and has a version specifier + registers an offense + when a gem is uncommented and has multiple version specifiers + registers an offense + when a gem is uncommented and has no version specified + does not register an offense + including one or more option names but not "version_specifiers" + when a gem is uncommented and has a version specifier but none of the specified options + does not register an offense + when a gem is uncommented and contains only options not specified + does not register an offense + when a gem is uncommented and has one of the specified options + registers an offense + including "restrictive_version_specifiers" + when a gem is uncommented and has a version specifier along with other options + registers an offense + when a gem is uncommented and has no version specified + does not register an offense + when a gem is uncommented and has both minimum and non-minimum version specifier + registers an offense + when a gem is uncommented and has a version specifier without operator + registers an offense + when a gem is uncommented and has a non-minimum version specifier with a leading space + registers an offense + when a gem is uncommented and has only a minimum version specifier + does not register an offense + when a gem is uncommented and has a pessimistic version specifier + registers an offense + when a gem is commented + does not register an offense + when a gem is uncommented and has a frozen version specifier + registers an offense + when a gem is uncommented and has options but no version specifiers + does not register an offense + and the gem is commented + does not register any offenses + and the gem is commented on the same line + does not register any offenses + and a gem has no comment + registers an offense + and the file is empty + does not register any offenses + and the file contains source and group + does not register any offenses + +RuboCop::Cop::Style::RedundantStringEscape + does not register an offense for a __FILE__ literal + does not register an offense for a x-str literal + does not register an offense for a __dir__ literal + does not register an offense for a regexp literal + with an interpolation-disabled HEREDOC + behaves like a literal without interpolation + does not register an offense for an escaped backslash + does not register an offense for a bracket-escaped interpolation + does not register an offense for an escaped ivar interpolation + does not register an offense with escaped # at end-of-string + does not register an offense for an escaped gvar interpolation + does not register an offense for a $-escaped gvar interpolation + does not register an offense for multiple unicode escapes + does not register an offense for an allowed escape inside multi-line literal + does not register an offense for a hex escape + does not register an offense for an escaped newline + does not register an offense for a unicode escape + does not register an offense for an escaped interpolation + does not register an offense for an escaped # with following { + does not register an offense for a technically-unnecessary escape + does not register an offense for an escaped cvar interpolation + does not register an offense for a meta character + does not register a bracket-escaped lvar interpolation + does not register an offense for a @-escaped cvar interpolation + does not register an offense for control characters + does not register an offense for a newline + does not register an offense without escapes + does not register an offense for a @-escaped ivar interpolation + does not register an offense with escaped double quote + does not register an offense for meta control characters + does not register an offense with escaped # without following { + does not register an offense with escaped single quote + does not register an offense for an octal escape + does not register an offense for an ascii DEL + does not register an offense for an escaped # followed { + with a %(...) literal + behaves like a literal with interpolation + does not register an offense for a @-escaped ivar interpolation + does not register an offense without escapes + does not register an offense for an ascii DEL + does not register an offense for an octal escape + does not register an offense for a @-escaped cvar interpolation + does not register an offense for a hex escape + does not register an offense for a meta character + does not register an offense for a unicode escape + does not register an offense for an escaped backslash + does not register an offense for an escaped cvar interpolation + does not register an offense for multiple unicode escapes + does not register an offense for an escaped interpolation + does not register an offense for a newline + does not register an offense for a technically-unnecessary escape + does not register an offense for an escaped ivar interpolation + registers an offense and corrects a escaped nested delimiter in a double quoted string + does not register an offense for a bracket-escaped interpolation + registers an offense and corrects an escaped # before interpolation + registers an offense and corrects an escaped # without following { + does not register an offense for an escaped gvar interpolation + registers an offense and corrects an escaped single quote + does not register an offense for meta control characters + does not register an offense for an escaped # followed { + registers an offense and corrects an escaped } when escaping both brackets to avoid interpolation + does not register an offense for an escaped delimiter before interpolation + does not register an offense for control characters + does not register an offense for an escaped delimiter + registers an offense and corrects an escaped double quote + registers an offense and corrects an escaped # at end-of-string + does not register an offense for a $-escaped gvar interpolation + does not register a bracket-escaped lvar interpolation + does not register an offense for an escaped newline + with a double quoted string + does not register an offense with escaped double quote + does not register an offense with multiple escaped backslashes + does not register an offense when escaping a quote in multi-line broken string + registers an offense and corrects an unnecessary escape in multi-line broken string + behaves like a literal with interpolation + does not register an offense for a meta character + does not register an offense for an escaped # followed { + does not register an offense for a $-escaped gvar interpolation + registers an offense and corrects an escaped } when escaping both brackets to avoid interpolation + does not register an offense for a @-escaped cvar interpolation + does not register an offense for a @-escaped ivar interpolation + does not register an offense without escapes + does not register an offense for a technically-unnecessary escape + does not register an offense for an escaped delimiter before interpolation + does not register an offense for an escaped interpolation + does not register an offense for an escaped newline + does not register an offense for a newline + does not register a bracket-escaped lvar interpolation + registers an offense and corrects an escaped # before interpolation + registers an offense and corrects an escaped # without following { + does not register an offense for a unicode escape + does not register an offense for meta control characters + does not register an offense for a hex escape + does not register an offense for an octal escape + does not register an offense for control characters + does not register an offense for an escaped delimiter + does not register an offense for an escaped backslash + does not register an offense for an escaped ivar interpolation + does not register an offense for an ascii DEL + registers an offense and corrects an escaped # at end-of-string + registers an offense and corrects an escaped single quote + does not register an offense for an escaped cvar interpolation + does not register an offense for a bracket-escaped interpolation + does not register an offense for multiple unicode escapes + does not register an offense for an escaped gvar interpolation + with a %q(...) literal + behaves like a literal without interpolation + does not register an offense with escaped double quote + does not register an offense for an escaped delimiter before interpolation + does not register an offense for an escaped # with following { + does not register an offense for an escaped ivar interpolation + does not register an offense for a $-escaped gvar interpolation + does not register an offense for an escaped gvar interpolation + does not register an offense for an escaped delimiter + does not register an offense with escaped single quote + does not register an offense with escaped # at end-of-string + does not register an offense for an octal escape + does not register an offense for an escaped newline + does not register an offense for an ascii DEL + does not register an offense for a unicode escape + does not register an offense for a @-escaped cvar interpolation + does not register an offense for an allowed escape inside multi-line literal + does not register an offense for multiple unicode escapes + does not register an offense for an escaped backslash + does not register an offense for a technically-unnecessary escape + does not register an offense with escaped # without following { + does not register an offense for a bracket-escaped interpolation + does not register an offense for an escaped cvar interpolation + does not register an offense for control characters + does not register an offense for a newline + does not register an offense for an escaped # followed { + does not register an offense without escapes + does not register an offense for a hex escape + does not register a bracket-escaped lvar interpolation + does not register an offense for an escaped interpolation + does not register an offense for a @-escaped ivar interpolation + does not register an offense for meta control characters + does not register an offense for a meta character + with a %W(...) literal + does not register an offense for escaped spaces + behaves like a literal with interpolation + does not register an offense without escapes + does not register an offense for an escaped interpolation + does not register an offense for an escaped # followed { + does not register an offense for an octal escape + does not register an offense for an escaped delimiter before interpolation + does not register an offense for control characters + registers an offense and corrects an escaped double quote + does not register an offense for an escaped newline + does not register an offense for a newline + does not register an offense for an escaped delimiter + does not register an offense for a hex escape + does not register an offense for an escaped cvar interpolation + does not register an offense for an escaped gvar interpolation + registers an offense and corrects an escaped single quote + registers an offense and corrects an escaped # without following { + does not register an offense for a $-escaped gvar interpolation + does not register an offense for a @-escaped cvar interpolation + does not register an offense for an ascii DEL + does not register an offense for multiple unicode escapes + does not register an offense for a technically-unnecessary escape + does not register an offense for a unicode escape + does not register a bracket-escaped lvar interpolation + does not register an offense for an escaped backslash + registers an offense and corrects an escaped # before interpolation + does not register an offense for an escaped ivar interpolation + does not register an offense for a @-escaped ivar interpolation + registers an offense and corrects a escaped nested delimiter in a double quoted string + registers an offense and corrects an escaped # at end-of-string + does not register an offense for meta control characters + registers an offense and corrects an escaped } when escaping both brackets to avoid interpolation + does not register an offense for a bracket-escaped interpolation + does not register an offense for a meta character + with a %Q(...) literal + behaves like a literal with interpolation + does not register an offense for a $-escaped gvar interpolation + does not register an offense for control characters + does not register an offense for an escaped delimiter before interpolation + does not register an offense for meta control characters + does not register an offense for a technically-unnecessary escape + does not register an offense for an escaped newline + does not register an offense for an escaped cvar interpolation + does not register an offense for multiple unicode escapes + does not register an offense for an escaped delimiter + does not register a bracket-escaped lvar interpolation + does not register an offense for an octal escape + registers an offense and corrects an escaped # without following { + does not register an offense for a @-escaped cvar interpolation + registers an offense and corrects a escaped nested delimiter in a double quoted string + does not register an offense for a @-escaped ivar interpolation + does not register an offense for a hex escape + does not register an offense for an ascii DEL + does not register an offense for an escaped interpolation + does not register an offense without escapes + registers an offense and corrects an escaped # at end-of-string + registers an offense and corrects an escaped single quote + does not register an offense for a newline + does not register an offense for a meta character + registers an offense and corrects an escaped } when escaping both brackets to avoid interpolation + does not register an offense for a bracket-escaped interpolation + does not register an offense for an escaped backslash + registers an offense and corrects an escaped double quote + does not register an offense for an escaped gvar interpolation + does not register an offense for an escaped ivar interpolation + registers an offense and corrects an escaped # before interpolation + does not register an offense for a unicode escape + does not register an offense for an escaped # followed { + with a %Q!...! literal + behaves like a literal with interpolation + does not register an offense for multiple unicode escapes + does not register an offense for a newline + does not register an offense for a meta character + registers an offense and corrects an escaped # at end-of-string + does not register an offense for a $-escaped gvar interpolation + does not register an offense for an escaped interpolation + registers an offense and corrects an escaped single quote + does not register an offense for an octal escape + does not register an offense for a unicode escape + does not register an offense for an escaped ivar interpolation + does not register an offense for control characters + registers an offense and corrects a escaped nested delimiter in a double quoted string + registers an offense and corrects an escaped # before interpolation + does not register an offense for an escaped # followed { + does not register a bracket-escaped lvar interpolation + does not register an offense for an escaped delimiter before interpolation + does not register an offense for a bracket-escaped interpolation + does not register an offense for a technically-unnecessary escape + registers an offense and corrects an escaped double quote + does not register an offense for a @-escaped ivar interpolation + does not register an offense without escapes + does not register an offense for a hex escape + does not register an offense for an escaped delimiter + registers an offense and corrects an escaped } when escaping both brackets to avoid interpolation + does not register an offense for meta control characters + does not register an offense for an escaped newline + does not register an offense for an ascii DEL + does not register an offense for a @-escaped cvar interpolation + registers an offense and corrects an escaped # without following { + does not register an offense for an escaped gvar interpolation + does not register an offense for an escaped cvar interpolation + does not register an offense for an escaped backslash + when using character literals + does not register an offense for `?a` + does not register an offense for `?\n` + with a single quoted string + behaves like a literal without interpolation + does not register an offense for an ascii DEL + does not register an offense for control characters + does not register an offense for an escaped delimiter + does not register an offense for an escaped ivar interpolation + does not register an offense for a newline + does not register an offense with escaped # at end-of-string + does not register an offense for a @-escaped cvar interpolation + does not register an offense with escaped double quote + does not register an offense for an octal escape + does not register an offense for an escaped # with following { + does not register an offense for an allowed escape inside multi-line literal + does not register a bracket-escaped lvar interpolation + does not register an offense for an escaped gvar interpolation + does not register an offense for an escaped interpolation + does not register an offense for a hex escape + does not register an offense for a @-escaped ivar interpolation + does not register an offense for an escaped delimiter before interpolation + does not register an offense for an escaped backslash + does not register an offense for a $-escaped gvar interpolation + does not register an offense for a bracket-escaped interpolation + does not register an offense with escaped # without following { + does not register an offense for an escaped newline + does not register an offense for an escaped cvar interpolation + does not register an offense for a meta character + does not register an offense for meta control characters + does not register an offense for a technically-unnecessary escape + does not register an offense without escapes + does not register an offense for an escaped # followed { + does not register an offense for a unicode escape + does not register an offense for multiple unicode escapes + does not register an offense with escaped single quote + with a %w(...) literal + does not register an offense for escaped spaces + behaves like a literal without interpolation + does not register an offense with escaped single quote + does not register an offense for an ascii DEL + does not register an offense for an allowed escape inside multi-line literal + does not register an offense for an escaped # with following { + does not register an offense for a $-escaped gvar interpolation + does not register an offense for meta control characters + does not register an offense for a @-escaped cvar interpolation + does not register an offense with escaped double quote + does not register an offense for control characters + does not register an offense for a meta character + does not register an offense for a newline + does not register an offense for an escaped cvar interpolation + does not register an offense for an escaped newline + does not register an offense for a unicode escape + does not register an offense for a hex escape + does not register an offense for a bracket-escaped interpolation + does not register an offense with escaped # at end-of-string + does not register an offense for a @-escaped ivar interpolation + does not register a bracket-escaped lvar interpolation + does not register an offense for an escaped delimiter before interpolation + does not register an offense for an escaped delimiter + does not register an offense for an escaped backslash + does not register an offense for an octal escape + does not register an offense for an escaped gvar interpolation + does not register an offense without escapes + does not register an offense with escaped # without following { + does not register an offense for multiple unicode escapes + does not register an offense for an escaped interpolation + does not register an offense for an escaped ivar interpolation + does not register an offense for a technically-unnecessary escape + does not register an offense for an escaped # followed { + with an interpolation-enabled HEREDOC + does not register an offense for an escaped backslash + does not register an offense for an escaped # followed { + does not register an offense without escapes + registers an offense and corrects an escaped single quote + registers an offense and corrects an escaped # without following { + registers an offense and corrects an escaped # at end-of-string + does not register an offense for a @-escaped cvar interpolation + does not register an offense for an octal escape + does not register an offense for an escaped cvar interpolation + does not register an offense for an escaped gvar interpolation + registers an offense and corrects an escaped # before interpolation + does not register an offense for control characters + does not register an offense for a $-escaped gvar interpolation + does not register an offense for a @-escaped ivar interpolation + does not register an offense for a nested heredoc without interpolation + does not register an offense for a bracket-escaped interpolation + does not register an offense for a unicode escape + does not register an offense for an escaped ivar interpolation + does not register an offense for an escaped newline + does not register an offense for an ascii DEL + does not register an offense for a newline + does not register an offense for an escaped interpolation + does not register an offense for meta control characters + does not register an offense for a technically-unnecessary escape + does not register an offense for multiple unicode escapes + does not register an offense for a hex escape + does not register an offense for a heredoc interpolating a string with an allowed escape + does not register a bracket-escaped lvar interpolation + does not register an offense for a meta character + +RuboCop::Cop::Layout::SpaceAroundBlockParameters + when EnforcedStyleInsidePipes is space + accepts an empty block + accepts a lambda with spaces in the right places + skips lambda without parens + registers an offense and corrects multiple spaces after last parameter + registers an offense and corrects a lambda for no space after last parameter + registers an offense and corrects a lambda for extra spacebefore first parameter + registers an offense and corrects missing space before first argument and after last argument + registers an offense for no space before first parameter + registers an offense and corrects no space after last parameter + accepts a block parameter without preceding space + accepts a block with parameters but no body + registers an offense and corrects space with parens at middle + registers an offense and corrects spacing in lambda args + registers an offense and corrects extra space before first parameter + registers an offense and corrects a lambda for multiple spacesafter last parameter + skips lambda without args + registers an offense and corrects multiple spaces before parameter + accepts line break after closing pipe + registers an offense and corrects a lambda for no space before first parameter + registers an offense and corrects no space after closing pipe + accepts a block with spaces in the right places + registers an offense and corrects block arguments inside Hash#each + trailing comma + accepts space both before and after the last comma + accepts space after the last comma + registers an offense and corrects no space after the last comma + when EnforcedStyleInsidePipes is no_space + registers an offense and corrects for space with parens + accepts a block with spaces in the right places + registers an offense and corrects a lambda for space before first parameter + registers an offense and corrects all types of spacing issues + registers an offense and corrects space after last parameter + accepts block parameters with surrounding space that includes line breaks + registers an offense and corrects space before first parameter + accepts line break after closing pipe + registers an offense and corrects a lambda for space after the last parameter + accepts a lambda with spaces in the right places + skips lambda without args + registers an offense and corrects multiple spaces before parameter + accepts a block with parameters but no body + skips lambda without parens + registers an offense and corrects all types of spacing issues for a lambda + registers an offense and corrects no space after closing pipe + accepts an empty block + accepts a block parameter without preceding space + trailing comma + registers an offense for space after the last comma + registers an offense for space before and after the last comma + +RuboCop::Cop::Style::RedundantSelfAssignment + does not register an offense when assigning to attribute of `self` the result from other object + does not register an offense when there is no a receiver + does not register an offense when lhs and receiver are different + registers an offense and corrects when assigning to attribute of non `self` + registers an offense and corrects when assigning to attribute of `self` + when lhs and receiver are the same + registers an offense and corrects when assigning to global variable + registers an offense and corrects when assigning to instance variable + registers an offense and corrects when assigning to local variable + registers an offense and corrects when assigning to class variable + +RuboCop::Cop::Style::MixinUsage + does not register an offense when using inside nested module + prepend + does not register an offense when using inside class + registers an offense when using outside class + include + does not register an offense when using outside class + does not register an offense when using `include` in method definition inside class + registers an offense when using only `include` statement + registers an offense when using outside class (used below) + doesn't register an offense when `include` call is a method argument + does not register an offense when using `include` in method definition inside module + registers an offense when using outside class (used above) + registers an offense when using `include` in method definition outside class or module + does not register an offense when using inside block and `if` condition is after `include` + does not register an offense when using inside block + does not register an offense when using inside class + Nested module + registers an offense when using outside class + Multiple definition classes in one + does not register an offense when using inside class + extend + does not register an offense when using inside class + registers an offense when using outside class + +RuboCop::Cop::Style::ClassMethodsDefinitions + when EnforcedStyle is def_self + does not register an offense when defining singleton methods using `self << object` + does not register an offense when `class << self` contains non public methods + correctly handles def self.x within class << self + registers and corrects an offense when defining class methods with `class << self` with comment only body + does not register an offense when class << self does not contain methods + removes empty class << self when correcting + does not register an offense when defining class methods with `def self.method` + registers and corrects an offense when defining class methods with `class << self` with inline comment + registers an offense and corrects when defining class methods with `class << self` and there is no blank line between method definition and attribute accessor + does not register an offense when class << self contains only class methods + registers an offense and corrects when defining class methods with `class << self` + correctly handles class << self containing multiple methods + correctly handles methods with annotation comments + when EnforcedStyle is self_class + does not register an offense when defining singleton methods not on self + does not register an offense when defining class methods with `class << self` + registers an offense when defining class methods with `def self.method` + +RuboCop::Cop::Lint::UnusedBlockArgument + when IgnoreEmptyBlocks config parameter is set + accepts an empty block with multiple unused parameters + registers an offense for a non-empty block with multiple unused args + registers an offense for a non-empty block with an unused parameter + accepts an empty block with a single unused parameter + inspection + when a block takes multiple arguments + and a splat argument is unused + registers an offense and preserves splat + and an argument is unused + registers an offense + and all the arguments are unused + registers offenses and suggests omitting them + and unused arguments span multiple lines + registers offenses and suggests omitting them + and an argument with default value is unused + registers an offense and preserves default value + and arguments are swap-assigned + accepts + and all arguments are used + accepts + and one argument is assigned to another, whilst other's value is not used + registers an offense + when a block takes single argument + and the method call is `define_method` + registers an offense + and the argument is unused + registers an offense and suggests omitting that + when an optional keyword argument is unused + when the method call is not `define_method` + registers an offense + when AllowUnusedKeywordArguments set + does not care + when the method call is `define_method` + registers an offense + when AllowUnusedKeywordArguments set + does not care + in a method calling `binding` without arguments + accepts all arguments + inside a method definition + registers offenses + in a method calling `binding` with arguments + when a method argument is unused + registers an offense + when a method argument is not used + does not care + with an empty block + when not configured to ignore empty blocks + registers an offense + when configured to ignore empty blocks + does not register an offense + when a variable is not used + does not care + when a lambda block takes arguments + and all the arguments are unused + registers offenses and suggests using a proc + and an argument is unused + registers an offense + when a block have a block local variable + and the variable is unused + registers an offense + and the variable is used + does not register offense + when an underscore-prefixed block argument is not used + accepts + +RuboCop::Cop::Style::MapToHash + >= Ruby 2.6 + `map` and `map.to_h` with newlines + registers an offense and corrects with newline removal + for `map.to_h` with block arity 2 + registers an offense and corrects + for `collect.to_h` with block arity 2 + registers an offense and corrects + when chained further + registers an offense and corrects + when the receiver is an array + registers an offense and corrects + for `collect.to_h` with block arity 1 + registers an offense and corrects + when the receiver is an hash + registers an offense and corrects + `collect` without `to_h` + does not register an offense + `map` without `to_h` + does not register an offense + `collect.to_h` with a block on `to_h` + registers an offense but does not correct + for `map.to_h` with block arity 1 + registers an offense and corrects + `map` and `collect.to_h` with newlines + registers an offense and corrects with newline removal + when the receiver is an array + registers an offense and corrects + when chained further + registers an offense and corrects + `map.to_h` with a block on `to_h` + registers an offense but does not correct + when the receiver is an hash + registers an offense and corrects + +RuboCop::Cop::Style::For + when for is the enforced style + accepts single line each + registers an offense for correct + opposite style + registers multiple offenses + registers an offense for each without an item and uses _ as the item + registers an offense for multiline each + registers an offense for a tuple of items + accepts for + Ruby 2.7 + registers an offense for each without an item and uses _ as the item + when using safe navigation operator + does not break + when each is the enforced style + accepts multiline each + accepts :for + accepts def for + registers an offense for opposite + correct style + registers multiple offenses + registers an offense for for + autocorrect + corrects an array with `*` operator + corrects an array with `+` operator + corrects an array with `&&` operator + corrects a tuple of items + corrects an array with `&` operator + changes for that does not have do or semicolon to each + corrects to `each` without parenthesize collection if non-operator method called + corrects an array with `|` operator + corrects an array with `||` operator + corrects an array with `-` operator + with range + changes for that does not have do or semicolon to each + changes for to each + without parentheses + changes for that does not have do or semicolon to each + changes for to each + +RuboCop::Cop::Lint::ShadowedArgument + block argument shadowing + when multiple arguments are shadowed + and one of them shadowed within a lambda while another is shadowed outside + registers an offense + when a single argument is shadowed + registers an offense + and the argument is not used + accepts + and shadowed within a conditional + registers an offense without specifying where the reassignment took place + and the argument was not shadowed outside the conditional + accepts + and the conditional is nested within a lambda + registers an offense without specifying where the reassignment took place + and the argument was used before shadowing + accepts + and the conditional occurs after the reassignment + registers an offense + and was used before shadowing + accepts + and the conditional is nested within a conditional + registers an offense without specifying where the reassignment took place + and the argument was used before shadowing + accepts + when binding is used + registers an offense + when IgnoreImplicitReferences config option is set to true + accepts + and shadowed within a block + registers an offense without specifying where the reassignment took place + and the block occurs after the reassignment + registers an offense + and the block is nested within a block + registers an offense without specifying where the reassignment took place + and the argument was used before shadowing + accepts + and the block is nested within a conditional + registers an offense without specifying where the reassignment took place + and the argument was used before shadowing + accepts + and the argument was not shadowed outside the block + accepts + and was used before shadowing + accepts + when zsuper is used + accepts + when a block local variable is assigned but no argument is shadowed + accepts + method argument shadowing + when a single argument is shadowed + registers an offense + when a splat argument is shadowed + registers an offense + and shadowed within a block + registers an offense without specifying where the reassignment took place + and the block occurs after the reassignment + registers an offense + and the block is nested within a conditional + registers an offense without specifying where the reassignment took place + and the argument was used before shadowing + accepts + and was used before shadowing + accepts + and the argument was not shadowed outside the block + accepts + and the block is nested within a block + registers an offense without specifying where the reassignment took place + and the argument was used before shadowing + accepts + and shadowed within a conditional + registers an offense without specifying where the reassignment took place + and was used before shadowing + accepts + and the conditional is nested within a lambda + registers an offense without specifying where the reassignment took place + and the argument was used before shadowing + accepts + and the argument was not shadowed outside the conditional + accepts + and the conditional occurs after the reassignment + registers an offense + and the conditional is nested within a conditional + registers an offense without specifying where the reassignment took place + and the argument was used before shadowing + accepts + and the argument is not used + accepts + when argument was used in shorthand assignment + does not register an offense + when binding is used + registers an offense + when IgnoreImplicitReferences config option is set to true + accepts + when reassigning to splat variable + does not register an offense + when zsuper is used + registers an offense + when IgnoreImplicitReferences config option is set to true + accepts + when argument was shadowed by zsuper + does not register an offense + when argument was shadowed by zsuper + registers an offense + when multiple arguments are shadowed + and one of them shadowed within a lambda while another is shadowed outside + registers an offense + +RuboCop::Cop::Style::SpecialGlobalVars + when style is use_builtin_english_names + does not register an offenses for builtin names + does not register an offense for backrefs like $1 + autocorrects non-preffered builtin names + generates correct auto-config when mixed styles are used + does not register an offense for Perl names + generates correct auto-config when Perl variable names are used + when style is use_perl_names + registers an offense for $PROGRAM_NAME + does not register an offense for backrefs like $1 + autocorrects #{$LOAD_PATH} to #$: + registers an offense for $LOAD_PATH + registers an offense for $LOADED_FEATURES + registers an offense for $PID + autocorrects $INPUT_RECORD_SEPARATOR to $/ + registers an offense for $PROCESS_ID + when style is use_english_names + when add require English is enabled + when English is already required at top-level + moves require English above replacement + leaves require English alone for $$ + when English has not been required at top-level + adds require English for $$ + adds require English for twice `$*` in nested code + adds require English for $$ in nested code + does not add for replacement outside of English lib + when add require English is disabled + registers an offense for $: + does not register an offense for backrefs like $1 + autocorrects #$: to #{$LOAD_PATH} + generates correct auto-config when mixed styles are used + autocorrects #{$!} to #{$ERROR_INFO} + registers an offense for $$ + registers an offense for $" + registers an offense for $0 + generates correct auto-config when Perl variable names are used + autocorrects $/ to $INPUT_RECORD_SEPARATOR + is clear about variables from the English library vs those not + +RuboCop::Cop::Style::TrailingCommaInBlockArgs + when `lambda` has multiple arguments + does not register an offense when more than one argument is present with no trailing comma + registers an offense and corrects when a trailing comma isn't needed + do/end block format + ignores commas in default argument strings + does not register an offense when a trailing comma is required + does not register an offense when no arguments are present + does not register an offense for default arguments + registers an offense when a trailing comma is not needed + does not register an offense for an empty block + preserves semicolons in block/local variables + does not register an offense when more than one argument is present with no trailing comma + does not register an offense for keyword arguments + when `->` has multiple arguments + does not register an offense + curly brace block format + does not register an offense when no arguments are present + registers an offense when a trailing comma is not needed + preserves semicolons in block/local variables + does not register an offense when a trailing comma is required + does not register an offense for default arguments + does not register an offense for keyword arguments + does not register an offense when more than one argument is present with no trailing comma + ignores commas in default argument strings + +RuboCop::Cop::Layout::EmptyLinesAroundArguments + when no extra lines + accepts method with argument that trails off block + accepts listed args starting on definition line + accepts block argument with empty line + accepts method with no arguments that trails off block + accepts method with argument that trails off heredoc + accepts multiple listed mixed args + accepts when blank line is inserted between method with arguments and receiver + accepts one line methods + accepts multiline style argument for method call without selector + with one argument + ignores empty lines inside of method arguments + with multiple arguments + ignores empty lines inside of method arguments + when extra lines + registers and autocorrects offense for empty line after arg + registers and autocorrects offense when args start on definition line + registers and autocorrects offense on correct lines for multi-offense example + registers autocorrects empty line whetn args start on definition line + registers and autocorrects offense on correct line for single offense example + registers and autocorrects offense for empty line before arg + registers and autocorrects offense when empty line between normal arg & block arg + registers and autocorrects offenses when multiple empty lines are detected + registers and autocorrects offense for empty line between args + when using safe navigation operator + registers and autocorrects offense for empty line before arg + +RuboCop::Cop::Lint::RequireParentheses + accepts parentheses around expression with boolean operator + accepts missing parentheses around expression with + operator + accepts calls to methods that are operators + accepts method calls that are all operations + accepts missing parentheses when method is not a predicate + registers an offense for missing parentheses around expression with || operator + accepts missing parentheses when using ternary operator + accepts method calls without parentheses followed by keyword and/or + registers an offense for missing parentheses around expression with && operator + accepts missing parentheses when using ternary operator in square bracksts + accepts condition that is not a call + accepts calls to methods that are setters + registers an offense for missing parentheses around expression in ternary + accepts method call with parentheses in ternary + when using safe navigation operator + registers an offense for missing parentheses around expression with && operator + +RuboCop::Cop::Style::DoubleNegation + when `EnforcedStyle: allowed_in_returns` + registers an offense and corrects for `!!` with complex array at return location + does not register an offense for `!!` when return location and using `rescue` + registers an offense and corrects for `!!` + does not register an offense for `!!` when return location and using `ensure` + does not register an offense for ! + does not register an offense for `not not` + registers an offense and corrects for `!!` when not return locationand using `if`, `elsif`, and `else` + does not register an offense for `!!` when return location and using `rescue`, `else`, and `ensure` + does not register an offense for `!!` with hash when return location and using `case`, `when`, and `else` + does not register an offense for `!!` with hash when return location and using `if`, `elsif`, and `else` + registers an offense and corrects for `!!` with array when not return locationand using `case`, `when`, and `else` + registers an offense and corrects for `!!` when not return location and using `unless` + registers an offense and corrects for `!!` with single-line array at return location + does not register an offense for `!!` when return location and using `if`, `elsif`, and `else` + registers an offense and corrects for `!!` with multi-line hash at return location + registers an offense and corrects for `!!` with hash when not return locationand using `case`, `when`, and `else` + does not register an offense for `!!` when return location and using `case`, `when`, and `else` + registers an offense and corrects for `!!` with multi-line array at return location + registers an offense and corrects for `!!` when not return locationand using `case`, `when`, and `else` + registers an offense and corrects for `!!` with nested hash at return location + does not register an offense for `!!` when return location and using `rescue` and `ensure` + does not register an offense for `!!` with array when return location and using `if`, `elsif`, and `else` + does not register an offense for `!!` when using `return` keyword + does not register an offense for `!!` when return location + does not register an offense for `!!` when return location by `define_singleton_method` + does not register an offense for `!!` when return location and using `unless` + registers an offense and corrects for `!!` with array when not return locationand using `if`, `elsif`, and `else` + registers an offense and corrects for `!!` with hash when not return locationand using `if`, `elsif`, and `else` + does not register an offense for `!!` when return location by `define_method` + does not register an offense for `!!` with array when return location and using `case`, `when`, and `else` + registers an offense and corrects for `!!` with nested array at return location + registers an offense and corrects for `!!` with single-line hash at return location + registers an offense and corrects for `!!` when not a return location + Ruby >= 2.7 + does not register an offense for `!!` when return location and using `case`, `in`, and `else` + Ruby >= 2.7 + registers an offense and corrects for `!!` when not return locationand using `case`, `in`, and `else` + when `EnforcedStyle: forbidden` + registers an offense for `!!` when return location and using `rescue`, `else`, and `ensure` + registers an offense and corrects for `!!` when not a return location + registers an offense and corrects for `!!` when using `return` keyword + does not register an offense for `not not` + registers an offense for `!!` when return location and using `rescue` and `ensure` + does not register an offense for ! + registers an offense for `!!` when return location and using `rescue` + registers an offense and corrects for `!!` when return location + registers an offense and corrects for `!!` + registers an offense for `!!` when return location and using `ensure` + +RuboCop::Cop::Metrics::ModuleLength + accepts empty modules + reports the correct beginning and end lines + rejects a module with more than 5 lines + does not count blank lines + accepts a module with 5 lines + accepts a module with less than 5 lines + when CountComments is enabled + also counts commented lines + when inspecting a class defined with Module.new + registers an offense + when inspecting a class defined with ::Module.new + registers an offense + when using numbered parameter + when inspecting a class defined with ::Module.new + registers an offense + when inspecting a class defined with Module.new + registers an offense + when a module has inner classes + rejects a module with 6 lines that belong to the module directly + does not count lines of inner classes + when a module has inner modules + rejects a module with 6 lines that belong to the module directly + does not count lines of inner modules + when `CountAsOne` is not empty + folds array into one line + +RuboCop::Cop::Bundler::GemVersion + when EnforcedStyle is set to forbidden + flags gems that specify a gem version + does not flag gems without a specified version + does not flag gems included in AllowedGems metadata + when EnforcedStyle is set to required (default) + does not flag gems included in AllowedGems metadata + flags gems that do not specify a version + does not flag gems with a specified version + +RuboCop::DirectiveComment + #line_number + returns line number for directive + #directive_count + when cops and departments used + is expected to eq 4 + when few department used + is expected to eq 3 + when few cops used + is expected to eq 2 + #department_names + when all cops mentioned + is expected to eq [] + when only department specified + is expected to eq ["Foo"] + when couple departments specified + is expected to eq ["Foo", "Baz"] + when department and cops specified + is expected to eq ["Foo"] + when only cop specified + is expected to eq [] + #disabled_all? + when enabled specific cops + is expected to equal false + when enabled all cops + is expected to equal false + when disabled all cops + is expected to equal true + when disabled specific cops + is expected to equal false + .before_comment + when line has code + is expected to eq "def foo " + when line has NO code + is expected to eq "" + #disabled? + when todo + is expected to equal true + when enable + is expected to equal false + when disable + is expected to equal true + #single_line? + when relates to single line + is expected to equal true + when does NOT relate to single line + is expected to equal false + #match? + when cop names are same as in the comment + is expected to equal true + when cop names are same but have duplicated names + is expected to equal true + when cop names are same but in a different order + is expected to equal true + when there are no cop names + is expected to equal false + when cop names are superset of names + is expected to equal false + when cop names are subset of names + is expected to equal false + when disabled all cops + is expected to equal true + #enabled_all? + when disabled all cops + is expected to equal false + when disabled specific cops + is expected to equal false + when enabled specific cops + is expected to equal false + when enabled all cops + is expected to equal true + #in_directive_department? + when cop department disabled + is expected to equal true + when cop disabled + is expected to equal false + when another department disabled + is expected to equal false + #all_cops? + when mentioned specific cops + is expected to equal false + when mentioned all + is expected to equal true + #enabled? + when enable + is expected to equal true + when todo + is expected to equal false + when disable + is expected to equal false + #cop_names + when couple departments specified + is expected to eq ["Foo/Bar", "Foo/Baz", "Baz/Bar"] + when all cops mentioned + is expected to eq ["all_names"] + when only cop specified + is expected to eq ["Foo/Bar"] + when redundant directive cop department specified + is expected to eq ["Lint/One", "Lint/Two"] + when department and cops specified + is expected to eq ["Foo/Bar", "Foo/Baz", "Baz/Cop"] + when only department specified + is expected to eq ["Foo/Bar", "Foo/Baz"] + #overridden_by_department? + when there are no cops + is expected to equal false + when there are no departments + is expected to equal false + when cop is not overridden by it's department + is expected to equal false + when cop is overridden by it's department + is expected to equal true + #match_captures + when disable + is expected to eq ["disable", "all", nil, nil] + when typo + is expected to be nil + when todo + is expected to eq ["todo", "all", nil, nil] + when enable + is expected to eq ["enable", "Foo/Bar", nil, "Foo/"] + +RuboCop::Cop::InternalAffairs::EmptyLineBetweenExpectOffenseAndCorrection + registers and corrects an offense when using no empty line between `expect_offense` and `expect_correction` with heredoc argument + does not register an offense when using only `expect_offense` + does not register an offense when using empty line between `expect_offense` and `expect_correction` with heredoc argument + does not register an offense when using empty line between `expect_offense` and `expect_no_corrections` + does not register an offense when using empty line between `expect_offense` and `expect_correction`with variable argument + registers and corrects an offense when using no empty line between `expect_offense` and `expect_correction`with variable argument + registers and corrects an offense when using no empty line between `expect_offense` and `expect_no_corrections` + +RuboCop::Cop::Lint::IdentityComparison + does not register an offense when using `==` + does not register an offense when rhs is `object_id` without receiver + registers an offense and corrects when using `==` for comparison between `object_id`s + does not register an offense when a receiver that is not `object_id` uses `==` + does not register an offense when lhs is `object_id` without receiver + does not register an offense when using `==` for comparison between `object_id` and other + +RuboCop::Cop::Style::CollectionCompact + registers an offense and corrects when using `reject` with block pass arg on array to reject nils + does not register an offense when using `reject` to not to rejecting nils + registers an offense and corrects when using `reject` on hash to reject nils + does not register an offense when using `compact/compact!` + registers an offense and corrects when using `reject` and receiver is a variable + registers an offense and corrects when using `reject` with block pass arg and no parentheses + registers an offense and corrects when using `reject` on array to reject nils + registers an offense and corrects when using `select/select!` to reject nils + Ruby >= 3.1 + registers an offense and corrects when using `to_enum.reject` on array to reject nils + registers an offense and corrects when using `lazy.reject` on array to reject nils + when without receiver + does not register an offense and corrects when using `reject` on array to reject nils + does not register an offense and corrects when using `select/select!` to reject nils + Ruby <= 3.0 + does not register an offense and corrects when using `lazy.reject` on array to reject nils + does not register an offense and corrects when using `to_enum.reject` on array to reject nils + +RuboCop::Formatter::EmacsStyleFormatter + #file_finished + displays parsable text + when the offense is automatically corrected + prints [Corrected] along with message + when the offense message contains a newline + strips newlines out of the error message + when the offense is marked as todo + prints [Todo] along with message + #finished + does not report summary + +RuboCop::Cop::Naming::PredicateName + with permitted predicate names + accepts method name which is in permitted list + with method definition macros + accepts method name when corrected name is invalid identifier + registers an offense when using `define_method` + registers an offense when using an internal affair macro + without restricted prefixes + accepts method name that starts with unknown prefix + registers an offense when method name starts with "is" + registers an offense when method name starts with "has" + accepts method name when corrected name is invalid identifier + with restricted prefixes + accepts method name that is an assignment + registers an offense when method name starts with "is" + accepts method name when corrected name is invalid identifier + accepts method name that starts with unknown prefix + registers an offense when method name starts with "has" + without method definition macros + accepts method name when corrected name is invalid identifier + does not register any offenses when using an internal affair macro + registers an offense when using `define_method` + +RuboCop::Cop::Style::MethodCallWithArgsParentheses + when EnforcedStyle is omit_parentheses + register an offense for parens in the last chain + accepts special lambda call syntax + accepts parens in super method calls as arguments + accepts parens in calls with hash as arg + accepts parens in nested method args + accepts parens in operator method calls + accepts no parens in method call without args + autocorrects multi-line calls with trailing whitespace + accepts parens in slash regexp literal as argument + register an offense for parens in method call without args + register an offense for parens in string interpolation + register an offense for %r regex literal as arguments + accepts parens in chaining with safe operators + accepts parens in single-line inheritance + register an offense for superclass call with parens + accepts parens in range literals + accepts parens in chained method calls + register an offense in complex conditionals + accepts parens in literals with unary operators as first argument + accepts parens in method args + accepts parens in default argument value calls + accepts parens in ternary condition calls + accepts parens in block passing calls + register an offense in assignments + register an offense for yield call with parens + accepts parens in calls with args with logical operators + accepts parens in assignment in conditions + register an offense for hashes in keyword values + accepts parens in args splat + accepts parens in super calls with braced blocks + accepts no parens in method call with args + accepts parens in yield argument method calls + register an offense for multi-line method calls + autocorrects complex multi-line calls + accepts parens in default keyword argument value calls + register an offense for camel-case methods with arguments + accepts parens in calls with logical operators + accepts parens in splat calls + accepts parens in super without args + register an offense in multi-line inheritance + register an offense for parens in do-end blocks + autocorrects single-line calls + accepts parens in argument calls with braced blocks + accepts parens in chaining with operators + accepts parens in args with ternary conditions + accepts parens in implicit #to_proc + accepts parens in camel case method without args + accepts parens in blocks with braces + hash value omission in 3.1 + registers an offense using assignment with parentheses call expr follows + does not register an offense when without parentheses call expr follows + registers an offense when last argument is a hash value omission + registers an offense when with parentheses call expr follows + registers and corrects an offense when explicit hash value with parentheses and using modifier form + does not register an offense when hash value omission with parentheses and using modifier form + forwarded arguments in 2.7 + accepts parens for forwarded arguments + numbered parameters in 2.7 + accepts parens for braced numeric block calls + behaves like endless methods + endless methods + with arguments + requires method calls to have parens + without arguments + registers an offense when there are parens + does not register an offense when there are arguments + does not register an offense when there are no parens + does not register an offense for `defs` when there are arguments + registers an offense for `defs` when there are parens + allowing parenthesis in chaining + accepts no parens in the last call if previous calls with parens + register offense for multi-line chaining without previous parens + accepts parens in the last call if any previous calls with parentheses + register offense for single-line chaining without previous parens + forwarded arguments in 3.0 + accepts parens for forwarded arguments + allowing parens in camel-case methods + accepts parens for camel-case method names + allowing parens in multi-line calls + accepts parens for multi-line calls + when EnforcedStyle is require_parentheses (default) + accepts no parens in method call without args + autocorrects calls where the argument node is a number + accepts parens in method call with do-end blocks + register no offense for superclass call with parens + register an offense for non-receiver method call without parens + autocorrects partially parenthesized args by adding needed braces + autocorrects calls where arg is method call + accepts no parens for unary operators + register no offense for yield without args + register an offense for superclass call without parens + autocorrects fully parenthesized args by removing space + autocorrects call with multiple args by adding braces + autocorrects parenthesized args for local methods by removing space + register an offense for methods starting with capital without parens + register no offense for superclass call without args + autocorrects calls with multiple args by adding needed braces + autocorrects calls where the argument node is a constant + accepts no parens for setter methods + register an offense for method call without parens + autocorrects calls where multiple args are method calls + accepts parens in method call with args + accepts no parens for operators + register an offense for yield without parens + when using safe navigation operator + register an offense for method call without parens + when inspecting macro methods + in a module body + does not register an offense + in a class body + does not register an offense + AllowedPatterns + ignored methods listed in AllowedPatterns + with AllowedMethods + allow method listed in AllowedMethods + behaves like endless methods + endless methods + without arguments + does not register an offense for `defs` when there are parens + does not register an offense when there are no parens + does not register an offense when there are arguments + does not register an offense for `defs` when there are arguments + does not register an offense when there are parens + with arguments + requires method calls to have parens + when inspecting macro methods with IncludedMacros + in a class body + finds offense + for a macro in both IncludedMacros and AllowedMethods + allows + in a module body + finds offense + for a macro not on the included list + allows + behaves like endless methods + endless methods + with arguments + requires method calls to have parens + without arguments + does not register an offense when there are arguments + does not register an offense for `defs` when there are parens + does not register an offense when there are parens + does not register an offense for `defs` when there are arguments + does not register an offense when there are no parens + allowing parens in string interpolation + accepts parens for camel-case method names + +RuboCop::Cop::Style::TrailingMethodEndStatement + autocorrects all trailing ends for larger example + register offense with trailing end on method with block + does not register on single line no op + register offense with trailing end on method with comment + register offense with trailing end on 3 line method + register offense with trailing end inside class + register offense with trailing end on 2 line method + does not register on single line method + when Ruby 3.0 or higher + does not register an offense when using endless method definition + does not register an offense when endless method definition signature and body are on different lines + +RuboCop::Cop::Corrector + #rewrite + allows insertion before and after a source range + accepts a node instead of a range + allows insertion before a source range + allows replacement of a range + allows removal of a range + allows removal of characters from range ending + allows insertion after a source range + allows removal of characters preceding range + allows removal of characters from range beginning + raises a useful error if not given a node or a range + when range is from incorrect source + raises exception from remove_trailing + raises exception from insert_before + raises exception from remove + raises exception from replace + raises exception from remove_preceding + raises exception from remove_leading + raises exception from insert_after + +RuboCop::Cop::Severity + redefines == to compare severities + overrides #to_s + is frozen + has a few required attributes + constructs from code + R + is expected to eq # + W + is expected to eq # + C + is expected to eq # + F + is expected to eq # + E + is expected to eq # + I + is expected to eq # + #level + error + is expected to eq 5 + convention + is expected to eq 3 + fatal + is expected to eq 6 + warning + is expected to eq 4 + refactor + is expected to eq 2 + info + is expected to eq 1 + #code + convention + is expected to eq "C" + error + is expected to eq "E" + fatal + is expected to eq "F" + warning + is expected to eq "W" + info + is expected to eq "I" + refactor + is expected to eq "R" + Comparable + convention + is expected to be < warning + info + is expected to be < refactor + refactor + is expected to be < convention + error + is expected to be < fatal + warning + is expected to be < error + +RuboCop::Formatter::OffenseCountFormatter + #finished + when there are many offenses + when --display-style-guide was given + shows links and sorts by offense count first and then by cop name + when --display-style-guide was not given + sorts by offense count first and then by cop name + when output tty is true + has a progress bar + #file_finished + when any offenses are detected + increments the count for the cop in offense_counts + when no offenses are detected + does not add to offense_counts + #report_summary + when an offense is detected + shows the cop and the offense count + +RuboCop::Cop::Layout::FirstMethodArgumentLineBreak + ignores arguments listed on a single line + ignores kwargs listed on a single line when the arguments are used in `super` + registers an offense and corrects hash arg spanning multiple lines + registers an offense and corrects hash arg without a line break before the first pair + ignores arguments without parens + ignores methods without arguments + args listed on the first line + registers an offense and corrects using `super` + registers an offense and corrects using safe navigation operator + registers an offense and corrects + +RuboCop::Cop::Style::MapCompactWithConditionalBlock + With single line block + registers an offense and corrects to `select` with modifier form of `if` condition + registers an offense and corrects to `reject` with ternary expression + registers an offense and corrects to `reject` with modifier form of `unless` condition + registers an offense and corrects to `select` with ternary expression + does not register offenses if `compact` is not chained to `map` + With multiline block + registers an offense and corrects to `select` with guard clause of `if` and `next` has a value and return nil + registers an offense and corrects to `reject` with guard clause of `unless` and `next` has a value and return nil + does not register offenses if there are multiple guard clauses + registers an offense and corrects to `select` with guard clause of `if` + registers an offense and corrects to `reject` with guard clause of `unless` and `next` explicitly nil + registers an offense and corrects to `select` with multi-line `if` condition + registers an offense and corrects to `select` with guard clause of `if` and `next` has a value + registers an offense and corrects to `select` if `next value` in if_branch and `nil` in else_branch + registers an offense and corrects to `select` if condition has not else branch + registers an offense and corrects to `select` with `if` condition + registers an offense and corrects to `reject` with ternary expression + registers an offense and corrects to `reject` with `unless` condition + registers an offense and corrects to `select` with guard clause of `if` and next explicitly nil + registers an offense and corrects to `select` with modifier form of `if` condition + registers an offense and corrects to `reject` if `next value` in else_branch and `nil` in if_branch + does not register offenses if return value is not same as block argument + does not register offenses if condition has elsif branch + does not register offenses if `compact` is not chained to `map` + registers an offense and corrects to `reject` with `if` condition + registers an offense and corrects to `reject` with guard clause of `unless` + registers an offense and corrects to `select` with ternary expression + registers an offense and corrects to `reject` with modifier form of `unless` condition + registers an offense and corrects to `reject` with guard clause of `unless` and `next` has a value + +RuboCop::CommentConfig + comment_only_line? + when line contains only code + returns false + returns false + returns false + returns false + when line contains code and comment + returns false + when line is empty + returns true + when line contains only comment + returns true + returns true + #cop_enabled_at_line? + supports enabling/disabling cops without a prefix + supports disabling cops on a comment line with an EOL comment + does not confuse a cop name including "all" with all cops + supports disabling all cops except Lint/RedundantCopDisableDirective with keyword all + supports disabling multiple lines with a pair of directive + supports disabling cops with multiple uppercase letters + supports disabling cops with multiple levels in department name + supports enabling/disabling multiple cops in a single directive + does not confuse a comment directive embedded in a string literal with a real comment + can handle double disable of one cop + handles indented single line + supports disabling all lines after a directive + supports disabling cops with numbers in their name + supports enabling/disabling multiple cops along with a comment + supports disabling single line with a directive at end of line + just ignores unpaired enabling directives + #cop_disabled_line_ranges + collects line ranges by disabled cops + #extra_enabled_comments + has values as arrays of extra enabled cops + has keys as instances of Parser::Source::Comment for extra enabled comments + +RuboCop::Cop::Bundler::OrderedGems + when a gem is referenced from a variable + resets the sorting to a new block + ignores the line + When the gemfile is empty + does not register any offenses + When there are duplicated gems in group + registers an offense + When gems have an inline comment, and not sorted + registers an offense + When a gem is sorted but not so when disregarding _- + when ConsiderPunctuation is true + does not register an offense + by default + registers an offense + When a gem that starts with a capital letter is sorted + does not register an offense + When gems are not alphabetically sorted + registers an offense + When gem groups is separated by multiline comment + with TreatCommentsAsGroupSeparators: false + registers an offense + with TreatCommentsAsGroupSeparators: true + accepts + When a gem that starts with a capital letter is not sorted + registers an offense + When gems are asciibetically sorted irrespective of _ + does not register an offense + When each individual group of line is sorted + does not register any offenses + When gems are alphabetically sorted + does not register any offenses + When each individual group of line is not sorted + registers some offenses + When a gem declaration takes several lines + registers an offense + +RuboCop::Cop::Style::DisableCopsWithinSourceCodeDirective + registers an offense for disabling all cops + registers an offense for disabled cop within source code + registers an offense for enabled cop within source code + with AllowedCops + when using leading source comment + does not register an offense + when an allowed cop is disabled + does not register an offense + when an non-allowed cop is disabled + registers an offense and corrects + when an mix of cops are disabled + registers an offense and corrects + +RuboCop::YAMLDuplicationChecker + when yaml does not have any duplication + does not call block + when yaml has duplicated keys in the top level + calls block with keys + calls block + when yaml has duplicated keys in the second level + calls block + calls block with keys + +RuboCop::Cop::Style::NilComparison + configured with predicate preferred + registers an offense for === nil + registers an offense for == nil + registers and corrects an offense when using `x == nil` as a guard condition + configured with comparison preferred + registers and corrects an offense for `!x.nil?` + registers an offense for nil? + +RuboCop::Cop::Style::EmptyLiteral + Empty Array + registers an offense for Array.new + does not register Array.new with block in other block + autocorrects Array.new in block in block + registers an offense for Array.new() + does not register an offense for Array.new(3) + registers an offense for ::Array.new + does not register an offense Array.new with block + does not register an offense for ::Array.new with block + Empty String + does not register an offense for ::String.new("top") + does not register an offense for String.new("top") + registers an offense for ::String.new + registers an offense for String.new() + registers an offense for String.new + when frozen string literals is enabled + does not register an offense for String.new + when Style/FrozenStringLiteral is enabled + and there is a frozen_string_literal: false comment + registers an offense and corrects + and there is no magic comment + does not register an offense + when double-quoted string literals are preferred + registers an offense for ::String.new + registers an offense for String.new + Empty Hash + registers an offense for ::Hash.new + registers an offense for Hash.new() + autocorrects Hash.new to {} and wraps it in parentheses when it is the only argument to super + does not register an offense for Hash.new { block } + autocorrects Hash.new to {} and wraps all arguments in parentheses when it is the first argument to super + registers an offense for Hash.new + autocorrects Hash.new in block + autocorrects Hash.new to {} as the first parameter to a method + does not register an offense for Hash.new(3) + does not register an offense for ::Hash.new { block } + does not register an offense for ::Hash.new(3) + autocorrects Hash.new to {} as the only parameter to a method + autocorrects Hash.new to {} in various contexts + Ruby 2.7 + does not register an offense for ::Hash.new { _1[_2] = [] } + does not register an offense for Hash.new { _1[_2] = [] } + +RuboCop::Cop::Style::InfiniteLoop + accepts Kernel#loop + registers an offense for a until loop with nil as condition + registers an offense for modifier until false if loop {} would not change semantics + registers an offense for a while loop with 1 as condition + registers an offense for until false if loop {} would work because of previous assignment in a while loop + accepts modifier while true if loop {} would change semantics + registers an offense for a while loop with {} as condition + registers an offense for until false if loop {} would work because the assigned variable is not used afterwards + registers an offense for while true if loop {} would work because it is an instance variable being assigned + registers an offense for a while loop with 2.0 as condition + accepts while true if loop {} would change semantics + registers an offense for a until loop with false as condition + registers an offense for a while loop with [1] as condition + registers an offense for while true or until false if loop {} would work because of an earlier assignment + behaves like autocorrector + autocorrects begin-end-while with one statement + autocorrects the usage of while without do + autocorrects the usage of while with do + autocorrects single line modifier while + autocorrects single line modifier while with and + autocorrects begin-end-while with two statements + with non-default indentation width + autocorrects multi-line modifier while and indents correctly + behaves like autocorrector + autocorrects the usage of until without do + autocorrects single line modifier until with and + autocorrects the usage of until with do + autocorrects begin-end-until with two statements + autocorrects begin-end-until with one statement + autocorrects single line modifier until + with non-default indentation width + autocorrects multi-line modifier until and indents correctly + +RuboCop::Cop::Lint::AmbiguousAssignment + registers an offense when using `+` with `$x` + registers an offense when using `-` with `x` + registers an offense when using `*` with `@@x` + registers an offense when using `*` with `@x` + does not register an offense when no mistype assignments + registers an offense when using `!` with `@x` + registers an offense when using `*` with `$x` + registers an offense when using `+` with `x` + does not register an offense when no mistype assignments + does not register an offense when no mistype assignments + does not register an offense when no mistype assignments + registers an offense when using `!` with `@@x` + registers an offense when using `-` with `@@x` + does not register an offense when no mistype assignments + does not register an offense when no mistype assignments + registers an offense when using `!` with `x` + does not register an offense when no mistype assignments + does not register an offense when no mistype assignments + does not register an offense when no mistype assignments + does not register an offense when no mistype assignments + does not register an offense when no mistype assignments + does not register an offense when no mistype assignments + registers an offense when using `!` with `$x` + does not register an offense when no mistype assignments + does not register an offense when no mistype assignments + does not register an offense when no mistype assignments + registers an offense when using `-` with `$x` + registers an offense when using `-` with `@x` + does not register an offense when no mistype assignments + does not register an offense when no mistype assignments + registers an offense when using `!` with `X` + registers an offense when using `+` with `@@x` + does not register an offense when no mistype assignments + registers an offense when using `+` with `X` + registers an offense when using `+` with `@x` + does not register an offense when no mistype assignments + registers an offense when using `*` with `X` + does not register an offense when no mistype assignments + registers an offense when using `*` with `x` + registers an offense when using `-` with `X` + +RuboCop::Cop::Lint::MultipleComparison + registers an offense for x > y > z + registers an offense for x > y >= z + accepts to use `&` operator + registers an offense for x < y < z + registers an offense for x >= y > z + registers an offense for x >= y < z + registers an offense for x < y >= z + registers an offense for x < y <= z + registers an offense for x > y <= z + accepts to use one compare operator + registers an offense for x >= y <= z + registers an offense for x >= y >= z + accepts to use `^` operator + registers an offense for x <= y >= z + registers an offense for x <= y < z + registers an offense for x > y < z + registers an offense for x <= y <= z + registers an offense for x < y > z + accepts to use `|` operator + registers an offense for x <= y > z + +RuboCop::Cop::Style::OperatorMethodCall + registers an offense when using `foo.=== bar` + registers an offense when using `foo.>(bar)` + registers an offense when using `foo.-(bar)` + does not register an offense when using `foo <=> bar` + does not register an offense when using `foo === bar` + does not register an offense when using `foo.~@bar` + does not register an offense when using `Foo.+(bar)` + registers an offense when chaining `foo.bar.**(baz).round(2)` + registers an offense when using `foo.>>(bar)` + does not register an offense when using `foo >> bar` + registers an offense when using `foo.< bar` + does not register an offense when using `foo <= bar` + registers an offense when using `foo.+(bar)` + does not register an offense when using `obj.!` + does not register an offense when using `foo < bar` + does not register an offense when using `foo ^ bar` + registers an offense when chaining `foo.bar.^(baz).round(2)` + registers an offense when chaining `foo.bar.~(baz).round(2)` + does not register an offense when using `foo << bar` + registers an offense when chaining `foo.bar./(baz).round(2)` + registers an offense when chaining `foo.bar.*(baz).round(2)` + registers an offense when using `foo.** bar` + registers an offense when chaining `foo.bar.>=(baz).round(2)` + does not register an offense when using `foo =~ bar` + registers an offense when using `foo.<=(bar)` + registers an offense when using `foo.|(bar)` + does not register an offense when using `foo !~ bar` + registers an offense when using `foo./(bar)` + registers an offense when chaining `foo.bar.-(baz).round(2)` + does not register an offense when using `foo.!@bar` + registers an offense when using `foo.>=(bar)` + registers an offense when using `foo.!= bar` + does not register an offense when using `foo.+@bar.to_s` + registers an offense when chaining `foo.bar.!=(baz).round(2)` + registers an offense when using `foo.%(bar)` + registers an offense when using `foo.*(bar)` + registers an offense when using `foo.- bar` + registers an offense when using `foo.| bar` + does not register an offense when using `foo > bar` + registers an offense when using `foo.!~(bar)` + does not register an offense when using `foo.`bar` + registers an offense when using `foo.&(bar)` + does not register an offense when using `foo ~ bar` + does not register an offense when using `foo - bar` + registers an offense when chaining `foo.bar.<(baz).round(2)` + registers an offense when chaining `foo.bar.<=>(baz).round(2)` + does not register an offense when using `foo % bar` + registers an offense when using `foo.<=>(bar)` + does not register an offense when using `foo * bar` + registers an offense when using `foo.> bar` + registers an offense when using `foo.<=> bar` + registers an offense when using `foo.=~ bar` + registers an offense when using `foo.== bar` + registers an offense when using `foo.^ bar` + registers an offense when using `foo.>= bar` + registers an offense when using `foo.**(bar)` + registers an offense when using `foo.~(bar)` + registers an offense when chaining `foo.bar.<=(baz).round(2)` + does not register an offense when using `foo / bar` + registers an offense when using `foo.* bar` + does not register an offense when using `foo.-@bar` + does not register an offense when using `foo >= bar` + does not register an offense when using `foo ** bar` + registers an offense when using `foo.!(bar)` + does not register an offense when using `foo + bar` + registers an offense when using `foo.+ bar` + registers an offense when chaining `foo.bar.+(baz).round(2)` + registers an offense when using `foo.<(bar)` + registers an offense when using `foo.!=(bar)` + registers an offense when chaining `foo.bar.|(baz).round(2)` + registers an offense when chaining `foo.bar.%(baz).round(2)` + registers an offense when chaining `foo.bar.=~(baz).round(2)` + registers an offense when using `foo.! bar` + does not register an offense when using `foo.+@bar` + registers an offense when using `foo.!~ bar` + does not register an offense when using `foo ! bar` + registers an offense when using `foo./ bar` + registers an offense when using `foo.<= bar` + registers an offense when using `foo.===(bar)` + does not register an offense when using `foo | bar` + registers an offense when using `foo.=~(bar)` + registers an offense when using `foo.==(bar)` + registers an offense when chaining `foo.bar.!~(baz).round(2)` + does not register an offense when using `foo == bar` + registers an offense when chaining `foo.bar.&(baz).round(2)` + registers an offense when using `foo.>> bar` + registers an offense when chaining `foo.bar.===(baz).round(2)` + registers an offense when using `foo.<<(bar)` + registers an offense when chaining `foo.bar.<<(baz).round(2)` + does not register an offense when using `foo != bar` + registers an offense when chaining `foo.bar.!(baz).round(2)` + registers an offense when chaining `foo.bar.>>(baz).round(2)` + registers an offense when chaining `foo.bar.>(baz).round(2)` + registers an offense when using `foo.~ bar` + does not register an offense when using `foo & bar` + registers an offense when using `foo.^(bar)` + registers an offense when using `foo.& bar` + registers an offense when using `foo.% bar` + registers an offense when using `foo.<< bar` + registers an offense when chaining `foo.bar.==(baz).round(2)` + +RuboCop::Cop::Lint::DuplicateRegexpCharacterClassElement + with repeated elements in different character classes + does not register an offense + with a repeated character class element and %r{} literal + registers an offense and corrects + with a repeated character posix character class inside a group + registers an offense and corrects + with a repeated character class element + registers an offense and corrects + with a repeated intersection character class + does not register an offense + with a range that covers a repeated element character class + does not register an offense + with a repeated range element + registers an offense and corrects + with a repeated character class element with quantifier + registers an offense and corrects + with no repeated character class elements when `"\0\07"` (means `"\u0000\a"`) + does not register an offense + with repeated character class elements when `"\0\08"` (means `"\u0000\u00008"`) + registers an offense + with a repeated character class element with interpolation + registers an offense and corrects + with no repeated character class elements + does not register an offense + with a repeated character class element inside a group + registers an offense and corrects + with multiple regexps with the same interpolation + does not register an offense + +RuboCop::Cop::Style::DoubleCopDisableDirective + registers an offense for duplicate todo directives + registers an offense for duplicate disable directives + does not register an offense for cops with single cop directive + +RuboCop::Cop::Layout::EndOfLine + when EnforcedStyle is lf + registers an offense for CR at end of file + accepts an empty file + registers an offense for CR+LF + does not register offenses after __END__ + and the default external encoding is US_ASCII + does not crash on UTF-8 encoded non-ascii characters + can inspect non-UTF-8 encoded source with proper encoding comment + and there are many lines ending with CR+LF + can inspect non-UTF-8 encoded source with proper encoding comment + registers only one offense + when EnforcedStyle is native + registers an offense for an incorrect EOL + when EnforcedStyle is crlf + does not register offense for no CR at end of file + registers an offense for CR+LF + accepts an empty file + does not register offenses after __END__ + and the default external encoding is US_ASCII + can inspect non-UTF-8 encoded source with proper encoding comment + does not crash on UTF-8 encoded non-ascii characters + and there are many lines ending with LF + registers only one offense + can inspect non-UTF-8 encoded source with proper encoding comment + +RuboCop::Cop::Lint::NonDeterministicRequireOrder + when not requiring files + does not register an offense + when requiring files + with sorted glob + does not register an offense + with sorted index + does not register an offense + when Ruby 3.0 or higher + with `Dir[]` + does not register an offense + with extra logic + does not register an offense + with require block passed as parameter + does not register an offense + with top-level ::Dir + does not register an offense + with direct block glob + does not register an offense + with require block passed as parameter + does not register an offense + with top-level ::Dir + does not register an offense + with `Dir.glob` + does not register an offense + with `sort: false` keyword option + does not register an offense + with require block passed as parameter + does not register an offense + with top-level ::Dir + does not register an offense + when Ruby 2.7 or lower + with unsorted index + registers an offense and autocorrects to add .sort when the block has `require` + registers an offense with extra logic + registers an offense and autocorrects to add .sort when the numblock has `require` + registers an offense and autocorrects to add .sort when the block has `require_relative` + with top-level ::Dir + registers an offense and corrects to add .sort + with require_relative block passed as parameter + registers an offense an autocorrects to add sort + with require block passed as parameter + registers an offense an autocorrects to add sort + with unsorted glob + registers an offense and autocorrects to add .sort + with require block passed as parameter + registers an offense an autocorrects to add sort + with top-level ::Dir + registers an offense and corrects to add .sort + with direct block glob + registers an offense and autocorrects to add .sort.each + with require block passed as parameter + registers an offense and autocorrects to add sort + with top-level ::Dir + registers an offense and corrects to add .sort.each + with require_relative block passed as parameter + registers an offense and autocorrects to add sort + +RuboCop::Cop::Layout::SpaceInsidePercentLiteralDelimiters + accepts other percent literals + accepts execute-string literals + for i type and ["{", "}"] delimiters + accepts literals without additional spaces + accepts multi-line literals within a method + registers an offense for literals with escaped and other spaces + accepts spaces between entries + registers an offense for spaces before final delimiter + accepts multi-line literals registers an offense for unnecessary spaces accepts newlines and additional following alignment spaces + registers an offense for spaces after first delimiter + accepts literals with escaped spaces + with space in blank percent literals + registers and corrects an offense + with spaces in blank percent literals + registers and corrects an offense + with newline in blank percent literals + registers and corrects an offense + for I type and ["[", "]"] delimiters + accepts spaces between entries + accepts literals with escaped spaces accepts literals without additional spaces + accepts newlines and additional following alignment spaces + accepts multi-line literals within a method + registers an offense for literals with escaped and other spaces + registers an offense for spaces after first delimiter + accepts multi-line literals + registers an offense for unnecessary spaces + registers an offense for spaces before final delimiter with space in blank percent literals registers and corrects an offense with newline in blank percent literals registers and corrects an offense with spaces in blank percent literals registers and corrects an offense - for x type and ["!", "!"] delimiters - accepts multi-line literals within a method + for w type and ["!", "!"] delimiters registers an offense for spaces before final delimiter + accepts multi-line literals + registers an offense for literals with escaped and other spaces registers an offense for spaces after first delimiter + registers an offense for unnecessary spaces + accepts literals without additional spaces + accepts multi-line literals within a method + accepts newlines and additional following alignment spaces + accepts spaces between entries + accepts literals with escaped spaces + with space in blank percent literals + registers and corrects an offense + with newline in blank percent literals + registers and corrects an offense + with spaces in blank percent literals + registers and corrects an offense + for x type and ["!", "!"] delimiters accepts spaces between entries + accepts multi-line literals + accepts literals with escaped spaces + registers an offense for literals with escaped and other spaces accepts literals without additional spaces + accepts multi-line literals within a method + registers an offense for spaces after first delimiter registers an offense for unnecessary spaces - registers an offense for literals with escaped and other spaces + registers an offense for spaces before final delimiter + accepts newlines and additional following alignment spaces + with newline in blank percent literals + registers and corrects an offense + with spaces in blank percent literals + registers and corrects an offense + with space in blank percent literals + registers and corrects an offense + for x type and ["{", "}"] delimiters + accepts multi-line literals within a method accepts multi-line literals + registers an offense for spaces before final delimiter + accepts spaces between entries accepts literals with escaped spaces + accepts literals without additional spaces + registers an offense for spaces after first delimiter + registers an offense for unnecessary spaces + registers an offense for literals with escaped and other spaces accepts newlines and additional following alignment spaces - with space in blank percent literals + with spaces in blank percent literals registers and corrects an offense with newline in blank percent literals registers and corrects an offense - with spaces in blank percent literals + with space in blank percent literals registers and corrects an offense for i type and ["[", "]"] delimiters + registers an offense for unnecessary spaces + accepts multi-line literals + registers an offense for spaces after first delimiter accepts spaces between entries + accepts literals with escaped spaces accepts newlines and additional following alignment spaces + registers an offense for literals with escaped and other spaces + registers an offense for spaces before final delimiter accepts multi-line literals within a method - registers an offense for unnecessary spaces + accepts literals without additional spaces + with space in blank percent literals + registers and corrects an offense + with spaces in blank percent literals + registers and corrects an offense + with newline in blank percent literals + registers and corrects an offense + for W type and ["(", ")"] delimiters accepts literals with escaped spaces + registers an offense for unnecessary spaces + accepts literals without additional spaces registers an offense for spaces before final delimiter accepts multi-line literals - registers an offense for spaces after first delimiter registers an offense for literals with escaped and other spaces - accepts literals without additional spaces + accepts newlines and additional following alignment spaces + registers an offense for spaces after first delimiter + accepts multi-line literals within a method + accepts spaces between entries with space in blank percent literals registers and corrects an offense with spaces in blank percent literals registers and corrects an offense with newline in blank percent literals registers and corrects an offense - for I type and ["!", "!"] delimiters + for w type and ["[", "]"] delimiters + registers an offense for unnecessary spaces registers an offense for literals with escaped and other spaces - accepts spaces between entries accepts literals without additional spaces - registers an offense for spaces after first delimiter - accepts multi-line literals accepts newlines and additional following alignment spaces - registers an offense for unnecessary spaces accepts literals with escaped spaces - registers an offense for spaces before final delimiter accepts multi-line literals within a method + accepts spaces between entries + accepts multi-line literals + registers an offense for spaces before final delimiter + registers an offense for spaces after first delimiter with newline in blank percent literals registers and corrects an offense with spaces in blank percent literals registers and corrects an offense with space in blank percent literals registers and corrects an offense - for w type and ["{", "}"] delimiters - registers an offense for spaces after first delimiter - accepts multi-line literals within a method - accepts literals with escaped spaces + for I type and ["(", ")"] delimiters + accepts newlines and additional following alignment spaces registers an offense for spaces before final delimiter - accepts multi-line literals + accepts multi-line literals within a method + registers an offense for spaces after first delimiter + accepts literals without additional spaces registers an offense for literals with escaped and other spaces - accepts newlines and additional following alignment spaces + accepts multi-line literals + accepts literals with escaped spaces accepts spaces between entries - accepts literals without additional spaces registers an offense for unnecessary spaces + with spaces in blank percent literals + registers and corrects an offense with newline in blank percent literals registers and corrects an offense with space in blank percent literals registers and corrects an offense + for i type and ["!", "!"] delimiters + accepts multi-line literals + accepts multi-line literals within a method + registers an offense for spaces after first delimiter + accepts newlines and additional following alignment spaces + accepts literals without additional spaces + registers an offense for unnecessary spaces + accepts spaces between entries + accepts literals with escaped spaces + registers an offense for spaces before final delimiter + registers an offense for literals with escaped and other spaces + with space in blank percent literals + registers and corrects an offense + with newline in blank percent literals + registers and corrects an offense with spaces in blank percent literals registers and corrects an offense - for w type and ["[", "]"] delimiters - accepts literals with escaped spaces + for I type and ["!", "!"] delimiters accepts literals without additional spaces - accepts multi-line literals + registers an offense for spaces before final delimiter accepts multi-line literals within a method - registers an offense for literals with escaped and other spaces - registers an offense for unnecessary spaces accepts spaces between entries + accepts literals with escaped spaces + registers an offense for unnecessary spaces + accepts multi-line literals accepts newlines and additional following alignment spaces registers an offense for spaces after first delimiter + registers an offense for literals with escaped and other spaces + with spaces in blank percent literals + registers and corrects an offense + with newline in blank percent literals + registers and corrects an offense + with space in blank percent literals + registers and corrects an offense + for w type and ["(", ")"] delimiters + accepts newlines and additional following alignment spaces + accepts multi-line literals within a method registers an offense for spaces before final delimiter + registers an offense for unnecessary spaces + accepts spaces between entries + registers an offense for spaces after first delimiter + accepts literals without additional spaces + registers an offense for literals with escaped and other spaces + accepts multi-line literals + accepts literals with escaped spaces with spaces in blank percent literals registers and corrects an offense with space in blank percent literals registers and corrects an offense with newline in blank percent literals registers and corrects an offense - for i type and ["{", "}"] delimiters + for I type and ["{", "}"] delimiters + registers an offense for unnecessary spaces + accepts literals with escaped spaces + registers an offense for spaces before final delimiter + accepts newlines and additional following alignment spaces + registers an offense for spaces after first delimiter + registers an offense for literals with escaped and other spaces accepts literals without additional spaces accepts multi-line literals accepts spaces between entries - registers an offense for literals with escaped and other spaces - registers an offense for spaces before final delimiter - accepts literals with escaped spaces accepts multi-line literals within a method + with space in blank percent literals + registers and corrects an offense + with newline in blank percent literals + registers and corrects an offense + with spaces in blank percent literals + registers and corrects an offense + for x type and ["[", "]"] delimiters + accepts multi-line literals within a method + accepts multi-line literals registers an offense for unnecessary spaces accepts newlines and additional following alignment spaces + accepts literals without additional spaces + registers an offense for spaces before final delimiter + accepts spaces between entries + registers an offense for literals with escaped and other spaces registers an offense for spaces after first delimiter + accepts literals with escaped spaces with space in blank percent literals registers and corrects an offense with spaces in blank percent literals registers and corrects an offense with newline in blank percent literals registers and corrects an offense - for W type and ["!", "!"] delimiters + for w type and ["{", "}"] delimiters accepts multi-line literals - registers an offense for spaces after first delimiter + registers an offense for unnecessary spaces + accepts newlines and additional following alignment spaces + accepts literals with escaped spaces registers an offense for literals with escaped and other spaces - accepts literals without additional spaces accepts multi-line literals within a method - accepts newlines and additional following alignment spaces - registers an offense for unnecessary spaces - accepts spaces between entries registers an offense for spaces before final delimiter - accepts literals with escaped spaces - with spaces in blank percent literals - registers and corrects an offense + accepts spaces between entries + registers an offense for spaces after first delimiter + accepts literals without additional spaces with space in blank percent literals registers and corrects an offense with newline in blank percent literals registers and corrects an offense - for I type and ["(", ")"] delimiters - accepts multi-line literals within a method + with spaces in blank percent literals + registers and corrects an offense + for W type and ["{", "}"] delimiters + registers an offense for literals with escaped and other spaces registers an offense for spaces before final delimiter + registers an offense for spaces after first delimiter accepts spaces between entries - registers an offense for unnecessary spaces accepts literals with escaped spaces - accepts literals without additional spaces - registers an offense for spaces after first delimiter - registers an offense for literals with escaped and other spaces - accepts newlines and additional following alignment spaces + registers an offense for unnecessary spaces accepts multi-line literals + accepts multi-line literals within a method + accepts newlines and additional following alignment spaces + accepts literals without additional spaces with space in blank percent literals registers and corrects an offense with newline in blank percent literals registers and corrects an offense with spaces in blank percent literals registers and corrects an offense - for w type and ["!", "!"] delimiters + for i type and ["(", ")"] delimiters + registers an offense for unnecessary spaces + registers an offense for literals with escaped and other spaces + accepts multi-line literals + accepts spaces between entries accepts literals without additional spaces + registers an offense for spaces before final delimiter registers an offense for spaces after first delimiter accepts literals with escaped spaces accepts multi-line literals within a method - registers an offense for unnecessary spaces accepts newlines and additional following alignment spaces + with space in blank percent literals + registers and corrects an offense + with newline in blank percent literals + registers and corrects an offense + with spaces in blank percent literals + registers and corrects an offense + for W type and ["[", "]"] delimiters + accepts newlines and additional following alignment spaces + accepts literals without additional spaces + accepts literals with escaped spaces + accepts multi-line literals registers an offense for literals with escaped and other spaces + accepts spaces between entries + registers an offense for spaces before final delimiter + accepts multi-line literals within a method + registers an offense for unnecessary spaces + registers an offense for spaces after first delimiter + with spaces in blank percent literals + registers and corrects an offense + with newline in blank percent literals + registers and corrects an offense + with space in blank percent literals + registers and corrects an offense + for W type and ["!", "!"] delimiters accepts multi-line literals + accepts newlines and additional following alignment spaces accepts spaces between entries + accepts literals without additional spaces + registers an offense for unnecessary spaces + registers an offense for literals with escaped and other spaces + registers an offense for spaces after first delimiter + accepts literals with escaped spaces + accepts multi-line literals within a method registers an offense for spaces before final delimiter + with newline in blank percent literals + registers and corrects an offense with spaces in blank percent literals registers and corrects an offense + with space in blank percent literals + registers and corrects an offense + for x type and ["(", ")"] delimiters + registers an offense for literals with escaped and other spaces + accepts multi-line literals within a method + accepts literals with escaped spaces + accepts newlines and additional following alignment spaces + registers an offense for spaces before final delimiter + accepts multi-line literals + accepts spaces between entries + accepts literals without additional spaces + registers an offense for unnecessary spaces + registers an offense for spaces after first delimiter with newline in blank percent literals registers and corrects an offense + with spaces in blank percent literals + registers and corrects an offense with space in blank percent literals registers and corrects an offense -RuboCop::Cop::Style::DateTime - registers an offense when using DateTime for modern date - does not register an offense when using ::DateTime for historic date - registers an offense when using DateTime for current time - does not register an offense when using DateTime in another namespace - does not register an offense when using Date for modern date - does not register an offense when using DateTime for historic date - registers an offense when using ::DateTime for current time - does not register an offense when using Time for current time - when configured to not allow #to_datetime - registers an offense - when configured to allow #to_datetime - does not register an offense +RuboCop::Cop::Lint::DeprecatedOpenSSLConstant + registers an offense with cipher constant and no arguments and corrects + registers an offense with AES + blocksize constant and corrects + does not register an offense with cipher constant and argument is a constant + registers an offense with cipher constant and two arguments and corrects + registers an offense with cipher constant and no arguments and corrects + registers an offense when using ::Digest class methods on an algorithm constant and corrects + does not register an offense when building digest using an algorithm string + registers an offense with cipher constant and one argument and corrects + does not register an offense when using ::Digest class methods with an algorithm string and value + registers an offense with cipher constant and no arguments and corrects + registers an offense with cipher constant and double quoted string argument and corrects + registers an offense with cipher constant and no arguments and corrects + registers an offense with cipher constant and `cbc` argument and corrects + does not register an offense with cipher constant and send argument is a method + registers an offense when using an digest constant with chained methods and corrects + registers an offense with AES + blocksize constant and mode argument and corrects + registers an offense when building an instance using an digest constant and corrects + does not register an offense when building digest using an algorithm string and nested digest constants + does not register an offense when using cipher with a string + does not register an offense with cipher constant and argument is a variable + when used in a block + registers an offense when using ::Digest class methods on an algorithm constant and corrects -RuboCop::Cop::Style::StringLiterals - when configured with a bad value - fails - when ConsistentQuotesInMultiline is true - and EnforcedStyle is single_quotes - accepts continued strings using all single quotes - doesn't register offense for double quotes with interpolation - doesn't choke on heredocs with inconsistent indentation - doesn't register offense for double quotes with embedded single - registers an offense for mixed quote styles in a continued string - accepts for double quotes with an escaped normal character - registers an offense for strings with line breaks in them - accepts for double quotes with an escaped special character - registers an offense for unneeded double quotes in continuation - and EnforcedStyle is double_quotes - doesn't register offense for single quotes with embedded double - registers an offense for mixed quote styles in a continued string - accepts continued strings using all double quotes - registers an offense for unneeded single quotes in continuation - configured with double quotes preferred - registers offense for opposite + correct - accepts single quotes in interpolation - accepts ' in a %w - registers offense for escaped single quote in single quotes - does not accept multiple escaped single quotes in single quotes - flags single quotes with plain # (not #@var or #{interpolation} or #$global - accepts escaped single quote in string with escaped non-' character - accepts double quotes - accepts % quotes - accepts single quotes when they are needed - accepts single quotes at the start of regexp literals - accepts heredocs - registers offense for single quotes when double quotes would be equivalent - accepts single quotes in string with escaped non-' character - can handle a built-in constant parsed as string - accepts single quoted string with backslash - accepts %q and %Q quotes - configured with single quotes preferred - accepts " in a %w - accepts double quotes when single quotes are used - accepts double quotes when new line is used - accepts double quotes when interpolating an instance variable - registers offense for double quotes when single quotes suffice - accepts double quotes when control characters are used - does not register an offense for words with non-ascii chars and other control sequences - accepts double quotes with some other special symbols - accepts heredocs - accepts double quotes when unicode control sequence is used - accepts double quotes when interpolating a class variable - accepts % quotes - can handle a built-in constant parsed as string - can handle character literals - registers an offense for "\"" - accepts single quotes in interpolation - accepts double quotes at the start of regexp literals - accepts %q and %Q quotes - accepts single quotes - registers offense for correct + opposite - accepts double quotes when interpolating a global variable - accepts double quotes when interpolating & quotes in multiple lines - registers an offense for words with non-ascii chars - accepts double quotes in interpolation - detects unneeded double quotes within concatenated string - registers an offense for "\" - accepts \\\n in a string +RuboCop::Cop::Style::EmptyBlockParameter + accepts a block that is {} style without parameter + registers an offense for an empty block parameter with {} style + accepts a block that is do-end style without parameter + registers an offense for an empty block parameter with do-end style + registers an offense for an empty block parameter with lambda + accepts a non-empty block parameter with do-end style + accepts an empty block parameter with a lambda + accepts a non-empty block parameter with {} style + registers an offense for an empty block parameter with super -RuboCop::Cop::Style::MultilineMethodSignature - when arguments span multiple lines - when correction would not exceed maximum line length - registers an offense and corrects - when correction would exceed maximum line length - does not register an offense - when defining an instance method - registers an offense and corrects when `end` is on the same line with last argument - registers an offense and corrects when `end` is on the same line with only closing parentheses - registers an offense and corrects when `end` is on the following line - when defining an class method - registers an offense and corrects when `end` is on the same line with only closing parentheses - registers an offense and corrects when `end` is on the same line - registers an offense and corrects when `end` is on the following line - when arguments span a single line - when defining an instance method - registers an offense and corrects when closing paren is on the following line - registers an offense and corrects when line break after opening parenthesis - when method signature is on a single line - does not register an offense for unparameterized method - does not register an offense for parameterized method - when defining an class method - when arguments span a single line - registers an offense and corrects when closing paren is on the following line - when method signature is on a single line - does not register an offense for unparameterized method - does not register an offense for parameterized method +RuboCop::Cop::Lint::NestedMethodDefinition + does not register offense for nested definition inside Class.new + does not register offense for nested definition inside class_exec + does not register offense for nested definition inside ::Class.new + registers an offense for a nested singleton method definition + does not register offense for definition of method on local var + does not register offense for nested definition inside class shovel + does not register offense for nested definition inside module_exec + does not register offense for nested definition inside ::Module.new + does not register offense for nested definition inside module_eval + does not register offense for nested definition inside instance_exec + does not register offense for nested definition inside instance_eval + does not register offense for nested definition inside ::Struct.new + does not register offense for nested definition inside Module.new + does not register offense for nested definition inside Struct.new + does not register an offense for a lambda definition inside method + registers an offense for a nested method definition + registers an offense for a nested class method definition + does not register offense for nested definition inside class_eval + registers an offense for a nested method definition inside lambda + when `AllowedPatterns: [baz]` + does not register offense for nested definition inside `do_baz` + registers offense for nested definition inside `do_qux` + when `AllowedMethods: [has_many]` + registers offense for nested definition inside `denied_method` + does not register offense for nested definition inside `has_many` -RuboCop::Cop::Style::MissingRespondToMissing - allows method_missing and respond_to_missing? when defined with inline access modifier - allows method_missing and respond_to_missing? implemented as instance methods - allows method_missing and respond_to_missing? implemented as class methods - registers an offense when method_missing is implemented as a class methods - allows method_missing and respond_to_missing? when defined with inline access modifier and method_missing is not qualified by inline access modifier - registers an offense respond_to_missing? is implemented as an instance method and method_missing is implemented as a class method - registers an offense respond_to_missing? is implemented as a class method and method_missing is implemented as an instance method - registers an offense when respond_to_missing? is not implemented +RuboCop::Formatter::WorstOffendersFormatter + #finished + when there are many offenses + sorts by offense count first and then by cop name -RuboCop::Formatter::HTMLFormatter - outputs the result in HTML - outputs the cached result in HTML +RuboCop::Formatter::JUnitFormatter + #file_finished + displays an offense for `classname='test_1` in parsable text + displays end of parsable text + displays start of parsable text + displays a non-offense element in parsable text + displays an offense for `classname='test_2` in parsable text -RuboCop::Cop::Layout::ClosingParenthesisIndentation - accepts begin nodes that are not grouped expressions - for method definitions - with line break before 1st parameter - accepts a correctly aligned ) - registers an offense for misaligned ) - with no line break before 1st parameter - accepts empty () - registers an offense for misaligned ) - accepts a correctly aligned ) - for method assignments with indented parameters - with no line break before 1st parameter - can handle individual arguments that are broken over lines - can handle inner method calls - can handle indentation up against the left edge - accepts a correctly aligned ) - registers an offense for misaligned ) - can handle hash arguments that are not broken over lines - accepts a correctly indented ) - without arguments - can handle indentation up against the method - accepts a correctly aligned ) against ( - can handle indentation up against the left edge - registers an offense for misaligned ) - accepts empty () - with line break before 1st parameter - accepts a correctly aligned ) - registers an offense for misaligned ) - for method calls - with first multiline arg on new line - accepts ) on the same level as ( with second arg on new line - accepts ) on the same level as ( with args on same line - with no line break before 1st parameter - registers an offense and corrects misindented ) when ) is aligned with the params - does not register an offense when using keyword arguments - accepts a correctly indented ) inside a block - accepts a correctly indented ) - registers an offense for misaligned ) - accepts a correctly aligned ) - without arguments - can handle indentation up against the left edge - accepts a correctly aligned ) against ( - accepts empty () - with line break before 1st parameter - accepts a correctly aligned ) - registers an offense for misaligned ) - for method chains - registers an offense and corrects method chains - can handle multiple chains with differing breaks - when using safe navigation operator - registers an offense and corrects misaligned ) - for grouped expressions - with line break before 1st operand - accepts a correctly aligned ) - registers an offense for misaligned ) - with no line break before 1st operand - registers an offense for misaligned ) - accepts ) that does not begin its line - accepts a correctly aligned ) +RuboCop::Cop::Layout::EmptyLines + does not register an offense for comments + does not register an offense for heredocs with empty lines inside + does not register an offense when there are no tokens + registers an offense for consecutive empty lines + does not register an offense for empty lines in a string -RuboCop::Cop::Style::ColonMethodDefinition - accepts a class method defined using . - using self - registers an offense for a class method defined using :: - using the class name - registers an offense for a class method defined using :: +RuboCop::Cop::Layout::CaseIndentation + when `when` is on the same line as `case` + registers an offense but does not autocorrect + with EnforcedStyle: case + with IndentOneStep: false + `case` ... `when` + doesn't get confused by strings with `case` in them + accepts correctly indented whens in complex combinations + registers an offense and corrects a `when` clause that is indented deeper than `case` + doesn't get confused by symbols named `case` or `when` + accepts a `when` clause that's equally indented with `case` + with everything on a single line + does not register an offense + regarding assignment where the right hand side is a `case` + registers an offense and corrects assignment indented as end + registers an offense and corrects assignment indented some other way + registers an offense and corrects correct + opposite style + accepts a correctly indented assignment + `case` ... `in` + doesn't get confused by strings with `case` in them + accepts correctly indented whens in complex combinations + registers an offense and corrects an `in` clause that is indented deeper than `case` + doesn't get confused by symbols named `case` or `in` + accepts an `in` clause that's equally indented with `case` + regarding assignment where the right hand side is a `case` + registers an offense and corrects assignment indented some other way + registers an offense and corrects assignment indented as `end` + registers an offense and corrects correct + opposite style + accepts a correctly indented assignment + with everything on a single line + does not register an offense + with IndentOneStep: true + `case` ... `when` + accepts a `when` clause that's 2 spaces deeper than `case` + registers an offense and corrects a `when` clause that is equally indented with `case` + with everything on a single line + does not register an offense + when indentation width is overridden for this cop only + respects cop-specific IndentationWidth + regarding assignment where the right hand side is a `case` + accepts a correctly indented assignment + registers an offense and corrects an assignment indented some other way + `case` ... `in` + registers an offense and corrects an `in` clause that is equally indented with `case` + accepts an `in` clause that's 2 spaces deeper than `case` + with everything on a single line + does not register an offense + regarding assignment where the right hand side is a `case` + accepts a correctly indented assignment + registers an offense and corrects an assignment indented some other way + when indentation width is overridden for this cop only + respects cop-specific IndentationWidth + with EnforcedStyle: end + with IndentOneStep: false + `case` ... `when` + regarding assignment where the right hand side is a `case` + accepts a correctly indented assignment + registers an offense and corrects an assignment indented some other way + `else` and `end` same line + does not register an offense + `when` and `end` same line + does not register an offense + with everything on a single line + does not register an offense + `case` ... `in` + with everything on a single line + does not register an offense + `in` and `end` same line + does not register an offense + regarding assignment where the right hand side is a `case` + registers an offense and corrects an assignment indented some other way + accepts a correctly indented assignment + with IndentOneStep: true + `case` ... `when` + with everything on a single line + does not register an offense + regarding assignment where the right hand side is a `case` + registers an offense and corrects an assignment indented as `case` + accepts a correctly indented assignment + registers an offense and corrects an assignment indented some other way + `case` ... `in` + regarding assignment where the right hand side is a `case` + accepts a correctly indented assignment + registers an offense and corrects an assignment indented some other way + registers an offense and corrects an assignment indented as `case` + with everything on a single line + does not register an offense -RuboCop::Cop::Layout::SpaceInsideBlockBraces - registers an offense and corrects left brace without inner space - registers an offense and corrects both left and right brace without inner space after success - registers an offense and corrects right brace without inner space - accepts braces surrounded by spaces - register offenses and correct both braces without inner space - accepts left brace without outer space - with space inside empty braces allowed - accepts empty braces with space inside - registers an offense and corrects empty braces with no space inside - with invalid value for EnforcedStyleForEmptyBraces - fails with an error - configured with no_space - accepts braces without spaces inside - accepts left brace without outer space - registers an offense and corrects both left and right brace with inner space after success - registers an offense and corrects left brace with inner space - registers an offense and corrects right brace with inner space - with passed in parameters - and space before block parameters allowed - accepts new lambda syntax - accepts left brace with inner space - registers an offense and corrects left brace without inner space - and space before block parameters not allowed - accepts when braces are aligned in multiline block - registers an offense and corrects left brace with inner space - accepts when braces are aligned in multiline block with bracket - registers an offense when braces are not aligned in multiline block with bracket - registers an offense when braces are not aligned in multiline block - accepts new lambda syntax - Ruby >= 2.7 - registers an offense for numblocks without inner space - with space inside empty braces not allowed - accepts empty braces with no space inside - accepts braces with something inside - registers an offense and corrects empty braces with space inside - accepts braces that are not empty - accepts empty braces with comment and line break inside - accepts multiline braces with content - accepts empty braces with line break inside - with passed in parameters - accepts new lambda syntax - and space before block parameters not allowed - registers an offense and corrects left brace with inner space - accepts left brace without inner space - accepts new lambda syntax - and BlockDelimiters cop enabled - registers an offense and corrects multi-line blocks - registers an offense and corrects for single-line blocks - for single-line blocks - registers an offense and corrects left brace without inner space - accepts left brace with inner space - for multi-line blocks - accepts left brace with inner space - registers an offense and corrects left brace without inner space +RuboCop::Cop::Lint::EmptyExpression + when used in a condition + registers an offense in the return value of a ternary operator + registers an offense inside `elsif` + registers an offense inside `case` + registers an offense inside `when` + registers an offense in the condition of a ternary operator + registers an offense inside `if` + when used as a standalone expression + registers an offense + with nested empty expressions + registers an offense + when used as an assignment + registers an offense for the assigned value + when used as a return value + registers an offense in the return value of a method + registers an offense in the return value of a case statement + registers an offense in the return value of a condition -RuboCop::Cop::Style::Send - with public_send - and with a receiver - does not register an offense for an invocation with args - does not register an offense for an invocation without args - and without a receiver - does not register an offense for an invocation without args - does not register an offense for an invocation with args - with send - and with a receiver - does not register an offense for an invocation without args - registers an offense for an invocation with args - when using safe navigation operator - registers an offense for an invocation with args - and without a receiver - does not register an offense for an invocation without args - registers an offense for an invocation with args - with __send__ - and with a receiver - does not register an offense for an invocation with args - does not register an offense for an invocation without args - and without a receiver - does not register an offense for an invocation without args - does not register an offense for an invocation with args +RuboCop::Cop::Style::MultilineWhenThen + autocorrects when the body of `when` branch starts with `then` + registers an offense when one line for multiple candidate values of `when` + doesn't register an offense for singleline when statement with then + registers an offense for multiline (one line in a body) when statement with then + registers an offense for empty when statement with then + registers an offense for multiline (two lines in a body) when statement with then + does not register an offense for array when statement with then + doesn't register an offense for multiline when statement without then + does not register an offense when line break for multiple candidate values of `when` + does not register an offense for hash when statement with then + doesn't register an offense when `then` required for a body of `when` is used + doesn't register an offense for empty when statement without then + doesn't register an offense for multiline when statementwith then followed by other lines -RuboCop::Cop::Style::NumericPredicate - when configured to enforce numeric comparison methods - allows checking if a number is not zero - registers an offense for checking if a number is negative - registers an offense for checking if a number is zero - registers an offense for checking if a number is positive - when configured to enforce numeric predicate methods - when checking if a number is zero - registers an offense - registers an offense with a complex expression - allows comparing against a global variable - when comparing against a method argument variable - registers an offense - registers an offense with complex expression - when checking if a number is negative - when target ruby version is 2.2 or lower - does not register an offense - when target ruby version is 2.3 or higher - registers an offense - registers an offense in yoda condition - with a complex expression - registers an offense in yoda condition - registers an offense - when checking if a number is positive - when target ruby version is 2.3 or higher - registers an offense in yoda condition - registers an offense - with a complex expression - registers an offense in yoda condition - registers an offense - when target ruby version is 2.2 or lower - does not register an offense - with checking if a number is not zero - allows comparing against a global variable - allows comparing against a complex expression - allows comparing against a variable - when there are allowed methods - in block - not ignored method - registers an offense for checking if a number is positive - registers an offense for checking if a number is negative - ignored method - with a regex - allows checking if a number is negative - allows checking if a number is positive - with a string - allows checking if a number is negative - allows checking if a number is positive - simple method call - `EnforcedStyle` is `predicate` - allows checking if a number is zero - `EnforcedStyle` is `comparison` - allows checking if a number is zero - in argument - not ignored method - when checking if a number is positive - when target ruby version is 2.3 or higher - registers an offense - when target ruby version is 2.2 or lower - does not register an offense - when checking if a number is negative - when target ruby version is 2.3 or higher - registers an offense - when target ruby version is 2.2 or lower - does not register an offense - ignored method - with a regex - allows checking if a number is positive - allows checking if a number is negative - with a string - allows checking if a number is negative - allows checking if a number is positive +RuboCop::Cop::Layout::LineContinuationSpacing + EnforcedStyle: space + ignores empty code + registers an offense when no space in front of backslash + ignores when too much space in front of backslash after `__END__` + ignores heredocs and comments + registers no offense with one space in front of backslash + registers an offense when too much space in front of backslash + marks the offense correctly when offense is not in first line + EnforcedStyle: no_space + registers no offense with zero spaces in front of backslash + ignores when too much space in front of backslash after `__END__` + registers an offense when one space in front of backslash + ignores empty code + marks the offense correctly when offense is not in first line + registers an offense when many spaces in front of backslash + ignores heredocs and comments -RuboCop::Server::CLI - when using `--start-server` option - returns exit status 0 and display an information message - when using `--no-server` option - returns exit status 0 - when using server option with `--cache-root path` option - returns exit status 0 and display an error message - when not using any server options and specifying `--server` in `RUBOCOP_OPTS` environment variable - returns exit status 0 and display an information message - when using server option with `--cache-root=path` option - returns exit status 0 and display an information message - when using `--server` option - returns exit status 0 and display an information message - when using exclusive `--server-status` option - returns exit status 2 and display an error message - when using `--restart-server` option - returns exit status 0 and display an information and a warning messages - when using `--server-status` option - returns exit status 0 and display an information message - when using exclusive `--stop-server` option - returns exit status 2 and display an error message - when using exclusive `--start-server` option - returns exit status 2 and display an error message - when using `--stop-server` option - returns exit status 0 and display a warning message - when using exclusive `--restart-server` option - returns exit status 2 and display an error message - when not using any server options and specifying `--server` in .rubocop file - returns exit status 0 and display an information message - when not using any server options - returns exit status 0 - when using multiple server options - returns exit status 2 and display an error message +RuboCop::Cop::Style::MultilineIfThen + does not get confused by a then in a when + does not get confused by a nested postfix unless + accepts table style if/then/elsif/ends + does not raise an error for an implicit match unless + does not raise an error for an implicit match if + does not get confused by a commented-out then + registers an offense for then in multiline if + registers an offense for then in multiline unless + does not get confused by a postfix unless + registers an offense for then in multiline elsif + does not get confused by empty elsif branch -RuboCop::Cop::Style::ObjectThen - EnforcedStyle: yield_self - registers an offense for then with proc param - registers an offense for then with block - accepts then without a block - accepts then with more than 1 param - EnforcedStyle: then - accepts yield_self without a block - accepts yield_self with more than 1 param - registers an offense for yield_self with proc param +RuboCop::FileFinder + #find_file_upwards + returns nil when file is not found + returns a file to be found upwards + #find_last_file_upwards + returns the last file found upwards + returns nil when file is not found + +RuboCop::Cop::Lint::MissingSuper + constructor + does not register an offense for the constructor-like method defined outside of a class + does not register an offense when there is a `super` call + does not register an offense for the class without parent class + registers an offense when no `super` call + does not register an offense for the class with stateless parent class + callbacks + registers an offense when method callback is without `super` call + does not register an offense when callback has a `super` call + registers an offense when class callback within `self << class` and without `super` call + registers an offense when class callback without `super` call + registers no offense when module callback without `super` call + +RuboCop::Cop::Layout::SpaceBeforeBrackets + does not register an offense when using percent array literal argument without parentheses + does not register an offense when using array literal argument without parentheses + does not register an offense when assigning an array + when referencing + does not register an offense when it is used as a method argument + does not register an offense when array literal argument is enclosed in parentheses + does not register an offense when call desugared `Hash#[]` to lvar receiver + registers an offense and corrects when using space between cvar receiver and left brackets + does not register an offense when call desugared `Hash#[]` to ivar receiver + does not register an offense when using space between method call and left brackets + does not register an offense when without receiver + registers an offense and corrects when using space between lvar receiver and left brackets + registers an offense and corrects when using space between gvar receiver and left brackets + does not register an offense when using multiple arguments + does not register an offense when call desugared `Hash#[]` to cvar receiver + does not register an offense when not using space between method call and left brackets + registers an offense and corrects when using space between ivar receiver and left brackets + does not register an offense when not using space between variable receiver and left brackets + when assigning + registers an offense and corrects when using space between receiver and left brackets + does not register an offense when not using space between receiver and left brackets + does not register an offense when multiple spaces are inserted inside the left bracket + does not register an offense when space is used in left bracket + +RuboCop::Cop::Style::ModuleFunction + when enforced style is `extend_self` + accepts module_function with an argument + registers an offense for `module_function` without an argument + when enforced style is `forbidden` + accepts `extend self` in a class + registers an offense for `module_function` without an argument + registers an offense for `extend self` + in a module + in a module with private methods + in a module with declarative private + when enforced style is `module_function` + accepts for `extend self` in a module with private methods + accepts for `extend self` in a module with declarative private + accepts `extend self` in a class + registers an offense for `extend self` in a module + +RuboCop::Cop::Layout::EmptyLinesAroundBlockBody + when EnforcedStyle is empty_lines for do end block + is not fooled by single line blocks + ignores block with an empty body + registers an offense for block body not starting or ending with a blank + when EnforcedStyle is empty_lines for { } block + ignores block with an empty body + is not fooled by single line blocks + registers an offense for block body not starting or ending with a blank + when EnforcedStyle is no_empty_lines for { } block + registers an offense for block body starting with a blank passed to a multi-line method call + is not fooled by single line blocks + registers an offense for block body starting with a blank + accepts block body starting with a line with spaces + registers an offense for block body ending with a blank Ruby 2.7 - registers an offense for yield_self with block - Ruby 2.6 - registers an offense for yield_self with block - Ruby 2.5 - accepts yield_self with block + registers an offense for block body ending with a blank + when EnforcedStyle is no_empty_lines for do end block + registers an offense for block body ending with a blank + accepts block body starting with a line with spaces + registers an offense for block body starting with a blank passed to a multi-line method call + is not fooled by single line blocks + registers an offense for block body starting with a blank + Ruby 2.7 + registers an offense for block body ending with a blank -RuboCop::Cop::Style::DefWithParentheses - reports an offense for def with empty parens - reports an offense for class def with empty parens - accepts def with arg and parens - accepts empty parentheses in one liners - accepts def without arguments - Ruby >= 3.0 - reports an offense for endless method definition with empty parens +RuboCop::Cop::VariableForce::Reference + .new + when non variable reference node is passed + raises error -RuboCop::Cop::Cop - will warn if custom severity is invalid - will set default severity - will report registered offenses - initially has 0 offenses - keeps track of offenses - will set custom severity if present - with lint cops - has right department - has right name - when disabled by a comment - ignore_disable_comments is true - will not set offense as disabled - ignore_disable_comments is false - will set offense as disabled - .qualified_cop_name - returns the cop name in a different namespace if the provided namespace is incorrect - returns the given cop name if it already has a namespace - adds namespace if the cop name is found in exactly one namespace - returns the given cop name if it already has a namespace even when the cop exists in multiple namespaces - raises an error if the cop name is in more than one namespace - returns the given cop name if it is not found in any namespace - .documentation_url - for a builtin cop class - is expected to eq "https://docs.rubocop.org/rubocop/cops_layout.html#layoutblockendnewline" - for a custom cop class - is expected to be nil - with no submodule - has right department - has right name - setting of Offense#corrected attribute - when cop supports autocorrection - when offense was corrected - is set to true - when autocorrection is not needed - is set to false - when offense was not corrected because of an error - is set to false - when cop does not support autocorrection - is not specified (set to nil) - when autocorrect is requested - is not specified (set to nil) - when disable_uncorrectable is enabled - is set to true - Registry - #departments - has departments - contains every value only once - is expected to include :Style - is expected to include :Lint - #with_department - returns 0 for an invalid type - has each cop in exactly one type - has at least one cop per department - with style cops - has right department - has right name - for a cop with a name - registers offense with its name - #relevant_file? - when the file is an anonymous source - is expected to equal true - when the file doesn't match the Include configuration - is expected to equal false - when the file matches the Include configuration - is expected to equal true - #safe_autocorrect? - when autocorrection of the cop is declared unsafe - is expected to equal false - when cop is declared unsafe +RuboCop::Config + #check + when a deprecated configuration is detected + prints a warning message for the loaded path + #deprecation_check + when there is no AllCops configuration + does not yield + when there is AllCops configuration + if there are is an Includes key + yields + if there are no Excludes or Includes keys + does not yield + if there are is an Excludes key + yields + #make_excludes_absolute + when config is in root directory + generates valid absolute directory + when config is in subdirectory + generates valid absolute directory + whether the cop is enabled + when an nested cop department is disabled + and an individual cop is not specified + the cop setting overrides the department + but an individual cop is enabled + the cop setting overrides the department + when an entire cop department is disabled + but an individual cop is enabled + the cop setting overrides the department + when configuration has no mention of a cop + enables the cop that is not mentioned + when all cops are explicitly enabled by default + enables the cop that is not mentioned + when all cops are disabled by default + disables the cop that is not mentioned + when a cop has configuration but no explicit Enabled setting + enables the cop by default + when an entire cop department is enabled + but an individual cop is disabled + still disables the cop + #for_department + accepts a Symbol + always returns the department's config + #for_badge + works if department has no config + takes into account the department + #file_to_include? + when the passed path does not match any of patterns to include + returns false + when the passed path matches any of patterns to include + returns true + #patterns_to_exclude + when config file has AllCops => Exclude key + returns the Exclude value + #possibly_include_hidden? + returns true when Include config includes a dotfile in a path + returns true when Include config includes a regex + returns true when Include config includes a toplevel dotfile + returns true when Include config only includes regular paths + #allowed_camel_case_file? + when the passed path does not match allowed camel case patterns to include is expected to equal false - when safety is undeclared + when the passed path matches allowed camel case patterns to include is expected to equal true - #autocorrect? - when the option is given + when the passed path is a gemspec is expected to equal true - when cop does not support autocorrection - is expected to equal false - when disable_uncorrectable is enabled - is expected to equal true - when the cop is set to not autocorrect - is expected to equal false - when the option is not given - is expected to equal false - -RuboCop::Cop::Lint::RefinementImportMethods - Ruby >= 3.1 - registers an offense when using `include` in `refine` block - does not register an offense when using `import_methods` in `refine` block - registers an offense when using `prepend` in `refine` block - does not register an offense when using `include` with a receiver in `refine` block - Ruby <= 3.0 - does not register an offense when using `include` in `refine` block - does not register an offense when using `prepend` in `refine` block - -RuboCop::Cop::Layout::HeredocIndentation - quoted by - displays message to use `<<~` instead of `<<` - registers an offense for not indented enough with empty line - accepts for indented, but with `-` - displays message to use `<<~` instead of `<<-` - registers an offense for not indented - registers an offense for not indented, with `~` - registers an offense for first line minus-level indented, with `-` - accepts for not indented but with whitespace - does not register an offense when not indented but with whitespace, with `-` - registers an offense for too deep indented with whitespace line - registers an offense for too deep indented with empty line - accepts for include empty lines - registers an offense for not indented enough with whitespace line - accepts for indented, but without `~` - registers an offense for not indented, without `~` - registers an offense for too deep indented - accepts for an empty line - accepts for indented, with `~` - registers an offense for minus level indented - when Layout/LineLength is configured - accepts for long heredoc - quoted by " - registers an offense for not indented enough with empty line - displays message to use `<<~` instead of `<<-` - accepts for include empty lines - does not register an offense when not indented but with whitespace, with `-` - accepts for indented, but with `-` - registers an offense for too deep indented with whitespace line - accepts for indented, with `~` - displays message to use `<<~` instead of `<<` - registers an offense for not indented - accepts for not indented but with whitespace - registers an offense for minus level indented - registers an offense for not indented, with `~` - registers an offense for first line minus-level indented, with `-` - accepts for an empty line - registers an offense for not indented enough with whitespace line - registers an offense for too deep indented - registers an offense for too deep indented with empty line - accepts for indented, but without `~` - registers an offense for not indented, without `~` - when Layout/LineLength is configured - accepts for long heredoc - quoted by ' - accepts for indented, but without `~` - registers an offense for too deep indented with whitespace line - displays message to use `<<~` instead of `<<-` - accepts for indented, but with `-` - displays message to use `<<~` instead of `<<` - accepts for indented, with `~` - registers an offense for not indented enough with empty line - registers an offense for too deep indented with empty line - accepts for include empty lines - accepts for not indented but with whitespace - registers an offense for not indented, without `~` - registers an offense for too deep indented - registers an offense for not indented - registers an offense for minus level indented - registers an offense for first line minus-level indented, with `-` - does not register an offense when not indented but with whitespace, with `-` - registers an offense for not indented, with `~` - accepts for an empty line - registers an offense for not indented enough with whitespace line - when Layout/LineLength is configured - accepts for long heredoc - quoted by ` - displays message to use `<<~` instead of `<<-` - accepts for indented, with `~` - registers an offense for not indented enough with empty line - registers an offense for not indented, without `~` - accepts for an empty line - registers an offense for not indented - displays message to use `<<~` instead of `<<` - registers an offense for too deep indented with whitespace line - registers an offense for too deep indented with empty line - registers an offense for too deep indented - registers an offense for minus level indented - accepts for include empty lines - accepts for indented, but without `~` - does not register an offense when not indented but with whitespace, with `-` - accepts for indented, but with `-` - registers an offense for not indented, with `~` - registers an offense for not indented enough with whitespace line - registers an offense for first line minus-level indented, with `-` - accepts for not indented but with whitespace - when Layout/LineLength is configured - accepts for long heredoc - -RuboCop::Cop::Style::HashEachMethods - when node matches a keys#each or values#each - when receiver is a hash literal - does not register an offense for {}#each_value - registers offense, autocorrects {}#keys.each to {}#each_key with a symbol proc argument - registers offense, autocorrects {}#values.each with {}#each_value - registers offense, autocorrects {}#keys.each with {}#each_key - registers offense, autocorrects {}#values.each to {}#each_value with a symbol proc argument - does not register an offense for {}#each_key - when receiver is implicit - does not register an offense for `values.each` - does not register an offense for `values.each` with a symbol proc argument - does not register an offense for each_value - does not register an offense for `keys.each` with a symbol proc argument - does not register an offense for `keys.each` - does not register an offense for each_key - when receiver is a send - registers offense, autocorrects foo#keys.each to foo#each_key with a symbol proc argument - registers offense, autocorrects foo#values.each to foo#each_value with a symbol proc argument - registers offense, autocorrects foo#keys.each to foo#each_key - does not register an offense for Hash#each_value - does not register an offense for foo#each_key - registers offense, autocorrects foo#values.each to foo#each_value - Ruby 2.7 - registers offense, autocorrects foo#keys.each to foo#each_key with numblock - when `AllowedReceivers: ['execute']` - registers an offense when receiver is not allowed name - does not register an offense when receiver is `execute` method with a symbol proc argument - does not register an offense when receiver is `execute` variable - does not register an offense when receiver is `execute` method + #file_to_exclude? + when the passed path does not match any of patterns to exclude + returns false + when the passed path matches any of patterns to exclude + returns true + #patterns_to_include + when config file has AllCops => Include key + returns the Include value + #validate + when the configuration includes any unrecognized parameter + prints a warning message + when the configuration includes an invalid EnforcedStyle + raises validation error + when the empty section is AllCops + raises validation error + when the configuration includes Lint/Syntax cop + when the configuration does not match the default + raises validation error + when the configuration matches the default + does not raise validation error + when the configuration includes multiple but config does not allow + raises validation error + when the configuration includes multiple valid enforced styles and one invalid style + raises validation error + when the configuration includes any unrecognized cop name and given `--ignore-unrecognized-cops` option + there are no unrecognized cops + does not print any warnings + there is unrecognized cop + prints a warning about the cop + when the configuration includes any unrecognized cop name + raises an validation error + when the configuration includes multiple invalid enforced styles + raises validation error + when the configuration includes multiple valid enforced styles + does not raise validation error + when the configuration includes an obsolete EnforcedStyle parameter + raises validation error + when the configuration is in the base RuboCop config folder + is not validated + when the configuration includes a valid EnforcedStyle + does not raise validation error + when the configuration includes an obsolete cop + raises validation error + when the configuration includes an obsolete parameter + raises validation error + when the configuration includes a valid enforced style + does not raise validation error + when all cops are both Enabled and Disabled by default + raises validation error + when the configuration includes obsolete parameters and cops + raises validation error + when the configuration includes any common parameter + does not raise validation error + when the configuration includes the obsolete Style/WhileUntilModifier: MaxLineLength parameter + raises validation error + conflicting Safe settings + when the configuration includes an unsafe cop that is explicitly declared to have a safe autocorrection + raises validation error + when the configuration includes an unsafe cop without a declaration of its autocorrection + does not raise validation error + when the configuration includes the obsolete Style/IfUnlessModifier: MaxLineLength parameter + raises validation error + when the configuration includes an invalid enforced style + raises validation error + when the configuration includes an empty section + raises validation error -RuboCop::Cop::Layout::EmptyLineAfterMagicComment - registers offense when frozen_string_literal used with shareable_constant_value without empty line - accepts code that separates the comment from the code with a newline - accepts a source file with only a magic comment - registers an offense for documentation immediately following comment - accepts magic comment with typed - registers an offense when code that immediately follows typed comment - accepts magic comment followed by encoding - registers an offense when multiple magic comments without empty line - accepts an empty source file - accepts magic comment with shareable_constant_value - registers an offense for code that immediately follows comment +RuboCop::Formatter::JSONFormatter + #file_finished + adds value of #hash_for_file to #output_hash[:files] + adds detected offense count in summary + #started + sets target file count in summary + #finished + outputs #output_hash as JSON + sets inspected file count in summary + #hash_for_offense + sets Offense#cop_name value for :cop_name key + sets Offense#message value for :message key + sets Offense#corrected? value for :corrected key + sets Offense#severity value for :severity key + sets value of #hash_for_location for :location key + sets Offense#correctable? value for :correctable key + #hash_for_location + sets column value for :column key + sets line value for :line key + sets length value for :length key + when the location is pseudo + returns a valid hash + #hash_for_file + sets relative file path for :path key + sets an array of #hash_for_offense values for :offenses key -RuboCop::Cop::Style::EmptyHeredoc - registers an offense when using empty `<<-EOS` heredoc - registers an offense when using empty `< interpolations + and multiple arguments + registers an offense + and 1 argument + does not register an offense + behaves like variables + does not register an offense for format called on a variable + does not register an offense for % called on a variable + does not register an offense for format called on a variable + behaves like variables + does not register an offense for format called on a variable + does not register an offense for format called on a variable + does not register an offense for % called on a variable + when format is invalid + registers an offense + when passed an empty array does not register an offense - behaves like offense - registers an offense for :"foo" - behaves like offense - registers an offense for "foo-bar".to_sym - behaves like offense - registers an offense for "foo".intern - behaves like offense - registers an offense for :foo.to_sym - behaves like offense - registers an offense for "foo".to_sym - behaves like offense - registers an offense for :foo.intern - behaves like offense - registers an offense for :"foo_bar" - single quoted symbol + behaves like variables + does not register an offense for format called on a variable + does not register an offense for format called on a variable + does not register an offense for % called on a variable + on format with %{} interpolations + and 1 argument + does not register an offense + and multiple arguments + registers an offense + when using (digit)$ flag does not register an offense - behaves like offense - registers an offense for "foo_bar".to_sym - EnforcedStyle: consistent - with a mix of string and symbol keys + registers an offense when mismatch between the maximum value specified by (digit)$ flag and the number of arguments + does not register an offense when match between the maximum value specified by (digit)$ flag and the number of arguments + with wildcard + does not register an offense for width + does not register an offense for precision + does not register an offense for multiple wildcards + does not register an offense for width and precision + when argument itself contains format characters and formats in format string and argument are not equal + ignores argument formatting + when splat argument is present + does not register an offense when args count is less than expected + when args count is more than expected + does not register an offense for `#sprintf` + does not register an offense for `#format` + registers an offense for `#%` + when multiple arguments are called for + and a single send node is passed does not register an offense - hash where no keys need to be quoted + and a single variable argument is passed does not register an offense - hash where there are keys needing quoting - registers an offense for unquoted keys - hash where keys are quoted but do not need to be - registers an offense - with different quote styles + +RuboCop::Cop::Style::StringConcatenation + correctly handles strings with special characters + registers an offense and corrects for string concatenation as part of other expression + does not register an offense when using `+` with all non string arguments + registers an offense and corrects for string concatenation + correctly handles nested concatenable parts + Mode = conservative + when first operand is string literal + registers offense + when first operand is not string literal + does not register offense + heredoc + registers an offense but does not correct when string concatenation with multiline heredoc text + registers an offense but does not correct + multiline + string continuation does not register an offense - with a key with = - requires symbols to be quoted + if condition + registers an offense but does not correct + simple expressions + registers an offense and corrects + multiline block + registers an offense but does not correct + empty quotes + registers offense and corrects + inline block + registers an offense but does not correct + nested interpolation + registers an offense and corrects + double quotes inside string surrounded single quotes + registers an offense and corrects with double quotes + double quotes inside string + registers an offense and corrects with double quotes + registers an offense and corrects with percentage quotes -RuboCop::Cop::Style::UnpackFirst - ruby version >= 2.4 - registers offense - when using `#unpack` with `#first` - when using `#unpack` with `#at` - when using `#unpack` with dot and square brackets - when using `#unpack` with `#slice` - when using `#unpack` with square brackets - does not register offense - when using `#unpack1` - when using `#unpack` accessing second element +RuboCop::Cop::Layout::FirstHashElementLineBreak + registers an offense and corrects elements listed on the first line + ignores implicit hashes in method calls that are improperly formatted + ignores elements listed on a single line + registers an offense and corrects single element multi-line hash + ignores implicit hashes in method calls without parens + ignores implicit hashes in method calls with parens + registers an offense and corrects hash nested in a method call -RuboCop::Cop::Layout::TrailingEmptyLines - when EnforcedStyle is final_blank_line - autocorrects missing blank line - registers an offense for no final newline - accepts final blank line - registers an offense for multiple trailing blank lines - registers an offense for final newline - registers an offense for multiple blank lines in an empty file - autocorrects missing newline - when EnforcedStyle is final_newline - accepts final newline - registers an offense for no final newline after assignment - registers an offense for multiple blank lines in an empty file - accepts final blank lines if they come after __END__ in empty file - accepts an empty file - registers an offense for no final newline after block comment - autocorrects even if some lines have space - registers an offense for multiple trailing blank lines - accepts final blank lines if they come after __END__ +RuboCop::Cop::Style::RedundantFileExtensionInRequire + registers an offense and corrects when requiring filename ending with `.rb` + does not register an offense when requiring filename ending with `.so` + does not register an offense when requiring filename without an extension + does not register an offense when requiring variable as a filename -RuboCop::Cop::Layout::SpaceInsideReferenceBrackets +RuboCop::Cop::Lint::ShadowingOuterLocalVariable + when a block local variable has same name as an outer scope variablewith same branches of same `case` condition node + registers an offense + when a block local variable has same name as an outer scope variable + registers an offense + when a block local variable has same name as an outer scope variablewith same branches of same `unless` condition node + registers an offense + when an outer scope variable is referenced in a block + does not register an offense + when a block argument has same name as an outer scope variable + registers an offense + when a block local variable has same name as an outer scope variablewith same branches of same `if` condition node + registers an offense + when an outer scope variable is reassigned in a block + does not register an offense + when the same variable name as a block variable is used in return value assignment of `if` + does not register an offense + when a block local variable has same name as an outer scope variablewith different branches of same `unless` condition node + does not register an offense + with Ractor.new + does not register an offense + when a block local variable has same name as an outer scope variablewith same branches of same `if` condition node not in the method definition + registers an offense + when a method argument has same name as an outer scope variable + does not register an offense + when a block argument has same name "_" as outer scope variable "_" + does not register an offense + when multiple block arguments have same name "_" + does not register an offense + when a block local variable has same name as an outer scope variablewith different branches of same `case` condition node + does not register an offense + when multiple block arguments have a same name starts with "_" + does not register an offense + when a block local variable has same name as an outer scope variablewith different branches of same `if` condition node + does not register an offense + when a block local variable has same name as an outer scope variablewith same branches of same nested `if` condition node + registers an offense + when a splat block argument has same name as an outer scope variable + registers an offense + when a block block argument has same name as an outer scope variable + registers an offense + when a block argument has a same name starts with "_" as an outer scope variable + does not register an offense + when a block argument has different name with outer scope variables + does not register an offense + +RuboCop::Cop::Style::FileWrite + registers an offense for and corrects `::File.open(filename, 'w+b').write(content)` + registers an offense for and corrects `::File.open(filename, 'wt').write(content)` + registers an offense for and corrects the `File.open` with multiline write block (mode 'w+') + registers an offense for and corrects `::File.open(filename, 'w').write(content)` + does not register an offense for the `File.open` with multiline write block when not writing to the block variable + registers an offense for and corrects the `File.open` with inline write block (mode 'wt') + registers an offense for and corrects the `File.open` with inline write block (mode 'w+t') + registers an offense for and corrects the `File.open` with inline write block (mode 'w+b') + registers an offense for and corrects `File.open(filename, 'w+b').write(content)` + registers an offense for and corrects `File.open(filename, 'w+t').write(content)` + registers an offense for and corrects the `File.open` with multiline write block (mode 'wb') with heredoc + registers an offense for and corrects `::File.open(filename, 'w+').write(content)` + registers an offense for and corrects the `File.open` with inline write block (mode 'wb') + registers an offense for and corrects the `File.open` with inline write block (mode 'w+') + registers an offense for and corrects the `File.open` with multiline write block (mode 'w+b') + does not register an offense when a splat argument is passed to `f.write` + registers an offense for and corrects the `File.open` with multiline write block (mode 'w+t') + registers an offense for and corrects the `File.open` with multiline write block (mode 'wb') + registers an offense for and corrects the `File.open` with multiline write block (mode 'w+') with heredoc + registers an offense for and corrects `::File.open(filename, 'w+t').write(content)` + registers an offense for and corrects `File.open(filename, 'wt').write(content)` + registers an offense for and corrects the `File.open` with multiline write block (mode 'w+b') with heredoc + registers an offense for and corrects `File.open(filename, 'w').write(content)` + registers an offense for and corrects `File.open(filename, 'wb').write(content)` + registers an offense for and corrects the `File.open` with multiline write block (mode 'wt') with heredoc + registers an offense for and corrects the `File.open` with multiline write block (mode 'wt') + registers an offense for and corrects `File.open(filename, 'w+').write(content)` + registers an offense for and corrects the `File.open` with multiline write block (mode 'w') with heredoc + registers an offense for and corrects the `File.open` with multiline write block (mode 'w') + registers an offense for and corrects `::File.open(filename, 'wb').write(content)` + registers an offense for and corrects the `File.open` with inline write block (mode 'w') + registers an offense for and corrects the `File.open` with multiline write block (mode 'w+t') with heredoc + +RuboCop::Formatter::FormatterSet + responds to all formatter API methods + formatter API method + invokes the same method of all containing formatters + #close_output_files + closes all output files + does not close non file output + #builtin_formatter_class + returns class which matches passed alias name exactly + returns class which matches double character alias name + returns class which matches single character alias name + #custom_formatter_class + returns constant represented by the passed string + can handle namespaced constant name + can handle top level namespaced constant name + when non-existent constant name is passed + raises error + add_formatter + adds a formatter to itself + can add multiple formatters by being invoked multiple times + adds a formatter with specified formatter type + when output path is omitted + adds a formatter outputs to $stdout + when output path is specified + adds a formatter outputs to the specified file + when parent directories don't exist + creates them + +RuboCop::Cop::Style::ConditionalAssignment + SingleLineConditionsOnly false + corrects assignment to an if elsif else with multiple elsifs + corrects assignment to a case when else condition + corrects assignment to a multiline if else condition + corrects assignment to a multiline if elsif else condition + corrects assignment to a case when else with multiple whens + corrects assignment to an unless else condition + behaves like all assignment types + registers an offense any assignment to case when + does not crash when used inside rescue + registers an offense for any assignment to unless else + registers an offense for any assignment to ternary + allows any assignment to if without else + registers an offense any assignment to if else + behaves like multiline all assignment types offense + any assignment to a multiline unless else + any assignment to a multiline case when + any assignment to a multiline if else + behaves like all variable types + does not crash for rescue assignment + registers an offense assigning any variable type to unless else + registers an offense assigning any variable type to if elsewith multiple assignment + allows assignment to if without else + registers an offense assigning any variable type to ternary + registers an offense for assigning any variable type to case when + registers an offense assigning any variable type to if elsif else + registers an offense assigning any variable type to if else + >= Ruby 2.7 + registers an offense for assigning any variable type to case in + behaves like multiline all assignment types offense + any assignment to a multiline if else + any assignment to a multiline case when + any assignment to a multiline unless else + behaves like all variable types + does not crash for rescue assignment + registers an offense assigning any variable type to if elsif else + allows assignment to if without else + registers an offense assigning any variable type to if else + registers an offense assigning any variable type to unless else + registers an offense assigning any variable type to if elsewith multiple assignment + registers an offense assigning any variable type to ternary + registers an offense for assigning any variable type to case when + >= Ruby 2.7 + registers an offense for assigning any variable type to case in + behaves like all assignment types + registers an offense for any assignment to ternary + allows any assignment to if without else + does not crash when used inside rescue + registers an offense any assignment to if else + registers an offense any assignment to case when + registers an offense for any assignment to unless else + behaves like multiline all assignment types offense + any assignment to a multiline unless else + any assignment to a multiline if else + any assignment to a multiline case when + behaves like all assignment types + allows any assignment to if without else + registers an offense for any assignment to unless else + registers an offense for any assignment to ternary + registers an offense any assignment to case when + does not crash when used inside rescue + registers an offense any assignment to if else + behaves like all assignment types + registers an offense for any assignment to ternary + registers an offense any assignment to if else + does not crash when used inside rescue + registers an offense for any assignment to unless else + allows any assignment to if without else + registers an offense any assignment to case when + behaves like all variable types + does not crash for rescue assignment + registers an offense assigning any variable type to if else + registers an offense assigning any variable type to if elsewith multiple assignment + registers an offense assigning any variable type to ternary + registers an offense for assigning any variable type to case when + registers an offense assigning any variable type to if elsif else + allows assignment to if without else + registers an offense assigning any variable type to unless else + >= Ruby 2.7 + registers an offense for assigning any variable type to case in + behaves like all assignment types + registers an offense for any assignment to ternary + registers an offense any assignment to case when + does not crash when used inside rescue + registers an offense for any assignment to unless else + allows any assignment to if without else + registers an offense any assignment to if else + behaves like multiline all assignment types offense + any assignment to a multiline case when + any assignment to a multiline unless else + any assignment to a multiline if else + behaves like multiline all variable types offense + assigning any variable type to a multiline case when + assigning any variable type to an if else with multiline in one branch + assigning any variable type to a multiline if elsif else + assigning any variable type to a multiline if else + assigning any variable type to a multiline unless else + behaves like multiline all assignment types offense + any assignment to a multiline case when + any assignment to a multiline unless else + any assignment to a multiline if else + behaves like all assignment types + registers an offense any assignment to if else + registers an offense for any assignment to ternary + does not crash when used inside rescue + allows any assignment to if without else + registers an offense for any assignment to unless else + registers an offense any assignment to case when + behaves like multiline all variable types offense + assigning any variable type to a multiline if elsif else + assigning any variable type to a multiline if else + assigning any variable type to a multiline case when + assigning any variable type to a multiline unless else + assigning any variable type to an if else with multiline in one branch + behaves like multiline all assignment types offense + any assignment to a multiline case when + any assignment to a multiline if else + any assignment to a multiline unless else + behaves like all assignment types + allows any assignment to if without else + registers an offense any assignment to if else + registers an offense any assignment to case when + registers an offense for any assignment to ternary + registers an offense for any assignment to unless else + does not crash when used inside rescue + behaves like all assignment types + registers an offense any assignment to if else + does not crash when used inside rescue + registers an offense for any assignment to unless else + allows any assignment to if without else + registers an offense any assignment to case when + registers an offense for any assignment to ternary + behaves like all assignment types + registers an offense for any assignment to unless else + allows any assignment to if without else + registers an offense any assignment to case when + does not crash when used inside rescue + registers an offense for any assignment to ternary + registers an offense any assignment to if else + behaves like all assignment types + allows any assignment to if without else + does not crash when used inside rescue + registers an offense any assignment to case when + registers an offense for any assignment to unless else + registers an offense for any assignment to ternary + registers an offense any assignment to if else + behaves like multiline all assignment types offense + any assignment to a multiline if else + any assignment to a multiline unless else + any assignment to a multiline case when + behaves like multiline all assignment types offense + any assignment to a multiline if else + any assignment to a multiline case when + any assignment to a multiline unless else + behaves like multiline all variable types offense + assigning any variable type to a multiline if else + assigning any variable type to a multiline unless else + assigning any variable type to a multiline if elsif else + assigning any variable type to a multiline case when + assigning any variable type to an if else with multiline in one branch + behaves like multiline all assignment types offense + any assignment to a multiline case when + any assignment to a multiline unless else + any assignment to a multiline if else + behaves like multiline all assignment types offense + any assignment to a multiline case when + any assignment to a multiline unless else + any assignment to a multiline if else + behaves like all variable types + registers an offense assigning any variable type to if elsewith multiple assignment + allows assignment to if without else + registers an offense assigning any variable type to ternary + registers an offense assigning any variable type to if elsif else + registers an offense assigning any variable type to unless else + registers an offense assigning any variable type to if else + does not crash for rescue assignment + registers an offense for assigning any variable type to case when + >= Ruby 2.7 + registers an offense for assigning any variable type to case in + behaves like all assignment types + registers an offense any assignment to if else + registers an offense any assignment to case when + registers an offense for any assignment to ternary + allows any assignment to if without else + registers an offense for any assignment to unless else + does not crash when used inside rescue + behaves like multiline all variable types offense + assigning any variable type to a multiline unless else + assigning any variable type to a multiline if else + assigning any variable type to an if else with multiline in one branch + assigning any variable type to a multiline case when + assigning any variable type to a multiline if elsif else + behaves like all assignment types + registers an offense any assignment to case when + does not crash when used inside rescue + registers an offense for any assignment to ternary + registers an offense any assignment to if else + allows any assignment to if without else + registers an offense for any assignment to unless else + behaves like multiline all assignment types offense + any assignment to a multiline case when + any assignment to a multiline unless else + any assignment to a multiline if else + behaves like all assignment types + registers an offense for any assignment to unless else + registers an offense any assignment to if else + registers an offense for any assignment to ternary + registers an offense any assignment to case when + does not crash when used inside rescue + allows any assignment to if without else + behaves like multiline all assignment types offense + any assignment to a multiline case when + any assignment to a multiline unless else + any assignment to a multiline if else + behaves like all assignment types + registers an offense for any assignment to ternary + allows any assignment to if without else + registers an offense any assignment to if else + registers an offense any assignment to case when + does not crash when used inside rescue + registers an offense for any assignment to unless else + behaves like multiline all variable types offense + assigning any variable type to a multiline case when + assigning any variable type to a multiline if else + assigning any variable type to a multiline if elsif else + assigning any variable type to an if else with multiline in one branch + assigning any variable type to a multiline unless else + behaves like all assignment types + registers an offense for any assignment to ternary + does not crash when used inside rescue + allows any assignment to if without else + registers an offense any assignment to case when + registers an offense for any assignment to unless else + registers an offense any assignment to if else + behaves like multiline all assignment types offense + any assignment to a multiline case when + any assignment to a multiline unless else + any assignment to a multiline if else + behaves like all variable types + registers an offense assigning any variable type to if else + registers an offense assigning any variable type to if elsewith multiple assignment + registers an offense for assigning any variable type to case when + allows assignment to if without else + does not crash for rescue assignment + registers an offense assigning any variable type to if elsif else + registers an offense assigning any variable type to ternary + registers an offense assigning any variable type to unless else + >= Ruby 2.7 + registers an offense for assigning any variable type to case in + behaves like all variable types + registers an offense assigning any variable type to if elsif else + registers an offense assigning any variable type to unless else + registers an offense for assigning any variable type to case when + registers an offense assigning any variable type to ternary + registers an offense assigning any variable type to if elsewith multiple assignment + allows assignment to if without else + does not crash for rescue assignment + registers an offense assigning any variable type to if else + >= Ruby 2.7 + registers an offense for assigning any variable type to case in + behaves like single line condition autocorrect + corrects assignment to a case when else condition + corrects assignment to a ternary operator + corrects assignment to an if elsif else condition + corrects assignment to an unless else condition + corrects assignment to an if elsif else with multiple elsifs + corrects assignment to a case when else with multiple whens + corrects assignment to an if else condition + behaves like all variable types + does not crash for rescue assignment + registers an offense assigning any variable type to unless else + registers an offense for assigning any variable type to case when + registers an offense assigning any variable type to if else + registers an offense assigning any variable type to if elsif else + allows assignment to if without else + registers an offense assigning any variable type to ternary + registers an offense assigning any variable type to if elsewith multiple assignment + >= Ruby 2.7 + registers an offense for assigning any variable type to case in + behaves like multiline all variable types offense + assigning any variable type to an if else with multiline in one branch + assigning any variable type to a multiline if elsif else + assigning any variable type to a multiline case when + assigning any variable type to a multiline unless else + assigning any variable type to a multiline if else + behaves like multiline all assignment types offense + any assignment to a multiline if else + any assignment to a multiline case when + any assignment to a multiline unless else + behaves like all assignment types + registers an offense any assignment to if else + does not crash when used inside rescue + allows any assignment to if without else + registers an offense for any assignment to unless else + registers an offense for any assignment to ternary + registers an offense any assignment to case when + behaves like all assignment types + registers an offense for any assignment to unless else + registers an offense any assignment to if else + allows any assignment to if without else + does not crash when used inside rescue + registers an offense for any assignment to ternary + registers an offense any assignment to case when + behaves like multiline all assignment types offense + any assignment to a multiline case when + any assignment to a multiline unless else + any assignment to a multiline if else + behaves like multiline all assignment types offense + any assignment to a multiline unless else + any assignment to a multiline case when + any assignment to a multiline if else + behaves like multiline all assignment types offense + any assignment to a multiline unless else + any assignment to a multiline if else + any assignment to a multiline case when + behaves like multiline all assignment types offense + any assignment to a multiline unless else + any assignment to a multiline if else + any assignment to a multiline case when + behaves like all assignment types + does not crash when used inside rescue + registers an offense for any assignment to unless else + registers an offense any assignment to case when + registers an offense for any assignment to ternary + registers an offense any assignment to if else + allows any assignment to if without else + behaves like multiline all assignment types offense + any assignment to a multiline if else + any assignment to a multiline case when + any assignment to a multiline unless else + behaves like all assignment types + registers an offense for any assignment to ternary + registers an offense any assignment to case when + registers an offense for any assignment to unless else + does not crash when used inside rescue + registers an offense any assignment to if else + allows any assignment to if without else + behaves like multiline all variable types offense + assigning any variable type to a multiline unless else + assigning any variable type to a multiline if else + assigning any variable type to a multiline case when + assigning any variable type to an if else with multiline in one branch + assigning any variable type to a multiline if elsif else + SingleLineConditionsOnly true + corrects assignment to a namespaced constant + allows a method call in the subject of a ternary operator + registers an offense for assignment to an if then else + registers an offense for assignment using []= + corrects assignment when without `else` branch + registers an offense for assignment to case when then else + registers an offense for assignment using a method that ends with an equal sign + behaves like all assignment types + registers an offense any assignment to if else + registers an offense for any assignment to ternary + does not crash when used inside rescue + registers an offense any assignment to case when + allows any assignment to if without else + registers an offense for any assignment to unless else + behaves like all assignment types + registers an offense any assignment to if else + does not crash when used inside rescue + registers an offense any assignment to case when + registers an offense for any assignment to unless else + registers an offense for any assignment to ternary + allows any assignment to if without else + behaves like multiline all assignment types allow + any assignment to a multiline if else + any assignment to a multiline unless else + any assignment to a multiline case when + behaves like multiline all assignment types allow + any assignment to a multiline unless else + any assignment to a multiline case when + any assignment to a multiline if else + behaves like multiline all assignment types allow + any assignment to a multiline if else + any assignment to a multiline case when + any assignment to a multiline unless else + behaves like multiline all assignment types allow + any assignment to a multiline unless else + any assignment to a multiline case when + any assignment to a multiline if else + behaves like all assignment types + registers an offense any assignment to if else + registers an offense for any assignment to unless else + allows any assignment to if without else + registers an offense for any assignment to ternary + registers an offense any assignment to case when + does not crash when used inside rescue + behaves like all variable types + registers an offense for assigning any variable type to case when + registers an offense assigning any variable type to ternary + allows assignment to if without else + registers an offense assigning any variable type to if elsif else + registers an offense assigning any variable type to if else + registers an offense assigning any variable type to if elsewith multiple assignment + does not crash for rescue assignment + registers an offense assigning any variable type to unless else + >= Ruby 2.7 + registers an offense for assigning any variable type to case in + behaves like all assignment types + registers an offense any assignment to case when + registers an offense for any assignment to ternary + does not crash when used inside rescue + registers an offense for any assignment to unless else + allows any assignment to if without else + registers an offense any assignment to if else + behaves like all assignment types + allows any assignment to if without else + registers an offense for any assignment to unless else + registers an offense for any assignment to ternary + registers an offense any assignment to case when + does not crash when used inside rescue + registers an offense any assignment to if else + behaves like all variable types + registers an offense assigning any variable type to if else + registers an offense assigning any variable type to ternary + registers an offense assigning any variable type to if elsewith multiple assignment + registers an offense assigning any variable type to unless else + registers an offense assigning any variable type to if elsif else + registers an offense for assigning any variable type to case when + does not crash for rescue assignment + allows assignment to if without else + >= Ruby 2.7 + registers an offense for assigning any variable type to case in + behaves like all assignment types + registers an offense for any assignment to unless else + does not crash when used inside rescue + registers an offense any assignment to if else + allows any assignment to if without else + registers an offense for any assignment to ternary + registers an offense any assignment to case when + behaves like all assignment types + registers an offense for any assignment to ternary + registers an offense any assignment to if else + registers an offense for any assignment to unless else + registers an offense any assignment to case when + allows any assignment to if without else + does not crash when used inside rescue + behaves like all assignment types + registers an offense any assignment to case when + registers an offense for any assignment to ternary + allows any assignment to if without else + registers an offense any assignment to if else + registers an offense for any assignment to unless else + does not crash when used inside rescue + behaves like multiline all assignment types allow + any assignment to a multiline case when + any assignment to a multiline unless else + any assignment to a multiline if else + behaves like multiline all assignment types allow + any assignment to a multiline case when + any assignment to a multiline unless else + any assignment to a multiline if else + behaves like multiline all assignment types allow + any assignment to a multiline case when + any assignment to a multiline if else + any assignment to a multiline unless else + behaves like multiline all assignment types allow + any assignment to a multiline case when + any assignment to a multiline if else + any assignment to a multiline unless else + behaves like all assignment types + allows any assignment to if without else + registers an offense for any assignment to unless else + registers an offense any assignment to case when + does not crash when used inside rescue + registers an offense any assignment to if else + registers an offense for any assignment to ternary + behaves like multiline all assignment types allow + any assignment to a multiline if else + any assignment to a multiline unless else + any assignment to a multiline case when + behaves like all variable types + registers an offense for assigning any variable type to case when + registers an offense assigning any variable type to if elsif else + registers an offense assigning any variable type to if else + registers an offense assigning any variable type to unless else + registers an offense assigning any variable type to ternary + allows assignment to if without else + does not crash for rescue assignment + registers an offense assigning any variable type to if elsewith multiple assignment + >= Ruby 2.7 + registers an offense for assigning any variable type to case in + behaves like multiline all assignment types allow + any assignment to a multiline if else + any assignment to a multiline case when + any assignment to a multiline unless else + behaves like all variable types + allows assignment to if without else + registers an offense for assigning any variable type to case when + registers an offense assigning any variable type to if elsewith multiple assignment + registers an offense assigning any variable type to ternary + registers an offense assigning any variable type to if else + does not crash for rescue assignment + registers an offense assigning any variable type to if elsif else + registers an offense assigning any variable type to unless else + >= Ruby 2.7 + registers an offense for assigning any variable type to case in + behaves like all variable types + registers an offense for assigning any variable type to case when + does not crash for rescue assignment + allows assignment to if without else + registers an offense assigning any variable type to if else + registers an offense assigning any variable type to if elsewith multiple assignment + registers an offense assigning any variable type to if elsif else + registers an offense assigning any variable type to unless else + registers an offense assigning any variable type to ternary + >= Ruby 2.7 + registers an offense for assigning any variable type to case in + behaves like multiline all assignment types allow + any assignment to a multiline case when + any assignment to a multiline unless else + any assignment to a multiline if else + behaves like multiline all assignment types allow + any assignment to a multiline if else + any assignment to a multiline case when + any assignment to a multiline unless else + behaves like multiline all variable types allow + assigning any variable type to a multiline if elsif else + assigning any variable type to a multiline unless else + assigning any variable type to a multiline if else + assigning any variable type to a multiline case when + assigning any variable type to an if else with multiline in one branch + behaves like all assignment types + registers an offense for any assignment to ternary + allows any assignment to if without else + registers an offense for any assignment to unless else + registers an offense any assignment to if else + does not crash when used inside rescue + registers an offense any assignment to case when + behaves like all assignment types + registers an offense any assignment to if else + registers an offense for any assignment to unless else + does not crash when used inside rescue + registers an offense any assignment to case when + registers an offense for any assignment to ternary + allows any assignment to if without else + behaves like multiline all variable types allow + assigning any variable type to an if else with multiline in one branch + assigning any variable type to a multiline case when + assigning any variable type to a multiline if elsif else + assigning any variable type to a multiline if else + assigning any variable type to a multiline unless else + behaves like multiline all variable types allow + assigning any variable type to a multiline if else + assigning any variable type to a multiline case when + assigning any variable type to a multiline if elsif else + assigning any variable type to a multiline unless else + assigning any variable type to an if else with multiline in one branch + behaves like multiline all assignment types allow + any assignment to a multiline unless else + any assignment to a multiline if else + any assignment to a multiline case when + behaves like all assignment types + registers an offense any assignment to case when + registers an offense for any assignment to unless else + allows any assignment to if without else + does not crash when used inside rescue + registers an offense any assignment to if else + registers an offense for any assignment to ternary + behaves like single line condition autocorrect + corrects assignment to an if elsif else with multiple elsifs + corrects assignment to an unless else condition + corrects assignment to a case when else condition + corrects assignment to an if else condition + corrects assignment to a ternary operator + corrects assignment to a case when else with multiple whens + corrects assignment to an if elsif else condition + behaves like all variable types + registers an offense for assigning any variable type to case when + does not crash for rescue assignment + registers an offense assigning any variable type to unless else + registers an offense assigning any variable type to if else + registers an offense assigning any variable type to ternary + allows assignment to if without else + registers an offense assigning any variable type to if elsewith multiple assignment + registers an offense assigning any variable type to if elsif else + >= Ruby 2.7 + registers an offense for assigning any variable type to case in + behaves like all assignment types + registers an offense any assignment to case when + does not crash when used inside rescue + registers an offense for any assignment to unless else + registers an offense any assignment to if else + registers an offense for any assignment to ternary + allows any assignment to if without else + behaves like multiline all assignment types allow + any assignment to a multiline case when + any assignment to a multiline if else + any assignment to a multiline unless else + behaves like multiline all variable types allow + assigning any variable type to a multiline if elsif else + assigning any variable type to a multiline case when + assigning any variable type to an if else with multiline in one branch + assigning any variable type to a multiline unless else + assigning any variable type to a multiline if else + behaves like all assignment types + registers an offense for any assignment to unless else + allows any assignment to if without else + does not crash when used inside rescue + registers an offense any assignment to if else + registers an offense for any assignment to ternary + registers an offense any assignment to case when + behaves like multiline all assignment types allow + any assignment to a multiline unless else + any assignment to a multiline case when + any assignment to a multiline if else + behaves like multiline all assignment types allow + any assignment to a multiline if else + any assignment to a multiline case when + any assignment to a multiline unless else + behaves like multiline all assignment types allow + any assignment to a multiline unless else + any assignment to a multiline case when + any assignment to a multiline if else + for loop + ignores pseudo assignments in a for loop + behaves like all assignment types + registers an offense any assignment to if else + registers an offense for any assignment to unless else + does not crash when used inside rescue + registers an offense for any assignment to ternary + allows any assignment to if without else + registers an offense any assignment to case when + behaves like multiline all variable types allow + assigning any variable type to a multiline if elsif else + assigning any variable type to a multiline unless else + assigning any variable type to a multiline if else + assigning any variable type to an if else with multiline in one branch + assigning any variable type to a multiline case when + behaves like multiline all variable types allow + assigning any variable type to an if else with multiline in one branch + assigning any variable type to a multiline if else + assigning any variable type to a multiline if elsif else + assigning any variable type to a multiline case when + assigning any variable type to a multiline unless else + behaves like all assignment types + registers an offense for any assignment to ternary + registers an offense for any assignment to unless else + does not crash when used inside rescue + allows any assignment to if without else + registers an offense any assignment to if else + registers an offense any assignment to case when + behaves like all assignment types + does not crash when used inside rescue + allows any assignment to if without else + registers an offense any assignment to case when + registers an offense any assignment to if else + registers an offense for any assignment to ternary + registers an offense for any assignment to unless else + behaves like all assignment types + registers an offense for any assignment to unless else + allows any assignment to if without else + registers an offense any assignment to if else + registers an offense any assignment to case when + does not crash when used inside rescue + registers an offense for any assignment to ternary + behaves like multiline all variable types allow + assigning any variable type to a multiline unless else + assigning any variable type to a multiline if else + assigning any variable type to a multiline case when + assigning any variable type to a multiline if elsif else + assigning any variable type to an if else with multiline in one branch + behaves like all assignment types + registers an offense any assignment to if else + registers an offense for any assignment to ternary + registers an offense for any assignment to unless else + registers an offense any assignment to case when + allows any assignment to if without else + does not crash when used inside rescue + behaves like multiline all assignment types allow + any assignment to a multiline unless else + any assignment to a multiline case when + any assignment to a multiline if else + behaves like multiline all assignment types allow + any assignment to a multiline unless else + any assignment to a multiline if else + any assignment to a multiline case when + behaves like all variable types + registers an offense assigning any variable type to if elsif else + registers an offense assigning any variable type to unless else + allows assignment to if without else + registers an offense assigning any variable type to ternary + registers an offense assigning any variable type to if elsewith multiple assignment + registers an offense for assigning any variable type to case when + registers an offense assigning any variable type to if else + does not crash for rescue assignment + >= Ruby 2.7 + registers an offense for assigning any variable type to case in + IncludeTernaryExpressions false + allows assigning any variable type to ternary + +RuboCop::Cop::Layout::SpaceInsideArrayLiteralBrackets + does not register offense for any kind of reference brackets + when EnforcedStyle is space + does not register offense for valid 2-dimensional array + behaves like space inside arrays + does not register offense when bottom bracket gets its own line & has trailing method + accepts square brackets as method name + registers an offense and corrects multiline array on end bracket with trailing method + does not register offense for arrays with spaces + does not register offense for indented array when bottom bracket gets its own line & is misaligned + registers an offense and corrects an array missing whitespace when there is more than one array on a line + registers an offense and corrects array brackets with no trailing whitespace + register an offense and corrects when 2 arrays are on one line + accepts square brackets called with method call syntax + does not register offense when 2 arrays on one line + does not register offense for valid multiline array + does not register offense for arrays using ref brackets + registers an offense and corrects multiline array on end bracket + registers an offense and corrects array brackets with no leading whitespace + does not register offense for array when brackets get their own line + accepts space inside array brackets with comment with space inside empty braces allowed - registers offense and corrects empty brackets with more than one space inside - registers offense and corrects empty brackets with newline inside - registers offense and corrects empty brackets with no space inside + registers an offense and corrects empty brackets with no space inside + registers an offense and corrects empty brackets with more than one space inside accepts empty brackets with space inside - when EnforcedStyle is space - registers an offense and corrects when a reference bracket is assigned by another reference bracket with no trailing whitespace - does not register offense for reference brackets with spaces - registers an offense and corrects ref brackets with no leading whitespace - accepts square brackets called with method call syntax - registers an offense and corrects ref brackets with no trailing whitespace - registers an offense and correct third ref brackets with no trailing whitespace - does not register offense for array literals - registers and corrects multiple offenses in one set of ref brackets - registers an offense and corrects when a reference bracket with no trailing whitespace is assigned by another reference bracket - registers an offense and corrects second ref brackets with no trailing whitespace - does not register offense for ref bcts with spaces that assign - accepts spaces in array brackets - registers an offense and corrects second ref brackets with no leading whitespace - accepts an array as a reference object - registers and corrects multiple offenses for multiple sets of ref brackets - registers an offense and corrects when a reference bracket with no leading whitespace is assigned by another reference bracket - registers an offense and corrects third ref brackets with no leading whitespace - accepts square brackets as method name when EnforcedStyle is no_space - registers an offense and corrects outer ref brackets - registers an offense and corrects second ref brackets with leading whitespace - registers an offense and corrects third ref brackets with trailing whitespace - registers an offense and corrects when a reference bracket with a leading whitespace is assigned by another reference bracket - register and correct multiple offenses for multiple sets of ref brackets - registers an offense and corrects third ref brackets with leading whitespace - registers multiple offenses and corrects multiple sets of ref brackets - registers an offense and corrects when a reference bracket with a trailing whitespace is assigned by another reference bracket - registers an offense and corrects when a reference bracket is assigned by another reference bracket with trailing whitespace - registers an offense and corrects ref brackets with trailing whitespace - does not register offense for reference brackets with no spaces - does not register offense for ref bcts with no spaces that assign - registers an offense and corrects ref brackets with leading whitespace - accepts square brackets as method name - does not register offense for array literals - registers multiple offenses and corrects one set of ref brackets - accepts an array as a reference object - accepts extra spacing in array brackets + does not register offense for valid multiline array + registers an offense and corrects array brackets with leading whitespace + does not register offense when contains an array literal as an argument after a heredoc is started accepts square brackets called with method call syntax - does not register offense for non-empty brackets with newline inside - registers an offense and corrects second ref brackets with trailing whitespace + accepts a multiline array with whitespace before end bracket + does not register offense for indented array when bottom bracket gets its own line & is misaligned + accepts square brackets as method name + does not register offense for arrays with no spaces + registers an offense and corrects 2 arrays on one line + accepts space inside array brackets if with comment + registers an offense and corrects multiline array on end bracket + does not register offense when bottom bracket gets its own line & has trailing method + registers an offense and corrects an array literal as an argument with trailing whitespace after a heredoc is started + does not register offense for array when brackets get own line + does not register offense when bottom bracket gets its own line indented with tabs + does not register offense for arrays using ref brackets + does not register offense for valid 2-dimensional array + registers an offense and corrects array brackets with trailing whitespace + registers an offense and corrects multiline array on end bracket with trailing method + registers an offense and corrects an array when two on one line + does not register offense when 2 arrays on one line with space inside empty brackets not allowed accepts empty brackets with no space inside - registers an offense and corrects empty brackets with newline inside - registers an offense and corrects empty brackets with 1 space inside + registers an offense and corrects multiline spaces registers an offense and corrects empty brackets with multiple spaces inside + registers an offense and corrects empty brackets with 1 space inside + when EnforcedStyle is compact + registers an offense and corrects space between 2 opening brackets + does not register offense for valid 2-dimensional array + does not register offense for valid 3-dimensional array + accepts multiline array + registers an offense and corrects 2-dimensional array with extra spaces + registers an offense and corrects space between 2 closing brackets + registers an offense and corrects 3-dimensional array with extra spaces + does not register offense for valid 4-dimensional array + behaves like space inside arrays + does not register offense for valid multiline array + does not register offense for arrays with spaces + accepts square brackets called with method call syntax + registers an offense and corrects an array missing whitespace when there is more than one array on a line + accepts space inside array brackets with comment + register an offense and corrects when 2 arrays are on one line + does not register offense for arrays using ref brackets + registers an offense and corrects array brackets with no trailing whitespace + accepts square brackets as method name + does not register offense when 2 arrays on one line + registers an offense and corrects array brackets with no leading whitespace + does not register offense for array when brackets get their own line + registers an offense and corrects multiline array on end bracket with trailing method + does not register offense when bottom bracket gets its own line & has trailing method + registers an offense and corrects multiline array on end bracket + does not register offense for indented array when bottom bracket gets its own line & is misaligned + multiline, 2-dimensional array with newlines + registers an offense and corrects at the beginning of array + registers an offense and corrects at the end of array + multiline, 2-dimensional array with spaces + registers an offense and corrects at the beginning of array + registers an offense and corrects at the end of array -RuboCop::Cop::Style::InlineComment - does not register an offense for a standalone comment - registers an offense for a trailing inline comment - does not register an offense for special rubocop inline comments +RuboCop::Cop::Layout::IndentationStyle + when EnforcedStyle is tabs + accepts a line with tabs between string literals + registers and corrects an offense for a line indented with fractional number ofindentation groups by rounding down + registers and corrects an offense for a line with tab in a string indented with space + registers offenses before __END__ but not after + registers and corrects an offense for a line indented with multiple spaces + accepts a line which begins with tab in a string + accepts a line which begins with tab in a heredoc + accepts a line with tab in a string + accepts a line a tab other than indentation + accepts a line which begins with tab in a multiline heredoc + registers and corrects an offense for a line indented with space + registers an offense for a line indented with mixed whitespace + custom indentation width + uses the configured number of spaces to replace with a tab + when EnforcedStyle is spaces + accepts a line with tab in a string + accepts a line which begins with tab in a string + registers and corrects an offense for a line with tab in a string indented with tab + accepts a line which begins with tab in a heredoc + registers and corrects an offense for a line indented with multiple tabs + registers offenses before __END__ but not after + accepts a line with a tab other than indentation + registers and corrects an offense for a line indented with tab + registers and corrects an offense for a line indented with mixed whitespaces + accepts a line with a tab between string literals + accepts a line which begins with tab in a multiline heredoc + custom indentation width + uses the configured number of spaces to replace a tab -RuboCop::ConfigObsoletion::RenamedCop - #message - when the cop has been moved to a new department - is expected to start with "The `Style/MyCop` cop has been moved to `Layout/MyCop`" - when the cop has changed names but in the same department - is expected to start with "The `Style/MyCop` cop has been renamed to `Style/NewCop`" - when the cop has changed names but in a new department - is expected to start with "The `Style/MyCop` cop has been renamed to `Layout/NewCop`" +RuboCop::Cop::Layout::InitialIndentation + accepts unindented method definition + accepts unindented comment + assignment + registers an offense for indented method definition + registers an offense and corrects indented assignment disregarding comment + accepts empty file + for a file with byte order mark + registers an offense and corrects indented method call after comment + registers an offense and corrects indented method call + accepts unindented method call -RuboCop::Cop::Lint::DeprecatedClassMethods - when using `ENV.dup` - registers an offense - does not register an offense for method calls to `ENV` other than `dup` - prefer `Addrinfo#getnameinfo` over `Socket.gethostbyaddr` - registers an offense for ::Socket.gethostbyaddr - registers an offense for Socket.gethostbyaddr - does not register an offense for method `gethostbyaddr` on other receivers - prefer `block_given?` over `iterator?` - does not register an offense for offensive method `iterator?`on other receivers - registers an offense and corrects iterator? - does not register an offense for block_given? - prefer `Dir.exist?` over `Dir.exists?` - registers an offense and corrects Dir.exists? - does not register an offense for Dir.exist? - does not register an offense for offensive method `exists?`on other receivers - registers an offense and corrects ::Dir.exists? - when using `ENV.clone` - does not register an offense for method calls to `ENV` other than `clone` +RuboCop::Cop::Style::NumericLiterals + accepts long numbers with underscore + autocorrects numeric literal with exponent (large E) and dot + accepts integers with less than three places at the end + registers an offense for an integer with misplaced underscore + ignores non-decimal literals + handles numeric literal with exponent + registers an offense for a float with a long undelimited integer part + registers an offense for a long undelimited integer + does not count a leading minus sign as a digit + autocorrects negative numbers + accepts short numbers without underscore + autocorrects negative floating-point numbers + autocorrects numbers with spaces between leading minus and numbers + autocorrects numeric literal with exponent and dot + accepts a short integer without underscore + when `'3000'` is specified for `AllowedNumbers` + does not register an offense registers an offense - prefer `Addrinfo#getaddrinfo` over `Socket.gethostbyname` - does not register an offense for method `gethostbyname` on other receivers - registers an offense for Socket.gethostbyname - registers an offense for ::Socket.gethostbyname - when using `ENV.freeze` - does not register an offense for method calls to `ENV` other than `freeze` + strict + registers an offense for an integer with misplaced underscore + AllowedPatterns + corrects by inserting underscores every 3 digits + registers an offense for numbers that do not exactly match the pattern + does not register an offense for numbers that exactly match the pattern + AllowedPatterns with repetition + does not register an offense for numbers that match the pattern + for --auto-gen-config + with separators + disables the cop + does not disable the cop if the line is disabled + when the number is only digits + sets the right value if one is disabled inline + detects right value of MinDigits based on the longest number + when `3000` is specified for `AllowedNumbers` registers an offense - prefer `File.exist?` over `File.exists?` - registers an offense and corrects File.exists? - does not register an offense for File.exist? - registers an offense and corrects ::File.exists? + does not register an offense + +RuboCop::Cop::Style::ArgumentsForwarding + TargetRubyVersion <= 2.6 + does not register an offense when using restarg with block arg + TargetRubyVersion >= 3.1 + registers an offense when using restarg, kwargs, and anonymous block arg + registers an offense when using restarg and anonymous block arg + TargetRubyVersion >= 2.7 + registers an offense when delegating + registers an offense when the parentheses of arguments are omitted + does not register an offense when different argument names are used + does not register an offense when assigning the restarg outside forwarding method arguments + does not register an offense when the block arg is overwritten + does not register an offense when body of method definition is empty + does not register an offense when the kwarg is overwritten + does not register an offense when the restarg is overwritten + registers an offense when using restarg and block arg + does not register an offense when using arguments forwarding + registers an offense when using restarg, kwargs and block arg + does not register an offense when different arguments are used + registers an offense when passing restarg and block arg in defs + registers an offense when forwarding to a method in block + does not register an offense when referencing the restarg outside forwarding method arguments + does not register an offense when using the restarg outside forwarding method arguments + AllowOnlyRestArgument: true + does not register an offense when using only rest arg + does not register an offense when using only kwrest arg + AllowOnlyRestArgument: false + registers an offense when using only kwrest arg + registers an offense when using only rest arg + +RuboCop::Cop::Layout::SpaceInLambdaLiteral + when configured to enforce spaces + registers an offense and corrects no space between -> and ( + registers an offense and corrects no space in the inner nested lambda + does not register an offense for multi-line lambdas + does not register an offense for a space between -> and ( + registers an offense and corrects no space in both lambdas when nested + registers an offense and corrects no space in the outer nested lambda + does not register an offense for no space between -> and { + when configured to enforce no space + registers an offense and corrects a space in the outer nested lambda + does not register an offense for no space between -> and ( + registers an offense and corrects a space between -> and ( + does not register an offense for a space between -> and { + registers an offense and corrects spaces between -> and ( + registers an offense and corrects a space in the inner nested lambda + does not register an offense for multi-line lambdas + register offenses and correct spaces in both lambdas when nested + +RuboCop::Formatter::PacmanFormatter + #step + character is normal dot + removes the first • and puts a . + character is a Pacdot + leaves the progress_line as it is + character is ghost + removes the first • and puts a ghosts + character is Pacman + removes the first • and puts a ᗧ + #next_step + when no offenses are detected + calls the step function with a dot + when a offense is detected in a file + calls the step function with a dot + #update_progress_line + when total_files less than columns in the terminal + updates the progress_line properly + when total_files is greater than columns in the terminal + updates the progress_line properly + when need to change the line + updates the progress_line properly + +RuboCop::Cop::Lint::UnexpectedBlockArity + registers multiple offenses + with a block + when given a splat parameter + does not register an offense + with optargs + with arity 1 + registers an offense + with arity 2 + does not register an offense + with shadow args + registers an offense + when given three parameters + does not register an offense + when given two parameters + does not register an offense + when destructuring + with arity 2 + does not register an offense + with arity 1 + registers an offense + when given one parameter + registers an offense + with no receiver + does not register an offense + with a keyword splat + registers an offense + with keyword args + registers an offense + when given no parameters + registers an offense + with a numblock + when given three parameters + does not register an offense + when given one parameter + registers an offense + when given two parameters + does not register an offense + when given no parameters + registers an offense + with no receiver + does not register an offense + when using enough parameters, but not all explicitly + does not register an offense RuboCop::Cop::Lint::ShadowedException + modifier rescue + accepts rescue in its modifier form + single rescue + registers an offense for the same exception multiple times + accepts rescuing a custom exception and a standard exception + accepts rescue containing multiple same error code exceptions + accepts rescuing a single exception that has an else + accepts rescuing a single exception + accepts rescuing a single exception that is assigned to a variable + accepts rescuing a single exception that has an ensure + rescue a exception without causing constant name deprecation warning + accepts an empty rescue + accepts splat arguments passed to rescue + accepts rescuing a multiple exceptions that are not ancestors that have an else + accepts rescuing a single custom exception + accepts rescuing multiple custom exceptions + registers an offense rescuing exceptions that are ancestors of each other + registers an offense rescuing Exception with any other error or exception + when there are multiple levels of exceptions in the same rescue + registers an offense for two exceptions + registers an offense for more than two exceptions multiple rescues - accepts many (>= 7) rescue groups - accepts rescuing exceptions in order of level with multiple exceptions in a group with custom exceptions - ignores expressions of non-const - registers an offense rescuing Exception before an unknown exceptions accepts rescuing custom exceptions in multiple rescue groups - registers an offense for two exceptions when there are multiple levels of exceptions in the same rescue - registers an offense when a higher level exception is rescued before a lower level exception when there are multiple exceptions rescued in a group accepts rescuing exceptions in order of level - accepts rescuing exceptions in order of level with multiple exceptions in a group - registers an offense rescuing out of order exceptions when there is an ensure + accepts many (>= 7) rescue groups + registers an offense rescuing Exception before an unknown exceptions accepts rescuing a known exception after an unknown exceptions - accepts rescuing a known exception between unknown exceptions + accepts rescuing exceptions in order of level with multiple exceptions in a group with custom exceptions accepts rescuing a known exception before an unknown exceptions + accepts rescuing exceptions in order of level with multiple exceptions in a group + registers an offense when a higher level exception is rescued before a lower level exception when there are multiple exceptions rescued in a group + accepts rescuing a known exception between unknown exceptions registers an offense when a higher level exception is rescued before a lower level exception + registers an offense rescuing out of order exceptions when there is an ensure + registers an offense for two exceptions when there are multiple levels of exceptions in the same rescue + ignores expressions of non-const splat arguments - registers an offense for splat arguments rescued after rescuing Exception - does not register an offense for splat arguments rescued after rescuing a known exception accepts splat arguments passed to multiple rescues - exceptions from different ancestry chains - accepts rescuing exceptions in another order - accepts rescuing exceptions in one order + does not register an offense for splat arguments rescued after rescuing a known exception + registers an offense for splat arguments rescued after rescuing Exception last rescue does not specify exception class highlights range ending at rescue keyword - single rescue - accepts rescuing a single exception that has an ensure - registers an offense rescuing exceptions that are ancestors of each other - accepts an empty rescue - accepts rescuing a single exception - accepts rescuing a single custom exception - accepts rescuing a single exception that is assigned to a variable - accepts splat arguments passed to rescue - accepts rescue containing multiple same error code exceptions - registers an offense rescuing Exception with any other error or exception - accepts rescuing a multiple exceptions that are not ancestors that have an else - rescue a exception without causing constant name deprecation warning - accepts rescuing multiple custom exceptions - accepts rescuing a single exception that has an else - registers an offense for the same exception multiple times - accepts rescuing a custom exception and a standard exception - when there are multiple levels of exceptions in the same rescue - registers an offense for more than two exceptions - registers an offense for two exceptions - modifier rescue - accepts rescue in its modifier form + exceptions from different ancestry chains + accepts rescuing exceptions in one order + accepts rescuing exceptions in another order -RuboCop::Cop::Style::ClassMethodsDefinitions - when EnforcedStyle is self_class - does not register an offense when defining singleton methods not on self - does not register an offense when defining class methods with `class << self` - registers an offense when defining class methods with `def self.method` - when EnforcedStyle is def_self - does not register an offense when defining class methods with `def self.method` - registers an offense and corrects when defining class methods with `class << self` - does not register an offense when class << self contains only class methods - registers and corrects an offense when defining class methods with `class << self` with comment only body - correctly handles methods with annotation comments - removes empty class << self when correcting - correctly handles class << self containing multiple methods - correctly handles def self.x within class << self - registers and corrects an offense when defining class methods with `class << self` with inline comment - registers an offense and corrects when defining class methods with `class << self` and there is no blank line between method definition and attribute accessor - does not register an offense when `class << self` contains non public methods - does not register an offense when class << self does not contain methods - does not register an offense when defining singleton methods using `self << object` +RuboCop::Cop::Metrics::MethodLength + accepts empty methods + does not count commented lines by default + properly counts lines when method ends with block + is not fooled by one-liner methods, syntax #1 + is not fooled by one-liner methods, syntax #2 + accepts a method with less than 5 lines + accepts a method with multiline arguments and less than 5 lines of body + does not count blank lines + when method is an instance method + registers an offense + when method is defined on a singleton class + registers an offense + when methods to allow are defined + AllowedMethods is enabled + accepts the foo method with more than 5 lines + still rejects other methods with more than 5 lines + AllowedPatterns is enabled + accepts the user_name method + raises offense for firstname + when `CountAsOne` is not empty + folds array into one line + when CountComments is enabled + also counts commented lines + when using numbered parameter + when method is defined with `define_method` + registers an offense + when method is defined with `define_method` + registers an offense + when method is a class method + registers an offense -RuboCop::Cop::Offense - has a few required attributes - does not blow up if a message contains % - overrides #to_s - is frozen - redefines == to compare offenses based on their contents - when unknown severity is passed - raises error - #severity - is frozen - #<=> - when receiver has {:line=>5, :col=>6} and other has {:line=>5, :col=>5} - returns 1 - when receiver has {:cop=>"B"} and other has {:cop=>"A"} - returns 1 - when receiver has {:line=>6, :cop=>"A"} and other has {:line=>5, :cop=>"B"} - returns 1 - when receiver has {:col=>6, :cop=>"A"} and other has {:col=>5, :cop=>"B"} - returns 1 - when receiver has {} and other has {} - returns 0 - when receiver has {:line=>6} and other has {:line=>5} - returns 1 - when receiver has {:line=>6, :col=>4} and other has {:line=>5, :col=>5} - returns 1 - #location - is frozen - #severity_level - when severity is :refactor - is 2 - when severity is :fatal - is 6 - when severity is :info - is 1 - offenses that span part of a line - highlights the first line - when the location is pseudo - returns the first line - returns a real column - returns a column range - returns a column - returns the last column - returns the last line - returns a source line - returns a line - returns a column length - returns a location with valid size and length - #message - is frozen - #cop_name - is frozen - offenses that span multiple lines - highlights the first line +RuboCop::Cop::Security::MarshalLoad + allows using dangerous Marshal methods for deep cloning + registers an offense for using Marshal.load + registers an offense for using Marshal.restore + does not register an offense Marshal methods under another namespace + does not register an offense for Marshal.dump -RuboCop::Cop::Lint::EmptyEnsure - registers an offense and corrects empty ensure - does not register an offense for non-empty ensure +RuboCop::Cop::Style::NonNilCheck + when `EnforcedStyle: comparison` of `Style/NilComparison` cop + `IncludeSemanticChanges: true` + registers an offense for `foo != nil` + `IncludeSemanticChanges: false` + does not register an offense for `foo != nil` + when allowing semantic changes + corrects code that would not be modified if IncludeSemanticChanges were false + registers an offense for `!x.nil?` + does not register an offense for `x.nil?` + autocorrects by changing `x != nil` to `x` + does not blow up with ternary operators + registers an offense for unless x.nil? + does not blow up when autocorrecting implicit receiver + does not register an offense for `!x` + registers an offense for `not x.nil?` + when not allowing semantic changes + does not register an offense for !x.nil? + does not register an offense for not x.nil? + does not register an offense for != 0 + does not register an offense if only expression in predicate + does not register an offense if only expression in class predicate + registers an offense but does not correct when the code was not modified + does not register an offense if last expression in predicate + registers an offense for != nil + does not register an offense if last expression in class predicate + does not register an offense with implicit receiver -RuboCop::Cop::Security::Eval - accepts eval with no arguments - accepts eval as method - registers an offense for eval as function - registers an offense for eval with string that has an interpolation - accepts eval with a string that interpolates a literal - registers an offense `Binding#eval` - accepts eval with a multiline string - registers an offense for eval as command - accepts eval on a literal string - accepts eval as variable - with an explicit binding, filename, and line number - registers an offense for eval as function - accepts eval on a literal string - registers an offense for eval as command +RuboCop::Cop::InternalAffairs::UselessRestrictOnSend + does not register an offense when using `RESTRICT_ON_SEND` and defines `on_send` with alias + does not register an offense when using `RESTRICT_ON_SEND` and defines `after_send` with alias + does not register an offense when using `RESTRICT_ON_SEND` and defines `on_send` with alias_method + registers an offense when using `RESTRICT_ON_SEND` and not defines send callback method + does not register an offense when using `RESTRICT_ON_SEND` and defines `after_send` with alias_method + does not register an offense when using `RESTRICT_ON_SEND` and defines `on_send` + does not register an offense when using `RESTRICT_ON_SEND` and defines `after_send` -RuboCop::Cop::InternalAffairs::NumblockHandler - does not register an offense for cops with on_numblock alias_method - registers an offense for cops with forgotten numblock handlers - does not register an offense for cops with on_numblock method - does not register an offense for cops with on_numblock alias +RuboCop::Cop::Style::IfWithSemicolon + accepts without `else` branch + can handle modifier conditionals + registers an offense and corrects for one line if/;/end + when elsif is present + accepts second elsif block + accepts with `else` branch + accepts without `else` branch -RuboCop::Cop::Style::EmptyElse - with nested if and case statement - behaves like autocorrect - MissingElse is disabled - does autocorrection - MissingElse is if - does autocorrection - MissingElse is case - does not autocorrect - MissingElse is both - does not autocorrect - configured to warn on empty else - given an unless-statement - with an else-clause with side-effects - doesn't register an offense - with no else-clause - doesn't register an offense - with a completely empty else-clause - behaves like autocorrect - MissingElse is if - does not autocorrect - MissingElse is disabled - does autocorrection - MissingElse is case - does autocorrection - MissingElse is both - does not autocorrect - with an else-clause containing only the literal nil - doesn't register an offense - given an if-statement - with an else-clause containing only the literal nil - doesn't register an offense - with a completely empty else-clause - using semicolons - behaves like autocorrect - MissingElse is disabled - does autocorrection - MissingElse is if - does not autocorrect - MissingElse is case - does autocorrection - MissingElse is both - does not autocorrect - not using semicolons - behaves like autocorrect - MissingElse is disabled - does autocorrection - MissingElse is if - does not autocorrect - MissingElse is case - does autocorrection - MissingElse is both - does not autocorrect - with an empty comment - does not autocorrect - with no else-clause - doesn't register an offense - in an if-statement - behaves like autocorrect - MissingElse is disabled - does autocorrection - MissingElse is case - does autocorrection - MissingElse is if - does not autocorrect - MissingElse is both - does not autocorrect - with an else-clause with side-effects - doesn't register an offense - given a case statement - with a completely empty else-clause - behaves like autocorrect - MissingElse is if - does autocorrection - MissingElse is both - does not autocorrect - MissingElse is disabled - does autocorrection - MissingElse is case - does not autocorrect - with an else-clause containing only the literal nil - doesn't register an offense - with no else-clause - doesn't register an offense - with an else-clause with side-effects - doesn't register an offense - configured to warn on empty else and nil in else - given an if-statement - with a completely empty else-clause - behaves like autocorrect - MissingElse is if - does not autocorrect - MissingElse is both - does not autocorrect - MissingElse is disabled - does autocorrection - MissingElse is case - does autocorrection - with an else-clause with side-effects - doesn't register an offense - with an else-clause containing only the literal nil - with multiple elsifs - behaves like autocorrect - MissingElse is disabled - does autocorrection - MissingElse is if - does not autocorrect - MissingElse is case - does autocorrection - MissingElse is both - does not autocorrect - with one elsif - behaves like autocorrect - MissingElse is both - does not autocorrect - MissingElse is case - does autocorrection - MissingElse is if - does not autocorrect - MissingElse is disabled - does autocorrection - with no else-clause - doesn't register an offense - given a case statement - with a completely empty else-clause - behaves like autocorrect - MissingElse is case - does not autocorrect - MissingElse is disabled - does autocorrection - MissingElse is both - does not autocorrect - MissingElse is if - does autocorrection - with an else-clause with side-effects - doesn't register an offense - with no else-clause - doesn't register an offense - with an else-clause containing only the literal nil - behaves like autocorrect - MissingElse is case - does not autocorrect - MissingElse is disabled - does autocorrection - MissingElse is if - does autocorrection - MissingElse is both - does not autocorrect - given an unless-statement - with an else-clause containing only the literal nil - behaves like autocorrect - MissingElse is disabled - does autocorrection - MissingElse is case - does autocorrection - MissingElse is if - does not autocorrect - MissingElse is both - does not autocorrect - with an else-clause with side-effects - doesn't register an offense - with no else-clause - doesn't register an offense - with a completely empty else-clause - behaves like autocorrect - MissingElse is case - does autocorrection - MissingElse is if - does not autocorrect - MissingElse is both - does not autocorrect - MissingElse is disabled - does autocorrection - when `AllowComments: true` - given an unless-statement - with not comment and empty else-clause - registers an offense - with not comment and nil else-clause - registers an offense - with comment and nil else-clause - doesn't register an offense - with comment and empty else-clause - doesn't register an offense - given an if-statement - with comment and empty else-clause - doesn't register an offense - with comment and nil else-clause - doesn't register an offense - with not comment and empty else-clause - registers an offense - with not comment and nil else-clause - registers an offense - given a case statement - with not comment and empty else-clause - registers an offense - with not comment and nil else-clause - registers an offense - with comment and empty else-clause - doesn't register an offense - with comment and nil else-clause - doesn't register an offense - configured to warn on nil in else - given an unless-statement - with no else-clause - doesn't register an offense - with an else-clause with side-effects - doesn't register an offense - with an else-clause containing only the literal nil - behaves like autocorrect - MissingElse is if - does not autocorrect - MissingElse is both - does not autocorrect - MissingElse is disabled - does autocorrection - MissingElse is case - does autocorrection - with a completely empty else-clause - doesn't register an offense - given an if-statement - with a completely empty else-clause - doesn't register an offense - with no else-clause - doesn't register an offense - with an else-clause containing only the literal nil using semicolons - with one elsif - behaves like autocorrect - MissingElse is if - does not autocorrect - MissingElse is case - does autocorrection - MissingElse is both - does not autocorrect - MissingElse is disabled - does autocorrection - with multiple elsifs - behaves like autocorrect - MissingElse is case - does autocorrection - MissingElse is if - does not autocorrect - MissingElse is both - does not autocorrect - MissingElse is disabled - does autocorrection - with an else-clause with side-effects - doesn't register an offense - with an else-clause containing only the literal nil - when the result is assigned to a variable - behaves like autocorrect - MissingElse is disabled - does autocorrection - MissingElse is if - does not autocorrect - MissingElse is case - does autocorrection - MissingElse is both - does not autocorrect - when standalone - behaves like autocorrect - MissingElse is both - does not autocorrect - MissingElse is if - does not autocorrect - MissingElse is disabled - does autocorrection - MissingElse is case - does autocorrection - given a case statement - with a completely empty else-clause - doesn't register an offense - with an else-clause with side-effects - doesn't register an offense - with an else-clause containing only the literal nil - when the result is assigned to a variable - behaves like autocorrect - MissingElse is case - does not autocorrect - MissingElse is disabled - does autocorrection - MissingElse is both - does not autocorrect - MissingElse is if - does autocorrection - using semicolons - behaves like autocorrect - MissingElse is case - does not autocorrect - MissingElse is both - does not autocorrect - MissingElse is disabled - does autocorrection - MissingElse is if - does autocorrection - with no else-clause - doesn't register an offense +RuboCop::Cop::Style::RedundantFetchBlock + with SafeForConstants: false + does not register an offense when using `#fetch` with constant in the block + with SafeForConstants: true + registers an offense and corrects when using `#fetch` with Float in the block + registers an offense and corrects when using `#fetch` with Symbol in the block + does not register an offense when using `#fetch` with argument fallback + registers an offense and corrects when using `#fetch` with Rational in the block + registers an offense and corrects when using `#fetch` with empty block + does not register an offense when using `#fetch` with an argument in the block + does not register an offense when using `#fetch` with interpolated Symbol in the block + registers an offense and corrects when using `#fetch` with Complex in the block + does not register an offense when using `#fetch` with `Rails.cache` + registers an offense and corrects when using `#fetch` with constant in the block + registers an offense and corrects when using `#fetch` with String in the block and strings are frozen + registers an offense and corrects when using `#fetch` with Integer in the block + does not register an offense when using `#fetch` with String in the block and strings are not frozen -RuboCop::Formatter::QuietFormatter - #report_summary - when no files inspected - handles pluralization correctly - when a offense detected and a offense correctable - handles pluralization correctly - when 2 offenses detected and 2 offenses correctable - handles pluralization correctly - when a offense detected - handles pluralization correctly - when an offense is corrected - prints about correction - when a file inspected and no offenses detected - handles pluralization correctly - when 2 offenses detected - handles pluralization correctly - when 2 offenses are corrected and 2 offenses correctable - handles pluralization correctly - when 2 offenses are corrected - handles pluralization correctly - #report_file - when the offense is correctable - prints message as-is - the file is under the current working directory - prints as relative path - when the offense is automatically corrected - prints [Corrected] along with message - the file is outside of the current working directory - prints as absolute path - when the offense is not corrected - prints message as-is +RuboCop::Cop::Style::MultilineTernaryOperator + register an offense and corrects when returning a multiline ternary operator expression with `next` + register an offense and corrects when returning a multiline ternary operator expression with `break` + accepts a single line ternary operator expression + registers an offense and corrects when condition is multiline and using hash key assignment + registers an offense and corrects when the false branch is on a separate line + registers an offense and corrects when the false branch is on a separate line and assigning a return value + registers an offense and corrects when everything is on a separate line + registers an offense and corrects when condition is multiline + registers offense and corrects when the if branch and the else branch are on a separate line from the condition + register an offense and corrects when returning a multiline ternary operator expression with `return` + registers an offense and corrects when condition is multiline and using assignment method + register an offense and corrects when returning a multiline ternary operator expression with method call -RuboCop::Cop::Style::DoubleCopDisableDirective - does not register an offense for cops with single cop directive - registers an offense for duplicate disable directives - registers an offense for duplicate todo directives +RuboCop::Cop::Style::CaseEquality + when AllowOnSelfClass is false + does not fail when the receiver is implicit + registers an offense and corrects for === when the receiver is a regexp + does not register an offense for === when the receiver is not a camel cased constant + registers an offense and corrects for === when the receiver is self.class + registers an offense and corrects for === when the receiver is a range + registers an offense and does not correct for === when receiver is of some other type + when AllowOnConstant is false + registers an offense and corrects for === when the receiver is a regexp + does not fail when the receiver is implicit + does not register an offense for === when the receiver is not a camel cased constant + registers an offense and corrects for === when the receiver is a range + registers an offense and corrects for === when the receiver is a constant + registers an offense and does not correct for === when receiver is of some other type + when AllowOnConstant is true + registers an offense and corrects for === when the receiver is a regexp + does not register an offense for === when the receiver is not a camel cased constant + registers an offense and corrects for === when the receiver is a range + does not fail when the receiver is implicit + does not register an offense for === when the receiver is a constant + registers an offense and does not correct for === when receiver is of some other type + when AllowOnSelfClass is true + does not register an offense for === when the receiver is not a camel cased constant + does not register an offense for === when the receiver is self.class + registers an offense and corrects for === when the receiver is self.klass + registers an offense and corrects for === when the receiver is a range + registers an offense and corrects for === when the receiver is a regexp + does not fail when the receiver is implicit + registers an offense and does not correct for === when receiver is of some other type -RuboCop::Cop::Style::RedundantAssignment - accepts empty when nodes - accepts empty method body - does not register an offense when ensure block present - accepts empty if body - reports an offense for def ending with assignment and returning - when inside a when-branch - registers an offense and autocorrects - when inside begin-end body - registers an offense and autocorrects - when rescue blocks present - registers an offense and autocorrects when inside function or rescue block - when inside an if-branch - registers an offense and autocorrects +RuboCop::Cop::Style::InlineComment + does not register an offense for a standalone comment + registers an offense for a trailing inline comment + does not register an offense for special rubocop inline comments -RuboCop::Cop::Lint::RedundantWithObject - registers an offense and corrects when using ary.each_with_object do-end block without parentheses - an object is used as a block argument - registers an offense and corrects when using `ary.each.with_object([]) { |v| v }` - registers an offense and corrects when using `ary.each_with_object { |v| v }` - registers an offense and corrects when using ary.each_with_object([]) do-end block - Ruby 2.7 - registers an offense and corrects when using `ary.each_with_object { _1 }` - registers an offense and corrects when using `ary.each.with_object([]) { _1 }` - when missing argument to `each_with_object` - does not register an offense when block has 1 argument - does not register an offense when block has 2 arguments +RuboCop::Cop::Layout::EmptyLinesAroundClassBody + when EnforcedStyle is no_empty_lines + autocorrects singleton class body containing only a blank + registers an offense for class body ending with a blank + registers an offense for class body starting with a blank + registers an offense for singleton class body ending with a blank + when EnforcedStyle is empty_lines_except_namespace + when only child is module + registers offense for namespace body ending with a blank + registers offense for namespace body starting with a blank + requires no empty lines for namespace + when only child is class + registers offenses for namespaced class body not starting with a blank + autocorrects beginning and end + registers offense for namespace body ending with a blank + registers offense for namespace body starting with a blank + registers offenses for namespaced class body not ending with a blank + requires no empty lines for namespace + when has multiple child classes + registers offenses for namespace body starting and ending without a blank + requires empty lines for namespace + when EnforcedStyle is beginning_only + registers an offense for an empty line at the end of a class + ignores empty lines at the beginning of a class + when EnforcedStyle is ending_only + ignores empty lines at the beginning of a class + registers an offense for an empty line at the end of a class + when EnforcedStyle is empty_lines_special + when first child is NOT a method + does not require blank line at the beginning of class body but requires blank line before first def definition and requires blank line at the end of class body + when class has a namespace + requires no empty lines for namespace and does not require blank line at the beginning of class body but requires blank line at the end of class body + source with constants + registers and autocorrects the offenses + source without blank lines + registers and autocorrects the offenses + source with blank lines + registers and autocorrects the offenses + source with blank lines + registers an offense for class beginning with a blank line + source without blank lines + registers an offense for class not ending with a blank line + source with comment before method definition + registers an offense for class beginning with a blank line + when first child is an access modifier + with no blank lines at the beginning and ending of class body + registers and corrects an offense + with blank lines at the beginning and ending of class body + registers no offense + class with constant and child class + registers and autocorrects the offenses + class with empty body + with empty line + does NOT register offenses + without empty line + does NOT register offenses + class with only constants + registers and autocorrects the offenses + when first child is a method + requires blank line at the beginning and ending of class body + when class has a namespace + requires no empty lines for namespace but requires blank line at the beginning and ending of class body + source without blank lines + registers and autocorrects the offenses + source with blank lines + autocorrects the offenses + source without blank lines + registers an offense for class not beginning and ending with a blank line + when namespace has multiple children + requires empty lines for namespace + when EnforcedStyle is empty_lines + accepts classes with an empty body + registers an offense for singleton class body not starting or ending with a blank + does not register offenses when specifying a superclass that breaks the line + accepts singleton classes with an empty body + registers an offense for class body not starting or ending with a blank + does not register offenses -RuboCop::Cop::Lint::FloatComparison - registers an offense when comparing with method on float receiver - registers an offense when comparing with float - registers an offense when comparing with float returning method - registers an offense when comparing with float method that can return numeric and returns float - does not register an offense when comparing with float method that can return numeric and returns integer - does not register an offense when comparing with float using epsilon - registers an offense when comparing with arightmetic operator on floats +RuboCop::Cop::Style::SelfAssignment + registers an offense for non-shorthand assignment | and @x + registers an offense for non-shorthand assignment | and x + registers an offense for non-shorthand assignment - and @x + registers an offense for non-shorthand assignment + and @x + registers an offense for non-shorthand assignment & and @@x + registers an offense for non-shorthand assignment * and @x + registers an offense for non-shorthand assignment + and x + registers an offense for non-shorthand assignment | and @@x + registers an offense for non-shorthand assignment || and @x + registers an offense for non-shorthand assignment / and @@x + registers an offense for non-shorthand assignment / and @x + registers an offense for non-shorthand assignment || and @@x + registers an offense for non-shorthand assignment ** and @x + registers an offense for non-shorthand assignment && and x + registers an offense for non-shorthand assignment & and x + registers an offense for non-shorthand assignment / and x + registers an offense for non-shorthand assignment * and x + registers an offense for non-shorthand assignment && and @@x + registers an offense for non-shorthand assignment || and x + registers an offense for non-shorthand assignment & and @x + registers an offense for non-shorthand assignment + and @@x + registers an offense for non-shorthand assignment ** and @@x + registers an offense for non-shorthand assignment - and @@x + registers an offense for non-shorthand assignment * and @@x + registers an offense for non-shorthand assignment - and x + registers an offense for non-shorthand assignment && and @x + registers an offense for non-shorthand assignment ** and x -RuboCop::Cop::Gemspec::DuplicatedAssignment - does not register an offense when using `<<` twice - registers an offense when using `name=` twice with `cbase` - does not register an offense when using `spec.add_dependency` twice - registers an offense when using `required_ruby_version=` twice - registers an offense when using `version=` twice - does not register an offense when `name=` method call is not block value - registers an offense when using `name=` twice +RuboCop::Cop::Style::ClassMethods + registers an offense for methods using a module name + registers an offense for methods using a class name + does not register an offense outside class/module bodies + does not register an offense for other top-level singleton methods + does not register an offense for methods using self -RuboCop::Cop::Style::ModuleFunction - when enforced style is `extend_self` - registers an offense for `module_function` without an argument - accepts module_function with an argument - when enforced style is `forbidden` - accepts `extend self` in a class - registers an offense for `module_function` without an argument - registers an offense for `extend self` - in a module with declarative private - in a module with private methods - in a module - when enforced style is `module_function` - accepts for `extend self` in a module with private methods - accepts for `extend self` in a module with declarative private - registers an offense for `extend self` in a module - accepts `extend self` in a class +RuboCop::Cop::Lint::PercentSymbolArray + detecting colons or commas in a %i/%I string + accepts tokens without colons or commas + registers an offense and corrects when symbols contain colons and are comma separated + registers an offense and corrects when one symbol has a colon but there are no commas + registers an offense and corrects when one symbol has a colon but there are no commas + registers an offense and corrects when there are no colons but one comma + accepts tokens without colons or commas + accepts likely false positive $, + registers an offense and corrects when symbols contain colons and are comma separated + accepts likely false positive $, + registers an offense and corrects when there are no colons but one comma + with binary encoded source + accepts if tokens contain no quotes + registers an offense and corrects when tokens contain quotes -RuboCop::Cop::InternalAffairs::LocationLineEqualityComparison - registers and corrects an offense when comparing `#loc.line` with LHS and RHS - registers an offense and corrects when using `loc.first_line` - registers an offense and corrects when using `source_range.first_line` - registers an offense and corrects when using `first_line` - registers and corrects an offense when comparing `#loc.source_range` with LHS and RHS - does not register an offense when using `same_line?` +RuboCop::Cop::Style::TrivialAccessors + registers an offense on class reader + accepts non-trivial writer + accepts reader nested within a module + registers an offense on class writer + registers an offense on reader with `private` + accepts reader using top level + accepts non-trivial reader + registers an offense on reader with braces + does not register an offense on DSL-style writer + accepts splats + accepts expressions within writer + accepts writer in a module + accepts blocks + accepts reader nested within an instance_eval call + flags a reader inside a class, inside an instance_eval call + accepts expressions within reader + accepts writer nested within a module + accepts reader with different ivar name + registers an offense on one-liner reader + registers an offense on instance reader + accepts writer with different ivar name + accepts an initialize method looking like a writer + registers an offense on instance writer + accepts writer nested within an instance_eval call + registers an offense on one-liner writer + accepts writer using top level + registers an offense on writer without braces + with allowed methods + accepts allowed writer + accepts allowed reader + with AllowPredicates: false + accepts allowed predicate + ignore class methods + accepts class reader + accepts class writer + allow predicates + accepts predicate-like reader + with DSL denied + registers an offense on DSL-style writer + exact name match disabled + registers an offense when names mismatch in writer + registers an offense when names mismatch in reader + disallow predicates + does not accept predicate-like reader -RuboCop::CLI --auto-gen-config - --auto-gen-config - can generate Exclude properties with a given limit - generates EnforcedStyle parameter if it solves all offenses - overwrites an existing todo file - generates Exclude if no EnforcedStyle solves all offenses - generates Exclude instead of Max when --auto-gen-only-exclude is used - can be called when there are no files to inspection - does not include a timestamp when --no-auto-gen-timestamp is used - does not generate configuration for the Syntax cop - can generate a todo list - generates a todo list that removes the reports - includes --auto-gen-only-exclude in the command comment when given - honors rubocop:disable comments - does not include offense counts when --no-offense-counts is used - for existing configuration with Exclude - leaves out Excludes that appear in .rubocop.yml but are merged for the cop - leaves out Excludes that appear in .rubocop.yml but are merged globally - generates Excludes that appear in .rubocop.yml - when existing config file has a YAML document start header - inserts `inherit_from` key after hearder - when cop is not safe to autocorrect - can generate a todo list, with the appropriate flag - when different styles appear in different files - generates Exclude list if --exclude-limit is not exceeded - disables cop if --exclude-limit is exceeded - when hash value omission enabled - generates Exclude if it solves all offenses - when .rubocop.yml is empty - bases other cops' configuration on the code base's current maximum line length - when .rubocop.yml inherits only from .rubocop_todo.yml in an array - bases other cops' configuration on the code base's current maximum line length - when .rubocop.yml inherits from two other files - bases other cops' configuration on the code base's current maximum line length - when .rubocop.yml inherits from another file - bases other cops' configuration on the code base's current maximum line length - when --no-exclude-limit is given - always prefers Exclude to Enabled - when .rubocop.yml inherits only from .rubocop_todo.yml - bases other cops' configuration on the code base's current maximum line length - console output - displays report summary but no offenses - when .rubocop.yml does not exist - bases other cops' configuration on the code base's current maximum line length - when duplicated default configuration parameter - parameters are displayed without duplication - when working with a cop who do not support autocorrection - can generate a todo list - with Layout/LineLength:Max overridden - when .rubocop.yml has Layout/LineLength disabled - skips the cop from both phases of the run - when .rubocop.yml has Layout/LineLength:Max less than code base max - bases other cops' configuration on the overridden LineLength:Max - when .rubocop.yml has Layout/LineLength:Max more than code base max - bases other cops' configuration on the overridden LineLength:Max - when working in a subdirectory - can generate a todo list - when .rubocop.yml inherits from another file and .rubocop_todo.yml - bases other cops' configuration on the code base's current maximum line length - when .rubocop.yml doesn't inherit - bases other cops' configuration on the code base's current maximum line length - when inheriting from a URL - when there are multiple entries - can generate a todo list - when there is a single entry - can generate a todo list - when --config is used - can generate a todo list - can generate a todo list if default .rubocop.yml exists +RuboCop::Cop::Lint::ToEnumArguments + does not register an offense when not inside method definition + registers an offense when enumerator is created for `__method__` with missing arguments + registers an offense when enumerator is created for another method + registers an offense when other values are passed for keyword arguments + registers an offense when required keyword arg is missing + registers an offense when splat keyword arg is missing + registers an offense when arguments are swapped + does not register an offense when enumerator is created with `__method__` and the correct arguments + does not register an offense when method call has a receiver other than `self` + registers an offense when required arg is missing + registers an offense when method is called on `self` + registers an offense when optional arg is missing + does not register an offense when enumerator is created with `:m` and the correct arguments + registers an offense when optional keyword arg is missing + ignores the block argument + registers an offense when splat arg is missing + does not register an offense when enumerator is created with `__callee__` and the correct arguments + arguments forwarding + registers an offense when enumerator is created with non matching arguments + does not register an offense when enumerator is created with the correct arguments -RuboCop::Cop::Lint::EmptyWhen - when a `when` body is missing - registers an offense for missing when body followed by else - registers an offense for missing when body with a comment - registers an offense for missing when body with a comment followed by else - registers an offense for missing when ... then body followed by else - registers an offense for a missing when body - registers an offense when case line has no expression - registers an offense for missing when ... then body - when a `when` body is present - accepts case with when bodies - accepts case with when bodies and else clause - accepts with no case line expression - accepts case with when ... then statements and else clause - accepts case with when ... then statements - when `AllowComments: false` - registers an offense for empty when body with a comment - when `AllowComments: true` - registers an offense for missing when body without a comment - accepts an empty when body with a comment - accepts an empty when ... then body with a comment +RuboCop::Cop::Style::MinMax + with an array literal containing calls to `#min` and `#max` + when the expression stands alone + registers an offense if the receivers match + does not register an offense if the receivers do not match + does not register an offense if there are additional elements + does not register an offense if the receiver is implicit + when the expression is used in a parallel assignment + does not register an offense if the receiver is implicit + does not register an offense if there are additional elements + does not register an offense if the receivers do not match + registers an offense if the receivers match + when the expression is used as a return value + does not register an offense if there are additional elements + does not register an offense if the receiver is implicit + does not register an offense if the receivers do not match + registers an offense if the receivers match -RuboCop::Cop::Gemspec::RequiredRubyVersion - registers an offense when `required_ruby_version` is an empty array - registers an offense when `required_ruby_version` is not specified - registers an offense when `required_ruby_version` is blank - target ruby version > 2.7 - recognizes a Gem::Requirement with multiple requirements and does not register an offense - registers an offense when `required_ruby_version` is specified in array and is lower than `TargetRubyVersion` - registers an offense when `required_ruby_version` is specified with >= and is lower than `TargetRubyVersion` - recognizes Gem::Requirement and registers offense - registers an offense when `required_ruby_version` is specified with ~> and is lower than `TargetRubyVersion` - false negatives - does not register an offense when `required_ruby_version` is assigned as a variable (an array of string literal) - does not register an offense when `required_ruby_version` is assigned as a variable (string literal) - target ruby version > 2.6 - registers an offense when `required_ruby_version` is specified with ~> and is higher than `TargetRubyVersion` - registers an offense when `required_ruby_version` is specified with >= and is higher than `TargetRubyVersion` - target ruby version > 2.7 - registers an offense when `required_ruby_version` is specified with ~> without a minor version and is lower than `TargetRubyVersion` - does not register an offense when `required_ruby_version` is specified with >= and equals `TargetRubyVersion` - does not register an offense when `required_ruby_version` is specified with >= without a patch version and equals `TargetRubyVersion` - does not register an offense when `required_ruby_version` is specified with ~> and equals `TargetRubyVersion` - registers an offense when `required_ruby_version` is specified with >= without a minor version and is lower than `TargetRubyVersion` - does not register an offense when lowest version of `required_ruby_version` equals `TargetRubyVersion` - does not register an offense when `required_ruby_version` is specified with ~> without a patch version and equals `TargetRubyVersion` +RuboCop::Cop::Layout::SpaceBeforeFirstArg + for method calls with parentheses + accepts a method call with space after the left parenthesis + accepts a method call without space + for method calls without parentheses + accepts + operator + accepts a method call with one space before the first arg + registers an offense and corrects method call with two spaces before the first arg + registers an offense for method call with no spaces before the first arg + accepts multiple space containing line break + accepts setter call + when a vertical argument positions are aligned + registers an offense + when AllowForAlignment is true + accepts method calls with aligned first arguments + when AllowForAlignment is false + registers an offense and corrects method calls with aligned first arguments + when using safe navigation operator + registers an offense and corrects method call with two spaces before the first arg -RuboCop::CLI - does not register any offenses for an empty file - finds a file with no .rb extension but has a shebang line - can process a file with an invalid UTF-8 byte sequence - registers an offense for Parser warnings - registers an offense for a syntax error - checks a given file with faults and returns 1 - configuration of `require` - unknown library is specified - exits with 2 - for a disabled cop - reports no offense when enabled on part of a file - obsolete cops - when configuration for TrailingComma is given - fails with an error message - unknown cop - in configuration file is given - prints the error and exists with code 2 - info severity - when there are not only info offenses - returns a 1 code - when given `--fail-level info` - returns a 1 code - when given `--display-only-fail-level-offenses` - returns a 0 code but does not list offenses - when there are only info offenses - returns a 0 code - when `Lint/Syntax` is given `Severity: info` - is an invalid configuration - rubocop:disable comment - can disable selected cops on a single line - can disable all cops in a code section - can disable selected cops in a code section - can disable all cops on a single line - when not necessary - causes an offense to be reported - and RedundantCopDisableDirective is individually disabled - does not report RedundantCopDisableDirective offenses - and there are no other offenses - exits with error code - when using `rubocop:disable` line comment for `Lint/EmptyBlock` - does not register an offense for `Lint/RedundantCopDisableDirective` - and RedundantCopDisableDirective is disabled through department - does not report RedundantCopDisableDirective offenses - and RedundantCopDisableDirective is individually excluded - does not report RedundantCopDisableDirective offenses - when using `rubocop:disable` line comment for `Style/RedundantInitialize` - does not register an offense for `Lint/RedundantCopDisableDirective` - without using namespace - can disable selected cops on a single line but prints a warning - when --autocorrect-all is given - does not trigger RedundantCopDisableDirective due to lines moving around - Specify `--init` option to `rubocop` command - when .rubocop.yml already exists - fails with an error message - when .rubocop.yml does not exist - generate a .rubocop.yml file - when parallel static by default - when setting `UseCache: true` - fails with an error message - when setting `UseCache: false` - fails with an error message - when specifying `--debug` and `-a` options` - uses parallel inspection when correcting the file - when specifying `--debug` option only` - fails with an error message - cops can exclude files based on config - ignores excluded files - when a directory is named `*` - does not crash - when checking a correct file - returns 0 - when super is used with a block - still returns 0 - style guide only usage - via the cli option - --only-guide-cops - runs cops for rules that link to a style guide - overrides configuration of AllCops/StyleGuideCopsOnly - skips cops that have no link to a style guide - via the config - AllCops/DisabledByDefault - when it is true - runs only the cop configured in .rubocop.yml - when it is false - runs all cops that are enabled in default configuration - AllCops/StyleGuideCopsOnly - when it is false - runs cops for rules regardless of any link to the style guide - when it is true - skips cops that have no link to a style guide - when lines end with CR+LF - reports an offense - when errors are raised while processing files due to bugs - displays an error message to stderr - configuration from file - works when a configuration file specifies Severity for Metrics/ParameterLists and Layout - excludes the vendor directory by default - runs without errors for an unrecognized cop name in .rubocop.yml and `--ignore-unrecognized-cops` option is given - can be configured to override a parameter that is a hash in a special case - finds included files - displays cop names if DisplayCopNames is false - can disable parser-derived offenses with warning severity - prints an error message for an unrecognized EnforcedStyle - cannot disable Syntax offenses - prints an error for an unrecognized cop name in .rubocop.yml - works when a configuration file specifies Severity for Metrics/ParameterLists and Layout/LineLength - can be configured with option to disable a certain error - works when a configuration file passed by -c specifies Exclude with strings - matches included/excluded files correctly when . argument is given - can exclude a typical vendor directory - allows the default configuration file as the -c argument - fails when a configuration file specifies an invalid Severity - can exclude directories relative to .rubocop.yml - shows an error if the input file cannot be found - prints a warning for an unrecognized configuration parameter - does not consider Include parameters in subdirectories - can have different config files in different directories - does not read files in excluded list - works when a cop that others depend on is disabled - can exclude a vendor directory indirectly - can be configured to merge a parameter that is a hash - can exclude a vendor directory with an erroneous config file - works when a configuration file passed by -c specifies Exclude with regexp - can use an alternative max line length from a config file - ignores excluded files - prefers a config file in ancestor directory to another in home - uses the DefaultFormatter if another formatter is not specified - can be configured with project config to disable a certain error - fails when a configuration file has invalid YAML syntax - only reads configuration in explicitly included hidden directories - displays style guide URLs if DisplayStyleGuide is true - when a value in a hash is overridden with nil - acts as if the key/value pair was removed - when configuration is taken from $HOME/.rubocop.yml - handles relative excludes correctly when run from project root - when obsolete MultiSpaceAllowedForOperators param is used - displays a warning - when a file inherits from a higher level - inherits relative excludes correctly - when --force-default-config option is specified - when config file specified with -c - ignores config file - when no config file specified - ignores config file - when MultilineOperationIndentation is used with aligned style and IndentationWidth parameter - fails with an error message - without using namespace - can be configured with option to disable a certain error - when configured for indented_internal_methods style indentation - registers offense for normal indentation in module - accepts indented_internal_methods style indentation - registers offense for normal indentation in class - when MultilineMethodCallIndentation is used with aligned style and IndentationWidth parameter - fails with an error message - when given a file/directory that is not under the current dir - and the Rakefile path is absolute - checks a Rakefile but Style/FileName does not report - and the Rakefile path is relative - checks a Rakefile but Style/FileName does not report - and the directory is relative - checks a Rakefile but Style/FileName does not report - and the directory is absolute - checks a Rakefile but Style/FileName does not report - configuration of target Ruby versions - when configured with an unsupported ruby - fails with an error message - when configured with an unknown version - fails with an error message - configuration of `AutoCorrect` - when setting `AutoCorrect: false` for `Style/StringLiterals` - does not suggest `1 offense autocorrectable` for `Style/StringLiterals` - when interrupted - returns 130 +RuboCop::Cop::Style::FormatString + when enforced style is format + registers an offense for a string followed by something + registers an offense for sprintf with 2 arguments + registers an offense for something followed by a hash + registers an offense for something followed by an array + works if the first operand contains embedded expressions + does not autocorrect String#% with variable argument and assignment + does not register an offense for numbers + registers an offense for sprintf + does not register an offense for ambiguous cases + registers an offense for variable argument but does not autocorrect + when enforced style is sprintf + registers an offense for something followed by an array + registers an offense for variable argument but does not autocorrect + does not register an offense for ambiguous cases + registers an offense for format with 2 arguments + registers an offense for variable argument and assignment but does not autocorrect + registers an offense for String#% with a hash argument + does not register an offense for numbers + registers an offense for a string followed by something + works if the first operand contains embedded expressions + registers an offense for format + when enforced style is percent + registers an offense for sprintf with 3 arguments + registers an offense and corrects when using springf with second argument that uses an operator + registers an offense for format with 3 arguments + registers an offense for format + registers an offense for sprintf + registers an offense for format with a hash argument + accepts format without arguments + accepts String#% + accepts sprintf without arguments + accepts format with 1 argument + accepts sprintf with 1 argument + registers an offense for sprintf with a hash argument -RuboCop::Formatter::MarkdownFormatter - outputs the cached result in Markdown - outputs the result in Markdown +RuboCop::Cop::Style::BlockComments + registers an offense for block comments + accepts regular comments + autocorrects a block comment into a regular comment (without trailingnewline) + autocorrects an empty block comment by removing it + autocorrects a block comment into a regular comment -RuboCop::Cop::Style::SymbolProc - accepts ::Proc.new with 1 argument - does not register an offense when receiver is a array literal and using `max` with a block - accepts Proc.new with 1 argument - autocorrects multiple aliases with symbols as proc - registers an offense when receiver is some value and using `reject` with a block - registers an offense for a block with parameterless method call on param - registers an offense for safe navigation operator - registers an offense when receiver is an array literal and using `select` with a block - accepts block with a block argument - autocorrects correctly when there are no arguments in parentheses - accepts lambda with 1 argument - registers an offense when receiver is an array literal and using `reject` with a block - accepts block with adding a comma after the sole argument - does not crash with a bare method call - does not register an offense when receiver is a hash literal and using `select` with a block - registers an offense for a block when method in body is unary -/+ - accepts a block with an unused argument with an method call - registers an offense when receiver is a hash literal and using `max` with a block - accepts a block with an unused argument with an lvar - registers an offense when receiver is a hash literal and using `min` with a block - accepts block with more than 1 expression in body - accepts empty block body - does not register an offense when receiver is a array literal and using `min` with a block - accepts block with no arguments - does not register an offense when receiver is a hash literal and using `reject` with a block - registers an offense when receiver is some value and using `select` with a block - accepts block with splat params - accepts proc with 1 argument - autocorrects correctly when args have a trailing comma - accepts block with more than 1 arguments - accepts block when method in body is not called on block arg - when AllowedMethods is enabled - accepts ignored method - when the method has arguments - registers an offense - when `super` has no arguments - registers an offense - AllowComments: true - registers an offense for a block with parameterless method call on paramand not contains a comment - accepts block with parameterless method call on param and contains a comment - when AllowedPatterns is enabled - accepts ignored method - numblocks - does not register an offense when receiver is a hash literal and using `reject` with a numblock - accepts lambda with 1 numbered parameter - registers an offense when receiver is some value and using `select` with a numblock - registers an offense when receiver is an array literal and using `select` with a numblock - registers an offense when receiver is an hash literal and using `max` with a numblock - does not register an offense when receiver is a hash literal and using `select` with a numblock - accepts Proc.new with 1 numbered parameter - registers an offense when receiver is an hash literal and using `min` with a numblock - accepts block with only second numbered parameter - accepts ::Proc.new with 1 numbered parameter - does not register an offense when receiver is a array literal and using `min` with a numblock - accepts block with multiple numbered parameters - registers an offense when receiver is some value and using `reject` with a numblock - registers an offense for a block with a numbered parameter - registers an offense when receiver is an array literal and using `reject` with a numblock - accepts proc with 1 numbered parameter - does not register an offense when receiver is a array literal and using `max` with a numblock - when `AllowMethodsWithArguments: true` - when method has no arguments +RuboCop::Cop::Lint::UnifiedInteger + when Integer + with MyNamespace + does not register an offense + when explicitly specified as toplevel constant + does not register an offense + without any decorations + does not register an offense + target ruby version < 2.4 + when Bignum + with MyNamespace + does not register an offense + without any decorations + registers an offense and autocorrects + when explicitly specified as toplevel constant + registers an offense + target ruby version >= 2.4 + when Bignum + without any decorations + registers an offense + when explicitly specified as toplevel constant + registers an offense + with MyNamespace + does not register an offense + target ruby version >= 2.4 + when Fixnum + without any decorations + registers an offense + with MyNamespace + does not register an offense + when explicitly specified as toplevel constant + registers an offense + target ruby version < 2.4 + when Fixnum + with MyNamespace + does not register an offense + without any decorations + registers an offense and autocorrects + when explicitly specified as toplevel constant + registers an offense + +RuboCop::Cop::Lint::DuplicateMagicComment + registers an offense when different encoding magic comments are duplicated + registers an offense when same encoding magic comments are duplicated + does not register an offense when frozen magic comments are not duplicated + does not register an offense when encoding and frozen magic comments are not duplicated + does not register an offense when encoding magic comments are not duplicated + registers an offense when frozen magic comments are duplicated + registers an offense when encoding and frozen magic comments are duplicated + +RuboCop::Cop::Migration::DepartmentName + when a disable comment has cop names with departments + accepts + when a disable comment contains a plain comment + accepts + when an unexpected disable comment format + does not register an offense + when todo/enable comments have cop names without departments + registers offenses and corrects + registers offenses and corrects when there is space around `:` + registers offenses and corrects when using a legacy cop name + when only department name has given + does not register an offense + when a disable comment contains an unexpected character for department name + accepts + +RuboCop::Cop::InternalAffairs::UndefinedConfig + works with deeper nested cop names + can handle an empty file + registers an offense when the cop is not within the `RuboCop::Cop` namespace + registers an offense when the cop inherits `RuboCop::Cop::Base` + does not register an offense if using `cop_config` outside of a cop class + registers an offense when the cop inherits `Cop::Base` + does not register an offense for implicit configuration keys + registers an offense when the cop inherits `::RuboCop::Cop::Base` + registers an offense when the cop has no configuration at all + works when the base class is `Cop` instead of `Base` + ignores `cop_config` in non-cop classes + ignores `cop_config` in non-cop subclasses + element lookup + does not register an offense for defined configuration keys + registers an offense for missing configuration keys + fetch + registers an offense for missing configuration keys + does not register an offense for defined configuration keys + with a default value + does not register an offense for defined configuration keys + registers an offense for missing configuration keys + +RuboCop::Cop::Team + #inspect_file + returns offenses + when done twice + allows cops to get ready + when a correction raises an error + records Team#errors + when autocorrection is enabled + still returns offenses + does autocorrection + when Parser reports non-fatal warning for the file + returns Parser warning offenses + returns offenses from cops + when a cop has no interest in the file + returns all offenses except the ones of the cop + when autocorrection is enabled and file encoding is mismatch + no error occurs + when Cop#on_* raises an error + records Team#errors + .new + calls mobilize when passed classes + accepts cops directly classes + #external_dependency_checksum + does not error with no cops + when cop with different checksum joins + has a different checksum for the whole team + when multiple cops join + returns string + when a cop joins + returns string + #autocorrect? + when the option argument of .new is omitted + is expected to be falsey + when { autocorrect: true } is passed to .new + is expected to be truthy + #cops + returns cop instances + when only some cop classes are passed to .new + returns only instances of the classes + when some classes are disabled with config + does not return instances of the classes + when incompatible cops are correcting together + autocorrects without SyntaxError + #forces + returns force instances + when no cops joined force + returns nothing + when multiple cops joined a same force + returns only one force instance + when a cop joined a force + returns the force + #debug? + when the option argument of .new is omitted + is expected to be falsey + when { debug: true } is passed to .new + is expected to be truthy + +RuboCop::Cop::Style::RaiseArgs + when enforced style is compact + accepts a raise with msg argument + accepts a raise with an exception argument + accepts exception constructor with keyword arguments and message argument + when used in a logical or expression + registers an offense and autocorrects + with a raise with exception instantiation and message arguments + reports an offense + when used in a ternary expression + registers an offense and autocorrects + when used in a logical and expression + registers an offense and autocorrects + with correct + opposite + reports an offense + reports multiple offenses + with a raise with 2 args and exception object is assigned to a local variable + reports an offense + with a raise with 3 args + reports an offense + with a raise with 2 args + reports an offense + when enforced style is exploded + accepts exception constructor with keyword arguments + accepts a raise with `new` method without receiver + accepts a raise with 3 args + accepts a raise with splatted arguments + ignores a raise with an exception argument + accepts a raise with msg argument + accepts a raise when exception object is assigned to a local variable + accepts exception constructor with more than 1 argument + accepts a raise with 2 args + when an exception object is assigned to a local variable + autocorrects to exploded style + with a raise with exception object + when used in a ternary expression + registers an offense and autocorrects + with no arguments + reports an offense + when used in a logical or expression + registers an offense and autocorrects + with one argument + reports an offense + when used in a logical and expression + registers an offense and autocorrects + with opposite + correct + reports multiple offenses + reports an offense for opposite + correct + when exception type is in AllowedCompactTypes + accepts exception constructor with no arguments + with more than one argument + accepts exception constructor + with one argument + accepts exception constructor + +RuboCop::Cop::Style::GuardClause + registers an error with raise "error" in the else branch + doesn't register an error if control flow expr has multiple lines + does not report an offense if raise "error" is inside elsif + does not report an offense if break is inside if..elsif..else..end + registers an offense when using `|| raise` in `then` branch + registers an error with next in the else branch + does not report an offense if next is inside elsif + does not report an offense if body is if..elsif..end + doesn't register an error if control flow expr has multiple lines + does not report an offense if return is inside if..elsif..else..end + registers an error if non-control-flow branch has multiple lines + accepts a method whose body is a modifier if / unless + registers an error if non-control-flow branch has multiple lines + accepts a method which body is if / unless with else + does not report an offense if return is inside elsif + registers an offense when using `|| raise` in `else` branch + registers an error with next in the if branch + accepts a method which body does not end with if / unless + registers an offense when using `and return` in `else` branch + doesn't register an error if condition has multiple lines + does not report an offense if next is inside if..elsif..else..end + doesn't register an error if condition has multiple lines + accepts a method with empty parentheses as its body + registers an error with break in the else branch + doesn't register an error if control flow expr has multiple lines + registers an error with return in the else branch + registers an offense when using `and return` in `then` branch + doesn't report an offense if condition has multiple lines + doesn't register an error if condition has multiple lines + doesn't register an error if condition has multiple lines + does not report an offense if break is inside elsif + registers an error with break in the if branch + does not register an offense when assigning the result of a guard condition with `else` + registers an error with return in the if branch + registers an error with raise "error" in the if branch + registers an error if non-control-flow branch has multiple lines + registers an error if non-control-flow branch has multiple lines + does not report an offense if raise "error" is inside if..elsif..else..end + doesn't register an error if control flow expr has multiple lines + behaves like reports offense + reports an offense if method body ends with if / unless without else + reports an offense if method body is if / unless without else + with Metrics/MaxLineLength disabled + registers an offense with modifier example code regardless of length + with Metrics/MaxLineLength enabled + when the correction is too long for a single line + with a nested `if` node + does registers an offense + with a trivial body + does not register an offense + with a nested `begin` node + does registers an offense + MinBodyLength: 4 + accepts a method whose body has 3 lines + AllowConsecutiveConditionals: true + does not register an offense when allowed same depth multiple if statement andpreceding expression is not a conditional at the same depth + reports an offense when allowed same depth multiple if statement andpreceding expression is not a conditional at the same depth + MinBodyLength: 1 + reports an offense for if whose body has 1 line + method in module + registers an offense for singleton methods + registers an offense for instance method + Invalid MinBodyLength + fails with an error + behaves like reports offense + reports an offense if method body ends with if / unless without else + reports an offense if method body is if / unless without else + AllowConsecutiveConditionals: false + reports an offense when not allowed same depth multiple if statement andpreceding expression is a conditional at the same depth + +RuboCop::Cop::Style::Lambda + with enforced `lambda` style + with a multiline lambda literal + with arguments + registers an offense + without arguments + registers an offense + with a single line lambda literal + with arguments + registers an offense + without argument parens and spaces + registers an offense + without arguments + registers an offense + when using safe navigation operator + does not break + with default `line_count_dependent` style + unusual lack of spacing + without spacing after arguments + registers an offense + without any spacing + registers an offense + with a multiline lambda literal + with no arguments and no spacing + registers an offense + with no parentheses and many args + registers an offense + with empty arguments + registers an offense + with no parentheses and bad spacing + registers an offense + with no arguments and bad spacing + registers an offense + without parentheses + registers an offense + without spacing before arguments + registers an offense + with a multiline lambda method call + does not register an offense + with a multiline do-end lambda as a parenthesized kwarg registers an offense - when method has arguments + with a multiline braces lambda literal as a keyword argument + registers an offense + with a single line lambda literal does not register an offense - when `super` has arguments + >= Ruby 2.7 + when using numbered parameter + with a single line lambda method call + registers an offense + with a single line lambda literal + does not register an offense + with a multiline lambda method call + does not register an offense + when calling a lambda method without a block does not register an offense - when `AllowMethodsWithArguments: false` - when `super` has arguments + with a multiline lambda literal as an argument registers an offense - when method has arguments + with a multiline lambda literal + with arguments + registers an offense + without arguments + registers an offense + with a multiline do-end lambda literal as a keyword argument registers an offense + with a single line lambda method call + without arguments + registers an offense + with arguments + registers an offense + with enforced `literal` style + with a single line lambda method call + without arguments + registers an offense + with arguments + registers an offense + with a multiline lambda method call + without arguments + registers an offense + with arguments + registers an offense -RuboCop::Cop::Style::PercentLiteralDelimiters - `%q` string - does not register an offense for preferred delimiters - does not register an offense for other delimiters when containing preferred delimiter characters - registers an offense for other delimiters - `default` override - allows individual preferred delimiters to override `default` - allows all preferred delimiters to be set with one key +RuboCop::Cop::Style::TrailingCommaInHashLiteral + with multi-line list of values + when EnforcedStyleForMultiline is consistent_comma + accepts trailing comma + accepts a multiline hash with a single pair and trailing comma + accepts trailing comma after a heredoc + accepts a multiline hash with pairs on a single line andtrailing comma + registers an offense for no trailing comma + when closing bracket is on same line as last value + registers an offense for literal with no trailing comma + when EnforcedStyleForMultiline is comma + accepts trailing comma after a heredoc + accepts a multiline hash with a single pair and trailing comma + accepts trailing comma + registers an offense for trailing comma in a comment + registers an offense for no trailing comma + when closing bracket is on same line as last value + accepts literal with no trailing comma + when EnforcedStyleForMultiline is no_comma + accepts comma in comment after last value item + accepts comma inside a heredoc parameters at the end + accepts literal with no trailing comma + registers an offense for trailing comma in literal + with single line list of values + when EnforcedStyleForMultiline is consistent_comma + accepts literal without trailing comma + accepts single element literal without trailing comma + registers an offense for trailing comma in a literal + accepts empty literal + when EnforcedStyleForMultiline is comma + accepts single element literal without trailing comma + accepts literal without trailing comma + accepts empty literal + registers an offense for trailing comma in a literal + when EnforcedStyleForMultiline is no_comma + registers an offense for trailing comma in a literal + accepts empty literal + accepts literal without trailing comma + accepts single element literal without trailing comma + +RuboCop::Cop::Layout::LeadingEmptyLines + registers an offense and corrects a new line before code + registers an offense and corrects a new line before a class + allows an empty input + registers an offense and corrects a new line before a comment + registers an offense and corrects multiple new lines before a class + accepts not having a blank line before a comment + allows blank lines without any comments or code + accepts not having a blank line before a class + accepts not having a blank line before code autocorrect - preserves indentation when correcting a multiline array - fixes a string array in a scope - preserves irregular indentation when correcting a multiline array - preserves line breaks when fixing a multiline array - behaves like escape characters - corrects %s with \t in it - corrects %s with \n in it - behaves like escape characters - corrects %Q with \n in it - corrects %Q with \t in it - behaves like escape characters - corrects %i with \n in it - corrects %i with \t in it - behaves like escape characters - corrects %W with \t in it - corrects %W with \n in it - behaves like escape characters - corrects %x with \n in it - corrects %x with \t in it - behaves like escape characters - corrects %w with \t in it - corrects %w with \n in it - behaves like escape characters - corrects % with \n in it - corrects % with \t in it - behaves like escape characters - corrects %q with \n in it - corrects %q with \t in it - behaves like escape characters - corrects %r with \n in it - corrects %r with \t in it - `%x` interpolated system call - does not register an offense for preferred delimiters - registers an offense for other delimiters when containing preferred delimiter characters in interpolation - does not register an offense for other delimiters when containing preferred delimiter characters - registers an offense for other delimiters - `%w` string array - does not register an offense for preferred delimiters with not a pairing delimiter - does not register an offense for other delimiters when containing preferred delimiter characters - registers an offense for other delimiters - does not register an offense for preferred delimiters with a pairing delimiters - does not register an offense for preferred delimiters with only a closing delimiter - does not register an offense for preferred delimiters - `%r` interpolated regular expression - registers an offense for other delimiters when containing preferred delimiter characters in interpolation - registers an offense for a regular expression with option - does not register an offense for preferred delimiters - does not register an offense for other delimiters when containing preferred delimiter characters - registers an offense for other delimiters - `%Q` interpolated string - registers an offense for other delimiters when containing preferred delimiter characters in interpolation - does not register an offense for other delimiters when containing preferred delimiter characters - does not register an offense for preferred delimiters - registers an offense for other delimiters - `%I` interpolated symbol array - registers an offense for other delimiters - registers an offense for other delimiters when containing preferred delimiter characters in interpolation - does not register an offense for preferred delimiters - `%i` symbol array - does not register an offense for preferred delimiters - does not register an offense for non-preferred delimiters enclosing escaped delimiters - registers an offense for other delimiters - `%` interpolated string - registers an offense when the source contains invalid characters - registers an offense for a string with no content - registers an offense for other delimiters when containing preferred delimiter characters in interpolation - does not register an offense for preferred delimiters - registers an offense for other delimiters - does not register an offense for other delimiters when containing preferred delimiter characters - `%s` symbol - does not register an offense for preferred delimiters - registers an offense for other delimiters - `%W` interpolated string array - does not register an offense for other delimiters when containing preferred delimiter characters - registers an offense for other delimiters - registers an offense for other delimiters when containing preferred delimiter characters in interpolation - does not register an offense for preferred delimiters - invalid cop config - raises an error when invalid configuration is specified + in collaboration + does not invoke conflicts with other cops + +RuboCop::Cop::Style::RedundantFreeze + allows .freeze on method call + behaves like immutable objects + registers an offense for frozen (1 + 2) + behaves like immutable objects + registers an offense for frozen (2 > 1) + behaves like mutable objects + allows ::ENV['foo'] with freeze + behaves like immutable objects + registers an offense for frozen 1 + when the receiver is a string literal + Ruby 3.0 or higher + when the frozen string literal comment is missing + behaves like mutable objects + allows "#{a}" with freeze + when the frozen string literal comment is true + behaves like mutable objects + allows "#{a}" with freeze + when the frozen string literal comment is false + behaves like mutable objects + allows "#{a}" with freeze + Ruby 2.7 or lower + when the frozen string literal comment is missing + behaves like mutable objects + allows "#{a}" with freeze + when the frozen string literal comment is true + behaves like immutable objects + registers an offense for frozen "#{a}" + when the frozen string literal comment is false + behaves like mutable objects + allows "#{a}" with freeze + Regexp and Range literals + Ruby 2.7 or lower + behaves like mutable objects + allows /./ with freeze + behaves like mutable objects + allows (1...5) with freeze + behaves like mutable objects + allows (1..5) with freeze + Ruby 3.0 or higher + behaves like immutable objects + registers an offense for frozen (1...5) + behaves like immutable objects + registers an offense for frozen /./ + behaves like immutable objects + registers an offense for frozen (1..5) + behaves like mutable objects + allows ([42] * 42) with freeze + behaves like mutable objects + allows (a + b) with freeze + behaves like immutable objects + registers an offense for frozen :sym + behaves like immutable objects + registers an offense for frozen :"" + behaves like mutable objects + allows { a: 1, b: 2 } with freeze + behaves like mutable objects + allows [1, 2, 3] with freeze + behaves like immutable objects + registers an offense for frozen ('a' > 'b') + behaves like immutable objects + registers an offense for frozen (a > b) + behaves like immutable objects + registers an offense for frozen 1.5 + behaves like mutable objects + allows ('a' + 'b') with freeze + behaves like immutable objects + registers an offense for frozen [1, 2, 3].size + behaves like mutable objects + allows ENV['foo'] with freeze + behaves like mutable objects + allows ('a' * 20) with freeze + behaves like mutable objects + allows 'str' with freeze + behaves like mutable objects + allows "top#{1 + 2}" with freeze + behaves like immutable objects + registers an offense for frozen 'foo'.count + +RuboCop::Cop::Style::MethodCallWithoutArgsParentheses + registers an offense for `obj.method ||= func()` + registers an offense for `obj.method &&= func()` + accepts parens after not + accepts special lambda call syntax + registers an offense for `obj.method += func()` + accepts parens in method call with args + registers an offense for parens in method call without args + autocorrects calls that could be empty literals + accepts parentheses for methods starting with an upcase letter + when AllowedMethods is enabled + ignores method listed in AllowedMethods + when AllowedPatterns is enabled + ignores method listed in AllowedMethods + method call as argument + registers an empty parens offense for multiple assignment + registers an offense with empty parens + accepts without parens + assignment to a variable with the same name + accepts parens in complex assignment + accepts parens in default argument assignment + accepts parens in parallel assignment + accepts parens in shorthand assignment + accepts parens in local variable assignment + +RuboCop::Cop::Style::TrailingCommaInArrayLiteral + with multi-line list of values + when EnforcedStyleForMultiline is comma + accepts a multiline array with a single item and trailing comma + accepts trailing comma + accepts literal with two of the values on the same line + registers an offense for a literal with two of the values on the same line and a trailing comma + accepts a multiline word array + accepts an empty array being passed as a method argument + when closing bracket is on same line as last value + accepts literal with no trailing comma + when EnforcedStyleForMultiline is consistent_comma + accepts a multiline word array + accepts a multiline array with items on a single line andtrailing comma + accepts trailing comma + accepts a multiline array with a single item and trailing comma + accepts two values on the same line + registers an offense for literal with two of the values on the same line and no trailing comma + when closing bracket is on same line as last value + registers an offense for no trailing comma + when EnforcedStyleForMultiline is no_comma + accepts HEREDOC with commas + accepts a literal with no trailing comma + registers an offense for trailing comma + autocorrects unwanted comma where HEREDOC has commas + with single line list of values + when EnforcedStyleForMultiline is no_comma + accepts literal without trailing comma + accepts empty literal + accepts rescue clause + registers an offense for trailing comma + accepts single element literal without trailing comma + when EnforcedStyleForMultiline is comma + accepts empty literal + accepts single element literal without trailing comma + accepts rescue clause + registers an offense for trailing comma + accepts literal without trailing comma + when EnforcedStyleForMultiline is consistent_comma + registers an offense for trailing comma + accepts rescue clause + accepts literal without trailing comma + accepts single element literal without trailing comma + accepts empty literal RuboCop::Cop::Lint::RedundantWithIndex registers an offense when using `ary.each.with_index(1) { |v| v }` and correct to `ary.each { |v| v }` - accepts an index is used as a block argument - registers an offense when using `ary.each.with_index { |v| v }` and corrects to `ary.each` - registers an offense for `ary.each_with_index { |v| v }` and corrects to `ary.each` registers an offense when using `ary.each_with_object([]).with_index { |v| v }` and corrects to `ary.each_with_object([]) { |v| v }` + registers an offense for `ary.each_with_index { |v| v }` and corrects to `ary.each` + registers an offense when using `ary.each.with_index { |v| v }` and corrects to `ary.each` + accepts an index is used as a block argument Ruby 2.7 + registers an offense for `ary.each_with_index { _1 }` and corrects to `ary.each` accepts an index is used as a numblock argument registers an offense when using `ary.each.with_index { _1 }` and corrects to `ary.each` - registers an offense for `ary.each_with_index { _1 }` and corrects to `ary.each` - -RuboCop::Cop::Bundler::GemVersion - when EnforcedStyle is set to required (default) - does not flag gems with a specified version - flags gems that do not specify a version - does not flag gems included in AllowedGems metadata - when EnforcedStyle is set to forbidden - does not flag gems without a specified version - flags gems that specify a gem version - does not flag gems included in AllowedGems metadata -RuboCop::Cop::Style::IfUnlessModifier - adds parens in autocorrect when if-end used with `&&` operator - accepts if-end followed by a chained call using `&.` - accepts if-end followed by a chained call using `.` - accepts code with EOL comment since user might want to keep it - accepts if-else-end - accepts if/elsif - adds parens in autocorrect when if-end used with `||` operator - accepts if-end when used as LHS of binary arithmetic - with tabs used for indentation - with Layout/IndentationWidth: Width config - behaves like with tabs indentation - it fits on one line - registers an offense - it doesn't fit on one line - doesn't register an offense - with Layout/IndentationStyle: IndentationWidth config - behaves like with tabs indentation - it fits on one line - registers an offense - it doesn't fit on one line - doesn't register an offense - when Layout/LineLength is disabled - registers an offense even for a long modifier statement - when if-end condition is assigned to a variable - with variable being on the same line - when it is short enough to fit on a single line - corrects it to the single-line form - when it is not short enough to fit on a single line - accepts it in the multiline form - with variable being on the previous line - when it is short enough to fit on a single line - corrects it to the single-line form - when it is not short enough to fit on a single line - accepts it in the multiline form - when if-end condition has some code after the end keyword - when it is not short enough to fit on a single line - accepts it in the multiline form - when it is short enough to fit on a single line - corrects it to the single-line form - unless-end with conditional as body - accepts - behaves like condition modifier cop - for a multiline 'if' - accepts it when condition has local variable assignment - doesn't break when used as RHS of instance var assignment - handles one-line usage - doesn't break when used as RHS of class var assignment - accepts an empty body - handles inline comments during autocorrection - accepts it if single line would not fit on one line - accepts it if body spans more than one line - doesn't break when used as RHS of constant assignment - doesn't break when used as RHS of binary arithmetic - corrects it if result fits in one line - corrects it when assignment is in body - doesn't break when used as RHS of local var assignment - when there is a comment on the first line and some code after the end keyword - does not register an offense - accepts multiline condition in modifier form - registers an offense - when Layout/LineLength is disabled - registers an offense even for a long modifier statement - with implicit match conditional - when a multiline if doesn't fit on one line - accepts - when a multiline if fits on one line - registers an offense - if-end is argument to a parenthesized method call - adds parentheses because otherwise it would cause SyntaxError - multiline if that fits on one line - registers an offense - and has two statements separated by semicolon - accepts - multiline if that fits on one line with comment near end - accepts - when if-end condition is a value in a hash - when it is not short enough to fit on a single line - accepts it in the multiline form - when it is short enough to fit on a single line - corrects it to the single-line form - when if-end condition is an element of an array - when not short enough to fit on a single line - accepts it in the multiline form - when short enough to fit on a single line - corrects it to the single-line form - modifier if that does not fit on one line - when Layout/LineLength is disabled with an EOL comment - accepts - when Layout/LineLength is enabled - corrects it to normal form - and the long line is allowed because AllowURI is true - accepts - when variable assignment is used in the branch body of if modifier - registers an offense - when using a method with heredoc argument - accepts - IgnoreCopDirectives - and the long line is too long because IgnoreCopDirectives is false - registers an offense - and the long line is allowed because IgnoreCopDirectives is true - accepts - and the long line is too long because AllowURI is false - registers an offense - when Layout/LineLength is disabled in configuration - accepts - when Layout/LineLength is disabled with enable/disable comments - accepts - if-end is argument to a non-parenthesized method call - adds parentheses so as not to change meaning - if-end with conditional as body - accepts - with a named regexp capture on the LHS - does not register an offense - short multiline if near an else etc +RuboCop::Cop::Style::MultilineIfModifier + unless guard clause registers an offense - modifier if that does not fit on one line, but is not the only statement on the line - accepts - multiline if that fits on one line with comment on first line - registers an offense and preserves comment - multiline unless that fits on one line + allows a multiline condition + registers an offense when indented + allows a one liner + if guard clause + allows a multiline condition registers an offense - when if-end condition has a first line comment - when it is short enough to fit on a single line - corrects it to the single-line form - when it is not short enough to fit on a single line - accepts it in the multiline form - behaves like condition modifier cop - for a multiline 'unless' - accepts an empty body - doesn't break when used as RHS of instance var assignment - accepts it if body spans more than one line - doesn't break when used as RHS of local var assignment - corrects it when assignment is in body - accepts it when condition has local variable assignment - handles inline comments during autocorrection - doesn't break when used as RHS of binary arithmetic - doesn't break when used as RHS of class var assignment - handles one-line usage - doesn't break when used as RHS of constant assignment - corrects it if result fits in one line - accepts it if single line would not fit on one line - when Layout/LineLength is disabled - registers an offense even for a long modifier statement - accepts multiline condition in modifier form - registers an offense - when there is a comment on the first line and some code after the end keyword - does not register an offense - -isolated environment - is not affected by a config file above the work directory - -RuboCop::Runner - #run with cops autocorrecting each-other - with two pairs of conflicting cops - if there is an offense in an inspected file - aborts because of an infinite loop - with three cop cycle - if there is an offense in an inspected file - aborts because of an infinite loop - with display options - --display-only-correctable - ommits uncorrectable `Layout/LineLength` - returns false - --display-only-safe-correctable - ommits unsafe correctable `Style/FrozenStringLiteral` - returns false - with two conflicting cops - if there is an offense in an inspected file - aborts because of an infinite loop - if there are multiple offenses in an inspected file - aborts because of an infinite loop - #run when interrupted - with SIGINT - returns false - #run - if -s/--stdin is used with an offense - returns false - sends the offense to a formatter - if there is an offense in an inspected file - returns false - sends the offense to a formatter - if a cop crashes - does not call ResultCache#save - if there are no offenses in inspected files - returns true - -RuboCop::Cop::Style::FrozenStringLiteralComment - never - allows not having a frozen string literal comment under an encoding comment - registers an offense for a frozen string literal comment below shebang and encoding comments - registers an offense for a disabled frozen string literal comment below shebang above an encoding comments - registers an offense for a disabled frozen string literal comment below shebang and encoding comments - accepts an empty source - allows not having a frozen string literal comment under a shebang and an encoding comment - accepts a source with no tokens - registers an offense for a frozen string literal comment below a shebang comment - registers an offense for a disabled frozen string literal below an encoding comment - registers an offense for having a frozen string literal comment after other comments - registers an offense for a frozen string literal comment below shebang above an encoding comments - registers an offense for a frozen string literal comment below an encoding comment - accepts not having not having a frozen string literal comment under a shebang - accepts not having a frozen string literal comment on the top line - registers an offense for a disabled frozen string literal below a shebang comment - registers an offense for a frozen string literal comment on the top line - registers an offense for a disabled frozen string literal comment on the top line - accepts a frozen string literal comment under ruby code - always - accepts a disabled frozen string literal below a shebang comment - accepts a source with no tokens - accepts an emacs style combined magic comment - accepts a frozen string literal comment below newline-separated magic comments - accepts a disabled frozen string literal comment below shebang and encoding comments - registers an offense for not having a frozen string literal comment under an encoding comment - registers an offense for not having a frozen string literal comment under an encoding comment separated by a newline - accepts a frozen string literal on the top line - registers an offense for not having a frozen string literal comment under a shebang - accepts an empty source - registers an offense for not having a frozen string literal comment under a shebang and an encoding comment - registers an offense for arbitrary tokens - accepts a frozen string literal comment after other comments - accepts a frozen string literal comment below shebang and encoding comments - accepts a disabled frozen string literal comment below shebang above an encoding comments - accepts a frozen string literal below a shebang comment - registers an offense for not having a frozen string literal comment when there is only a shebang - accepts a frozen string literal below an encoding comment - accepts a disabled frozen string literal below an encoding comment - accepts a disabled frozen string literal on the top line - registers an offense for not having a frozen string literal comment on the top line - registers an offense with an empty line between magic comments and the code - registers an offense for having a frozen string literal comment under ruby code - accepts a frozen string literal comment below shebang above an encoding comments - registers an offense for an extra first empty line - target_ruby_version < 2.3 - accepts freezing a string with interpolation - accepts calling << on a string - accepts calling << on a string with interpolation - accepts freezing a string - always_true - registers an offense for arbitrary tokens under shebang with no other code - registers an offense for not having a frozen string literal comment under an encoding comment - registers an offense for not having a frozen string literal comment under an encoding comment and extra space - registers an offense for not having a frozen string literal comment under a shebang and an encoding comment - registers an offense for not having a frozen string literal comment on the top line - accepts a frozen string literal comment below shebang, an encoding comment, and extra space - accepts a frozen string literal below an encoding comment - registers an offense for arbitrary tokens below an encoding comment and extra space - accepts a frozen string literal comment under shebang with no other code - registers an offense for arbitrary tokens below a shebang comment - accepts a frozen string literal comment below shebang above an encoding comments - registers an offense for having a frozen string literal comment under ruby code - accepts a frozen string literal below a shebang comment - registers an offense for a disabled frozen string literal comment after other comments - registers an offense for an extra first empty line - accepts a source with no tokens - registers an offense for a disabled frozen string literal below a shebang comment - registers an offense for a disabled frozen string literal comment below shebang, an encoding comment, and extra space - registers an offense for a disabled frozen string literal below an encoding comment - accepts an empty source - registers an offense for arbitrary tokens - registers an offense for arbitrary tokens below shebang above an encoding comments - registers an offense for not having a frozen string literal comment under shebang with no other code - registers an offense for a disabled frozen string literal on the top line - registers an offense for a disabled frozen string literal - registers an offense for a disabled frozen string literal above an empty line - registers an offense for not having a frozen string literal comment under a shebang, an encoding comment, and extra space - registers an offense for a disabled frozen string literal comment under shebang with no other code - registers an offense for a disabled frozen string literal comment below shebang and encoding comments - accepts a frozen string literal on the top line - registers an offense for a disabled frozen string literal comment below an encoding comment and extra space - registers an offense for arbitrary tokens above an empty line - accepts a frozen string literal comment after other comments - registers an offense for arbitrary tokens below shebang and encoding comments - accepts a frozen string literal comment below an encoding comment and extra space - registers an offense for arbitrary tokens below an encoding comment - registers an offense for arbitrary tokens below shebang, an encoding comment, and extra space - registers an offense for a disabled frozen string literal comment below shebang above an encoding comments - accepts a frozen string literal comment below shebang and encoding comments - accepts an emacs style combined magic comment - -RuboCop::Cop::Style::SingleLineMethods - autocorrects def with semicolon after method name - accepts a multi-line method - autocorrects def with argument and no parentheses - registers an offense for a single-line method - autocorrects def with semicolon before end - autocorrects defs with parentheses after method name - autocorrects def with argument in parentheses - registers an offense for a single-line method and method body is enclosed in parentheses - does not crash on an method with a capitalized name - when AllowIfMethodIsEmpty is disabled - registers an offense for an empty method - when AllowIfMethodIsEmpty is enabled - accepts a single-line empty method - when `Style/EndlessMethod` is disabled - corrects to an normal method - endless methods - does not register an offense - when `Style/EndlessMethod` is enabled - prior to ruby 3.0 - corrects to a multiline method - with `allow_single_line` style - behaves like convert to endless method - handles arguments properly - corrects to an endless class method definition when using != - does not to an endless class method definition when using `next` - corrects to an endless class method definition when using <= - corrects to an endless method definition when method body is a literal - corrects to an endless class method definition when using > - corrects to an endless class method definition when using >= - does not to an endless class method definition when using `break` - does not to an endless class method definition when using `return` - retains comments - corrects to multiline method definition when defining setter method - corrects to an endless method definition when single line method call with parentheses - does not add parens if they are already present - corrects to an endless class method definition - corrects to a normal method if the method body contains multiple statements - corrects to an endless method definition when single line method call without parentheses - corrects to an endless class method definition when using === - corrects to an endless class method definition when using == - corrects to an endless class method definition when using < - corrects to an endless method definition - with AllowIfMethodIsEmpty: true - does not correct - with AllowIfMethodIsEmpty: false - does not turn a method with no body into an endless method - with `allow_always` style - behaves like convert to endless method - corrects to an endless method definition - handles arguments properly - does not add parens if they are already present - does not to an endless class method definition when using `return` - does not to an endless class method definition when using `break` - corrects to an endless class method definition when using != - corrects to an endless class method definition when using == - corrects to an endless class method definition when using < - corrects to an endless class method definition - corrects to a normal method if the method body contains multiple statements - does not to an endless class method definition when using `next` - corrects to multiline method definition when defining setter method - corrects to an endless class method definition when using === - corrects to an endless class method definition when using >= - retains comments - corrects to an endless class method definition when using <= - corrects to an endless method definition when method body is a literal - corrects to an endless class method definition when using > - corrects to an endless method definition when single line method call without parentheses - corrects to an endless method definition when single line method call with parentheses - with AllowIfMethodIsEmpty: true - does not correct - with AllowIfMethodIsEmpty: false - does not turn a method with no body into an endless method - with `disallow` style - corrects to an normal method - -RuboCop::Cop::Layout::SpaceInsideHashLiteralBraces - accepts hashes with spaces by default - registers an offense for hashes with no spaces if so configured - can handle interpolation in a braceless hash literal - accepts hash literals with no braces - registers an offense for correct + opposite - with space inside empty braces allowed - accepts empty braces with space inside - registers an offense for empty braces with no space inside - when using method argument that both key and value are hash literals - registers hashes with no spaces - when EnforcedStyle is compact - doesn't register an offense for non-nested hashes with spaces - accepts multiline hash with comment - accepts multiline hash - registers an offense for opposite + correct - registers an offense for nested hashes with spaces - registers offenses for hashes with no spaces - with newline inside empty braces not allowed - registers an offense - with space inside empty braces not allowed - accepts empty braces with no space inside - registers an offense for empty braces with space inside - offending hash following empty hash - registers an offense on both sides - when EnforcedStyle is no_space - accepts multiline hash with comment - registers an offense for opposite + correct - accepts multiline hash - accepts hashes with no spaces - registers an offense for hashes with spaces - when using method argument that both key and value are hash literals - accepts hashes with no spaces - on Hash[{ x: 1 } => [1]] - does not register an offense - on { key: "{" } - does not register an offense - -RuboCop::Cop::Layout::ArgumentAlignment - aligned with first argument - registers an offense and corrects splat operator - can handle do-end - can handle a call embedded in a string - accepts correctly aligned arguments with fullwidth characters - can handle method calls without parentheses - registers an offense and corrects arguments with single indent - can handle heredoc strings - can handle parentheses used with no arguments - registers an offense and corrects arguments with double indent - doesn't get confused by a symbol argument - can handle a multiline hash as second parameter - can handle a string literal as other argument - can handle other method calls without parentheses - can handle a ternary condition with a block reference - doesn't crash and burn when there are nested issues - accepts correctly aligned arguments - accepts calls that only span one line - accepts braceless hashes - registers an offense and corrects multiline missed indentation - registers an offense and corrects multi-line outdented parameters - accepts multiline []= method call - doesn't get confused by extra comma at the end - registers an offense and corrects when missed indentation kwargs - accepts the first parameter being on a new row - doesn't get confused by symbols with embedded expressions - can handle a correctly aligned string literal as first argument - registers an offense and correct multi-line parametersindented too far - does not crash in autocorrect on dynamic string in parameter value - doesn't get confused by a line break inside a parameter - can handle a call with a block inside another call - doesn't get confused by regexen with embedded expressions - can handle a method call within a method call - assigned methods - accepts the first parameter being on method row - accepts the first parameter being on a new row - when using safe navigation operator - registers an offense and corrects arguments with single indent - aligned with fixed indentation - autocorrects by outdenting when indented too far - autocorrects by indenting when not indented - corrects indentation for kwargs starting on same line as other args - does not register an offense when using aligned braced hash as a argument - autocorrects when first line is indented - registers an offense and corrects when missed indentation kwargs - multi-line method calls - autocorrects relative to position of relevant method call - does not err on method call without a method name - registers offenses and corrects double indentation from relevant method - can handle existing indentation from multi-line method calls - assigned methods - with ArgumentAlignment:IndentationWidth set to 4 - accepts the first parameter being on method row - accepts the first parameter being on a new row - with IndentationWidth:Width set to 4 - accepts the first parameter being on a new row - accepts the first parameter being on method row - autocorrects even when first argument is in wrong position - -RuboCop::Cop::Lint::ConstantResolution - registers an offense not qualifying a namespace const - registers no offense qualifying a namespace const - registers no offense when qualifying a const - registers an offense not qualifying a const - with Only set - registers an offense when an unqualified namespace const - registers no offense not qualifying another const - registers no offense when qualifying a const - registers no with a namespace const - registers no offense qualifying a namespace const - registers an offense with an unqualified const - module & class definitions - does not register offense - with Ignore set - registers no offense qualifying a namespace const - registers no offense with an unqualified const - registers an offense not qualifying another const - registers no offense when qualifying a const - registers no offense when an unqualified namespace const - registers an with a namespace const - -RuboCop::Cop::Style::For - when each is the enforced style - accepts multiline each - accepts def for - registers an offense for opposite + correct style - registers multiple offenses - accepts :for - registers an offense for for - autocorrect - corrects an array with `&` operator - corrects an array with `&&` operator - corrects an array with `||` operator - corrects an array with `-` operator - corrects an array with `*` operator - corrects an array with `|` operator - corrects an array with `+` operator - corrects to `each` without parenthesize collection if non-operator method called - corrects a tuple of items - changes for that does not have do or semicolon to each - with range - changes for to each - changes for that does not have do or semicolon to each - without parentheses - changes for to each - changes for that does not have do or semicolon to each - when for is the enforced style - accepts single line each - accepts for - registers an offense for a tuple of items - registers an offense for multiline each - registers an offense for each without an item and uses _ as the item - registers an offense for correct + opposite style - registers multiple offenses - Ruby 2.7 - registers an offense for each without an item and uses _ as the item - when using safe navigation operator - does not break + registers an offense when indented + allows a one liner -RuboCop::Cop::Style::StructInheritance - registers an offense when extending instance of Struct with do ... end - accepts extending DelegateClass - registers an offense when extending instance of ::Struct - registers an offense when extending instance of ::Struct with do ... end - accepts assignment to Struct.new - registers an offense when extending instance of Struct without `do` ... `end` and class body is empty - registers an offense when extending instance of `Struct` when there is a comment before class declaration - accepts assignment to block form of Struct.new - registers an offense when extending instance of Struct without `do` ... `end` and class body is empty and single line definition - accepts assignment to ::Struct.new - accepts plain class - registers an offense when extending instance of Struct +RuboCop::Cop::VariableForce::Assignment + #name + returns the variable name + .new + when an argument declaration node is passed + raises error + when any other type node is passed + raises error + when an assignment node is passed + does not raise error + #meta_assignment_node + when it is += operator assignment + returns op_asgn node + when it is multiple assignment + returns masgn node + when it is &&= operator assignment + returns and_asgn node + when it is ||= operator assignment + returns or_asgn node + #operator + when it is normal assignment + returns = + when it is ||= operator assignment + returns ||= + when it is &&= operator assignment + returns &&= + when it is += operator assignment + returns += + when it is multiple assignment + returns = -RuboCop::Cop::Lint::RedundantCopEnableDirective - registers correct offense when combined with necessary enable - registers offense and corrects redundant enabling of same cop - registers multiple offenses and corrects the same comment - registers an offense and corrects when the first cop is unnecessarily enabled - registers offense and corrects unnecessary enable - registers correct offense when combined with necessary enable, no white-space after comma - when last cop is unnecessarily enabled - registers an offense and corrects - registers an offense and corrects when there is no space between the cops and the comma - when cop is disabled in the configuration - registers no offense when enabling the cop - registers an offense if enabling it twice - when all cops are unnecessarily enabled - on separate lines - registers an offense and corrects when there is extra white space - on the same line - registers an offense and corrects - all switch - registers offense and corrects unnecessary enable all - when at least one cop was disabled - does not register offense - when middle cop is unnecessarily enabled - registers an offense and corrects when there is extra white space - registers an offense and corrects - when all department enabled - registers offense and corrects redundant enabling of cop of same department - registers offense and corrects redundant enabling of department of same cop - registers correct offense when combined with necessary enable - registers offense and corrects redundant enabling of same department - registers multiple offenses and corrects the same comment - registers an offense and corrects when the first department is unnecessarily enabled - registers offense and corrects unnecessary enable +RuboCop::Cop::Lint::DuplicateRequire + does not register an offense when using single `require` + does not register an offense when there are no duplicate `require`s + registers and corrects an offense for duplicate non top-level requires + registers and corrects an offense for multiple duplicate requires + registers and corrects an offense when duplicate `require` through `Kernel` is detected + registers and corrects an offense when duplicate `require` is detected + registers and corrects an offense when duplicate `require_relative` is detected + does not register an offense when calling user-defined `require` method + registers and corrects an offense when duplicate requires are interleaved with some other code + does not register an offense when same feature argument but different require method RuboCop::Cop::Lint::ParenthesesAsGroupedExpression - accepts a space inside opening paren followed by left paren - does not register an offense for ternary operator + accepts a chain of method calls + accepts a method call with arguments but no parentheses + does not register an offesne when heredoc has a space between the same string as the method name and `(` + registers an offense and corrects for method call with space before the parenthesis + does not register an offense when method argument parentheses are omitted and hash argument key is enclosed in parentheses + accepts a method call without arguments + does not register an offense for expression followed by chained expression with safe navigation operator accepts an operator call with argument in parentheses + does not register an offense for expression followed by chained expression + accepts a space inside opening paren followed by left paren + does not register an offense for math expression with `to_i` does not register an offense for a call with multiple arguments + does not register an offense for ternary operator accepts method with parens as arg to method without - accepts a method call with arguments but no parentheses - does not register an offense for expression followed by chained expression - accepts a chain of method calls + registers an offense and corrects for predicate method call with space before the parenthesis does not register an offense for math expression - does not register an offense for math expression with `to_i` - accepts a method call without arguments - does not register an offense for expression followed by chained expression with safe navigation operator does not register an offense for expression followed by an operator - does not register an offesne when heredoc has a space between the same string as the method name and `(` - registers an offense and corrects for method call with space before the parenthesis - registers an offense and corrects for predicate method call with space before the parenthesis - does not register an offense when method argument parentheses are omitted and hash argument key is enclosed in parentheses when using safe navigation operator registers an offense and corrects for method call with space before the parenthesis -RuboCop::Cop::Style::EvenOdd - converts x._(y) % 2 != 1 to even? - accepts x % 2 == 2 - converts x % 2 != 0 to #odd? - accepts x % 3 != 0 - converts complex examples - converts (x(y) % 2) != 1 to #even? - converts x % 2 != 1 to #even? - converts (x.y % 2) != 1 to #even? - converts (x % 2) == 1 to #odd? - accepts x % 3 == 0 - converts 1 % 2 != 1 to even? - converts (y % 2) != 1 to #even? - converts (x._(y) % 2) != 1 to even? - converts x % 2 == 0 to #even? - converts (x % 2) == 0 to #even? - converts (x % 2) != 0 to #odd? - converts x % 2 == 1 to #odd? - converts (x._(y)) % 2 != 1 to even? - -RuboCop::Cop::Style::EmptyBlockParameter - accepts a block that is do-end style without parameter - accepts a non-empty block parameter with do-end style - registers an offense for an empty block parameter with do-end style - registers an offense for an empty block parameter with super - accepts a non-empty block parameter with {} style - registers an offense for an empty block parameter with lambda - registers an offense for an empty block parameter with {} style - accepts a block that is {} style without parameter - accepts an empty block parameter with a lambda - -RuboCop::Cop::Bundler::DuplicatedGem - when investigating Ruby files - does not register any offenses - when investigating Gemfiles - does not register an offense when gem is duplicated within `if-else` statement - does not register an offense when gem is duplicated within `if-elsif` statement - registers an offense when gem from default group is conditionally duplicated - does not register an offense when gem is duplicated within `case` statement - and a duplicated gem is in a git/path/group/platforms block - registers an offense - and the file is empty - does not register any offenses - and a gem is duplicated in default group - registers an offense - and no duplicate gems are present - does not register any offenses - -RuboCop::Cop::Lint::UselessAssignment - when a variable is assigned while being passed to a method taking block - and the variable is used - accepts - and the variable is not used - registers an offense - when a variable is assigned and referenced when defining a module - does not register an offense - when a method argument is not used - accepts - when a variable is assigned and unreferenced in a method - registers an offense - when a block method argument is not used - accepts - when a variable is reassigned multiple times in ensure with rescue then referenced after the begin - registers an offense - when a variable is assigned in begin and referenced outside - accepts - when a variable is assigned in branch of modifier if that references the variable in its conditional clauseand referenced after the branching - accepts - when a variable is reassigned while referencing itself in rhs and referenced - accepts - when a variable is assigned in loop body and unreferenced - registers an offense - when a variable is reassigned in a loop - post until loop - accepts - until loop - accepts - while loop - accepts - for loop - accepts - post while loop - accepts - when a unreferenced variable is reassigned on the left side of && and referenced after the && - registers an offense for the unreferenced assignment - when a variable is assigned at the end of rescue and would be referenced with retry - accepts - when a variable is assigned in branch of modifier if that references the variable in its conditional clauseand unreferenced - registers an offense - when a splat method argument is not used - accepts - when an optional method argument is not used - accepts - when a variable is reassigned in single branch if and referenced in the branch - registers an offense for the unreferenced assignment - when a variable is assigned in loop body and referenced in post until condition - accepts - when a variable is assigned in main body of begin with rescue but unreferenced - registers an offense - when a method argument is reassigned and zero arity super is called - accepts - when a variable is reassigned multiple times in main body of begin then referenced in rescue - accepts - when a keyword splat method argument is not used - accepts - when a variable is reassigned with multiple assignment while referencing itself in rhs and referenced - accepts - inside a `case-match` node - does not register an offense when the variable is used - when a variable is reassigned and unreferenced in a if branch while the variable is referenced in the paired else branch - registers an offense for the reassignment in the if branch - when a variable is assigned multiple times but unreferenced - registers offenses for each assignment - when a variable is reassigned multiple times in rescue with ensure then referenced after the begin - registers an offense - when a variable is referenced in rhs of named capture expression - accepts - when a method argument is reassigned but not passed to super - registers an offense - when there's an unreferenced reassignment in a if branch while the variable is referenced in the paired elsif branch - registers an offense for the reassignment in the if branch - when a variable is assigned and passed to a method followed by method taking block - accepts - when a variable is reassigned at the end of loop body and would be referenced in loop condition - accepts - when a variable is assigned in main body of begin, rescue and else then referenced after the begin - accepts - when an assignment in a if branch is referenced in another if branch - accepts - when a variable is reassigned at the end of loop body and would be referenced in next iteration - accepts - when a variable is assigned with operator assignment in rescue and would be referenced with retry - accepts - when a block local variable is assigned and unreferenced - registers offenses for the assignment - when an anonymous keyword splat method argument is defined - accepts - when a unreferenced variable is reassigned in same branch and referenced after the branching - registers an offense for the unreferenced assignment - when a variable is reassigned multiple times in rescue and referenced after the begin - registers an offense - when a variable is reassigned with binary operator assignment while assigning to itself in rhs then referenced - registers an offense for the assignment in rhs - when a named capture is unreferenced in top level - registers an offense - when a variable is assigned and unreferenced in top level - registers an offense - when a variable is reassigned with logical operator assignment and referenced - accepts - when a variable is assigned and assigned again in a modifier condition - accepts without parentheses - accepts with parentheses - when a keyword splat method argument is used - accepts - when a block argument is not used - accepts - when a variable is assigned and unreferenced in a class subclassing another class stored in local variable - registers an offense - when an unreferenced variable is reassigned and re-referenced - registers an offense for the unreferenced assignment - when a variable that has same name as outer scope variable is not referenced in a method defined in loop - registers an offense - when a variable is assigned in single branch if and unreferenced - registers an offense - when a variable is assigned in loop body and referenced in post while condition - accepts - when a variable is reassigned with binary operator assignment and referenced - accepts - when a variable is assigned on each side of && and referenced after the && - accepts - when there is only one AST node and it is unused variable - registers an offense - when a unreferenced variable is reassigned on the right side of && and referenced after the && - accepts - when there's an unreferenced assignment in top level if branch while the variable is referenced in the paired else branch - registers an offense for the assignment in the if branch - when a variable is assigned and unreferenced in a singleton class - registers an offense - when a variable is assigned first with ||= and referenced - accepts - when a variable is assigned with operator assignment in top level - registers an offense - when a variable is assigned with ||= before the last expression of the scope - registers an offense - when a referenced variable is reassigned but not re-referenced in a method defined in loop - registers an offense - when a variable is reassigned in loop body but won't be referenced either next iteration or loop condition - registers an offense (PENDING: Requires an advanced logic that checks whether the return value of an operator assignment is used or not.) - when a variable is assigned and unreferenced in a singleton method defined with self keyword - registers an offense - when a variable is not used and the name starts with _ - accepts - when an unreferenced variable is reassigned in a block - accepts - when a variable is assigned and unreferenced in a class - registers an offense - when a rescued error variable is wrongly tried to be referenced in another rescue body - registers an offense - when a referenced variable is reassigned in a block - accepts - when a variable is shadowed by a block argument and unreferenced - registers an offense - when a variable is assigned and unreferenced in a module - registers an offense - when a variable is assigned in 2 identical if branches - doesn't think 1 of the 2 assignments is useless - when a referenced variable is reassigned but not re-referenced - registers an offense for the non-re-referenced assignment - when a variable is assigned in main body of begin, rescue and else and reassigned in ensure then referenced after the begin - registers offenses for each assignment before ensure - when a optional keyword method argument is not used - accepts - when a variable is reassigned multiple times in main body of begin then referenced in ensure - accepts - when a variable is assigned in each branch of if and referenced in the else branch - registers an offense for the assignment in the if branch - when there's an unreferenced reassignment in a if branch while the variable is referenced in a case branch in the paired else branch - registers an offense for the reassignment in the if branch - when a block local variable is declared but not assigned - accepts - when a variable is assigned in each branch of if and referenced after the branching - accepts - when a variable is assigned with multiple assignment and unreferenced - registers an offense - when a named capture is referenced - accepts - when a setter is invoked with operator assignment in loop body - accepts - when a local variable is unreferenced and zero arity super is called - registers an offense - when a variable is assigned with ||= at the last expression of the scope - registers an offense - when a named capture is unreferenced in other than top level - registers an offense - when a variable is reassigned multiple times in main body of begin then referenced after the begin - accepts - when a variable is assigned and unreferenced in a singleton method defined with variable name - registers an offense - similar name suggestion - when there's a similar variable-like method invocation - suggests the method name - when there's a similar variable - suggests the variable name - when there's a similar method invocation with arguments - does not suggest any name - when there are only less similar names - does not suggest any name - when there's a similar name but it's in inner scope - does not suggest any name - when there's a similar method invocation with explicit receiver - does not suggest any name - when a variable is reassigned in single branch if and referenced after the branching - accepts +RuboCop::Cop::Layout::MultilineBlockLayout + does not register offenses when there are too many parameters to fit on one line + registers an offense and corrects line-break within arguments + registers an offense and corrects for missing newline in {} block w/o params + registers an offense and corrects for missing newline before opening parenthesis `(` for block body + registers an offense and corrects line-break before arguments with empty block + doesn't move end keyword in a way which causes infinite loop in combination with Style/BlockEndNewLine + autocorrects nested parens correctly + registers an offense and corrects for missing newline in do/end block with params + registers an offense for missing newline in do/end block w/o params + registers an offense and corrects for missing newline in {} block with params + does not register offenses when there is a newline for {} block + does not register an offense for one-line {} blocks + registers an offense and corrects a line break within destructured arguments + registers offenses and corrects for new lambda literal syntax + registers offenses when there are not too many parameters to fit on one line + considers the extra space required to join the lines together + registers an offense and corrects a line-break within arguments + registers an offense and corrects a do/end block with a mult-line body + autocorrects in more complex case with lambda and assignment, and aligns the next line two spaces out from the start of the block + registers an offense and corrects line-break before arguments + does not error out when the block is empty + does not register an offense for one-line do/end blocks + registers offenses and corrects for lambdas + does not register offenses when there is a newline for do/end block + does not remove a trailing comma when only one argument is present + Ruby 2.7 + registers an offense and corrects for missing newline in do/end block with params + registers an offense and corrects for missing newline in {} block w/o params -RuboCop::Cop::Style::InfiniteLoop - registers an offense for a while loop with {} as condition - registers an offense for modifier until false if loop {} would not change semantics - registers an offense for a while loop with 2.0 as condition - registers an offense for a while loop with [1] as condition - registers an offense for a until loop with false as condition - registers an offense for a until loop with nil as condition - registers an offense for until false if loop {} would work because the assigned variable is not used afterwards - registers an offense for a while loop with 1 as condition - accepts Kernel#loop - registers an offense for until false if loop {} would work because of previous assignment in a while loop - registers an offense for while true if loop {} would work because it is an instance variable being assigned - accepts while true if loop {} would change semantics - accepts modifier while true if loop {} would change semantics - registers an offense for while true or until false if loop {} would work because of an earlier assignment - behaves like autocorrector - autocorrects single line modifier while - autocorrects the usage of while with do - autocorrects begin-end-while with two statements - autocorrects the usage of while without do - autocorrects begin-end-while with one statement - autocorrects single line modifier while with and - with non-default indentation width - autocorrects multi-line modifier while and indents correctly - behaves like autocorrector - autocorrects the usage of until without do - autocorrects single line modifier until with and - autocorrects single line modifier until - autocorrects begin-end-until with one statement - autocorrects begin-end-until with two statements - autocorrects the usage of until with do - with non-default indentation width - autocorrects multi-line modifier until and indents correctly +RuboCop::Cop::Style::SoleNestedConditional + registers an offense and corrects when using nested `unless` modifier multiple conditional + registers an offense and corrects for multiple nested conditionals + registers an offense and corrects when using nested `unless` modifier with a single expression condition + registers an offense and corrects when nested `||` operator modifier condition + does not register an offense when nested conditional has an `else` branch + registers an offense and corrects when `if` foo do_something end `unless` bar && baz + registers an offense and corrects when using nested `if` within `unless foo == bar` + registers an offense and corrects when `if` foo && bar do_something end `unless` baz + registers an offense and corrects when using guard conditional with outer comment + registers an offense and corrects when there are outer and inline comments + registers an offense and corrects when using nested `unless` modifier conditional + registers an offense and corrects when using `unless` and multiple method arguments with parenthesesin the outer condition and nested modifier condition + does not register an offense when no nested conditionals + registers an offense and corrects for multiple nested conditionals with using method call outer condition by omitting parentheses + registers an offense and corrects when using `unless` and method arguments with parentheses in the outer condition and nested modifier condition + registers an offense and corrects when using `unless` and method arguments without parentheses in the outer condition and nested modifier condition + does not register an offense when using nested conditional is not the whole body + registers an offense and corrects when using `unless` and `||` without parens in the outer condition and nested modifier condition + does not register an offense when using nested conditional within `elsif` + registers an offense and corrects when using `unless` and `&&` without parens in the outer condition and nested modifier condition + does not register an offense when using nested modifier on value assigned in multiple conditions + registers an offense and corrects when `if` foo do_something end `if` bar + does not register an offense when using nested modifier on value assigned in single condition + registers an offense and corrects when `if` foo do_something end `if` bar && baz + registers an offense and corrects when using nested `if` modifier conditional + registers an offense and corrects when using nested `if` within `if foo = bar` + registers an offense and corrects when using `||` in the outer condition and nested modifier condition + registers an offense and corrects when using nested `unless` within `if` + registers an offense and corrects when `if` foo do_something end `unless` bar + registers an offense and corrects when using `unless` and `||` and parens in the outer condition and nested modifier condition + registers an offense and corrects when using nested conditional and branch contains a comment + registers an offense and corrects when using nested `if` within `if` + registers an offense and corrects when `if` foo && bar do_something end `if` baz + registers an offense and corrects when `unless` foo && bar do_something end `if` baz + registers an offense and corrects when using nested `if` within `unless` + does not register an offense when using nested ternary within conditional + registers an offense and corrects when using `||` in the outer condition + does not register an offense for nested conditionals when outer conditional has an `else` branch + registers an offense and corrects when nested `||` operator condition + registers an offense and corrects when `unless` foo do_something end `if` bar + registers an offense and corrects when using nested `unless` within `unless` + when AllowModifier is true + does not register an offense when using nested modifier conditional + when the inner condition has a send node with parens + in guard style + registers an offense and corrects + in modifier style + registers an offense and corrects + when disabling `Style/IfUnlessModifier` + registers an offense and corrects when using nested conditional and branch contains a comment + registers an offense and corrects when there are outer and inline comments + when the inner condition has a send node without parens + in guard style + registers an offense and corrects + in modifier style + registers an offense and corrects + with a `csend` node + registers an offense and corrects + with a block + registers an offense and corrects RuboCop::Cop::Lint::DisjunctiveAssignmentInConstructor - empty constructor - accepts - constructor does not have disjunctive assignment - accepts constructor has disjunctive assignment + LHS is lvar + accepts LHS is ivar registers an offense and corrects + constructor calls any method before disjunctive assignment + accepts constructor calls super after assignment registers an offense and corrects constructor calls super before disjunctive assignment accepts - constructor calls any method before disjunctive assignment - accepts - LHS is lvar - accepts - -RuboCop::Cop::Generator::RequireFileInjector - when a `require_relative` entry does not exist from before - injects a `require_relative` statement on the right line in the root file - when a `require` entry already exists - does not write to any file - when using an unknown department - inserts a `require_relative` statement to the bottom of the file - when a cop of style department already exists - injects a `require_relative` statement on the end of style department - -RuboCop::Cop::Style::ExpandPathArguments - does not register an offense when using `File.expand_path('..', __dir__)` - does not register an offense when using `File.expand_path(__dir__)` - registers an offense when using `File.expand_path('.', __FILE__)` - does not register an offense when using `File.expand_path(__FILE__)` - registers an offense when using `File.expand_path('./../..', __FILE__)` - does not register an offense when using `Pathname(__dir__).expand_path` - does not register an offense when using `File.expand_path("#{path_to_file}.png", __FILE__)` - does not register an offense when using `File.expand_path(path, __FILE__)` - registers an offense when using `File.expand_path('..', __FILE__)` - registers an offense when using `::Pathname.new(__FILE__).parent.expand_path` - registers an offense when using `File.expand_path('../..', __FILE__)` - registers an offense when using `Pathname.new(__FILE__).parent.expand_path` - registers an offense when using `File.expand_path('../../lib', __FILE__)` - registers an offense when using `::File.expand_path('./../..', __FILE__)` - registers an offense when using `File.expand_path('../../..', __FILE__)` - registers an offense when using `Pathname(__FILE__).parent.expand_path` - -RuboCop::Cop::Style::UnlessElse - unless without else - does not register an offense - unless with nested if-else - registers an offense - unless with else - registers an offense - and nested unless with else - registers offenses for both but corrects only the outer unless/else - -RuboCop::Cop::Commissioner - #investigate - traverses the AST and invoke cops specific callbacks - stores all errors raised by the cops - when passed :raise_cop_error option - re-raises the exception received while processing - when given a source with parsing errors - only calls on_other_file - when passed :raise_error option - re-raises the exception received while processing - when a cop reports offenses - returns all offenses found by the cops - traverses the AST with on_send / on_csend - for unrestricted cops - calls on_send all method calls - for a restricted cop - calls on_send for the right method calls - on both csend and send - calls on_send for the right method calls - when given a force - passes the input params to all cops/forces that implement their own #investigate method - -RuboCop::Cop::Layout::SpaceInLambdaLiteral - when configured to enforce spaces - does not register an offense for a space between -> and ( - does not register an offense for no space between -> and { - registers an offense and corrects no space between -> and ( - registers an offense and corrects no space in the inner nested lambda - does not register an offense for multi-line lambdas - registers an offense and corrects no space in the outer nested lambda - registers an offense and corrects no space in both lambdas when nested - when configured to enforce no space - registers an offense and corrects spaces between -> and ( - register offenses and correct spaces in both lambdas when nested - does not register an offense for no space between -> and ( - registers an offense and corrects a space in the outer nested lambda - registers an offense and corrects a space in the inner nested lambda - registers an offense and corrects a space between -> and ( - does not register an offense for a space between -> and { - does not register an offense for multi-line lambdas - -RuboCop::Cop::Lint::DuplicateRescueException - does not register an offense when there are no duplicate exceptions - registers an offense when duplicate exception exists within rescues with `else` branch - registers an offense when duplicate exception exists - registers an offense when multiple duplicate exceptions exist - registers an offense when duplicate exception exists within rescues with empty `rescue` branch - registers an offense when duplicate exception splat exists - -RuboCop::Cop::Naming::AsciiIdentifiers - when AsciiConstants is true - does not get confused by an empty file - registers an offense for a variable name with mixed chars - does not get confused by a byte order mark - registers an offense for a constant name with non-ascii chars - registers an offense for a variable name with non-ascii chars - accepts identifiers with only ascii chars - when AsciiConstants is false - accepts constants with only ascii chars - does not get confused by a byte order mark - accepts identifiers with only ascii chars - registers an offense for a variable name with mixed chars - does not get confused by an empty file - registers an offense for a variable name with non-ascii chars - -RuboCop::Cop::Lint::EmptyBlock - does not register an offense on an empty proc - does not register an offense for empty block with inline comments - does not register an offense on an empty lambda - does not register an offense on an empty stabby lambda - does not register an offense on an empty Proc.new - does not register an offense for empty block with inner comments - does not register an offense when block is not empty - registers an offense for empty block within method call - does not register an offense on an empty ::Proc.new - registers an offense for an empty block given to a non-Kernel `proc` method - when AllowEmptyLambdas is false - registers an offense for an empty lambda - registers an offense on an empty proc - registers an offense for an empty stabby lambda - registers an offense on an empty Proc.new - registers an offense on an empty ::Proc.new - when AllowComments is false - registers an offense for empty block with inner comments - registers an offense for empty block with inline comments - -RuboCop::Cop::Bundler::OrderedGems - When gems are not alphabetically sorted - registers an offense - When a gem that starts with a capital letter is sorted - does not register an offense - When gems are asciibetically sorted irrespective of _ - does not register an offense - When each individual group of line is not sorted - registers some offenses - When there are duplicated gems in group - registers an offense - When gem groups is separated by multiline comment - with TreatCommentsAsGroupSeparators: true - accepts - with TreatCommentsAsGroupSeparators: false - registers an offense - When each individual group of line is sorted - does not register any offenses - When a gem that starts with a capital letter is not sorted - registers an offense - when a gem is referenced from a variable - resets the sorting to a new block - ignores the line - When gems have an inline comment, and not sorted - registers an offense - When a gem is sorted but not so when disregarding _- - when ConsiderPunctuation is true - does not register an offense - by default - registers an offense - When a gem declaration takes several lines - registers an offense - When gems are alphabetically sorted - does not register any offenses - When the gemfile is empty - does not register any offenses - -RuboCop::Cop::Style::ImplicitRuntimeError - does not register an offense for `fail` with an error class - registers an offense for `fail` without error class - does not register an offense for `raise` without arguments - registers an offense for `fail` with a multiline string - does not register an offense for `raise` with an error class - registers an offense for `raise` with a multiline string - does not register an offense for `fail` without arguments - registers an offense for `raise` without error class - -RuboCop::Cop::Layout::SpaceInsideStringInterpolation - when EnforcedStyle is no_space - does not touch spaces inside the interpolated expression - accepts empty interpolation - for ill-formatted string interpolations - registers offenses and autocorrects - finds interpolations in string-like contexts - when interpolation starts or ends with a line break - does not register an offense - ignores comments and whitespace when looking for line breaks - for well-formatted string interpolations - accepts excess literal spacing - for "space" style formatted string interpolations - registers offenses and autocorrects - when EnforcedStyle is space - accepts empty interpolation - for well-formatted string interpolations - does not register an offense for excess literal spacing - for ill-formatted string interpolations - registers offenses and autocorrects - for "no_space" style formatted string interpolations - registers offenses and autocorrects - -RuboCop::Cop::Lint::Void - accepts short call syntax - registers an offense for void lit [1] if not on last line - registers an offense for void `self` if not on last line - accepts void op - by itself without a begin block - registers an offense for void op <=> if not on last line - registers two offenses for void literals in a setter method - registers an offense for void lit {} if not on last line - registers an offense for void var $var if not on last line - registers an offense for void var @var if not on last line - accepts void op - if on last line - registers an offense for void sign op + if not on last line - registers an offense for void op > if not on last line - registers an offense for void op >= if not on last line - accepts void op != if on last line - handles `#each` block with single expression - accepts void unary op + if on last line - accepts void op < if on last line - registers an offense for void literal in a method definition - registers two offenses for void literals in `#tap` method - accepts void op % by itself without a begin block - accepts void op * if on last line - accepts void op * by itself without a begin block - registers an offense for void op < if not on last line - registers an offense for void op - if not on last line - accepts void unary op ! if on last line - accepts void op < by itself without a begin block - registers two offenses for void literals in an initialize method - registers an offense for void sign op - if not on last line - registers an offense for void unary op ~ if not on last line - accepts void unary op ~ by itself without a begin block - registers an offense for void op != if not on last line - registers an offense for void var VAR if not on last line - registers an offense for void `defined?` if not on last line - accepts void op / by itself without a begin block - accepts backtick commands - accepts void op + by itself without a begin block - registers two offenses for void literals in a `#each` method - accepts void unary op ! by itself without a begin block - registers an offense for void var var if not on last line - accepts void op != by itself without a begin block - accepts void op <= by itself without a begin block - accepts void op === if on last line - accepts void op + if on last line - registers an offense for void op + if not on last line - accepts void op == by itself without a begin block - registers an offense for void op <= if not on last line - registers an offense for void lit 1 if not on last line - accepts method with irange block - accepts void unary op ~ if on last line - accepts void op > if on last line - accepts void op >= if on last line - accepts percent-x commands - registers an offense for void op === if not on last line - accepts void unary op - if on last line - accepts void op / if on last line - accepts void op === by itself without a begin block - accepts method with erange block - registers two offenses for void literals in a `for` - accepts empty block - handles explicit begin blocks - registers an offense for void lit :test if not on last line - accepts void unary op + by itself without a begin block - accepts void op <=> if on last line - registers an offense for void op / if not on last line - registers an offense for void var @@var if not on last line - accepts void unary op - by itself without a begin block - registers an offense for void op * if not on last line - accepts void op == if on last line - accepts void op % if on last line - accepts void op <=> by itself without a begin block - registers an offense for void op % if not on last line - registers an offense for void unary op ! if not on last line - registers an offense for void op == if not on last line - registers an offense for void lit 2.0 if not on last line - accepts void op >= by itself without a begin block - registers an offense for void lit /test/ if not on last line - accepts void op > by itself without a begin block - accepts void op <= if on last line - Ruby 2.7 - registers two offenses for void literals in `#tap` method - when checking for methods with no side effects - registers an offense for chained methods - registers an offense if not on last line - when not checking for methods with no side effects - does not register an offense for void nonmutating methods - -RuboCop::Cop::Style::BlockComments - autocorrects an empty block comment by removing it - registers an offense for block comments - accepts regular comments - autocorrects a block comment into a regular comment - autocorrects a block comment into a regular comment (without trailingnewline) - -RuboCop::Cop::Style::WhileUntilDo - accepts multi-line until without do - accepts multi-line while without do - registers an offense for do in multiline while - accepts do in single-line while - registers an offense for do in multiline until - accepts do in single-line until - -RuboCop::Cop::InternalAffairs::NodeMatcherDirective - registers an offense if the matcher has multiple directives - registers an offense if the matcher has multiple directives - registers an offense if the matcher does not have a directive - retains indentation properly when correcting - does not register an offense if the node matcher already has a directive - registers an offense if the matcher does not have a directive and a method call is used for a pattern argument - does not insert a blank line if one already exists - registers an offense if the matcher does not have a directive and a method call is used for a pattern argument - does not register an offense if called with a dynamic method name - does not register an offense if called with a dynamic method name - retains indentation properly when inserting - autocorrects with the right arguments if the pattern references a non-contiguous argument - does not insert a blank line if one already exists - registers an offense if the matcher does not have a directive - inserts a blank line between multiple multi-line pattern matchers - inserts a blank line between multiple pattern matchers - autocorrects with the right arguments if the pattern includes arguments - does not register an offense if the node matcher already has a directive - autocorrects with the right arguments if the pattern references a non-contiguous argument - registers an offense if the directive name does not match the actual name - does not register an offense if the directive is in a comment block - inserts a blank line between multiple pattern matchers - inserts a blank line between multiple multi-line pattern matchers - retains indentation properly when correcting - retains indentation properly when inserting - autocorrects with the right arguments if the pattern includes arguments - registers an offense if the matcher does not have a directive but has preceding comments - registers an offense if the matcher does not have a directive but has preceding comments - registers an offense if the directive name does not match the actual name - does not register an offense if the directive is in a comment block - -RuboCop::Cop::Metrics::MethodLength - properly counts lines when method ends with block - does not count blank lines - is not fooled by one-liner methods, syntax #1 - is not fooled by one-liner methods, syntax #2 - accepts empty methods - accepts a method with multiline arguments and less than 5 lines of body - accepts a method with less than 5 lines - does not count commented lines by default - when method is defined on a singleton class - registers an offense - when `CountAsOne` is not empty - folds array into one line - when method is defined with `define_method` - registers an offense - when methods to allow are defined - AllowedPatterns is enabled - accepts the user_name method - raises offense for firstname - AllowedMethods is enabled - still rejects other methods with more than 5 lines - accepts the foo method with more than 5 lines - when method is an instance method - registers an offense - when using numbered parameter - when method is defined with `define_method` - registers an offense - when CountComments is enabled - also counts commented lines - when method is a class method - registers an offense - -RuboCop::Cop::Style::StringChars - registers and corrects an offense when using `split('')` - does not register an offense when using `chars` - does not register an offense when using `split` - does not register an offense when using `split(/ /)` - registers and corrects an offense when using `split` without parentheses - registers and corrects an offense when using `split(//)` - registers and corrects an offense when using `split("")` + empty constructor + accepts + constructor does not have disjunctive assignment + accepts -RuboCop::Cop::Style::ColonMethodCall - registers an offense for class method call - does not register an offense for constant access - does not register an offense for nested class - does not register an offense for op methods - does not register an offense when for constructor methods - does not register an offense for Java static types - registers an offense for instance method call with arg - registers an offense for instance method call - registers an offense for class method call with arg - does not register an offense for Java package namespaces +RuboCop::Cop::Style::MixinGrouping + when configured with separated style + when using a mix of diffent methods + registers an offense for some calls having several mixins + when using `include` + allows include call as an argument to another method + registers an offense for several mixins in one call + registers an offense for several mixins in separate calls + when using `prepend` + registers an offense for several mixins in one call + when using `extend` + registers an offense for several mixins in one call + when configured with grouped style + when using `prepend` + registers an offense for single mixins in separate calls, interspersed + registers an offense for single mixins in separate calls + registers an offense when other mixins have receivers + when using `extend` + registers an offense for single mixins in separate calls + when using a mix of diffent methods + registers an offense with some duplicated mixin methods + allows all different mixin methods + when using include + registers an offense for single mixins in separate calls + registers an offense for several mixins in separate calls + allows include with an explicit receiver -RuboCop::Cop::Style::RedundantSortBy - autocorrects array.sort_by { |x| x } - autocorrects array.sort_by { |y| y } - autocorrects array.sort_by do |x| x end - Ruby 2.7 - autocorrects array.sort_by { |x| x } +RuboCop::Cop::Style::SelectByRegexp + with find_all + registers an offense and corrects for `lvar =~ blockvar` + does not register an offense when given a proc + registers an offense and corrects when there is no explicit regexp + does not register an offense when the receiver is `Hash[]` + does not register an offense when the receiver is a hash literal + registers an offense and corrects without a receiver + does not register an offense when the block has multiple expressions + registers an offense and corrects for `match?` + registers an offense and corrects with a multiline block + registers an offense and corrects for `regexp =~ blockvar` + does not register an offense when the receiver is `ENV` + does not register an offense when there is no block + registers an offense and corrects for `Regexp#match?` + does not register an offense when the block does not match a regexp + registers an offense and corrects for `blockvar =~ lvar` + registers an offense and corrects when the receiver is a set + registers an offense and corrects for `blockvar =~ regexp` + does not register an offense when the receiver is `to_hash` + registers an offense if `to_h` is in the receiver chain but not the actual receiver + does not register an offense when the block param is a method argument + registers an offense and corrects when the receiver is an array + does not register an offense when the receiver is `to_h` + does not register an offense when the receiver is `Hash.new` + does not register an offense when the block arity is not 1 + does not register an offense when the block uses an external variable in a regexp match + registers an offense and corrects when the receiver is a range + with `numblock`s + registers an offense and corrects for `regexp =~ blockvar` + does not register an offense if there is more than one numbered param + registers an offense and corrects for `match?` + registers an offense and corrects for `blockvar =~ regexp` + does not register an offense when using `match?` without a receiver + does not register an offense when the param is a method argument + registers an offense and corrects for `Regexp#match?` + with select + registers an offense and corrects for `lvar =~ blockvar` + registers an offense and corrects for `regexp =~ blockvar` + registers an offense and corrects for `Regexp#match?` + registers an offense and corrects when there is no explicit regexp + does not register an offense when the block does not match a regexp + does not register an offense when there is no block + does not register an offense when the block has multiple expressions + registers an offense if `to_h` is in the receiver chain but not the actual receiver + registers an offense and corrects when the receiver is an array + registers an offense and corrects without a receiver + does not register an offense when the receiver is `to_h` + registers an offense and corrects for `match?` + does not register an offense when the block arity is not 1 + does not register an offense when the receiver is `to_hash` + does not register an offense when the receiver is `ENV` + does not register an offense when the block param is a method argument + does not register an offense when the receiver is `Hash[]` + registers an offense and corrects when the receiver is a range + registers an offense and corrects for `blockvar =~ regexp` + does not register an offense when the receiver is a hash literal + does not register an offense when given a proc + registers an offense and corrects with a multiline block + registers an offense and corrects for `blockvar =~ lvar` + registers an offense and corrects when the receiver is a set + does not register an offense when the receiver is `Hash.new` + does not register an offense when the block uses an external variable in a regexp match + with `numblock`s + registers an offense and corrects for `regexp =~ blockvar` + does not register an offense when the param is a method argument + does not register an offense if there is more than one numbered param + registers an offense and corrects for `blockvar =~ regexp` + does not register an offense when using `match?` without a receiver + registers an offense and corrects for `Regexp#match?` + registers an offense and corrects for `match?` + with reject + registers an offense and corrects for `Regexp#match?` + does not register an offense when the block arity is not 1 + does not register an offense when the receiver is `ENV` + registers an offense if `to_h` is in the receiver chain but not the actual receiver + does not register an offense when the block has multiple expressions + registers an offense and corrects for `blockvar =~ lvar` + registers an offense and corrects with a multiline block + does not register an offense when there is no block + does not register an offense when the receiver is `to_h` + does not register an offense when the receiver is `Hash.new` + registers an offense and corrects for `lvar =~ blockvar` + registers an offense and corrects without a receiver + does not register an offense when the block does not match a regexp + does not register an offense when given a proc + does not register an offense when the block param is a method argument + registers an offense and corrects when the receiver is an array + registers an offense and corrects when the receiver is a set + does not register an offense when the receiver is a hash literal + registers an offense and corrects when the receiver is a range + registers an offense and corrects for `match?` + does not register an offense when the block uses an external variable in a regexp match + does not register an offense when the receiver is `to_hash` + registers an offense and corrects for `regexp =~ blockvar` + registers an offense and corrects when there is no explicit regexp + does not register an offense when the receiver is `Hash[]` + registers an offense and corrects for `blockvar =~ regexp` + with `numblock`s + registers an offense and corrects for `blockvar =~ regexp` + registers an offense and corrects for `match?` + does not register an offense when using `match?` without a receiver + does not register an offense if there is more than one numbered param + registers an offense and corrects for `regexp =~ blockvar` + registers an offense and corrects for `Regexp#match?` + does not register an offense when the param is a method argument -RuboCop::Cop::Layout::MultilineArrayLineBreaks - when nested arrays - registers an offense and corrects - when two elements on same line - registers an offense and corrects - when on same line - does not add any offenses - when on same line, separate line from brackets - does not add any offenses +RuboCop::Cop::Style::NegatedUnless + does not blow up for empty if condition + does not blow up for empty unless condition + does not blow up on a negated ternary operator + does not blow up for ternary ops + with “postfix” style + does not register an offense for prefix + registers an offense for postfix + with “both” style + registers an offense for unless with "not" condition + autocorrects by replacing parenthesized unless not with if + accepts an unless where only part of the condition is negated + accepts an unless/else with negative condition + registers an offense for unless with exclamation point condition + accepts an unless where the condition is doubly negated + with “prefix” style + registers an offense for prefix + does not register an offense for postfix -RuboCop::Cop::Lint::UnusedMethodArgument - when IgnoreNotImplementedMethods config parameter is set - accepts a method with a single unused parameter & fails with message - accepts a method with a single unused parameter & raises NotImplementedError - accepts an empty method with multiple unused parameters - accepts a method with a single unused parameter & raises ::NotImplementedError - accepts a method with a single unused parameter & raises NotImplementedError, message - registers an offense for a non-empty method with multiple unused parameters - accepts an empty singleton method with a single unused parameter &raise NotImplementedError - accepts a method with a single unused parameter & fails without message - registers an offense for a non-empty method with a single unused parameter - when IgnoreEmptyMethods config parameter is set - registers an offense for a non-empty method with multiple unused parameters - accepts an empty method with multiple unused parameters - accepts an empty method with a single unused parameter - accepts an empty singleton method with a single unused parameter - registers an offense for a non-empty method with a single unused parameter - inspection - in a method calling `super` with arguments - when a method argument is unused - registers an offense - when a splat argument is unused - registers an offense and preserves the splat - when a block argument is unused - does not care - when a method argument is used - accepts - when an optional keyword argument is unused - registers an offense but does not suggest underscore-prefix - and AllowUnusedKeywordArguments set - does not care - when a trailing block argument is unused - registers an offense and removes the unused block arg - in a method calling `binding` without arguments - accepts all arguments - inside another method definition - registers offenses - when a variable is unused - does not care - in a method calling `binding` with arguments - when a method argument is unused - registers an offense - when an argument with a default value is unused - registers an offense and preserves the default value - when an underscore-prefixed method argument is unused - accepts - when a singleton method argument is unused - registers an offense - in a method calling `super` without arguments - when a method argument is not used explicitly - accepts since the arguments are guaranteed to be the same as superclass' ones and the user has no control on them - when a method takes multiple arguments - and all the arguments are unused - registers offenses and suggests the use of `*` and autocorrects to add underscore-prefix to all arguments - and an argument is unused - registers an offense and adds underscore-prefix - and one argument is assigned to another, whilst other's value is not used - registers an offense - and there is some whitespace around the unused argument - registers an offense and preserves whitespace - and arguments are swap-assigned - accepts - when a required keyword argument is unused - when a required keyword argument is unused - registers an offense but does not suggest underscore-prefix +RuboCop::Cop::Style::TrailingBodyOnMethodDefinition + autocorrects with comment after body + does not register offense with trailing body on method end + registers an offense when body trails after method definition + accepts a method with multiple lines of body + registers when body starts on def line & continues one more line + autocorrects body with method definition with args not in parens + removes semicolon from method definition but not body when autocorrecting + accepts a method with one line of body + registers when body starts on def line & continues many more lines + Ruby 3.0 or higher + does not register offense when endless method definition body is after newline in opening parenthesis + when method is not on first line of processed_source + autocorrects offense -RuboCop::Cop::Lint::EachWithObjectArgument - accepts a string argument - accepts two arguments - registers an offense for fixnum argument - registers an offense for bignum argument - registers an offense for float argument - accepts a variable argument - when using safe navigation operator - registers an offense for fixnum argument +RuboCop::Cop::Style::RedundantReturn + reports an offense for defs ending with return + accepts return in a non-final position + autocorrects by removing redundant returns + does not blow up on empty method body + reports an offense for def ending with return with splat argument + reports an offense for def ending with return + reports an offense for defs with only a return + reports an offense for def with only a return + does not blow up on empty if body + when multi-value returns are allowed + accepts def ending with return + accepts def with only a return + accepts defs with only a return + accepts defs ending with return + when case nodes are empty + accepts empty when nodes + when return is inside a when-branch + registers an offense and autocorrects + when rescue and return blocks present + registers an offense and autocorrects when rescue has else clause + registers an offense and autocorrects when inside function or rescue block + when return has no arguments + behaves like common behavior + registers an offense for return and autocorrects replacing return with nil + behaves like common behavior + registers an offense for return() and autocorrects replacing return() with nil + when multi-value returns are not allowed + reports an offense for defs ending with return + reports an offense for def ending with return + autocorrects by removing return when using an explicit hash + reports an offense when multiple return values have a parenthesized return value + autocorrects by making an implicit hash explicit + reports an offense for defs with only a return + reports an offense for def with only a return + when return is inside an if-branch + registers an offense and autocorrects + when return is inside begin-end body + registers an offense and autocorrects -RuboCop::Cop::InternalAffairs::RedundantLocationArgument - when location argument is passed - when location argument is :expression - removes default `location` surrounded by other keywords - registers an offense - removes default `location` when preceded by another keyword - when there is a message argument - registers an offense - when location argument does not equal to :expression - does not register an offense - when location argument is not passed +RuboCop::Cop::Style::Semicolon + accepts one line empty module definitions + registers an offense for several expressions + accepts semicolon before end if so configured + accept semicolons inside strings + accepts one line empty class definitions + registers an offense for range (`1..42`) with semicolon + accepts semicolon after params if so configured + registers an offense for range (`1...42`) with semicolon + registers an offense for semicolon at the end no matter what + registers an offense for a single expression + registers an offense for a semicolon at the beginning of a line + registers an offense for one line method with two statements + accepts one line method definitions + accepts one line empty method definitions + with a multi-expression line without a semicolon does not register an offense - -RuboCop::Cop::Style::NestedFileDirname - Ruby <= 3.0 - does not register an offense when using `File.dirname(path)` nested two times - Ruby >= 3.1 - registers and corrects an offense when using `File.dirname(path)` nested two times - registers and corrects an offense when using `File.dirname(path)` nested three times - does not register an offense when using `File.dirname(path, 2)` - does not register an offense when using non nested `File.dirname(path)` - -RuboCop::Cop::Style::FormatString - when enforced style is format - registers an offense for variable argument but does not autocorrect - registers an offense for something followed by a hash - does not autocorrect String#% with variable argument and assignment - registers an offense for sprintf with 2 arguments - does not register an offense for ambiguous cases - registers an offense for something followed by an array - works if the first operand contains embedded expressions - registers an offense for sprintf - does not register an offense for numbers - registers an offense for a string followed by something - when enforced style is sprintf - registers an offense for String#% with a hash argument - does not register an offense for numbers - registers an offense for format - registers an offense for variable argument and assignment but does not autocorrect - registers an offense for variable argument but does not autocorrect - registers an offense for format with 2 arguments - registers an offense for a string followed by something - does not register an offense for ambiguous cases - works if the first operand contains embedded expressions - registers an offense for something followed by an array - when enforced style is percent - accepts format with 1 argument - registers an offense for format - registers an offense for sprintf - registers an offense and corrects when using springf with second argument that uses an operator - registers an offense for sprintf with 3 arguments - registers an offense for sprintf with a hash argument - registers an offense for format with a hash argument - registers an offense for format with 3 arguments - accepts format without arguments - accepts sprintf without arguments - accepts String#% - accepts sprintf with 1 argument - -RuboCop::Cop::Style::Encoding - does not register an offense when encoding present but not UTF-8 - does not register an offense when encoding is in the wrong place - registers an offense and corrects the magic comment follows another magic comment - does not register an offense when encoding is not at the top of the file - registers an offense when encoding present on 2nd line after shebang - registers an offense when encoding present and UTF-8 - registers an offense and corrects if there are multiple encoding magic comments - does not register an offense when no encoding present - does not register an offense on a different magic comment type - vim comments - registers an offense and corrects - emacs comment - only removes encoding if there are other editor comments - registers an offense for encoding - -RuboCop::Cop::InternalAffairs::MethodNameEqual - registers an offense when using `#method == :do_something` - registers an offense when using `#method == other_node.do_something` - does not register an offense when using `#method?` - -RuboCop::Cop::Style::HashTransformValues - when using Ruby 2.4 or newer - flags _.map {...}.to_h when transform_values could be used when wrapped in another block - flags Hash[_.map{...}] when transform_values could be used - does not flag each_with_object when its argument is not modified - does not flag each_with_object when receiver is array literal - does not flag `each_with_object` when its receiver is `with_index` - does not flag `each_with_object` when its receiver is `each_with_index` - does not flag `Hash[_.map{...}]` when its receiver is `with_index` - correctly autocorrects _.map{...}.to_h with block - flags _.map {...}.to_h when transform_values could be used when line break before `to_h` - does not flag `_.map{...}.to_h` when its receiver is `each_with_index` - does not flag _.map{...}.to_h when both key & value are transformed - does not flag each_with_object when no transformation occurs - does not flag `_.map{...}.to_h` when its receiver is `zip` - does not flag `each_with_object` when its receiver is `zip` - flags _.map {...}.to_h when transform_values could be used - does not flag `each_with_object` when its argument is used in the value - does not flag `_.map{...}.to_h` when its receiver is `with_index` - does not flag value transformation when receiver is array literal - does not flag each_with_object when value transformation uses key - does not flag `Hash[_.map{...}]` when its receiver is an array literal - does not flag `Hash[_.map{...}]` when its receiver is `zip` - does not flag each_with_object when both key & value are transformed - does not flag `Hash[_.map{...}]` when its receiver is `each_with_index` - does not flag Hash[_.map{...}] when both key & value are transformed - does not flag _.map {...}.to_h when value block argument is unused - does not flag value transformation in the absence of to_h - with safe navigation operator - flags each_with_object when transform_values could be used - with inline block - flags each_with_object when transform_values could be used - with multiline block - flags each_with_object when transform_values could be used - below Ruby 2.6 - does not flag _.to_h{...} - when using Ruby 2.6 or newer - register and corrects an offense _.to_h{...} when value is a hash literal and is not enclosed in braces - does not flag `_.to_h{...}` when its receiver is `with_index` - does not flag `_.to_h{...}` when its receiver is `each_with_index` - register and corrects an offense _.to_h{...} when value is a hash literal and is enclosed in braces - does not flag `_.to_h{...}` when its receiver is `zip` - does not flag `_.to_h{...}` when both key & value are transformed - flags _.to_h{...} when transform_values could be used - does not flag _.to_h {...} when value block argument is unused - does not flag `_.to_h{...}` when its receiver is an array literal - below Ruby 2.4 - does not flag even if transform_values could be used - -RuboCop::Cop::InternalAffairs::RedundantContextConfigParameter - does not register an offense when using `:ruby30` only - registers an offense when using `:config` parameter - does not register an offense when using `:config` in other than `context` - registers an offense when using `:config` parameter with other parameters - does not register an offense when not using `:config` - -RuboCop::Cop::Style::CaseLikeIf - registers an offense and corrects when using `===` - registers an offense and corrects when using `is_a?` - does not register an offense when one of `||` subconditions is not convertible - does not register an offense when using `cover?` without a receiver - does not register an offense when using `=~` in first branch with non regexp - registers an offense and corrects when using `match?` with regexp - registers an offense and corrects when using `||` within conditions - does not register an offense when not all conditions contain target - does not register an offense when using ternary operator - registers an offense and corrects when using `==` with constant - does not register an offense when using `match?` in first branch with non regexp - does not register an offense when using `==` with class reference - does not register an offense when using `match?` with non regexp - does not register an offense when only single `if` - registers an offense and corrects when using `==` with literal - registers an offense and corrects when using `match?` with non regexp in other branches except first - does not register an offense when using `==` with method call with arguments - does not register an offense when an object overrides `equal?` with no arity - registers an offense and corrects when using nested conditions with `||` - registers an offense and corrects when using `=~` - does not register an offense when only `if-else` - does not register an offense when using `equal?` without a receiver - does not register an offense when using modifier `if` - does not register an offense when using `==` with constant containing 1 letter in name - registers an offense and corrects when using `include?` with range - does not register an offense when using `match?` without a receiver - does not register an offense when using `include?` without a receiver - registers an offense and corrects when target is a method call - does not register an offense when using `unless` - does not register an offense when one of the branches contains `==` with class reference - when using regexp with named captures - does not register an offense with =~ and regexp on lhs - does not register an offense with match and regexp on rhs - registers and corrects an offense with =~ and regexp on rhs - does not register an offense with match and regexp on lhs - registers and corrects an offense with match? and regexp on rhs - registers and corrects an offense with match? and regexp on lhs - -RuboCop::ResultCache - #save - when the @path is not writable - behaves like invalid cache location - doesn't raise an exception - behaves like invalid cache location - doesn't raise an exception - when the default internal encoding is UTF-8 - writes non UTF-8 encodable data to file with no exception - .cleanup - removes the oldest files in the cache if needed - the cache path - when CacheRootDirectory not set - and XDG_CACHE_HOME is set - contains the given path and UID - and XDG_CACHE_HOME is not set - contains $HOME/.cache - when CacheRootDirectory is set - contains the given root - and RUBOCOP_CACHE_ROOT is set - contains the root from RUBOCOP_CACHE_ROOT - cached result that was saved with no command line option - when --display-cop-names is given - is invalid - when --cache-root is given - takes the cache_root from the options - when a cache source is read - has utf8 encoding - when no option is given - is valid and can be loaded - when file contents have changed - is invalid - when team external_dependency_checksum is the same - is valid - when a symlink is present in the cache location - and symlink attack protection is disabled - permits caching and prints no warning - and symlink attack protection is enabled - prevents caching and prints a warning - when team external_dependency_checksum changes - is invalid - when end of line characters have changed - is invalid - when file permission have changed - is invalid - when offenses are saved - an offense with status corrected - serializes them with uncorrected status - an offense with status uncorrected - serializes them with uncorrected status - an offense with status new_status - serializes them with new_status status - an offense with status corrected_with_todo - serializes them with uncorrected status - an offense with status unsupported - serializes them with unsupported status - when --only is given - is invalid - when --format is given - is valid and can be loaded - -RuboCop::Cop::Security::YAMLLoad - does not register an offense for YAML.load under a different namespace - registers an offense and corrects load with a literal string - does not register an offense for YAML.dump - registers an offense and corrects a fully qualified ::YAML.load - Ruby >= 3.1 - does not register an offense and corrects a fully qualified `::YAML.load` - does not register an offense and corrects load with a literal string - -RuboCop::Cop::Style::TopLevelMethodDefinition - does not register an offense when just called method on top-level - does not register an offense when using module - does not register an offense when using Struct - registers an offense top-level class methods - does not register an offense when defined within arbitrary block - registers an offense top-level methods - registers an offense when defining a top-level method after a class definition - does not register an offense when define_method is not top-level - does not register an offense when using class - top-level define_method - registers offense for proc argument - registers offense with inline block - registers offense for multi-line block - Ruby >= 2.7 - registers offense with inline numblock - -RuboCop::CommentConfig - #cop_disabled_line_ranges - collects line ranges by disabled cops - comment_only_line? - when line contains only comment - returns true - returns true - when line contains only code - returns false - returns false - returns false - returns false - when line is empty - returns true - when line contains code and comment - returns false - #extra_enabled_comments - has keys as instances of Parser::Source::Comment for extra enabled comments - has values as arrays of extra enabled cops - #cop_enabled_at_line? - does not confuse a cop name including "all" with all cops - supports disabling cops with multiple uppercase letters - just ignores unpaired enabling directives - supports disabling all cops except Lint/RedundantCopDisableDirective with keyword all - supports enabling/disabling multiple cops along with a comment - handles indented single line - supports enabling/disabling cops without a prefix - can handle double disable of one cop - supports disabling cops with numbers in their name - supports disabling all lines after a directive - supports disabling cops on a comment line with an EOL comment - supports enabling/disabling multiple cops in a single directive - does not confuse a comment directive embedded in a string literal with a real comment - supports disabling single line with a directive at end of line - supports disabling cops with multiple levels in department name - supports disabling multiple lines with a pair of directive - -RuboCop::Cop::Style::Sample - behaves like accepts - accepts shuffle.map { |e| e } - behaves like accepts - accepts shuffle[2..-3] - behaves like accepts - accepts shuffle[-4..-3] - behaves like accepts - accepts shuffle.at(2) - behaves like offense - registers an offense for shuffle.slice(0) - behaves like accepts - accepts shuffle[2..3] - behaves like offense - registers an offense for shuffle[0..3] - behaves like offense - registers an offense for shuffle.last - behaves like accepts - accepts shuffle.slice(2..-3) - behaves like offense - registers an offense for shuffle[-1] - behaves like accepts - accepts shuffle.slice(foo..3) - behaves like accepts - accepts shuffle[2] - behaves like accepts - accepts shuffle.slice(3, 3) - behaves like accepts - accepts shuffle - behaves like accepts - accepts shuffle.slice(foo) - behaves like offense - registers an offense for shuffle.at(0) - behaves like offense - registers an offense for shuffle(random: Random.new).first Ruby >= 2.6 - behaves like accepts - accepts shuffle[3...] - behaves like accepts - accepts shuffle[3..] - behaves like accepts - accepts shuffle(random: Random.new).find(&:odd?) - behaves like accepts - accepts shuffle.join([5, 6, 7]) - behaves like accepts - accepts shuffle(random: Random.new)[2] - behaves like offense - registers an offense for shuffle(random: Random.new).first(2) - behaves like accepts - accepts shuffle[foo] - behaves like offense - registers an offense for shuffle[0] - behaves like accepts - accepts shuffle[foo..3] - behaves like accepts - accepts shuffle(random: Random.new)[2, 3] - Ruby >= 2.7 - behaves like offense - registers an offense for shuffle[...3] - behaves like offense - registers an offense for shuffle.slice(0..3) - behaves like accepts - accepts sample - behaves like offense - registers an offense for shuffle.slice(-1) - behaves like offense - registers an offense for shuffle.slice(0...3) - behaves like accepts - accepts shuffle.slice(foo, bar) - behaves like accepts - accepts shuffle.slice(foo..bar) - behaves like accepts - accepts shuffle.slice(-4..-3) - behaves like offense - registers an offense for shuffle.first - behaves like accepts - accepts shuffle.at(foo) - behaves like accepts - accepts shuffle.slice(2..3) - behaves like accepts - accepts shuffle.slice(2) - behaves like accepts - accepts shuffle(random: Random.new) - behaves like offense - registers an offense for shuffle[0...3] - behaves like offense - registers an offense for shuffle.at(-1) - behaves like offense - registers an offense for shuffle(random: foo).last(bar) - behaves like accepts - accepts shuffle[3, 3] - behaves like offense - registers an offense for shuffle[0, 3] - behaves like offense - registers an offense for shuffle.last(3) - behaves like offense - registers an offense for shuffle.last(bar) - behaves like offense - registers an offense for shuffle.slice(0, 3) - behaves like accepts - accepts shuffle[foo, 3] - behaves like offense - registers an offense for shuffle(random: Random.new)[0..3] - behaves like accepts - accepts shuffle[foo, bar] - behaves like accepts - accepts shuffle[foo..bar] - behaves like offense - registers an offense for shuffle.first(foo) - behaves like accepts - accepts shuffle.slice(foo, 3) - behaves like offense - registers an offense for shuffle.first(2) - -RuboCop::Cop::Style::MethodCalledOnDoEndBlock - with a single-line do..end block - registers an offense for a chained call - accepts a single-line do..end block with a chained block - with a {} block - accepts a multi-line block with a chained call - accepts a single-line block with a chained call - Ruby 2.7 - registers an offense for a chained call - with a multi-line do..end block - registers an offense for a chained call - accepts a chained block - accepts it if there is no chained call - when using safe navigation operator - registers an offense for a chained call - -RuboCop::Cop::Style::HashAsLastArrayItem - when EnforcedStyle is no_braces - registers an offense and corrects when hash with braces - registers an offense and corrects when hash with braces and trailing comma - does not register an offense when hash without braces - does not register an offense when hash is not inside array - does not register an offense when hash is not the last element - does not register an offense when passing an implicit array to a setter - does not register an offense when the hash is empty - does not register an offense when the array is all hashes - registers an offense and corrects when hash with braces and trailing comma and new line - when EnforcedStyle is braces - does not register an offense when hash is not inside array - does not register an offense when the hash is empty - registers an offense and corrects when hash without braces - does not register an offense when hash with braces - does not register an offense when the array is all hashes - does not register an offense when using double splat operator - -RuboCop::Cop::Lint::MissingSuper - callbacks - registers an offense when method callback is without `super` call - does not register an offense when callback has a `super` call - registers an offense when class callback within `self << class` and without `super` call - registers an offense when class callback without `super` call - registers no offense when module callback without `super` call - constructor - does not register an offense for the constructor-like method defined outside of a class - does not register an offense for the class with stateless parent class - does not register an offense when there is a `super` call - registers an offense when no `super` call - does not register an offense for the class without parent class - -RuboCop::Cop::Style::StringHashKeys - does not register an offense when string key is used in gsub! - does not register an offense when not using strings as keys - does not register an offense when string key is used in Open3.pipeline - registers an offense when using strings as keys - does not register an offense when string key is used in gsub - does not register an offense when string key is used in Open3.capture3 - does not register an offense when string key is used in IO.popen - autocorrects strings as keys into symbols with the correct syntax - registers an offense when using strings as keys mixed with other keys - -RuboCop::Cop::InternalAffairs::UndefinedConfig - registers an offense when the cop has no configuration at all - works with deeper nested cop names - registers an offense when the cop inherits `::RuboCop::Cop::Base` - ignores `cop_config` in non-cop subclasses - registers an offense when the cop inherits `RuboCop::Cop::Base` - does not register an offense if using `cop_config` outside of a cop class - ignores `cop_config` in non-cop classes - registers an offense when the cop is not within the `RuboCop::Cop` namespace - does not register an offense for implicit configuration keys - works when the base class is `Cop` instead of `Base` - registers an offense when the cop inherits `Cop::Base` - can handle an empty file - element lookup - registers an offense for missing configuration keys - does not register an offense for defined configuration keys - fetch - does not register an offense for defined configuration keys - registers an offense for missing configuration keys - with a default value - does not register an offense for defined configuration keys - registers an offense for missing configuration keys + does not register an offense for endless range without semicolon + registers an offense for endless range with semicolon (irange and erange) + registers an offense for endless range with semicolon in the method definition + registers an offense for endless range with semicolon (irange only) + when AllowAsExpressionSeparator is true + accepts several expressions + accepts one line method with two statements -RuboCop::Cop::Layout::EmptyLinesAroundModuleBody - when EnforcedStyle is empty_lines_except_namespace - when only child is class - requires no empty lines for namespace - registers offense for namespace body ending with a blank - registers offense for namespace body starting with a blank - when only child is module - registers offense for namespace body starting with a blank - autocorrects beginning and end - requires no empty lines for namespace - registers offense for namespace body ending with a blank - registers offenses for namespaced module body not starting with a blank - registers offenses for namespaced module body not ending with a blank - when has multiple child modules - requires empty lines for namespace - registers offenses for namespace body starting and ending without a blank - when EnforcedStyle is no_empty_lines - registers an offense for module body ending with a blank - autocorrects beginning and end - registers an offense for module body starting with a blank - when EnforcedStyle is empty_lines - registers an offense for module body not ending with a blank - registers an offense for module body not starting or ending with a blank - accepts modules with an empty body - autocorrects beginning and end - when EnforcedStyle is empty_lines_special - module with empty body - with empty line - does NOT register offenses - without empty line - does NOT register offenses - when namespace has multiple children - requires empty lines for namespace - module with only constants - registers and autocorrects the offenses - when first child is an access modifier - with no blank lines at the beginning and ending of module body - registers and corrects an offense - with blank lines at the beginning and ending of module body - registers no offense - when first child is NOT a method - does not require blank line at the beginning of module body but requires blank line before first def definition and requires blank line at the end of module body - source with blank lines - registers an offense for module beginning with a blank line - source with comment before method definition - registers an offense for module beginning with a blank line - source without blank lines - registers an offense for module not ending with a blank line - when module has a namespace - requires no empty lines for namespace and does not require blank line at the beginning of module body but requires blank line at the end of module body - source with constants - registers and autocorrects the offenses - source with blank lines - registers and autocorrects the offenses - source without blank lines - registers and autocorrects the offenses - module with constant and child module - registers and autocorrects the offenses - when first child is a method - requires blank line at the beginning and ending of module body - when module has a namespace - requires no empty lines for namespace but requires blank line at the beginning and ending of module body - source without blank lines - registers and autocorrects the offenses - source with blank lines - autocorrects the offenses - source without blank lines - registers an offense for module not beginning and ending with a blank line +RuboCop::Cop::Naming::BlockForwarding + when `EnforcedStyle: explicit + Ruby >= 3.1 + registers and corrects an offense when using `yield` in method body + registers and corrects and corrects an offense when using anonymous block forwarding without method body + registers and corrects an offense when using symbol proc argument in method body + does not register an offense when using explicit block forwarding without method body + registers and corrects an offense when using anonymous block forwarding in singleton method + registers and corrects an offense when using anonymous block forwarding + does not register an offense when assigning the block arg + does not register an offense when using explicit block forwarding + does not register an offense when defining without block argument method + when `BlockForwardingName: proc + registers and corrects an offense when using anonymous block forwarding + when `BlockForwardingName: block` is already in use + registers and no corrects an offense when using anonymous block forwarding + when `EnforcedStyle: anonymous + Ruby < 3.0 + does not register an offense when not using anonymous block forwarding + Ruby >= 3.1 + registers and corrects an offense when using `yield` in method body + does not register an offense when defining without block argument method + registers and corrects an offense when using explicit block forwarding in singleton method + does not register an offense when defining kwarg with block args method + registers and corrects an offense when using explicit block forwarding without method body + does not register an offense when using anonymous block forwarding + does not register an offense when using anonymous block forwarding without method body + registers and corrects an offense when using explicit block forwarding without method definition parentheses + registers and corrects an offense when using explicit block forwarding + does not register an offense when assigning the block arg + does not register an offense when using block argument as a variable + registers and corrects an offense when using symbol proc argument in method body + registers and corrects an only explicit block forwarding when using multiple proc arguments + does not register an offense when defining no arguments method + does not register an offense when defining kwoptarg with block args method -RuboCop::Cop::Layout::EmptyLineBetweenDefs - doesn't allow more than the required number of newlines - accepts the first def without leading empty line in a class - accepts a nested def - accepts a def that follows a line with code - registers an offense for multiple one-liners on the same line - treats lines with whitespaces as blank - accepts a def that follows an empty line and then a comment - finds offenses in inner classes - accepts a def that follows code and a comment - registers an offense for adjacent one-liners by default - accepts a def that is the first of a module - autocorrects when there are too many new lines - when there are only comments between defs +RuboCop::Cop::Lint::UselessElseWithoutRescue + with `else` with `rescue` + accepts + with `else` without `rescue` registers an offense - EmptyLineBetweenClassDefs - registers offense when no empty lines between class and method definitions - with AllowAdjacentOneLineDefs enabled - does not register offense - when disabled - does not register offense - EmptyLineBetweenModuleDefs - registers offense when no empty lines between module and method definitions - when disabled - does not register offense - conditional method definitions - registers an offense for consecutive defs inside a conditional - accepts defs inside a conditional without blank lines in between - when multiple lines between defs are allowed - treats lines with whitespaces as blank - registers an offense and corrects when there are too many new lines - endless methods - between endless class method and regular class methods - registers an offense and corrects - between regular and endless methods - registers an offense and corrects - with AllowAdjacentOneLineDefs: true - does not register an offense - with AllowAdjacentOneLineDefs: false - registers an offense and corrects - between endless and regular methods - registers an offense and corrects - between endless class method and regular methods - registers an offense and corrects - class methods - adjacent class methods - registers an offense for missing blank line between methods - mixed instance and class methods - registers an offense for missing blank line between methods - when empty lines between classes and modules together - registers offense when no empty lines between module and method definitions - when a maximum of empty lines is specified - finds an offense for two empty lines - finds no offense for no empty line - finds no offense for one empty line - when AllowAdjacentOneLineDefs is enabled - accepts adjacent one-liners - registers an offense for adjacent defs if some are multi-line - -RuboCop::Cop::Layout::IndentationStyle - when EnforcedStyle is spaces - accepts a line with a tab between string literals - registers offenses before __END__ but not after - accepts a line which begins with tab in a heredoc - registers and corrects an offense for a line indented with mixed whitespaces - registers and corrects an offense for a line with tab in a string indented with tab - registers and corrects an offense for a line indented with tab - accepts a line with tab in a string - accepts a line which begins with tab in a string - accepts a line with a tab other than indentation - registers and corrects an offense for a line indented with multiple tabs - accepts a line which begins with tab in a multiline heredoc - custom indentation width - uses the configured number of spaces to replace a tab - when EnforcedStyle is tabs - accepts a line with tabs between string literals - registers and corrects an offense for a line with tab in a string indented with space - registers and corrects an offense for a line indented with space - registers an offense for a line indented with mixed whitespace - accepts a line which begins with tab in a string - accepts a line a tab other than indentation - accepts a line with tab in a string - accepts a line which begins with tab in a heredoc - accepts a line which begins with tab in a multiline heredoc - registers offenses before __END__ but not after - registers and corrects an offense for a line indented with fractional number ofindentation groups by rounding down - registers and corrects an offense for a line indented with multiple spaces - custom indentation width - uses the configured number of spaces to replace with a tab - -RuboCop::Cop::Layout::SpaceBeforeComment - accepts an EOL comment with a preceding space - registers an offense and corrects after a heredoc - accepts a comment that begins a line - accepts a doc comment - registers an offense and corrects missing space before an EOL comment -RuboCop::Cop::Style::Next - allows super nodes - allows loops with conditions at the end with ternary op - handles nested autocorrections - allows empty blocks - does not blow up on empty body for block - does not blow up on empty body until block - does not blow up on empty body while block - handles `then` when autocorrecting - does not crash with an empty body branch - doesn't reindent heredoc bodies when autocorrecting - keeps comments when autocorrecting - does not crash with empty brackets - MinBodyLength: 3 - accepts if whose body has 1 line - Invalid MinBodyLength - fails with an error - behaves like iterators - autocorrects a misaligned end - registers an offense for unless inside of nested iterators - allows loops with unless being the entire body with else - registers an offense for unless inside of for - registers an offense for unless inside of select - registers an offense for unless inside of map - registers an offense for unless inside of times - allows loops with unless with else, nested in another condition - registers an offense for unless inside of nested iterators - registers an offense for unless inside of downto - registers an offense for unless inside of loop - allows loops with conditional return - registers an offense for unless inside of reject - allows loops with conditional break - registers an offense for unless inside of each - registers an offense for unless inside of select! - registers an offense for unless inside of reject! - registers an offense for a condition at the end of an iterator when there is more in the iterator than the condition - registers an offense when line break before condition - reports an offense for unless whose body has 3 lines - registers an offense for unless inside of collect - allows loops with unless with else at the end - registers an offense for unless inside of each_with_object - EnforcedStyle: skip_modifier_ifs - allows modifier unless - EnforcedStyle: always - registers an offense for modifier unless - Ruby 2.7 - registers an offense for unless inside of downto numblock - behaves like iterators - registers an offense for a condition at the end of an iterator when there is more in the iterator than the condition - registers an offense for if inside of reject! - registers an offense for if inside of each - registers an offense for if inside of for - allows loops with conditional break - registers an offense for if inside of map - registers an offense for if inside of loop - registers an offense for if inside of times - registers an offense for if inside of reject - registers an offense for if inside of select! - registers an offense when line break before condition - allows loops with if with else, nested in another condition - allows loops with conditional return - allows loops with if being the entire body with else - registers an offense for if inside of select - registers an offense for if inside of collect - registers an offense for if inside of downto - registers an offense for if inside of nested iterators - allows loops with if with else at the end - reports an offense for if whose body has 3 lines - autocorrects a misaligned end - registers an offense for if inside of nested iterators - registers an offense for if inside of each_with_object - EnforcedStyle: skip_modifier_ifs - allows modifier if - EnforcedStyle: always - registers an offense for modifier if - Ruby 2.7 - registers an offense for if inside of downto numblock +RuboCop::Cop::InternalAffairs::StyleDetectedApiUse + registers an offense when conflicting_styles_detected is used in a conditional expression + registers an offense when ambiguous_style_detected is used in a conditional expression + registers an offense when correct_style_detected is used without a negative *_style_detected follow up + registers an offense when opposite_style_detected is used in a conditional expression + does not register an offense when correct_style_detected and a unexpected_style_detected are both used + does not register an offense when correct_style_detected and a no_acceptable_style! are both used + does not register an offense when correct_style_detected and a ambiguous_style_detected are both used + registers an offense when no_acceptable_style! is used without a correct_style_detected follow up + registers an offense when ambiguous_style_detected is used without a correct_style_detected follow up + registers an offense when opposite_style_detected is used without a correct_style_detected follow up + registers an offense when unexpected_style_detected is used without a correct_style_detected follow up + does not register an offense when correct_style_detected and a unrecognized_style_detected are both used + registers an offense when unrecognized_style_detected is used without a correct_style_detected follow up + does not register an offense when correct_style_detected and a opposite_style_detected are both used + registers an offense when correct_style_detected is used in a conditional expression + registers an offense when unrecognized_style_detected is used in a conditional expression + does not register an offense when correct_style_detected and a conflicting_styles_detected are both used + registers an offense when unexpected_style_detected is used in a conditional expression + registers an offense when conflicting_styles_detected is used without a correct_style_detected follow up + registers an offense when no_acceptable_style! is used in a conditional expression -RuboCop::Cop::Style::HashSyntax - configured to enforce ruby 1.9 style with no mixed keys - UseHashRocketsWithSymbolValues enabled - registers an offense when keys have special symbols in them - accepts new syntax when keys are interpolated string - accepts hash rockets when keys have different types - accepts an empty hash - accepts new syntax in method calls - registers an offense when any element has a symbol value in method calls - registers offense for hash rocket syntax when new is possible - registers an offense when any element uses a symbol for the value - registers an offense when keys have different types and styles - registers an offense when keys start with a digit - registers an offense for mixed syntax when new is possible - registers an offense for hash rockets in method calls - autocorrects to hash rockets when all elements have symbol value - accepts new syntax in a hash literal - registers an offense when keys have whitespaces in them - ruby < 2.2 - accepts hash rockets when keys have special symbols in them - registers an offense when keys have special symbols and mix styles - registers an offense when keys start with a digit and mix styles - accepts hash rockets when keys start with a digit - registers an offense when keys have whitespaces and mix styles - accepts hash rockets when keys have whitespaces in them - UseHashRocketsWithSymbolValues disabled - registers offense for hash rocket syntax when new is possible - accepts new syntax in a hash literal - accepts new syntax in method calls - registers an offense when keys have different types and styles - accepts new syntax when keys are interpolated string - accepts an empty hash - registers an offense when keys have whitespaces in them - registers an offense for mixed syntax when new is possible - registers an offense for hash rockets in method calls - registers an offense when keys have special symbols in them - accepts hash rockets when keys have different types - registers an offense when keys start with a digit - ruby < 2.2 - registers an offense when keys start with a digit and mix styles - accepts hash rockets when keys start with a digit - registers an offense when keys have whitespaces and mix styles - accepts hash rockets when keys have whitespaces in them - accepts hash rockets when keys have special symbols in them - registers an offense when keys have special symbols and mix styles - configured to enforce explicit hash value syntax style - Ruby <= 3.0 - does not register an offense when hash key and hash value are the same - Ruby >= 3.1 - does not register an offense when hash key and hash value are the same - registers and corrects an offense when hash key and hash value are partially the same - does not register an offense when hash key and hash value are not the same - registers and corrects an offense when hash values are omitted - configured to enforce shorthand syntax style - Ruby >= 3.1 - does not register an offense when hash key and hash value are partially the same - registers and corrects an offense when hash key and hash value are the same - does not register an offense when hash key and hash value are the same but the value ends `?` - does not register an offense when hash values are omitted - does not register an offense when one line `until` condition follows (without parentheses) - registers and corrects an offense when hash key and hash value (lvar) are the same - does not register an offense when hash pattern matching - does not register an offense when with parentheses call expr follows assignment expr - registers an offense when hash key and hash value are not the same and method with `[]` is called - does not register an offense when symbol hash key and string hash value are the same - registers an offense when one line `if` condition follows (with parentheses) - does not register an offense when hash key and hash value are not the same - does not register an offense when without parentheses call expr follows - does not register an offense when method call hash key and hash value are the same - does not register an offense when with parentheses call expr follows - does not register an offense when one line `if` condition follows (without parentheses) - registers an offense when one line `until` condition follows (with parentheses) - registers and corrects an offense when hash key and hash value are partially the same - registers and corrects an offense when `Hash[foo: foo]` and an expression follows - does not register an offense when `return` with one line `if` condition follows (without parentheses) - does not register an offense when lvar hash key and hash value are the same - does not register an offense when without parentheses call expr follows after nested method call - does not register an offense when symbol hash key and hash value (lvar) are not the same - registers and corrects an offense when `Hash[foo: foo]` - registers and corrects an offense when hash key and hash value are the same and it in the method body - does not register an offense when call expr with argument and a block follows - does not register an offense when call expr without arguments and with a block follows - registers and corrects an offense when hash key and hash value are the same and it in the method bodyand an expression follows - does not register an offense when hash key and hash value are the same but the value ends `!` - when hash roket syntax - does not register an offense - Ruby <= 3.0 - does not register an offense when hash key and hash value are the same - configured to enforce hash rockets style - accepts hash rockets in method calls - registers offense for Ruby 1.9 style - accepts hash rockets in a hash literal - registers an offense for mixed syntax - accepts an empty hash - registers an offense for 1.9 style in method calls - UseHashRocketsWithSymbolValues has no impact - does not register an offense when there is a symbol value - configured to disallow mixing of implicit and explicit hash literal value - Ruby >= 3.1 - registers an offense when some hash values are omitted but they cannot all be omitted - does not register an offense when all hash values are omitted - does not register an offense when all hash values are present, but only some values can be omitted - does not register an offense when all hash values are present, but no values can be omitted - registers an offense when some hash values are omitted but they can all be omitted - registers an offense when all hash values are present, but can all be omitted - Ruby <= 3.0 - does not register an offense when all hash key and hash values are the same - configured to enforce ruby19 style - with SpaceAroundOperators disabled - autocorrects even if there is no space around => - with SpaceAroundOperators enabled - accepts hash rockets when keys have different types - accepts hash rockets when symbol characters are not supported - accepts new syntax in a hash literal - registers an offense for mixed syntax when new is possible - accepts new syntax in method calls - autocorrects a missing space when hash is used as argument - accepts hash rockets when symbol keys end with = - registers an offense for hash rockets in method calls - accepts an empty hash - autocorrects even if it interferes with SpaceAroundOperators - registers offense for hash rocket syntax when new is possible - registers offense when keys start with an uppercase letter - registers an offense when symbol keys have strings in them - preserves quotes during autocorrection - if PreferHashRocketsForNonAlnumEndingSymbols is true - accepts hash rockets when symbols end with ! - accepts hash rockets when symbols end with ? - when using a return value uses `return` - registers an offense and corrects when not enclosed in parentheses - registers an offense and corrects when enclosed in parentheses - if PreferHashRocketsForNonAlnumEndingSymbols is false - registers an offense for hash rockets when symbols end with ? - registers an offense for hash rockets when symbols end with ! - ruby < 2.2 - accepts hash rockets when symbol keys have string in them - configured to use hash rockets when symbol values are found - registers an offense when any element has a symbol value in method calls - accepts ruby19 syntax when no elements have symbol values in method calls - registers an offense when using hash rockets and no elements have a symbol value - accepts hash in ruby19 style with no symbol values - accepts both hash rockets and ruby19 syntax in the same code - registers an offense for hashes with elements on multiple lines - autocorrects to hash rockets when all elements have symbol value - accepts ruby19 syntax when no elements have symbol values - registers an offense when any element uses a symbol for the value - accepts an empty hash - configured to accept both shorthand and explicit use of hash literal value - Ruby >= 3.1 - does not register an offense when hash key and hash value are partially the same - does not register an offense when hash key and hash value are not the same - does not register an offense when hash key and hash value are the same - does not register an offense when hash values are omitted - Ruby <= 3.0 - does not register an offense when hash key and hash value are the same - configured to enforce no mixed keys - accepts hash rockets when keys have whitespaces in them - accepts new syntax in a hash literal - accepts new syntax in method calls - accepts hash rockets when keys have different types - registers an offense when keys have different types and styles - accepts an empty hash - registers an offense when keys have special symbols and mix styles - accepts the hash rocket syntax when new is possible - accepts hash rockets when keys start with a digit - accepts hash rockets when keys have special symbols in them - registers an offense for mixed syntax when new is possible - registers an offense when keys start with a digit and mix styles - autocorrects mixed key hashes - accepts hash rockets in method calls - accepts old hash rockets style - registers an offense when keys have whitespaces and mix styles - accepts new hash style +RuboCop::Cop::Style::ExpandPathArguments + registers an offense when using `File.expand_path('../../..', __FILE__)` + registers an offense when using `::File.expand_path('./../..', __FILE__)` + registers an offense when using `File.expand_path('.', __FILE__)` + registers an offense when using `File.expand_path('../../lib', __FILE__)` + does not register an offense when using `File.expand_path(__dir__)` + registers an offense when using `File.expand_path('./../..', __FILE__)` + does not register an offense when using `Pathname(__dir__).expand_path` + does not register an offense when using `File.expand_path(__FILE__)` + registers an offense when using `Pathname.new(__FILE__).parent.expand_path` + does not register an offense when using `File.expand_path(path, __FILE__)` + does not register an offense when using `File.expand_path('..', __dir__)` + registers an offense when using `Pathname(__FILE__).parent.expand_path` + registers an offense when using `File.expand_path('..', __FILE__)` + registers an offense when using `File.expand_path('../..', __FILE__)` + registers an offense when using `::Pathname.new(__FILE__).parent.expand_path` + does not register an offense when using `File.expand_path("#{path_to_file}.png", __FILE__)` -RuboCop::Formatter::TapFormatter - #report_file - when the source contains multibyte characters - displays text containing the offending source line - #finished - when any offenses are detected - reports all detected offenses for all failed files - when no offenses are detected - does not report offenses - #file_finished - when no offenses are detected - prints "ok" - when any offenses are detected - prints "not ok" +RuboCop::Cop::Style::ParenthesesAroundCondition + accepts parentheses around condition in a ternary + allows parens if the condition node is a modifier unless op + does not blow up when the condition is a ternary op + allows parens if the condition node is a modifier while op + is not confused by parentheses in subexpression + allows parens if the condition node is a modifier until op + allows parens if the condition node is a modifier if op + is not confused by leading parentheses in subexpression + allows parens if the condition node is a modifier rescue op + does not blow up for empty unless condition + does not blow up for empty if condition + registers an offense for parentheses around condition + does not register an offense when parentheses in multiple expressions separated by semicolon + accepts parentheses if there is no space between the keyword and (. + parentheses in multiline conditions are not allowed + registers an offense for parentheses around multiline condition + safe assignment is allowed + accepts variable assignment in condition surrounded with parentheses + accepts setter in condition surrounded with parentheses + accepts element assignment in condition surrounded with parentheses + safe assignment is not allowed + does not accept variable assignment in condition surrounded with parentheses + does not accept element assignment in condition surrounded with parentheses + parentheses in multiline conditions are allowed + registers an offense for parentheses in single line condition + accepts parentheses around multiline condition -RuboCop::Cop::Style::ConditionalAssignment - SingleLineConditionsOnly false - corrects assignment to a multiline if elsif else condition - corrects assignment to a case when else condition - corrects assignment to a case when else with multiple whens - corrects assignment to an if elsif else with multiple elsifs - corrects assignment to a multiline if else condition - corrects assignment to an unless else condition - behaves like multiline all assignment types offense - any assignment to a multiline if else - any assignment to a multiline case when - any assignment to a multiline unless else - behaves like all assignment types - registers an offense for any assignment to ternary - registers an offense for any assignment to unless else - registers an offense any assignment to if else - does not crash when used inside rescue - allows any assignment to if without else - registers an offense any assignment to case when - behaves like all assignment types - allows any assignment to if without else - registers an offense for any assignment to ternary - registers an offense any assignment to case when - does not crash when used inside rescue - registers an offense for any assignment to unless else - registers an offense any assignment to if else - behaves like multiline all assignment types offense - any assignment to a multiline unless else - any assignment to a multiline if else - any assignment to a multiline case when - behaves like multiline all assignment types offense - any assignment to a multiline case when - any assignment to a multiline if else - any assignment to a multiline unless else - behaves like multiline all assignment types offense - any assignment to a multiline unless else - any assignment to a multiline case when - any assignment to a multiline if else - behaves like multiline all assignment types offense - any assignment to a multiline if else - any assignment to a multiline case when - any assignment to a multiline unless else - behaves like multiline all assignment types offense - any assignment to a multiline case when - any assignment to a multiline unless else - any assignment to a multiline if else - behaves like multiline all variable types offense - assigning any variable type to an if else with multiline in one branch - assigning any variable type to a multiline unless else - assigning any variable type to a multiline case when - assigning any variable type to a multiline if else - assigning any variable type to a multiline if elsif else - behaves like all assignment types - does not crash when used inside rescue - registers an offense for any assignment to unless else - registers an offense for any assignment to ternary - registers an offense any assignment to if else - registers an offense any assignment to case when - allows any assignment to if without else - behaves like all assignment types - allows any assignment to if without else - does not crash when used inside rescue - registers an offense for any assignment to unless else - registers an offense any assignment to if else - registers an offense any assignment to case when - registers an offense for any assignment to ternary - behaves like all assignment types - registers an offense any assignment to if else - does not crash when used inside rescue - registers an offense for any assignment to unless else - allows any assignment to if without else - registers an offense any assignment to case when - registers an offense for any assignment to ternary - behaves like multiline all assignment types offense - any assignment to a multiline case when - any assignment to a multiline unless else - any assignment to a multiline if else - behaves like multiline all assignment types offense - any assignment to a multiline if else - any assignment to a multiline unless else - any assignment to a multiline case when - behaves like all variable types - registers an offense assigning any variable type to ternary - registers an offense assigning any variable type to unless else - allows assignment to if without else - registers an offense assigning any variable type to if elsif else - registers an offense assigning any variable type to if elsewith multiple assignment - does not crash for rescue assignment - registers an offense for assigning any variable type to case when - registers an offense assigning any variable type to if else - >= Ruby 2.7 - registers an offense for assigning any variable type to case in - behaves like multiline all assignment types offense - any assignment to a multiline unless else - any assignment to a multiline if else - any assignment to a multiline case when - behaves like all assignment types - registers an offense any assignment to if else - does not crash when used inside rescue - allows any assignment to if without else - registers an offense for any assignment to ternary - registers an offense any assignment to case when - registers an offense for any assignment to unless else - behaves like multiline all assignment types offense - any assignment to a multiline if else - any assignment to a multiline unless else - any assignment to a multiline case when - behaves like all assignment types - registers an offense for any assignment to unless else - allows any assignment to if without else - registers an offense any assignment to case when - registers an offense for any assignment to ternary - registers an offense any assignment to if else - does not crash when used inside rescue - behaves like multiline all assignment types offense - any assignment to a multiline if else - any assignment to a multiline case when - any assignment to a multiline unless else - behaves like all assignment types - registers an offense any assignment to case when - does not crash when used inside rescue - registers an offense for any assignment to unless else - registers an offense for any assignment to ternary - allows any assignment to if without else - registers an offense any assignment to if else - behaves like all variable types - registers an offense assigning any variable type to if else - registers an offense assigning any variable type to ternary - allows assignment to if without else - registers an offense assigning any variable type to if elsewith multiple assignment - registers an offense assigning any variable type to if elsif else - does not crash for rescue assignment - registers an offense for assigning any variable type to case when - registers an offense assigning any variable type to unless else - >= Ruby 2.7 - registers an offense for assigning any variable type to case in - behaves like all assignment types - registers an offense for any assignment to ternary - does not crash when used inside rescue - registers an offense any assignment to case when - registers an offense for any assignment to unless else - allows any assignment to if without else - registers an offense any assignment to if else - behaves like multiline all variable types offense - assigning any variable type to a multiline if else - assigning any variable type to a multiline case when - assigning any variable type to an if else with multiline in one branch - assigning any variable type to a multiline unless else - assigning any variable type to a multiline if elsif else - behaves like multiline all assignment types offense - any assignment to a multiline unless else - any assignment to a multiline if else - any assignment to a multiline case when - behaves like single line condition autocorrect - corrects assignment to an if elsif else condition - corrects assignment to a case when else condition - corrects assignment to a case when else with multiple whens - corrects assignment to an if else condition - corrects assignment to a ternary operator - corrects assignment to an unless else condition - corrects assignment to an if elsif else with multiple elsifs - behaves like multiline all variable types offense - assigning any variable type to an if else with multiline in one branch - assigning any variable type to a multiline case when - assigning any variable type to a multiline if else - assigning any variable type to a multiline if elsif else - assigning any variable type to a multiline unless else - behaves like all assignment types - does not crash when used inside rescue - registers an offense for any assignment to ternary - allows any assignment to if without else - registers an offense any assignment to case when - registers an offense any assignment to if else - registers an offense for any assignment to unless else - behaves like all variable types - allows assignment to if without else - does not crash for rescue assignment - registers an offense assigning any variable type to unless else - registers an offense assigning any variable type to if elsif else - registers an offense for assigning any variable type to case when - registers an offense assigning any variable type to ternary - registers an offense assigning any variable type to if elsewith multiple assignment - registers an offense assigning any variable type to if else - >= Ruby 2.7 - registers an offense for assigning any variable type to case in - behaves like all assignment types - registers an offense for any assignment to ternary - does not crash when used inside rescue - registers an offense any assignment to if else - allows any assignment to if without else - registers an offense for any assignment to unless else - registers an offense any assignment to case when - behaves like multiline all variable types offense - assigning any variable type to a multiline if elsif else - assigning any variable type to a multiline case when - assigning any variable type to an if else with multiline in one branch - assigning any variable type to a multiline if else - assigning any variable type to a multiline unless else - behaves like all assignment types - allows any assignment to if without else - registers an offense for any assignment to ternary - registers an offense any assignment to case when - does not crash when used inside rescue - registers an offense any assignment to if else - registers an offense for any assignment to unless else - behaves like multiline all assignment types offense - any assignment to a multiline if else - any assignment to a multiline unless else - any assignment to a multiline case when - behaves like multiline all variable types offense - assigning any variable type to an if else with multiline in one branch - assigning any variable type to a multiline if elsif else - assigning any variable type to a multiline unless else - assigning any variable type to a multiline case when - assigning any variable type to a multiline if else - behaves like all variable types - registers an offense assigning any variable type to if else - registers an offense assigning any variable type to ternary - registers an offense assigning any variable type to if elsif else - registers an offense assigning any variable type to if elsewith multiple assignment - registers an offense assigning any variable type to unless else - registers an offense for assigning any variable type to case when - allows assignment to if without else - does not crash for rescue assignment - >= Ruby 2.7 - registers an offense for assigning any variable type to case in - behaves like all assignment types - registers an offense for any assignment to unless else - registers an offense any assignment to case when - allows any assignment to if without else - registers an offense any assignment to if else - does not crash when used inside rescue - registers an offense for any assignment to ternary - behaves like multiline all assignment types offense - any assignment to a multiline case when - any assignment to a multiline if else - any assignment to a multiline unless else - behaves like multiline all assignment types offense - any assignment to a multiline case when - any assignment to a multiline if else - any assignment to a multiline unless else - behaves like all assignment types - registers an offense any assignment to case when - registers an offense for any assignment to unless else - registers an offense for any assignment to ternary - allows any assignment to if without else - registers an offense any assignment to if else - does not crash when used inside rescue - behaves like multiline all variable types offense - assigning any variable type to a multiline if else - assigning any variable type to an if else with multiline in one branch - assigning any variable type to a multiline case when - assigning any variable type to a multiline unless else - assigning any variable type to a multiline if elsif else - behaves like multiline all variable types offense - assigning any variable type to a multiline unless else - assigning any variable type to a multiline case when - assigning any variable type to a multiline if else - assigning any variable type to a multiline if elsif else - assigning any variable type to an if else with multiline in one branch - behaves like multiline all assignment types offense - any assignment to a multiline if else - any assignment to a multiline unless else - any assignment to a multiline case when - behaves like all assignment types - registers an offense for any assignment to ternary - allows any assignment to if without else - registers an offense for any assignment to unless else - registers an offense any assignment to case when - does not crash when used inside rescue - registers an offense any assignment to if else - behaves like all assignment types - registers an offense for any assignment to unless else - registers an offense for any assignment to ternary - registers an offense any assignment to if else - does not crash when used inside rescue - allows any assignment to if without else - registers an offense any assignment to case when - behaves like multiline all assignment types offense - any assignment to a multiline unless else - any assignment to a multiline case when - any assignment to a multiline if else - behaves like multiline all assignment types offense - any assignment to a multiline case when - any assignment to a multiline unless else - any assignment to a multiline if else - behaves like all assignment types - allows any assignment to if without else - registers an offense any assignment to case when - registers an offense for any assignment to unless else - registers an offense any assignment to if else - registers an offense for any assignment to ternary - does not crash when used inside rescue - behaves like all variable types - allows assignment to if without else - does not crash for rescue assignment - registers an offense for assigning any variable type to case when - registers an offense assigning any variable type to if elsif else - registers an offense assigning any variable type to ternary - registers an offense assigning any variable type to unless else - registers an offense assigning any variable type to if else - registers an offense assigning any variable type to if elsewith multiple assignment - >= Ruby 2.7 - registers an offense for assigning any variable type to case in - behaves like multiline all assignment types offense - any assignment to a multiline unless else - any assignment to a multiline case when - any assignment to a multiline if else - behaves like all variable types - registers an offense assigning any variable type to unless else - registers an offense assigning any variable type to if else - allows assignment to if without else - does not crash for rescue assignment - registers an offense assigning any variable type to ternary - registers an offense assigning any variable type to if elsif else - registers an offense for assigning any variable type to case when - registers an offense assigning any variable type to if elsewith multiple assignment - >= Ruby 2.7 - registers an offense for assigning any variable type to case in - behaves like all variable types - does not crash for rescue assignment - registers an offense assigning any variable type to ternary - registers an offense assigning any variable type to unless else - allows assignment to if without else - registers an offense assigning any variable type to if elsewith multiple assignment - registers an offense assigning any variable type to if elsif else - registers an offense for assigning any variable type to case when - registers an offense assigning any variable type to if else - >= Ruby 2.7 - registers an offense for assigning any variable type to case in - behaves like all assignment types - registers an offense any assignment to if else - does not crash when used inside rescue - registers an offense any assignment to case when - allows any assignment to if without else - registers an offense for any assignment to ternary - registers an offense for any assignment to unless else - behaves like all assignment types - registers an offense any assignment to case when - registers an offense for any assignment to ternary - registers an offense for any assignment to unless else - registers an offense any assignment to if else - allows any assignment to if without else - does not crash when used inside rescue - SingleLineConditionsOnly true - allows a method call in the subject of a ternary operator - registers an offense for assignment to an if then else - corrects assignment to a namespaced constant - registers an offense for assignment using []= - registers an offense for assignment using a method that ends with an equal sign - registers an offense for assignment to case when then else - corrects assignment when without `else` branch - behaves like all assignment types - allows any assignment to if without else - registers an offense for any assignment to ternary - registers an offense for any assignment to unless else - does not crash when used inside rescue - registers an offense any assignment to case when - registers an offense any assignment to if else - behaves like all assignment types - registers an offense for any assignment to ternary - allows any assignment to if without else - registers an offense any assignment to case when - does not crash when used inside rescue - registers an offense any assignment to if else - registers an offense for any assignment to unless else - behaves like all assignment types - registers an offense for any assignment to unless else - does not crash when used inside rescue - registers an offense any assignment to if else - allows any assignment to if without else - registers an offense for any assignment to ternary - registers an offense any assignment to case when - behaves like all variable types - registers an offense assigning any variable type to if else - registers an offense assigning any variable type to unless else - registers an offense assigning any variable type to ternary - registers an offense for assigning any variable type to case when - registers an offense assigning any variable type to if elsewith multiple assignment - registers an offense assigning any variable type to if elsif else - does not crash for rescue assignment - allows assignment to if without else - >= Ruby 2.7 - registers an offense for assigning any variable type to case in - behaves like all variable types - allows assignment to if without else - registers an offense assigning any variable type to ternary - does not crash for rescue assignment - registers an offense for assigning any variable type to case when - registers an offense assigning any variable type to if elsif else - registers an offense assigning any variable type to unless else - registers an offense assigning any variable type to if else - registers an offense assigning any variable type to if elsewith multiple assignment - >= Ruby 2.7 - registers an offense for assigning any variable type to case in - behaves like multiline all assignment types allow - any assignment to a multiline unless else - any assignment to a multiline case when - any assignment to a multiline if else - behaves like all assignment types - registers an offense for any assignment to ternary - registers an offense any assignment to if else - registers an offense any assignment to case when - does not crash when used inside rescue - registers an offense for any assignment to unless else - allows any assignment to if without else - behaves like multiline all variable types allow - assigning any variable type to a multiline if elsif else - assigning any variable type to a multiline unless else - assigning any variable type to an if else with multiline in one branch - assigning any variable type to a multiline case when - assigning any variable type to a multiline if else - behaves like all assignment types - registers an offense any assignment to if else - does not crash when used inside rescue - registers an offense for any assignment to ternary - registers an offense any assignment to case when - registers an offense for any assignment to unless else - allows any assignment to if without else - behaves like multiline all assignment types allow - any assignment to a multiline if else - any assignment to a multiline unless else - any assignment to a multiline case when - behaves like all assignment types - registers an offense for any assignment to unless else - registers an offense for any assignment to ternary - registers an offense any assignment to if else - allows any assignment to if without else - does not crash when used inside rescue - registers an offense any assignment to case when - behaves like multiline all assignment types allow - any assignment to a multiline if else - any assignment to a multiline unless else - any assignment to a multiline case when - behaves like all assignment types - registers an offense for any assignment to unless else - registers an offense any assignment to case when - registers an offense for any assignment to ternary - registers an offense any assignment to if else - does not crash when used inside rescue - allows any assignment to if without else - behaves like multiline all assignment types allow - any assignment to a multiline unless else - any assignment to a multiline case when - any assignment to a multiline if else - behaves like multiline all assignment types allow - any assignment to a multiline unless else - any assignment to a multiline if else - any assignment to a multiline case when - behaves like all variable types - registers an offense assigning any variable type to if else - does not crash for rescue assignment - registers an offense assigning any variable type to if elsif else - registers an offense assigning any variable type to ternary - allows assignment to if without else - registers an offense assigning any variable type to if elsewith multiple assignment - registers an offense for assigning any variable type to case when - registers an offense assigning any variable type to unless else - >= Ruby 2.7 - registers an offense for assigning any variable type to case in - behaves like all assignment types - does not crash when used inside rescue - registers an offense any assignment to case when - registers an offense any assignment to if else - registers an offense for any assignment to unless else - allows any assignment to if without else - registers an offense for any assignment to ternary - behaves like all assignment types - registers an offense any assignment to if else - allows any assignment to if without else - does not crash when used inside rescue - registers an offense for any assignment to unless else - registers an offense for any assignment to ternary - registers an offense any assignment to case when - behaves like multiline all variable types allow - assigning any variable type to a multiline unless else - assigning any variable type to a multiline case when - assigning any variable type to a multiline if elsif else - assigning any variable type to a multiline if else - assigning any variable type to an if else with multiline in one branch - behaves like all variable types - registers an offense for assigning any variable type to case when - registers an offense assigning any variable type to unless else - registers an offense assigning any variable type to if else - registers an offense assigning any variable type to ternary - registers an offense assigning any variable type to if elsif else - does not crash for rescue assignment - allows assignment to if without else - registers an offense assigning any variable type to if elsewith multiple assignment - >= Ruby 2.7 - registers an offense for assigning any variable type to case in - behaves like multiline all variable types allow - assigning any variable type to an if else with multiline in one branch - assigning any variable type to a multiline if else - assigning any variable type to a multiline unless else - assigning any variable type to a multiline case when - assigning any variable type to a multiline if elsif else - behaves like all assignment types - registers an offense for any assignment to unless else - registers an offense any assignment to case when - does not crash when used inside rescue - registers an offense for any assignment to ternary - registers an offense any assignment to if else - allows any assignment to if without else - for loop - ignores pseudo assignments in a for loop - behaves like multiline all variable types allow - assigning any variable type to a multiline unless else - assigning any variable type to a multiline if else - assigning any variable type to a multiline if elsif else - assigning any variable type to a multiline case when - assigning any variable type to an if else with multiline in one branch - behaves like all assignment types - does not crash when used inside rescue - registers an offense any assignment to case when - allows any assignment to if without else - registers an offense any assignment to if else - registers an offense for any assignment to ternary - registers an offense for any assignment to unless else - behaves like all variable types - registers an offense assigning any variable type to ternary - registers an offense assigning any variable type to if else - does not crash for rescue assignment - registers an offense assigning any variable type to if elsewith multiple assignment - registers an offense assigning any variable type to unless else - registers an offense for assigning any variable type to case when - registers an offense assigning any variable type to if elsif else - allows assignment to if without else - >= Ruby 2.7 - registers an offense for assigning any variable type to case in - behaves like all assignment types - registers an offense any assignment to case when - allows any assignment to if without else - does not crash when used inside rescue - registers an offense for any assignment to unless else - registers an offense for any assignment to ternary - registers an offense any assignment to if else - behaves like single line condition autocorrect - corrects assignment to an if elsif else condition - corrects assignment to a case when else with multiple whens - corrects assignment to a ternary operator - corrects assignment to an unless else condition - corrects assignment to a case when else condition - corrects assignment to an if elsif else with multiple elsifs - corrects assignment to an if else condition - behaves like all assignment types - registers an offense any assignment to if else - does not crash when used inside rescue - registers an offense for any assignment to unless else - allows any assignment to if without else - registers an offense any assignment to case when - registers an offense for any assignment to ternary - behaves like multiline all assignment types allow - any assignment to a multiline unless else - any assignment to a multiline if else - any assignment to a multiline case when - behaves like all assignment types - registers an offense any assignment to case when - registers an offense any assignment to if else - registers an offense for any assignment to ternary - registers an offense for any assignment to unless else - allows any assignment to if without else - does not crash when used inside rescue - behaves like all variable types - allows assignment to if without else - registers an offense assigning any variable type to if elsif else - registers an offense assigning any variable type to ternary - registers an offense assigning any variable type to if else - registers an offense assigning any variable type to unless else - does not crash for rescue assignment - registers an offense assigning any variable type to if elsewith multiple assignment - registers an offense for assigning any variable type to case when - >= Ruby 2.7 - registers an offense for assigning any variable type to case in - behaves like multiline all assignment types allow - any assignment to a multiline unless else - any assignment to a multiline case when - any assignment to a multiline if else - behaves like multiline all assignment types allow - any assignment to a multiline unless else - any assignment to a multiline if else - any assignment to a multiline case when - behaves like multiline all assignment types allow - any assignment to a multiline unless else - any assignment to a multiline case when - any assignment to a multiline if else - behaves like multiline all assignment types allow - any assignment to a multiline if else - any assignment to a multiline case when - any assignment to a multiline unless else - behaves like multiline all assignment types allow - any assignment to a multiline if else - any assignment to a multiline case when - any assignment to a multiline unless else - behaves like multiline all variable types allow - assigning any variable type to a multiline case when - assigning any variable type to an if else with multiline in one branch - assigning any variable type to a multiline if else - assigning any variable type to a multiline unless else - assigning any variable type to a multiline if elsif else - behaves like all assignment types - allows any assignment to if without else - registers an offense any assignment to if else - registers an offense for any assignment to unless else - does not crash when used inside rescue - registers an offense any assignment to case when - registers an offense for any assignment to ternary - behaves like all assignment types - registers an offense for any assignment to ternary - allows any assignment to if without else - registers an offense for any assignment to unless else - registers an offense any assignment to if else - does not crash when used inside rescue - registers an offense any assignment to case when - behaves like multiline all assignment types allow - any assignment to a multiline unless else - any assignment to a multiline if else - any assignment to a multiline case when - behaves like all assignment types - does not crash when used inside rescue - registers an offense any assignment to case when - registers an offense for any assignment to unless else - allows any assignment to if without else - registers an offense any assignment to if else - registers an offense for any assignment to ternary - behaves like multiline all assignment types allow - any assignment to a multiline unless else - any assignment to a multiline if else - any assignment to a multiline case when - behaves like multiline all assignment types allow - any assignment to a multiline case when - any assignment to a multiline if else - any assignment to a multiline unless else - behaves like multiline all variable types allow - assigning any variable type to a multiline unless else - assigning any variable type to a multiline case when - assigning any variable type to a multiline if elsif else - assigning any variable type to an if else with multiline in one branch - assigning any variable type to a multiline if else - behaves like all assignment types - registers an offense for any assignment to unless else - does not crash when used inside rescue - allows any assignment to if without else - registers an offense for any assignment to ternary - registers an offense any assignment to case when - registers an offense any assignment to if else - behaves like multiline all assignment types allow - any assignment to a multiline if else - any assignment to a multiline unless else - any assignment to a multiline case when - behaves like multiline all assignment types allow - any assignment to a multiline if else - any assignment to a multiline case when - any assignment to a multiline unless else - behaves like multiline all variable types allow - assigning any variable type to a multiline if elsif else - assigning any variable type to a multiline unless else - assigning any variable type to an if else with multiline in one branch - assigning any variable type to a multiline if else - assigning any variable type to a multiline case when - behaves like multiline all assignment types allow - any assignment to a multiline if else - any assignment to a multiline case when - any assignment to a multiline unless else - behaves like multiline all assignment types allow - any assignment to a multiline case when - any assignment to a multiline if else - any assignment to a multiline unless else - behaves like multiline all assignment types allow - any assignment to a multiline unless else - any assignment to a multiline if else - any assignment to a multiline case when - behaves like all assignment types - does not crash when used inside rescue - registers an offense any assignment to if else - registers an offense for any assignment to unless else - allows any assignment to if without else - registers an offense any assignment to case when - registers an offense for any assignment to ternary - behaves like all variable types - registers an offense assigning any variable type to ternary - registers an offense assigning any variable type to if elsif else - does not crash for rescue assignment - allows assignment to if without else - registers an offense for assigning any variable type to case when - registers an offense assigning any variable type to if elsewith multiple assignment - registers an offense assigning any variable type to unless else - registers an offense assigning any variable type to if else - >= Ruby 2.7 - registers an offense for assigning any variable type to case in - IncludeTernaryExpressions false - allows assigning any variable type to ternary +RuboCop::Cop::Style::CharacterLiteral + registers an offense for character literals + accepts literals like ?\C-\M-d + registers an offense for literals like \n + accepts ? in a %w literal + autocorrects ?' to "'" RuboCop::Cop::Lint::DuplicateBranch - registers an offense when `rescue` has multiple duplicate `resbody` branches - registers an offense when `case` has duplicate `when` branch - does not register an offense when ternary has no duplicate branches - does not register an offense for simple `if` without other branches - registers an offense when `rescue` has duplicate `else` branch - registers an offense when `if` has multiple duplicate branches - does not register an offense for simple `unless` without other branches - registers an offense when `rescue` has duplicate `resbody` branch - does not register an offense when `unless` has no duplicate branches - does not register an offense when `rescue` has no duplicate branches - does not register an offense for empty `unless` - does not register an offense for modifier `if` - registers an offense when `case` has duplicate `else` branch does not register an offense for empty `if` - registers an offense when `if` has duplicate `elsif` branch registers an offense when ternary has duplicate branches - does not register an offense when `case` has no duplicate branches registers an offense when `if` has duplicate `else` branch - registers an offense when `case` has multiple duplicate branches + registers an offense when `if` has duplicate `elsif` branch + does not register an offense for modifier `if` + registers an offense when `rescue` has duplicate `else` branch + does not register an offense when `case` has no duplicate branches registers an offense when `unless` has duplicate `else` branch - does not register an offense when `if` has no duplicate branches + registers an offense when `if` has multiple duplicate branches + registers an offense when `rescue` has multiple duplicate `resbody` branches + registers an offense when `case` has multiple duplicate branches + does not register an offense when `unless` has no duplicate branches + registers an offense when `rescue` has duplicate `resbody` branch + does not register an offense when ternary has no duplicate branches does not register an offense for modifier `unless` - with IgnoreLiteralBranches: true + does not register an offense when `if` has no duplicate branches + registers an offense when `case` has duplicate `else` branch + does not register an offense for empty `unless` + does not register an offense when `rescue` has no duplicate branches + registers an offense when `case` has duplicate `when` branch + does not register an offense for simple `if` without other branches + does not register an offense for simple `unless` without other branches + with IgnoreConstantBranches: true + with `rescue` + behaves like literal rescue disallowed + when returning a object in multiple branches + registers an offense + behaves like literal rescue allowed + when returning a constant in multiple branches + allows branches to be duplicated + with `if` + behaves like literal if disallowed + when returning a object in multiple branches + registers an offense + behaves like literal if allowed + when returning a constant in multiple branches + allows branches to be duplicated + with `case-match` + behaves like literal case-match allowed + when returning a constant in multiple branches + allows branches to be duplicated + behaves like literal case-match disallowed + when returning a object in multiple branches + registers an offense with `case` + behaves like literal case allowed + when returning a constant in multiple branches + allows branches to be duplicated behaves like literal case disallowed - when returning a complex regexp in multiple branches + when returning a object in multiple branches registers an offense - behaves like literal case allowed - when returning a integer in multiple branches + with IgnoreLiteralBranches: true + with `if` + behaves like literal if allowed + when returning a true in multiple branches allows branches to be duplicated - behaves like literal case allowed + and IgnoreConstBranches: false + behaves like literal if disallowed + when returning a hash of constants in multiple branches + registers an offense + behaves like literal if disallowed + when returning a array of constants in multiple branches + registers an offense + behaves like literal if allowed + when returning a symbol in multiple branches + allows branches to be duplicated + behaves like literal if allowed + when returning a empty array in multiple branches + allows branches to be duplicated + behaves like literal if allowed + when returning a empty hash in multiple branches + allows branches to be duplicated + behaves like literal if disallowed + when returning a complex hash in multiple branches + registers an offense + behaves like literal if allowed + when returning a hash of literals in multiple branches + allows branches to be duplicated + behaves like literal if allowed when returning a float in multiple branches allows branches to be duplicated - behaves like literal case allowed - when returning a simple irange in multiple branches + behaves like literal if allowed + when returning a integer in multiple branches allows branches to be duplicated - behaves like literal case disallowed + behaves like literal if allowed + when returning a array of literals in multiple branches + allows branches to be duplicated + behaves like literal if disallowed when returning a dsym in multiple branches registers an offense - behaves like literal case allowed + behaves like literal if allowed + when returning a simple irange in multiple branches + allows branches to be duplicated + behaves like literal if allowed + when returning a regexp in multiple branches + allows branches to be duplicated + behaves like literal if disallowed + when returning a variable in multiple branches + registers an offense + behaves like literal if allowed when returning a regexp with modifier in multiple branches allows branches to be duplicated - behaves like literal case allowed - when returning a true in multiple branches + behaves like literal if disallowed + when returning a complex regexp in multiple branches + registers an offense + behaves like literal if disallowed + when returning a dstr in multiple branches + registers an offense + behaves like literal if allowed + when returning a simple erange in multiple branches allows branches to be duplicated - behaves like literal case allowed - when returning a string in multiple branches + behaves like literal if allowed + when returning a rational in multiple branches allows branches to be duplicated - behaves like literal case disallowed + behaves like literal if disallowed + when returning a method call in multiple branches + registers an offense + behaves like literal if allowed + when returning a complex in multiple branches + allows branches to be duplicated + and IgnoreConstBranches: true + behaves like literal if allowed + when returning a array of constants in multiple branches + allows branches to be duplicated + behaves like literal if allowed + when returning a hash of constants in multiple branches + allows branches to be duplicated + behaves like literal if allowed + when returning a nil in multiple branches + allows branches to be duplicated + behaves like literal if disallowed + when returning a complex array in multiple branches + registers an offense + behaves like literal if disallowed when returning a xstr in multiple branches registers an offense - behaves like literal case allowed - when returning a regexp in multiple branches + behaves like literal if allowed + when returning a false in multiple branches + allows branches to be duplicated + behaves like literal if disallowed + when returning a complex irange in multiple branches + registers an offense + behaves like literal if disallowed + when returning a complex erange in multiple branches + registers an offense + behaves like literal if allowed + when returning a string in multiple branches allows branches to be duplicated + with `case` behaves like literal case allowed - when returning a hash of literals in multiple branches + when returning a simple irange in multiple branches allows branches to be duplicated behaves like literal case allowed - when returning a array of literals in multiple branches + when returning a rational in multiple branches allows branches to be duplicated behaves like literal case allowed - when returning a nil in multiple branches + when returning a integer in multiple branches allows branches to be duplicated behaves like literal case allowed - when returning a complex in multiple branches + when returning a float in multiple branches allows branches to be duplicated - behaves like literal case disallowed - when returning a method call in multiple branches - registers an offense behaves like literal case allowed - when returning a false in multiple branches + when returning a string in multiple branches allows branches to be duplicated and IgnoreConstBranches: false behaves like literal case disallowed @@ -25461,3025 +20846,9224 @@ behaves like literal case disallowed when returning a hash of constants in multiple branches registers an offense + behaves like literal case allowed + when returning a empty array in multiple branches + allows branches to be duplicated + behaves like literal case allowed + when returning a true in multiple branches + allows branches to be duplicated + behaves like literal case allowed + when returning a simple erange in multiple branches + allows branches to be duplicated + behaves like literal case allowed + when returning a false in multiple branches + allows branches to be duplicated + behaves like literal case allowed + when returning a regexp with modifier in multiple branches + allows branches to be duplicated behaves like literal case disallowed when returning a variable in multiple branches registers an offense behaves like literal case allowed - when returning a empty array in multiple branches + when returning a nil in multiple branches allows branches to be duplicated + behaves like literal case allowed + when returning a array of literals in multiple branches + allows branches to be duplicated + and IgnoreConstBranches: true + behaves like literal case allowed + when returning a array of constants in multiple branches + allows branches to be duplicated + behaves like literal case allowed + when returning a hash of constants in multiple branches + allows branches to be duplicated behaves like literal case disallowed - when returning a complex hash in multiple branches + when returning a dsym in multiple branches + registers an offense + behaves like literal case disallowed + when returning a complex array in multiple branches + registers an offense + behaves like literal case disallowed + when returning a complex erange in multiple branches registers an offense behaves like literal case allowed - when returning a empty hash in multiple branches + when returning a symbol in multiple branches allows branches to be duplicated behaves like literal case disallowed - when returning a complex irange in multiple branches + when returning a complex hash in multiple branches registers an offense behaves like literal case allowed - when returning a symbol in multiple branches + when returning a regexp in multiple branches allows branches to be duplicated behaves like literal case disallowed - when returning a complex array in multiple branches + when returning a xstr in multiple branches registers an offense behaves like literal case disallowed - when returning a dstr in multiple branches + when returning a method call in multiple branches registers an offense behaves like literal case allowed - when returning a rational in multiple branches + when returning a hash of literals in multiple branches allows branches to be duplicated + behaves like literal case disallowed + when returning a complex regexp in multiple branches + registers an offense behaves like literal case allowed - when returning a simple erange in multiple branches + when returning a empty hash in multiple branches allows branches to be duplicated behaves like literal case disallowed - when returning a complex erange in multiple branches + when returning a complex irange in multiple branches + registers an offense + behaves like literal case disallowed + when returning a dstr in multiple branches + registers an offense + behaves like literal case allowed + when returning a complex in multiple branches + allows branches to be duplicated + with `rescue` + behaves like literal rescue allowed + when returning a integer in multiple branches + allows branches to be duplicated + behaves like literal rescue disallowed + when returning a xstr in multiple branches + registers an offense + behaves like literal rescue disallowed + when returning a complex hash in multiple branches + registers an offense + behaves like literal rescue disallowed + when returning a complex array in multiple branches registers an offense and IgnoreConstBranches: true - behaves like literal case allowed + behaves like literal rescue allowed when returning a array of constants in multiple branches allows branches to be duplicated - behaves like literal case allowed + behaves like literal rescue allowed when returning a hash of constants in multiple branches allows branches to be duplicated - with `rescue` - behaves like literal rescue allowed - when returning a nil in multiple branches - allows branches to be duplicated behaves like literal rescue allowed - when returning a string in multiple branches + when returning a symbol in multiple branches allows branches to be duplicated behaves like literal rescue disallowed - when returning a dstr in multiple branches + when returning a complex erange in multiple branches registers an offense - behaves like literal rescue allowed - when returning a complex in multiple branches - allows branches to be duplicated behaves like literal rescue disallowed - when returning a dsym in multiple branches + when returning a method call in multiple branches registers an offense behaves like literal rescue allowed - when returning a simple irange in multiple branches - allows branches to be duplicated - behaves like literal rescue allowed - when returning a symbol in multiple branches + when returning a simple erange in multiple branches allows branches to be duplicated behaves like literal rescue allowed - when returning a false in multiple branches + when returning a float in multiple branches allows branches to be duplicated behaves like literal rescue allowed when returning a regexp in multiple branches allows branches to be duplicated - and IgnoreConstBranches: false - behaves like literal rescue disallowed - when returning a hash of constants in multiple branches - registers an offense - behaves like literal rescue disallowed - when returning a array of constants in multiple branches - registers an offense - behaves like literal rescue disallowed - when returning a complex erange in multiple branches - registers an offense behaves like literal rescue allowed - when returning a empty array in multiple branches + when returning a simple irange in multiple branches allows branches to be duplicated behaves like literal rescue allowed - when returning a float in multiple branches + when returning a rational in multiple branches allows branches to be duplicated behaves like literal rescue allowed when returning a regexp with modifier in multiple branches allows branches to be duplicated - behaves like literal rescue disallowed - when returning a xstr in multiple branches - registers an offense - behaves like literal rescue allowed - when returning a empty hash in multiple branches - allows branches to be duplicated - and IgnoreConstBranches: true - behaves like literal rescue allowed - when returning a hash of constants in multiple branches - allows branches to be duplicated - behaves like literal rescue allowed - when returning a array of constants in multiple branches - allows branches to be duplicated behaves like literal rescue allowed - when returning a true in multiple branches + when returning a empty array in multiple branches allows branches to be duplicated - behaves like literal rescue disallowed - when returning a complex irange in multiple branches - registers an offense behaves like literal rescue allowed - when returning a simple erange in multiple branches + when returning a nil in multiple branches allows branches to be duplicated - behaves like literal rescue disallowed - when returning a complex array in multiple branches - registers an offense behaves like literal rescue allowed - when returning a integer in multiple branches + when returning a hash of literals in multiple branches allows branches to be duplicated - behaves like literal rescue disallowed - when returning a variable in multiple branches - registers an offense behaves like literal rescue allowed - when returning a rational in multiple branches + when returning a true in multiple branches allows branches to be duplicated behaves like literal rescue disallowed - when returning a complex regexp in multiple branches + when returning a complex irange in multiple branches registers an offense behaves like literal rescue disallowed - when returning a complex hash in multiple branches + when returning a dsym in multiple branches registers an offense behaves like literal rescue allowed - when returning a array of literals in multiple branches + when returning a complex in multiple branches allows branches to be duplicated behaves like literal rescue allowed - when returning a hash of literals in multiple branches + when returning a empty hash in multiple branches allows branches to be duplicated behaves like literal rescue disallowed - when returning a method call in multiple branches - registers an offense - with `if` - behaves like literal if disallowed - when returning a complex irange in multiple branches - registers an offense - behaves like literal if disallowed - when returning a complex erange in multiple branches - registers an offense - behaves like literal if allowed - when returning a nil in multiple branches - allows branches to be duplicated - behaves like literal if disallowed - when returning a variable in multiple branches - registers an offense - behaves like literal if disallowed - when returning a dsym in multiple branches - registers an offense - behaves like literal if disallowed - when returning a complex array in multiple branches + when returning a complex regexp in multiple branches registers an offense - and IgnoreConstBranches: true - behaves like literal if allowed - when returning a array of constants in multiple branches - allows branches to be duplicated - behaves like literal if allowed - when returning a hash of constants in multiple branches - allows branches to be duplicated - behaves like literal if allowed - when returning a integer in multiple branches - allows branches to be duplicated - behaves like literal if allowed - when returning a symbol in multiple branches - allows branches to be duplicated - behaves like literal if allowed - when returning a rational in multiple branches - allows branches to be duplicated - behaves like literal if allowed + behaves like literal rescue allowed when returning a false in multiple branches allows branches to be duplicated and IgnoreConstBranches: false - behaves like literal if disallowed - when returning a hash of constants in multiple branches - registers an offense - behaves like literal if disallowed + behaves like literal rescue disallowed when returning a array of constants in multiple branches registers an offense - behaves like literal if allowed - when returning a regexp in multiple branches - allows branches to be duplicated - behaves like literal if allowed - when returning a empty hash in multiple branches - allows branches to be duplicated - behaves like literal if allowed - when returning a true in multiple branches - allows branches to be duplicated - behaves like literal if disallowed - when returning a complex regexp in multiple branches - registers an offense - behaves like literal if allowed - when returning a complex in multiple branches - allows branches to be duplicated - behaves like literal if allowed + behaves like literal rescue disallowed + when returning a hash of constants in multiple branches + registers an offense + behaves like literal rescue allowed when returning a string in multiple branches allows branches to be duplicated - behaves like literal if disallowed - when returning a xstr in multiple branches - registers an offense - behaves like literal if allowed - when returning a empty array in multiple branches - allows branches to be duplicated - behaves like literal if allowed - when returning a hash of literals in multiple branches - allows branches to be duplicated - behaves like literal if disallowed - when returning a complex hash in multiple branches - registers an offense - behaves like literal if allowed - when returning a float in multiple branches - allows branches to be duplicated - behaves like literal if allowed + behaves like literal rescue allowed when returning a array of literals in multiple branches allows branches to be duplicated - behaves like literal if allowed - when returning a simple erange in multiple branches - allows branches to be duplicated - behaves like literal if allowed - when returning a simple irange in multiple branches - allows branches to be duplicated - behaves like literal if disallowed - when returning a method call in multiple branches - registers an offense - behaves like literal if allowed - when returning a regexp with modifier in multiple branches - allows branches to be duplicated - behaves like literal if disallowed - when returning a dstr in multiple branches - registers an offense - with IgnoreConstantBranches: true - with `case` - behaves like literal case allowed - when returning a constant in multiple branches - allows branches to be duplicated - behaves like literal case disallowed - when returning a object in multiple branches - registers an offense - with `rescue` behaves like literal rescue disallowed - when returning a object in multiple branches - registers an offense - behaves like literal rescue allowed - when returning a constant in multiple branches - allows branches to be duplicated - with `if` - behaves like literal if disallowed - when returning a object in multiple branches + when returning a variable in multiple branches registers an offense - behaves like literal if allowed - when returning a constant in multiple branches - allows branches to be duplicated - with `case-match` - behaves like literal case-match allowed - when returning a constant in multiple branches - allows branches to be duplicated - behaves like literal case-match disallowed - when returning a object in multiple branches + behaves like literal rescue disallowed + when returning a dstr in multiple branches registers an offense -RuboCop::Cop::Lint::IdentityComparison - does not register an offense when lhs is `object_id` without receiver - registers an offense and corrects when using `==` for comparison between `object_id`s - does not register an offense when a receiver that is not `object_id` uses `==` - does not register an offense when using `==` - does not register an offense when using `==` for comparison between `object_id` and other - does not register an offense when rhs is `object_id` without receiver +RuboCop::Cop::Style::Documentation + registers an offense for non-empty class with encoding comment + registers an offense for compact-style nested class + accepts namespace class without documentation + registers an offense for empty module without documentation + accepts non-empty class with annotation comment followed by other comment + registers an offense for non-namespace + registers an offense if the comment line contains code + registers an offense for compact-style nested module + accepts non-empty class with comment that ends with an annotation + does not raise an error for an implicit match conditional + does not consider comment followed by empty line to be class documentation + accepts namespace module without documentation + registers an offense for a deeply nested class + accepts namespace class which defines constants + accepts empty class without documentation + registers an offense for non-empty cbase class + registers an offense for non-empty class with directive comment + registers an offense for non-empty class + accepts non-empty module with documentation + accepts non-empty class with documentation + registers offense for non-empty class with frozen string comment + registers an offense for non-empty class with annotation comment + accepts namespace module which defines constants + with # :nodoc: + accepts non-namespace module without documentation + accepts non-namespace class without documentation + registers an offense for nested class without documentation + registers an offense for nested module without documentation + accepts compact-style nested module without documentation + accepts compact-style nested class without documentation + with `all` modifier + accepts nested class without documentation + with `all` modifier + accepts nested module without documentation + on a subclass + accepts non-namespace subclass without documentation + registers an offense for nested subclass without documentation + with `all` modifier + accepts nested subclass without documentation + when AllowedConstants is configured + ignores the constants in the config + without documentation + with non-empty module + with constants visibility declaration content + does not register an offense + macro-only class + registers offense for macro with other methods + does not register offense with multiple macros + does not register offense with single macro + with non-empty class + with constants visibility declaration content + does not register an offense + sparse and trailing comments + ignores comments after module node end + ignores comments after class node end + ignores sparse comments inside class node + ignores sparse comments inside module node -RuboCop::Cop::Style::MultilineIfModifier - unless guard clause - allows a one liner - allows a multiline condition - registers an offense - registers an offense when indented - if guard clause - allows a one liner - registers an offense when indented - allows a multiline condition - registers an offense +RuboCop::Cop::Layout::SpaceAroundMethodCallOperator + does not register an offense when no method call operator + does not register an offense when using `__ENCODING__` + dot operator + registers an offense and corrects when spaces around method call + registers an offense and corrects when spaces after `Proc#call` shorthand call + registers an offense and corrects when space after method call + registers an offense and corrects when spaces before method call + registers an offense and corrects when space after last method call operator + registers an offense and corrects when space before method call + registers an offense and corrects when spaces after method call + registers an offense and corrects when space after first method call operator + registers an offense and corrects when space around intermediate method call operator + does not register an offense when no space around any `.` operators + does not register an offense when no space around method call + registers an offense and corrects when space around multiple method call operator + registers an offense and corrects when space before last method call operator + registers an offense and corrects when space before first method call operator + when there is a space between `.` operator and a comment + registers an offense when there is a space before `.` + does not register an offense when there is not a space before `.` + when multi line method call + does not register an offense when no space after the `.` + registers an offense and corrects when space before method call + registers an offense and corrects when space before method call in suffix chaining + safe navigation operator + registers an offense and corrects when space before last method call operator + registers an offense and corrects when space before method call + registers an offense and corrects when space after last method call operator + does not register an offense when no space around method call + registers an offense and corrects when spaces around method call + registers an offense and corrects when spaces before method call + registers an offense and corrects when spaces after method call + registers an offense and corrects when space after method call + registers an offense and corrects when space around intermediate method call operator + does not register an offense when no space around any `.` operators + registers an offense and corrects when space before first method call operator + registers an offense and corrects when space after first method call operator + registers an offense and corrects when space around multiple method call operator + when multi line method call + registers an offense and corrects when space before method call in suffix chaining + does not register an offense when no space after the `&.` + registers an offense and corrects when space before method call + :: operator + does not register an offense if no space before `::` operator with inheritance + registers an offense and corrects when space after first operator with assignment + registers an offense and corrects when multiple spaces with assignment + registers an offense and corrects when spaces after method call + does not register an offense if no space with conditionals + registers an offense and corrects when space around multiple method call operator + registers an offense and corrects when space around intermediate method call operator + registers an offense and corrects when space after method call + does not register an offense if no space before `::` operator with assignment + does not register an offense when no space around method call + registers an offense and corrects when space after last method call operator + does not register an offense when no space around any `.` operators + when multi line method call + registers an offense and corrects when space before method call + does not register an offense when no space after the `::` -RuboCop::Cop::InternalAffairs::CopDescription - There is no description comment - does not register offense - The description starts with `This cop ...` - registers an offense if using an auxiliary verb - registers an offense and corrects if using just a verb - registers an offense if the description like `This cop is ...` - The description starts with a word such as verb - does not register if the description starts with non-verb word - does not register if the description like `Checks` +RuboCop::Cop::Lint::EmptyInterpolation + registers an offense and corrects #{ } in interpolation + finds interpolations in string-like contexts + registers an offense and corrects #{} in interpolation + accepts non-empty interpolation -RuboCop::Cop::Style::OptionalBooleanParameter - registers an offense when defining method with optional boolean arg - registers an offense when defining method with multiple optional boolean args - does not register an offense when defining method without args - does not register an offense when defining method with optional non-boolean arg - registers an offense when defining class method with optional boolean arg - registers an offense when defining method with optional boolean arg that has no space - does not register an offense when defining method with keyword boolean arg - when AllowedMethods is not empty - does not register an offense +RuboCop::Cop::Layout::ParameterAlignment + aligned with first parameter + doesn't get confused by splat + accepts proper indentation + registers an offense and corrects alignment in simple case + accepts parameter lists on a single line + registers an offense and corrects parameters with double indent + accepts a method definition without parameters + accepts the first parameter being on a new row + registers an offense and corrects parameters with single indent + defining self.method + accepts proper indentation + registers an offense and corrects parameters with single indent + aligned with fixed indentation + accepts parameter lists on a single line + registers an offense and corrects parameters with double indent + registers an offense and corrects parameters aligned to first param + accepts a method definition without parameters + accepts the first parameter being on a new row + accepts proper indentation + doesn't get confused by splat + defining self.method + registers an offense and corrects parameters aligned to first param + accepts proper indentation -RuboCop::Cop::Layout::MultilineAssignmentLayout - new_line style - registers an offense when the rhs is on the same line - allows multi-line assignments on separate lines - registers an offense for masgn with multi-line lhs - registers an offense when the rhs is on the same line in setters - registers an offense when the rhs is on the same line in []= - ignores arrays - configured supported types - allows supported types to be configured - when supported types is block - allows multi-line assignments when using block definition on separate lines - registers an offense when multi-line assignments using block definition is on the same line - allows multi-line assignments when using shovel operator - allows multi-line block defines on separate lines - same_line style - registers an offense when the rhs is a different line - registers an offense when the rhs is a different line in []= - registers an offense when the rhs is a different line in setters - allows multi-line assignments on the same line - registers an offense for masgn with multi-line lhs - ignores arrays - configured supported types - allows supported types to be configured - when supported types is block - registers an offense when multi-line assignments using block definition on separate lines - allows multi-line assignments when using shovel operator - allows when multi-line assignments using block definition is on the same line - allows multi-line block defines on separate lines +RuboCop::Cop::Style::FileRead + registers an offense for and corrects `File.open(filename, 'r+').read` + registers an offense for and corrects the `File.open` with symbolic read proc (implicit text mode) + registers an offense for and corrects the `File.open` with inline read block (implicit text mode) + registers an offense for and corrects the `File.open` with symbolic read proc (mode 'rb') + registers an offense for and corrects the `File.open` with multiline read block (implicit text mode) + registers an offense for and corrects the `File.open` with inline read block (mode 'rb') + registers an offense for and corrects the `File.open` with symbolic read proc (mode 'r+') + registers an offense for and corrects `File.open(filename, 'r+t').read` + registers an offense for and corrects `File.open(filename, 'r+b').read` + registers an offense for and corrects the `File.open` with multiline read block (mode 'r+') + registers an offense for and corrects the `File.open` with symbolic read proc (mode 'rt') + registers an offense for and corrects `File.open(filename, 'rt').read` + registers an offense for and corrects the `File.open` with multiline read block (mode 'rt') + registers an offense for and corrects `File.open(filename).read` + registers an offense for and corrects the `File.open` with symbolic read proc (mode 'r+t') + registers an offense for and corrects the `File.open` with multiline read block (mode 'r+b') + registers an offense for and corrects the `File.open` with multiline read block (mode 'rb') + registers an offense for and corrects the `File.open` with inline read block (mode 'r+b') + registers an offense for and corrects `::File.open(filename).read` + registers an offense for and corrects the `File.open` with multiline read block (mode 'r') + registers an offense for and corrects the `File.open` with inline read block (mode 'rt') + does not register an offense when not reading from the block variable + registers an offense for and corrects the `File.open` with inline read block (mode 'r+t') + registers an offense for and corrects `File.open(filename, 'rb').read` + registers an offense for and corrects the `File.open` with symbolic read proc (mode 'r+b') + registers an offense for and corrects the `File.open` with multiline read block (mode 'r+t') + registers an offense for and corrects the `File.open` with symbolic read proc (mode 'r') + registers an offense for and corrects the `File.open` with inline read block (mode 'r') + registers an offense for and corrects the `File.open` with inline read block (mode 'r+') + registers an offense for and corrects `File.open(filename, 'r').read` -RuboCop::Cop::Lint::EmptyClass - registers an offense when empty metaclass contains only comments - does not register an offense when metaclass is not empty - registers an offense for empty class metaclass - does not register an offense when empty has a parent - does not register an offense when class is not empty - registers an offense for empty object metaclass - registers an offense for empty class - when AllowComments is true - does not register an offense when empty class contains only comments - does not register an offense when empty metaclass contains only comments +RuboCop::Cop::Style::PercentQLiterals + when EnforcedStyle is upper_case_q + with interpolation + accepts single quotes + accepts double quotes + accepts %q + accepts %Q + without interpolation + accepts single quotes + accepts %Q + registers offense for %q + accepts double quotes + with special characters + accepts %Q + accepts %q + when EnforcedStyle is lower_case_q + with interpolation + accepts single quotes + accepts double quotes + accepts %q + accepts %Q + without interpolation + accepts %q + registers offense for %Q + accepts double quotes + accepts single quotes + with special characters + accepts %q + accepts %Q -RuboCop::Formatter::ClangStyleFormatter - #report_file - displays text containing the offending source line - when the offense is correctable - prints message as-is - when the offense is automatically corrected - prints [Corrected] along with message - when the offense is not corrected - prints message as-is - when the source line is blank - does not display offending source line - when the source contains multibyte characters - displays text containing the offending source line - when the offending source spans multiple lines - displays the first line with ellipses +RuboCop::Cop::Style::BisectedAttrAccessor + does not register an offense when only one accessor of the name exists + registers an offense and corrects when attr and attr_writer exists + registers an offense and corrects when both accessors of the name exists + registers an offense for accessors with the same visibility in different scopes + registers and corrects in a module + registers an offense and corrects properly when attr_writer is before attr_reader + does not register an offense when accessors are within different visibility scopes + does not register an offense when using `attr_accessor` + registers an offense and corrects when both accessors of the name exists and accessor contains multiple names + registers an offense and corrects when both accessors of the splat exists + registers an offense and corrects when both accessors are in the same visibility scope + registers an offense and corrects when within eigenclass + multiple bisected accessors + when all attr names are bisected + registers and replaces with attr_accessor + when some attr names are bisected + registers and retains non-bisected attrs -RuboCop::Cop::Style::CommentAnnotation - with default RequireColon configuration (colon + space) - accepts upper case keyword with colon, space and note - accepts upper case keyword alone - accepts a keyword that is just the beginning of a sentence - accepts a keyword that is somewhere in a sentence - accepts a comment that is obviously a code example - multiline comment - only registers an offense on the first line - upper case keyword with colon but no note - registers an offense without autocorrection - offenses in consecutive inline comments - registers each of them - capitalized keyword - registers an offense and upcases - upper case keyword with space but no note - registers an offense without autocorrection - with configured keyword - registers an offense for a missing colon after the word - missing colon - registers an offense and adds colon - with multiword keywords - registers an offense for each matching keyword - when a keyword is not in the configuration - accepts the word without colon - missing space after colon - registers an offense and adds space - lower case keyword - registers an offense and upcases - with RequireColon configuration set to false - accepts a comment that is obviously a code example - accepts a keyword that is somewhere in a sentence - accepts upper case keyword with colon, space and note - accepts upper case keyword alone - accepts a keyword that is just the beginning of a sentence - lower case keyword - registers an offense and upcases - multiline comment - only registers an offense on the first line - when a keyword is not in the configuration - accepts the word with colon - upper case keyword with space but no note - registers an offense without autocorrection - upper case keyword with colon but no note - registers an offense without autocorrection - with colon - registers an offense and removes colon - with configured keyword - registers an offense for containing a colon after the word - offenses in consecutive inline comments - registers each of them +RuboCop::Cop::Style::IfUnlessModifier + accepts if-else-end + adds parens in autocorrect when if-end used with `&&` operator + accepts if-end followed by a chained call using `.` + adds parens in autocorrect when if-end used with `||` operator + accepts if/elsif + accepts if-end followed by a chained call using `&.` + accepts code with EOL comment since user might want to keep it + accepts if-end when used as LHS of binary arithmetic + with implicit match conditional + when a multiline if fits on one line + registers an offense + when a multiline if doesn't fit on one line + accepts + when if-end condition has a first line comment + when it is short enough to fit on a single line + corrects it to the single-line form + when it is not short enough to fit on a single line + accepts it in the multiline form + multiline unless that fits on one line + registers an offense + if-end with conditional as body + accepts + when if-end condition has some code after the end keyword + when it is not short enough to fit on a single line + accepts it in the multiline form + when it is short enough to fit on a single line + corrects it to the single-line form + when if-end condition is assigned to a variable + with variable being on the previous line + when it is not short enough to fit on a single line + accepts it in the multiline form + when it is short enough to fit on a single line + corrects it to the single-line form + with variable being on the same line + when it is not short enough to fit on a single line + accepts it in the multiline form + when it is short enough to fit on a single line + corrects it to the single-line form + if-end is argument to a non-parenthesized method call + adds parentheses so as not to change meaning + modifier if that does not fit on one line + when Layout/LineLength is disabled with enable/disable comments + accepts + when Layout/LineLength is disabled in configuration + accepts + when Layout/LineLength is disabled with an EOL comment + accepts + when Layout/LineLength is enabled + corrects it to normal form + IgnoreCopDirectives + and the long line is too long because IgnoreCopDirectives is false + registers an offense + and the long line is allowed because IgnoreCopDirectives is true + accepts + when variable assignment is used in the branch body of if modifier + registers an offense + when using a method with heredoc argument + accepts + and the long line is too long because AllowURI is false + registers an offense + and the long line is allowed because AllowURI is true + accepts + when if-end condition is a value in a hash + when it is short enough to fit on a single line + corrects it to the single-line form + when it is not short enough to fit on a single line + accepts it in the multiline form + unless-end with conditional as body + accepts + modifier if that does not fit on one line, but is not the only statement on the line + accepts + multiline if that fits on one line with comment near end + accepts + when if-end condition is an element of an array + when not short enough to fit on a single line + accepts it in the multiline form + when short enough to fit on a single line + corrects it to the single-line form + behaves like condition modifier cop + for a multiline 'unless' + accepts an empty body + accepts it if single line would not fit on one line + doesn't break when used as RHS of constant assignment + corrects it when assignment is in body + doesn't break when used as RHS of binary arithmetic + handles one-line usage + handles inline comments during autocorrection + accepts it when condition has local variable assignment + doesn't break when used as RHS of class var assignment + corrects it if result fits in one line + accepts it if body spans more than one line + doesn't break when used as RHS of local var assignment + doesn't break when used as RHS of instance var assignment + when there is a comment on the first line and some code after the end keyword + does not register an offense + when Layout/LineLength is disabled + registers an offense even for a long modifier statement + accepts multiline condition in modifier form + registers an offense + behaves like condition modifier cop + for a multiline 'if' + handles one-line usage + handles inline comments during autocorrection + corrects it when assignment is in body + accepts it if body spans more than one line + doesn't break when used as RHS of binary arithmetic + accepts it if single line would not fit on one line + corrects it if result fits in one line + accepts an empty body + doesn't break when used as RHS of constant assignment + doesn't break when used as RHS of local var assignment + doesn't break when used as RHS of class var assignment + accepts it when condition has local variable assignment + doesn't break when used as RHS of instance var assignment + when there is a comment on the first line and some code after the end keyword + does not register an offense + when Layout/LineLength is disabled + registers an offense even for a long modifier statement + accepts multiline condition in modifier form + registers an offense + multiline if that fits on one line + registers an offense + and has two statements separated by semicolon + accepts + short multiline if near an else etc + registers an offense + with tabs used for indentation + with Layout/IndentationWidth: Width config + behaves like with tabs indentation + it fits on one line + registers an offense + it doesn't fit on one line + doesn't register an offense + with Layout/IndentationStyle: IndentationWidth config + behaves like with tabs indentation + it fits on one line + registers an offense + it doesn't fit on one line + doesn't register an offense + multiline if that fits on one line with comment on first line + registers an offense and preserves comment + if-end is argument to a parenthesized method call + adds parentheses because otherwise it would cause SyntaxError + with a named regexp capture on the LHS + does not register an offense + when Layout/LineLength is disabled + registers an offense even for a long modifier statement + +RuboCop::FeatureLoader + .load + with normally loadable feature + loads it normally + with namespaced feature + loads it as namespaced feature + with unloadable namespaced feature + raises LoadError with preferred message + with unexpected LoadError from require + raises LoadError + with dot-prefixed loadable feature + loads it as relative path + with dot-prefixed namespaced feature + loads it as namespaced feature + +RuboCop::Cop::Lint::BinaryOperatorWithIdenticalOperands + does not register an offense for `+` with duplicate operands + does not register an offense for `>>` with duplicate operands + does not register an offense for `<<` with duplicate operands + registers an offense for `%` with duplicate operands + registers an offense for `||` with duplicate operands + registers an offense for `>=` with duplicate operands + registers an offense for `/` with duplicate operands + registers an offense for `=~` with duplicate operands + registers an offense for `^` with duplicate operands + does not register an offense for `*` with duplicate operands + registers an offense for `!=` with duplicate operands + registers an offense for `<` with duplicate operands + does not register an offense for `**` with duplicate operands + registers an offense for `-` with duplicate operands + does not register an offense when using binary operator with different operands + does not crash on operator without any argument + does not register an offense when using arithmetic operator with numerics + registers an offense for `===` with duplicate operands + registers an offense for `<=` with duplicate operands + registers an offense for `>` with duplicate operands + registers an offense for `|` with duplicate operands + registers an offense for `==` with duplicate operands + registers an offense for `&&` with duplicate operands + registers an offense for `<=>` with duplicate operands + +RuboCop::Cop::Style::NestedParenthesizedCalls + on a non-parenthesized method call + doesn't register an offense + on a non-parenthesized call nested in a parenthesized one + with a single argument to the nested call + registers an offense + when using safe navigation operator + registers an offense + with multiple arguments to the nested call + registers an offense + on a call to a setter method + doesn't register an offense + on a permitted method + doesn't register an offense + backslash newline in method call + registers an offense + on a method call with no arguments + doesn't register an offense + on a deeply nested argument + doesn't register an offense + on a nested, parenthesized method call + doesn't register an offense + on an aref, nested in a parenthesized method call + doesn't register an offense + on a call with no arguments, nested in a parenthesized one + doesn't register an offense + +RuboCop::TargetRuby + when TargetRubyVersion is not set + when .ruby-version is not in a parent directory + when gems.locked is in a parent directory + does + when Gemfile.lock is in a parent directory + does + when .ruby-version is present + does not read .tool-versions, Gemfile.lock or gems.locked + when .ruby-version contains a Rbx version + uses the default target ruby version + when the MRI version contains multiple digits + reads it to determine the target ruby version + when .ruby-version contains an MRI version + reads it to determine the target ruby version + when .ruby-version contains "system" version + uses the default target ruby version + when .ruby-version contains a JRuby version + uses the default target ruby version + when .ruby-version contains a version prefixed by "ruby-" + correctly determines the target ruby version + when .ruby-version is in a parent directory + reads it to determine the target ruby version + when .ruby-version is not present + gemspec file + when file does not contain `required_ruby_version` + sets default target_ruby + when file contains `required_ruby_version` as a requirement + sets target_ruby from required_ruby_version from inclusive requirement range + sets first known ruby version that satisfies requirement + when file contains `required_ruby_version` as an array + sets target_ruby to the minimal version satisfying the requirements + sets target_ruby from required_ruby_version with many requirements + when file contains `required_ruby_version` as a string + sets target_ruby from approximate version + sets target_ruby from inclusive range + sets target_ruby from exclusive range + when bundler lock files are not present + uses the default target ruby version + and Gemfile.lock exists + uses the default Ruby when jruby is in Gemfile.lock + uses MRI Ruby version when it has multiple digits + uses MRI Ruby version when it is present in Gemfile.lock + uses the default Ruby when Ruby is not in Gemfile.lock + uses the default Ruby when rbx is in Gemfile.lock + and gems.locked exists + uses the default Ruby when rbx is in gems.locked + uses MRI Ruby version when it has multiple digits + uses MRI Ruby version when it is present in gems.locked + uses the default Ruby when Ruby is not in gems.locked + uses the default Ruby when jruby is in gems.locked + when .tool-versions is present + when .tool-versions does not contain a ruby version + uses the default ruby version + when .tool-versions contains a ruby version + reads it to determine the target ruby version + does not read Gemfile.lock, gems.locked + when TargetRubyVersion is set + does not read Gemfile.lock or gems.locked + does not read .ruby-version + uses TargetRubyVersion + +RuboCop::Cop::Style::StabbyLambdaParentheses + require_parentheses + registers an offense for a stabby lambda without parentheses + does not register an offense for a stabby lambda with parentheses + behaves like common + does not check a method call named lambda + does not check a stabby lambda without arguments + does not check the old lambda syntax + require_no_parentheses + registers an offense for a stabby lambda with parentheses + behaves like common + does not check the old lambda syntax + does not check a stabby lambda without arguments + does not check a method call named lambda + +RuboCop::Cop::InternalAffairs::CopDescription + The description starts with `This cop ...` + registers an offense if the description like `This cop is ...` + registers an offense and corrects if using just a verb + registers an offense if using an auxiliary verb + There is no description comment + does not register offense + The description starts with a word such as verb + does not register if the description starts with non-verb word + does not register if the description like `Checks` + +RuboCop::Cop::Metrics::ClassLength + accepts a class with less than 5 lines + accepts empty classes + reports the correct beginning and end lines + does not count blank lines + accepts a class with 5 lines + rejects a class with more than 5 lines + when `CountAsOne` is not empty + folds array into one line + when a class has inner classes + rejects a class with 6 lines that belong to the class directly + does not count lines of inner classes + when using numbered parameter + when inspecting a class defined with Class.new + registers an offense + when inspecting a class defined with ::Class.new + registers an offense + when inspecting a class defined with Struct.new + registers an offense + registers an offense when multiple assignments to constants + registers an offense when inspecting or equals (`||=`) for constant + when CountComments is enabled + registers an offense for a class that only contains comments + also counts commented lines + when CountComments is disabled + accepts classes that only contain comments + when overlapping constant assignments + does not register an offense + when inspecting a class defined with ::Class.new + registers an offense + when inspecting a class defined with Struct.new + registers an offense + registers an offense when multiple assignments to constants + registers an offense when inspecting or equals (`||=`) for constant + when inspecting a class defined with Class.new + registers an offense + +RuboCop::Cop::Metrics::AbcSize + when Max is 2 + accepts two assignments + when Max is 10.3 + reports size and max as <10, 10, 40> 42.43/10.3 + when Max is 1.3 + reports size and max as <1, 1, 4> 4.24/1.3 + when Max is 100.321 + reports size and max as <100, 100, 400> 424.3/100.3 + when Max is 1000.3 + reports size and max as <1000, 1000, 4000> 4243/1000 + when Max is 2.3 + accepts a total score of 2.24 + when Max is 0 + accepts an empty method + registers an offense for an if modifier + registers an offense for a `define_method` + registers an offense for complex content including A, B, and C scores + accepts an empty `define_method` + registers an offense for an assignment of a local variable + treats safe navigation method calls like regular method calls + a condition + registers an offense for an assignment of an element + when CountRepeatedAttributes is `false` + does not count repeated attributes + when CountRepeatedAttributes is `true` + counts repeated attributes + when method is in list of allowed methods + when AllowedMethods is enabled + does not register an offense when defining a class method + does not register an offense when defining an instance method + does not register an offense when using `define_method` + when AllowedPatterns is enabled + does not register an offense when defining an instance method + does not register an offense when using `define_method` + does not register an offense when defining a class method + Ruby 2.7 + registers an offense for a `define_method` with numblock + +RuboCop::Cop::Style::MultipleComparison + does not register an offense when comparing two sides of the disjunction is unrelated + registers an offense and corrects when `a` is compared three times on the right hand side + does not register an offense for Array#include? + registers an offense and corrects when `a` is compared three times + registers an offense and corrects when `a` is compared twice + does not register an offense for comparing lvars when a string is on the lefthand side + registers an offense and corrects when `a` is compared three times, once on the righthand side + registers an offense and corrects when multiple comparison is not part of a conditional + does not register an offense for comparing lvars + does not register an offense for comparing multiple int literals + registers an offense and corrects when `a` is compared twice in `if` and `elsif` conditions + does not register an offense for a == b || b == a + does not register an offense for comparing multiple literal strings + does not register an offense for a duplicated condition + does not register an offense for comparing an lvar + when `AllowMethodComparison: true` + does not register an offense when using multiple method calls + when `AllowMethodComparison: false` + registers an offense and corrects when using multiple method calls + +RuboCop::Cop::Style::Attr + registers offense for attr within module_eval + accepts attr when it does not take arguments + does not register offense for custom `attr` method + registers an offense attr + registers offense for attr within class_eval + accepts attr when it has a receiver + autocorrects + attr :name, true to attr_accessor :name + attr, false to attr_reader + attr to attr_reader + attr with multiple names to attr_reader + +RuboCop::Cop::Style::RedundantSelf + does not report an offense when masgn name is used in `unless` + accepts a self receiver used to distinguish from constant + accepts a self receiver on an lvalue of an or-assignment + reports an offense when a different lvasgn name is used in `if` + reports an offense when a different masgn name is used in `if` + accepts a self receiver used to distinguish from argument of block + accepts a self receiver of .() + reports an offense a self receiver of .call + accepts a self receiver with the square bracket operator + accepts a self receiver on an lvalue of an assignment + accepts a self receiver on an lvalue of a parallel assignment + does not report an offense when lvasgn name is used in `while` + does not report an offense when masgn name is used in `while` + does not report an offense when lvasgn name is used in `until` + accepts when nested receiver and lvalue have the name name + accepts a self receiver on an lvalue of mlhs arguments + reports an offense a self receiver on an rvalue + does not report an offense when self receiver in a method argument and lvalue have the same name + accepts a self receiver on an lvalue of an and-assignment + does not report an offense when receiver and multiple assigned lvalue have the same name + does not report an offense when lvasgn name is used in `if` + accepts a self receiver for methods named like ruby keywords + does not report an offense when self receiver in a method argument and multiple assigned lvalue have the same name + does not report an offense when masgn name is used in `if` + does not report an offense when masgn name is used in `until` + accepts a self receiver of methods also defined on `Kernel` + does not report an offense when receiver and lvalue have the same name + accepts a self receiver on an lvalue of a plus-assignment + does not report an offense when lvasgn name is used in `unless` + does not report an offense when lvasgn name is nested below `if` + accepts a self receiver with the double less-than operator + Ruby 2.7 + registers offense for self usage in numblocks + instance methods + accepts a self receiver used to distinguish from an argument + accepts a self receiver used to distinguish from optional argument + accepts a self receiver used to distinguish from blockarg + accepts a self receiver used to distinguish from an argument when an inner method is defined + accepts a self receiver used to distinguish from local variable + accepts a self receiver used to distinguish from argument + class methods + accepts a self receiver used to distinguish from argument + accepts a self receiver used to distinguish from optional argument + accepts a self receiver used to distinguish from blockarg + accepts a self receiver used to distinguish from local variable + with ruby >= 2.7 + with pattern matching + accepts a self receiver in a nested pattern` + accepts a self receiver in a `if-guard` + registers an offense when using self with a different match var + registers an offense when using a self receiver with a pin + accepts a self receiver in a conditional pattern + accepts a self receiver on a `array-pattern` + accepts a self receiver on a `hash-pattern` + accepts a self receiver with a `match-alt` + accepts a self receiver on an `match-var` + +RuboCop::Cop::Style::ClassEqualityComparison + registers an offense and corrects when comparing `Module#name` for equality + registers an offense and corrects when comparing single quoted class name for equality + registers an offense and corrects when comparing class using `eql?` for equality + registers an offense and corrects when comparing class using `equal?` for equality + registers an offense and corrects when comparing class using `==` for equality + does not register an offense when using `instance_of?` + registers an offense and corrects when comparing double quoted class name for equality + when AllowedPatterns is enabled + does not register an offense when comparing class for equality + when AllowedMethods is enabled + does not register an offense when comparing class for equality + with instance variable comparison in module + registers and corrects an offense + with String comparison in module + registers and corrects an offense + +RuboCop::Cop::Layout::SpaceBeforeBlockBraces + with space before empty braces allowed + registers an offense and corrects empty braces + accepts empty braces with outer space + when EnforcedStyle is space + registers an offense and corrects multiline block where the left brace has no outer space + registers an offense and corrects left brace without outer space + accepts braces surrounded by spaces + registers an offense and corrects opposite + correct style + Ruby 2.7 + registers an offense and corrects multiline block where the left brace has no outer space + registers an offense and corrects opposite + correct style + with invalid value for EnforcedStyleForEmptyBraces + fails with an error + with space before empty braces not allowed + registers an offense and corrects empty braces + accepts empty braces without outer space + when EnforcedStyle is no_space + accepts left brace without outer space + registers an offense and corrects correct + opposite style + registers an offense and corrects braces surrounded by spaces + Ruby 2.7 + registers an offense and corrects correct + opposite style + with `EnforcedStyle` of `Style/BlockDelimiters` + accepts left brace without outer space + +RuboCop::Cop::Style::MultilineInPatternThen + >= Ruby 2.7 + doesn't register an offense for singleline `in` statement with `then` + autocorrects when the body of `in` branch starts with `then` + registers an offense when one line for multiple candidate values of `in` + doesn't register an offense for multiline `in` statement with `then` followed by other lines + doesn't register an offense for multiline `in` statement without `then` + doesn't register an offense for empty `in` statement without `then` + registers an offense for multiline (two lines in a body) `in` statement with `then` + doesn't register an offense when `then` required for a body of `in` is used + does not register an offense for hash `in` statement with `then` + does not register an offense for array `when` statement with `then` + registers an offense for multiline (one line in a body) `in` statement with `then` + does not register an offense when line break for multiple candidate values of `in` + registers an offense for empty `in` statement with `then` + +RuboCop::Cop::Layout::EmptyLineAfterGuardClause + registers an offense and corrects a `raise` guard clause not followed by empty line when `unless` condition is after heredoc + accepts a guard clause after a single line heredoc + accepts a modifier if when the next line is `end` + registers an offense when the clause ends with a semicolon but the next clause is on the next line + registers an offense and corrects a next guard clause not followed by empty line when guard clause is after heredoc including string interpolation + accepts multiple guard clauses + accepts a guard clause when the next line is `else` + accepts a guard clause that is after a multiline heredoc with chained calls + accepts modifier if + registers an offense and corrects using heredoc with `and return` before guard condition + registers no offenses using heredoc with `and return` before guard condition with empty line + registers an offense and corrects a guard clause that is a ternary operator + accepts a guard clause inside oneliner block + registers an offense and corrects `next` guard clause not followed by empty line + accepts a guard clause when the next line is `ensure` + registers an offense and corrects a guard clause not followed by empty line + registers an offense and corrects a `raise` guard clause not followed by empty line when guard clause is after method call with argument + registers an offense and corrects only the last guard clause + registers an offense and corrects a method starting with end_ + registers an offense and corrects a guard clause is before `begin` + accepts a guard clause that is after a multiline heredoc nested argument call + accepts using guard clause is after `raise` + registers and corrects when using guard clause is after `rubocop:disable` comment + accepts a `raise` guard clause not followed by empty line when guard clause is after condition without method invocation + registers an offense and corrects when using `or return` before guard condition + does not register an offense when there are multiple clauses on the same line + registers and corrects when using guard clause is after `rubocop:enable` comment + accepts a guard clause when the next line is `elsif` + accepts a guard clause when the next line is `rescue`-`else` + registers an offense and corrects a guard clause not followed by empty line when guard clause including heredoc + accepts a guard clause that is after multiline heredoc + does not register an offense when the clause ends with a semicolon but is followed by a newline + does not register an offense when the clause is not followed by other code + registers an offense and corrects when using `and return` before guard condition + accepts a guard clause followed by end + accepts a guard clause when the next line is `rescue` + accepts using guard clause is after `rubocop:enable` comment + accepts a guard clause followed by empty line when guard clause including heredoc + registers an offense and corrects a `raise` guard clause not followed by empty line when `if` condition is after heredoc + +RuboCop::CLI --disable-uncorrectable + --disable-uncorrectable + does not disable anything for cops that support autocorrect + if one one-line disable statement fits + adds it + adds it when the cop supports autocorrect but does not correct the offense + and there are two offenses of the same kind on one line + adds a single one-line disable statement + but there are more offenses on the line and they don't all fit + adds both one-line and before-and-after disable statements + if a one-line disable statement doesn't fit + adds before-and-after disable statement + and the offense is inside a heredoc + adds before-and-after disable statement around the heredoc + when exist offense for Layout/SpaceInsideArrayLiteralBrackets + when `EnforcedStyle: no_space` + does not disable anything for cops that support autocorrect + when `EnforcedStyle: space` + does not disable anything for cops that support autocorrect + +RuboCop::Cop::Style::SafeNavigation + allows calls using safe navigation + allows an object check before a method chain longer than 2 methods + allows method calls that do not get called using . safe guarded by an object check + allows an object check before a negated method call with a safe navigation + allows an object check before a method call that is used in a regex comparison + allows an object check before a method call that is used with `empty?` + allows chained method calls during assignment safe guardedby an object check + allows for empty if blocks with comments + allows an object check before a nil check on a long chain + allows method call that is used in a comparison safe guarded by an object check + allows a method call safeguarded when using `unless nil?` + allows chained method calls during arithmetic operations safe guarded by an object check + allows a method chain that is used in a comparison safe guarded by an object check + allows an object check before a method call that is used in a comparison + allows an object check before a negated predicate method chain + allows a method call as a parameter when the parameter is safe guarded with an object check + allows an object check before a nil check on a short chain + allows method call that is used in a regex comparison safe guarded by an object check + allows an object check before a blank check + allows an object check before a method call that is used in a negated regex comparison + allows method call that is used in a spaceship comparison safe guarded by an object check + allows an object check before a method chain that is used in a comparison + allows method call that is used in a negated regex comparison safe guarded by an object check + allows a method call safeguarded with a negative check for the object when using `if` + allows an object check before a negated predicate + allows calls on nil + allows object checks in the condition of an elsif statement and a method call on that object in the body + does not move comments that are inside an inner block + allows a method call safeguarded with a negative check for the object when using `unless` + allows an object check before hash access + allows an object check before a long chain with a block + allows calls to methods not safeguarded by respond_to + allows an object check before a method call that is used in a spaceship comparison + behaves like all variable types + object check before method call + allows a nil object check followed by a method call with params + allows a non object check followed by a method call with params + allows a non object check followed by a method call with a block + allows a non object check followed by a method call with params and a block + allows a non object check followed by a method call + allows a nil object check followed by a method call with params and a block + allows a nil object check followed by a method call with a block + allows a nil object check followed by a method call + ConvertCodeThatCanStartToReturnNil false + registers an offense for an object check followed by a method call + registers an offense for an object check followed by a method calls that nil responds to + registers an offense for an object check followed by a method call with a block + allows a non-nil object check followed by a method call with params + registers an offense for a check for the object followed by a method call in the condition for an if expression + allows a non-nil object check followed by a method call + registers an offense for an object check followed by a method call with params and a block + allows a non-nil object check followed by a method call with a block + registers an offense for an object check followed by a method call with params + allows a non-nil object check followed by a method call with params and a block + method chaining + corrects an object check followed by a chained method call with a symbol proc + corrects an object check followed by a chained method call with a block + corrects an object check followed by a chained method call + corrects an object check followed by a chained method call with params + ConvertCodeThatCanStartToReturnNil true + registers an offense for a non-nil object check followed by a method call with params and a block + registers an offense for an object check followed by a method call + registers an offense for an object check followed by a method call with params and a block + registers an offense for a check for the object followed by a method call in the condition for an if expression + registers an offense for a non-nil object check followed by a method call with params + registers an offense for an object check followed by a method call with params + registers an offense for a non-nil object check followed by a method call + corrects an object check followed by a method call and another check + registers an offense for a non-nil object check followed by a method call with a block + registers an offense for an object check followed by a method call with a block + method chaining + registers an offense for an object check followed by chained method calls with blocks + MaxChainLength: 1 + registers an offense for an object check followed by 1 chained method calls + allows an object check followed by 2 chained method calls + with Lint/SafeNavigationChain disabled + allows an object check followed by chained method calls with blocks + allows an object check followed by chained method calls + MaxChainLength: 3 + registers an offense for an object check followed by 3 chained method calls + allows an object check followed by 4 chained method calls + if expression + registers an offense for a single method call inside of a non-nil check for the object + registers an offense for a single method call with params and a block inside of a check for the object + registers an offense for a single method call inside of an unless negative check for the object + registers an offense for a single method call with params inside of a check for the object + registers an offense for a single method call with params and a block inside of an unless negative check for the object + registers an offense for a single method call with a block inside of a check for the object + registers an offense for a single method call inside of a check for the object + registers an offense for a single method call inside of an unless nil check for the object + does not lose comments within if expression + registers an offense for a single method call with params and a block inside of a non-nil check for the object + only moves comments that fall within the expression + registers an offense for a single method call with params and a block inside of an unless nil check for the object + registers an offense for a single method call with a block inside of an unless negative check for the object + registers an offense for a single method call with params inside of a non-nil check for the object + registers an offense for a single method call with params inside of an unless nil check for the object + registers an offense for a single method call with params inside of an unless negative check for the object + registers an offense for a single method call with a block inside of a non-nil check for the object + allows a single method call inside of a check for the object with an else + registers an offense for a single method call with a block inside of an unless nil check for the object + ternary expression + allows ternary expression + modifier if + registers an offense for a method call with params safeguarded with a nil check for the object + registers an offense when safe guard check and safe navigation method call are connected with `&&` condition + registers an offense for a method call with a block safeguarded with a check for the object + registers an offense for a method call with params and a block safeguarded with a negative check for the object + registers an offense for a method call safeguarded with a negative check for the object + registers an offense for a method call on an accessor safeguarded by a check for the accessed variable + registers an offense for a method call that nil responds to safe guarded by an object check + registers an offense for a method call with a block safeguarded with a negative check for the object + registers an offense for a method call with params safeguarded with a negative nil check for the object + registers an offense for a method call with params and a block safeguarded with a negative nil check for the object + registers an offense for a method call safeguarded with a check for the object + registers an offense for a method call safeguarded with a negative nil check for the object + registers an offense for a method call with params safeguarded with a check for the object + registers an offense for an object check followed by a method call with a comment at EOL + registers an offense for a method call safeguarded with a nil check for the object + registers an offense for a method call with params and a block safeguarded with a check for the object + registers an offense for a method call with a block safeguarded with a nil check for the object + registers an offense for a method call with params safeguarded with a negative check for the object + registers an offense for a chained method call safeguarded with an unless nil check for the object + registers an offense for a method call with params and a block safeguarded with a nil check for the object + registers an offense for a chained method call safeguarded with a negative nil check for the object + registers an offense for a method call with a block safeguarded with a negative nil check for the object + registers an offense for a chained method call safeguarded with a check for the object + behaves like safe guarding logical break keywords + allows a method call being passed to throw safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to fail safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to return safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to raise safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to next safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to break safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to yield safe guarded by an object check + behaves like all variable types + object check before method call + allows a non object check followed by a method call with a block + allows a nil object check followed by a method call with params and a block + allows a nil object check followed by a method call with a block + allows a nil object check followed by a method call with params + allows a nil object check followed by a method call + allows a non object check followed by a method call + allows a non object check followed by a method call with params + allows a non object check followed by a method call with params and a block + ConvertCodeThatCanStartToReturnNil true + registers an offense for a non-nil object check followed by a method call with a block + registers an offense for an object check followed by a method call + registers an offense for an object check followed by a method call with params and a block + registers an offense for a non-nil object check followed by a method call + registers an offense for a non-nil object check followed by a method call with params + registers an offense for an object check followed by a method call with params + registers an offense for a check for the object followed by a method call in the condition for an if expression + corrects an object check followed by a method call and another check + registers an offense for an object check followed by a method call with a block + registers an offense for a non-nil object check followed by a method call with params and a block + method chaining + registers an offense for an object check followed by chained method calls with blocks + MaxChainLength: 3 + registers an offense for an object check followed by 3 chained method calls + allows an object check followed by 4 chained method calls + with Lint/SafeNavigationChain disabled + allows an object check followed by chained method calls + allows an object check followed by chained method calls with blocks + MaxChainLength: 1 + allows an object check followed by 2 chained method calls + registers an offense for an object check followed by 1 chained method calls + ConvertCodeThatCanStartToReturnNil false + allows a non-nil object check followed by a method call with params + registers an offense for a check for the object followed by a method call in the condition for an if expression + allows a non-nil object check followed by a method call with a block + registers an offense for an object check followed by a method call with a block + allows a non-nil object check followed by a method call + registers an offense for an object check followed by a method call with params and a block + registers an offense for an object check followed by a method call + registers an offense for an object check followed by a method calls that nil responds to + allows a non-nil object check followed by a method call with params and a block + registers an offense for an object check followed by a method call with params + method chaining + corrects an object check followed by a chained method call with a symbol proc + corrects an object check followed by a chained method call with params + corrects an object check followed by a chained method call with a block + corrects an object check followed by a chained method call + modifier if + registers an offense for a method call safeguarded with a check for the object + registers an offense for a method call with params safeguarded with a negative nil check for the object + registers an offense for a method call that nil responds to safe guarded by an object check + registers an offense for a method call with params safeguarded with a check for the object + registers an offense for a chained method call safeguarded with an unless nil check for the object + registers an offense for an object check followed by a method call with a comment at EOL + registers an offense for a method call with a block safeguarded with a negative nil check for the object + registers an offense for a method call with a block safeguarded with a nil check for the object + registers an offense when safe guard check and safe navigation method call are connected with `&&` condition + registers an offense for a method call with params and a block safeguarded with a check for the object + registers an offense for a method call safeguarded with a negative nil check for the object + registers an offense for a method call with a block safeguarded with a check for the object + registers an offense for a method call with a block safeguarded with a negative check for the object + registers an offense for a method call with params and a block safeguarded with a nil check for the object + registers an offense for a method call with params and a block safeguarded with a negative check for the object + registers an offense for a chained method call safeguarded with a check for the object + registers an offense for a chained method call safeguarded with a negative nil check for the object + registers an offense for a method call safeguarded with a nil check for the object + registers an offense for a method call with params and a block safeguarded with a negative nil check for the object + registers an offense for a method call on an accessor safeguarded by a check for the accessed variable + registers an offense for a method call with params safeguarded with a nil check for the object + registers an offense for a method call safeguarded with a negative check for the object + registers an offense for a method call with params safeguarded with a negative check for the object + behaves like safe guarding logical break keywords + allows a method call being passed to throw safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to break safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to yield safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to fail safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to return safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to next safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to raise safe guarded by an object check + if expression + registers an offense for a single method call with a block inside of a check for the object + allows a single method call inside of a check for the object with an else + only moves comments that fall within the expression + registers an offense for a single method call with params inside of a non-nil check for the object + registers an offense for a single method call with params and a block inside of an unless nil check for the object + registers an offense for a single method call inside of an unless negative check for the object + registers an offense for a single method call with params and a block inside of an unless negative check for the object + registers an offense for a single method call with a block inside of an unless nil check for the object + registers an offense for a single method call with params and a block inside of a non-nil check for the object + registers an offense for a single method call inside of a check for the object + registers an offense for a single method call with params and a block inside of a check for the object + registers an offense for a single method call inside of an unless nil check for the object + registers an offense for a single method call inside of a non-nil check for the object + registers an offense for a single method call with a block inside of a non-nil check for the object + does not lose comments within if expression + registers an offense for a single method call with params inside of an unless nil check for the object + registers an offense for a single method call with a block inside of an unless negative check for the object + registers an offense for a single method call with params inside of an unless negative check for the object + registers an offense for a single method call with params inside of a check for the object + ternary expression + allows ternary expression + when Ruby <= 2.2 + does not register an offense when a method call that nil responds to safe guarded by an object check + behaves like all variable types + modifier if + registers an offense for a chained method call safeguarded with an unless nil check for the object + registers an offense for a method call on an accessor safeguarded by a check for the accessed variable + registers an offense for a method call with params safeguarded with a nil check for the object + registers an offense for a method call with a block safeguarded with a check for the object + registers an offense for a method call with params safeguarded with a check for the object + registers an offense for an object check followed by a method call with a comment at EOL + registers an offense for a method call safeguarded with a check for the object + registers an offense for a method call safeguarded with a negative nil check for the object + registers an offense for a method call with params and a block safeguarded with a negative nil check for the object + registers an offense for a chained method call safeguarded with a check for the object + registers an offense for a method call with params and a block safeguarded with a negative check for the object + registers an offense for a method call with params safeguarded with a negative check for the object + registers an offense for a method call with a block safeguarded with a nil check for the object + registers an offense for a method call with params safeguarded with a negative nil check for the object + registers an offense for a method call with a block safeguarded with a negative check for the object + registers an offense for a method call with params and a block safeguarded with a nil check for the object + registers an offense when safe guard check and safe navigation method call are connected with `&&` condition + registers an offense for a chained method call safeguarded with a negative nil check for the object + registers an offense for a method call safeguarded with a nil check for the object + registers an offense for a method call safeguarded with a negative check for the object + registers an offense for a method call with a block safeguarded with a negative nil check for the object + registers an offense for a method call with params and a block safeguarded with a check for the object + registers an offense for a method call that nil responds to safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to raise safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to return safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to yield safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to throw safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to next safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to fail safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to break safe guarded by an object check + object check before method call + allows a non object check followed by a method call + allows a non object check followed by a method call with a block + allows a nil object check followed by a method call + allows a nil object check followed by a method call with params + allows a nil object check followed by a method call with a block + allows a nil object check followed by a method call with params and a block + allows a non object check followed by a method call with params + allows a non object check followed by a method call with params and a block + ConvertCodeThatCanStartToReturnNil false + allows a non-nil object check followed by a method call with params + allows a non-nil object check followed by a method call + registers an offense for a check for the object followed by a method call in the condition for an if expression + registers an offense for an object check followed by a method calls that nil responds to + registers an offense for an object check followed by a method call with a block + registers an offense for an object check followed by a method call with params + allows a non-nil object check followed by a method call with params and a block + registers an offense for an object check followed by a method call with params and a block + allows a non-nil object check followed by a method call with a block + registers an offense for an object check followed by a method call + method chaining + corrects an object check followed by a chained method call with a block + corrects an object check followed by a chained method call + corrects an object check followed by a chained method call with a symbol proc + corrects an object check followed by a chained method call with params + ConvertCodeThatCanStartToReturnNil true + registers an offense for an object check followed by a method call with params and a block + registers an offense for a non-nil object check followed by a method call with params and a block + registers an offense for a check for the object followed by a method call in the condition for an if expression + registers an offense for a non-nil object check followed by a method call + registers an offense for a non-nil object check followed by a method call with params + registers an offense for an object check followed by a method call with a block + corrects an object check followed by a method call and another check + registers an offense for an object check followed by a method call + registers an offense for an object check followed by a method call with params + registers an offense for a non-nil object check followed by a method call with a block + method chaining + registers an offense for an object check followed by chained method calls with blocks + MaxChainLength: 1 + registers an offense for an object check followed by 1 chained method calls + allows an object check followed by 2 chained method calls + MaxChainLength: 3 + registers an offense for an object check followed by 3 chained method calls + allows an object check followed by 4 chained method calls + with Lint/SafeNavigationChain disabled + allows an object check followed by chained method calls + allows an object check followed by chained method calls with blocks + if expression + registers an offense for a single method call with params and a block inside of a non-nil check for the object + registers an offense for a single method call with params and a block inside of an unless negative check for the object + registers an offense for a single method call inside of a non-nil check for the object + registers an offense for a single method call with a block inside of a check for the object + registers an offense for a single method call with params and a block inside of a check for the object + registers an offense for a single method call inside of a check for the object + registers an offense for a single method call with params inside of an unless negative check for the object + registers an offense for a single method call with params inside of a check for the object + registers an offense for a single method call inside of an unless nil check for the object + registers an offense for a single method call with params and a block inside of an unless nil check for the object + registers an offense for a single method call inside of an unless negative check for the object + registers an offense for a single method call with a block inside of an unless negative check for the object + registers an offense for a single method call with params inside of an unless nil check for the object + registers an offense for a single method call with params inside of a non-nil check for the object + allows a single method call inside of a check for the object with an else + does not lose comments within if expression + registers an offense for a single method call with a block inside of an unless nil check for the object + only moves comments that fall within the expression + registers an offense for a single method call with a block inside of a non-nil check for the object + ternary expression + allows ternary expression + respond_to? + allows method calls safeguarded by a respond_to check + allows method calls safeguarded by a respond_to check on adifferent variable and method + allows method calls safeguarded by a respond_to check to a different method + allows method calls safeguarded by a respond_to check on adifferent variable but the same method + allows enumerable accessor method calls safeguarded by a respond_to check + behaves like all variable types + object check before method call + allows a nil object check followed by a method call + allows a non object check followed by a method call + allows a nil object check followed by a method call with params and a block + allows a nil object check followed by a method call with params + allows a non object check followed by a method call with params + allows a non object check followed by a method call with a block + allows a nil object check followed by a method call with a block + allows a non object check followed by a method call with params and a block + ConvertCodeThatCanStartToReturnNil false + allows a non-nil object check followed by a method call with a block + registers an offense for an object check followed by a method call with params + allows a non-nil object check followed by a method call with params + allows a non-nil object check followed by a method call + registers an offense for an object check followed by a method calls that nil responds to + registers an offense for an object check followed by a method call with params and a block + registers an offense for an object check followed by a method call with a block + allows a non-nil object check followed by a method call with params and a block + registers an offense for an object check followed by a method call + registers an offense for a check for the object followed by a method call in the condition for an if expression + method chaining + corrects an object check followed by a chained method call with a symbol proc + corrects an object check followed by a chained method call with params + corrects an object check followed by a chained method call + corrects an object check followed by a chained method call with a block + ConvertCodeThatCanStartToReturnNil true + registers an offense for a non-nil object check followed by a method call with a block + registers an offense for a non-nil object check followed by a method call with params + registers an offense for an object check followed by a method call with params and a block + registers an offense for an object check followed by a method call with a block + registers an offense for a check for the object followed by a method call in the condition for an if expression + registers an offense for a non-nil object check followed by a method call + registers an offense for an object check followed by a method call + registers an offense for a non-nil object check followed by a method call with params and a block + registers an offense for an object check followed by a method call with params + corrects an object check followed by a method call and another check + method chaining + registers an offense for an object check followed by chained method calls with blocks + with Lint/SafeNavigationChain disabled + allows an object check followed by chained method calls + allows an object check followed by chained method calls with blocks + MaxChainLength: 3 + registers an offense for an object check followed by 3 chained method calls + allows an object check followed by 4 chained method calls + MaxChainLength: 1 + registers an offense for an object check followed by 1 chained method calls + allows an object check followed by 2 chained method calls + modifier if + registers an offense for a method call with params safeguarded with a nil check for the object + registers an offense for a method call safeguarded with a nil check for the object + registers an offense for a chained method call safeguarded with a check for the object + registers an offense for a method call safeguarded with a negative nil check for the object + registers an offense for a method call with params safeguarded with a negative nil check for the object + registers an offense for a method call with params safeguarded with a negative check for the object + registers an offense for a method call with params and a block safeguarded with a negative nil check for the object + registers an offense for a method call that nil responds to safe guarded by an object check + registers an offense for a method call on an accessor safeguarded by a check for the accessed variable + registers an offense for a method call with a block safeguarded with a negative nil check for the object + registers an offense when safe guard check and safe navigation method call are connected with `&&` condition + registers an offense for a method call with params safeguarded with a check for the object + registers an offense for a method call with a block safeguarded with a negative check for the object + registers an offense for a method call with params and a block safeguarded with a check for the object + registers an offense for a chained method call safeguarded with an unless nil check for the object + registers an offense for a method call with params and a block safeguarded with a negative check for the object + registers an offense for an object check followed by a method call with a comment at EOL + registers an offense for a method call safeguarded with a check for the object + registers an offense for a method call with a block safeguarded with a nil check for the object + registers an offense for a chained method call safeguarded with a negative nil check for the object + registers an offense for a method call with params and a block safeguarded with a nil check for the object + registers an offense for a method call safeguarded with a negative check for the object + registers an offense for a method call with a block safeguarded with a check for the object + behaves like safe guarding logical break keywords + allows a method call being passed to break safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to next safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to return safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to raise safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to fail safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to yield safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to throw safe guarded by an object check + if expression + registers an offense for a single method call with params inside of an unless negative check for the object + registers an offense for a single method call with a block inside of an unless negative check for the object + registers an offense for a single method call with params and a block inside of an unless negative check for the object + registers an offense for a single method call inside of an unless negative check for the object + allows a single method call inside of a check for the object with an else + registers an offense for a single method call with params and a block inside of an unless nil check for the object + registers an offense for a single method call with a block inside of a check for the object + registers an offense for a single method call with params and a block inside of a non-nil check for the object + registers an offense for a single method call with a block inside of a non-nil check for the object + does not lose comments within if expression + registers an offense for a single method call with params inside of a non-nil check for the object + only moves comments that fall within the expression + registers an offense for a single method call inside of an unless nil check for the object + registers an offense for a single method call with params and a block inside of a check for the object + registers an offense for a single method call inside of a check for the object + registers an offense for a single method call with a block inside of an unless nil check for the object + registers an offense for a single method call with params inside of a check for the object + registers an offense for a single method call with params inside of an unless nil check for the object + registers an offense for a single method call inside of a non-nil check for the object + ternary expression + allows ternary expression + behaves like all variable types + modifier if + registers an offense for a method call on an accessor safeguarded by a check for the accessed variable + registers an offense for a chained method call safeguarded with a check for the object + registers an offense when safe guard check and safe navigation method call are connected with `&&` condition + registers an offense for a method call with params and a block safeguarded with a check for the object + registers an offense for a chained method call safeguarded with an unless nil check for the object + registers an offense for a method call with params safeguarded with a check for the object + registers an offense for a method call with params safeguarded with a nil check for the object + registers an offense for a method call with a block safeguarded with a check for the object + registers an offense for a method call safeguarded with a check for the object + registers an offense for a method call with a block safeguarded with a negative check for the object + registers an offense for a method call with params safeguarded with a negative nil check for the object + registers an offense for an object check followed by a method call with a comment at EOL + registers an offense for a method call with params and a block safeguarded with a nil check for the object + registers an offense for a method call with a block safeguarded with a negative nil check for the object + registers an offense for a method call with a block safeguarded with a nil check for the object + registers an offense for a method call safeguarded with a negative check for the object + registers an offense for a method call with params and a block safeguarded with a negative check for the object + registers an offense for a chained method call safeguarded with a negative nil check for the object + registers an offense for a method call with params and a block safeguarded with a negative nil check for the object + registers an offense for a method call safeguarded with a nil check for the object + registers an offense for a method call safeguarded with a negative nil check for the object + registers an offense for a method call with params safeguarded with a negative check for the object + registers an offense for a method call that nil responds to safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to return safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to fail safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to yield safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to next safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to break safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to throw safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to raise safe guarded by an object check + if expression + allows a single method call inside of a check for the object with an else + registers an offense for a single method call with params inside of an unless negative check for the object + registers an offense for a single method call with a block inside of a non-nil check for the object + registers an offense for a single method call with params and a block inside of a non-nil check for the object + registers an offense for a single method call with params inside of a non-nil check for the object + registers an offense for a single method call with params and a block inside of an unless nil check for the object + registers an offense for a single method call inside of an unless nil check for the object + does not lose comments within if expression + registers an offense for a single method call with a block inside of a check for the object + registers an offense for a single method call with params inside of an unless nil check for the object + registers an offense for a single method call inside of a check for the object + registers an offense for a single method call with a block inside of an unless negative check for the object + registers an offense for a single method call with params and a block inside of an unless negative check for the object + registers an offense for a single method call with a block inside of an unless nil check for the object + registers an offense for a single method call with params and a block inside of a check for the object + registers an offense for a single method call with params inside of a check for the object + only moves comments that fall within the expression + registers an offense for a single method call inside of an unless negative check for the object + registers an offense for a single method call inside of a non-nil check for the object + ternary expression + allows ternary expression + object check before method call + allows a non object check followed by a method call with params + allows a non object check followed by a method call + allows a nil object check followed by a method call with params and a block + allows a non object check followed by a method call with params and a block + allows a nil object check followed by a method call with params + allows a non object check followed by a method call with a block + allows a nil object check followed by a method call + allows a nil object check followed by a method call with a block + ConvertCodeThatCanStartToReturnNil false + registers an offense for an object check followed by a method calls that nil responds to + registers an offense for a check for the object followed by a method call in the condition for an if expression + registers an offense for an object check followed by a method call + registers an offense for an object check followed by a method call with params and a block + registers an offense for an object check followed by a method call with a block + allows a non-nil object check followed by a method call with params and a block + allows a non-nil object check followed by a method call with a block + allows a non-nil object check followed by a method call + registers an offense for an object check followed by a method call with params + allows a non-nil object check followed by a method call with params + method chaining + corrects an object check followed by a chained method call with a block + corrects an object check followed by a chained method call with params + corrects an object check followed by a chained method call with a symbol proc + corrects an object check followed by a chained method call + ConvertCodeThatCanStartToReturnNil true + registers an offense for a non-nil object check followed by a method call with params and a block + registers an offense for a non-nil object check followed by a method call + registers an offense for an object check followed by a method call + registers an offense for a check for the object followed by a method call in the condition for an if expression + registers an offense for an object check followed by a method call with params and a block + registers an offense for a non-nil object check followed by a method call with params + corrects an object check followed by a method call and another check + registers an offense for an object check followed by a method call with params + registers an offense for a non-nil object check followed by a method call with a block + registers an offense for an object check followed by a method call with a block + method chaining + registers an offense for an object check followed by chained method calls with blocks + MaxChainLength: 3 + registers an offense for an object check followed by 3 chained method calls + allows an object check followed by 4 chained method calls + MaxChainLength: 1 + registers an offense for an object check followed by 1 chained method calls + allows an object check followed by 2 chained method calls + with Lint/SafeNavigationChain disabled + allows an object check followed by chained method calls + allows an object check followed by chained method calls with blocks + behaves like all variable types + modifier if + registers an offense for a method call with a block safeguarded with a check for the object + registers an offense for a chained method call safeguarded with a negative nil check for the object + registers an offense for a method call with a block safeguarded with a negative check for the object + registers an offense for a method call with params safeguarded with a nil check for the object + registers an offense for a method call safeguarded with a negative nil check for the object + registers an offense for a method call with params and a block safeguarded with a check for the object + registers an offense for a chained method call safeguarded with a check for the object + registers an offense when safe guard check and safe navigation method call are connected with `&&` condition + registers an offense for a method call with params and a block safeguarded with a negative check for the object + registers an offense for an object check followed by a method call with a comment at EOL + registers an offense for a method call safeguarded with a nil check for the object + registers an offense for a method call with params and a block safeguarded with a nil check for the object + registers an offense for a method call with a block safeguarded with a negative nil check for the object + registers an offense for a method call that nil responds to safe guarded by an object check + registers an offense for a method call safeguarded with a check for the object + registers an offense for a method call with params safeguarded with a negative check for the object + registers an offense for a method call with a block safeguarded with a nil check for the object + registers an offense for a chained method call safeguarded with an unless nil check for the object + registers an offense for a method call with params safeguarded with a check for the object + registers an offense for a method call safeguarded with a negative check for the object + registers an offense for a method call on an accessor safeguarded by a check for the accessed variable + registers an offense for a method call with params safeguarded with a negative nil check for the object + registers an offense for a method call with params and a block safeguarded with a negative nil check for the object + behaves like safe guarding logical break keywords + allows a method call being passed to yield safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to fail safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to raise safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to next safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to return safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to break safe guarded by an object check + behaves like safe guarding logical break keywords + allows a method call being passed to throw safe guarded by an object check + if expression + registers an offense for a single method call with a block inside of an unless negative check for the object + registers an offense for a single method call with params inside of an unless nil check for the object + registers an offense for a single method call with params inside of an unless negative check for the object + allows a single method call inside of a check for the object with an else + registers an offense for a single method call inside of an unless negative check for the object + registers an offense for a single method call with params inside of a non-nil check for the object + registers an offense for a single method call with params inside of a check for the object + registers an offense for a single method call with params and a block inside of a non-nil check for the object + only moves comments that fall within the expression + does not lose comments within if expression + registers an offense for a single method call inside of a check for the object + registers an offense for a single method call with params and a block inside of an unless negative check for the object + registers an offense for a single method call inside of an unless nil check for the object + registers an offense for a single method call inside of a non-nil check for the object + registers an offense for a single method call with a block inside of an unless nil check for the object + registers an offense for a single method call with a block inside of a non-nil check for the object + registers an offense for a single method call with params and a block inside of an unless nil check for the object + registers an offense for a single method call with params and a block inside of a check for the object + registers an offense for a single method call with a block inside of a check for the object + ternary expression + allows ternary expression + object check before method call + allows a non object check followed by a method call + allows a nil object check followed by a method call with a block + allows a non object check followed by a method call with params + allows a non object check followed by a method call with a block + allows a non object check followed by a method call with params and a block + allows a nil object check followed by a method call + allows a nil object check followed by a method call with params and a block + allows a nil object check followed by a method call with params + ConvertCodeThatCanStartToReturnNil true + registers an offense for a non-nil object check followed by a method call with a block + registers an offense for an object check followed by a method call with a block + registers an offense for a non-nil object check followed by a method call with params and a block + registers an offense for an object check followed by a method call + registers an offense for a non-nil object check followed by a method call with params + registers an offense for a check for the object followed by a method call in the condition for an if expression + corrects an object check followed by a method call and another check + registers an offense for a non-nil object check followed by a method call + registers an offense for an object check followed by a method call with params and a block + registers an offense for an object check followed by a method call with params + method chaining + registers an offense for an object check followed by chained method calls with blocks + with Lint/SafeNavigationChain disabled + allows an object check followed by chained method calls with blocks + allows an object check followed by chained method calls + MaxChainLength: 3 + registers an offense for an object check followed by 3 chained method calls + allows an object check followed by 4 chained method calls + MaxChainLength: 1 + registers an offense for an object check followed by 1 chained method calls + allows an object check followed by 2 chained method calls + ConvertCodeThatCanStartToReturnNil false + registers an offense for an object check followed by a method call with a block + registers an offense for an object check followed by a method calls that nil responds to + registers an offense for an object check followed by a method call + registers an offense for an object check followed by a method call with params and a block + registers an offense for a check for the object followed by a method call in the condition for an if expression + allows a non-nil object check followed by a method call + registers an offense for an object check followed by a method call with params + allows a non-nil object check followed by a method call with a block + allows a non-nil object check followed by a method call with params and a block + allows a non-nil object check followed by a method call with params + method chaining + corrects an object check followed by a chained method call + corrects an object check followed by a chained method call with a symbol proc + corrects an object check followed by a chained method call with a block + corrects an object check followed by a chained method call with params + +RuboCop::Cop::Utils::FormatString + finds the correct number of fields + #valid? + returns true when there are only named formats + returns true when there are only numbered formats + returns false when there are unnumbered and numbered formats + returns true when there are only named with escaped `%` formats + returns false when there are numbered and named formats + returns false when there are unnumbered and named formats + returns true when there are only unnumbered formats + #named_interpolation? + behaves like named format sequence + does not detect escaped named format sequence + detects named format sequence + behaves like named format sequence + detects named format sequence + does not detect escaped named format sequence + behaves like named format sequence + detects named format sequence + does not detect escaped named format sequence + behaves like named format sequence + detects named format sequence + does not detect escaped named format sequence + +RuboCop::Cop::Lint::AmbiguousOperatorPrecedence + does not register an offense when expressions are wrapped in parentheses by reverse precedence + does not register an offense when all operators in the expression have the same precedence + registers an offense when the entire expression is wrapped in parentheses + does not register an offense when boolean expressions are wrapped in parens + does not register an offense when expressions are wrapped in parentheses by precedence + registers an offense for expressions containing booleans and operators + allows an operator with `or` + corrects a super long expression in precedence order + registers an offense when an expression with mixed boolean operators has no parens + allows an operator with `and` + does not register an offense when there is only one operator in the expression + corrects a super long expression in reverse precedence order + registers an offense when an expression with mixed precedence has no parens + +RuboCop::Cop::Layout::SingleLineBlockChain + does not register an offense for method call chained on the same line as a multiline block + does not register an offense for method call chained without a dot + does not register an offense for method call chained on a new line after a single line block + registers an offense for no selector method call chained on the same line as a block + does not register an offense for method call chained on a new line after a single line block with trailing dot + registers an offense for method call chained on the same line as a block + +RuboCop::Cop::Style::IdenticalConditionalBranches + on if..else with identical trailing lines + registers and corrects an offense + on if..else with identical bodies and assigning to a variable used in `if` condition + doesn't register an offense + on case with empty when + doesn't register an offense + on case..when with identical bodies and assigning to a variable used in `case` condition + doesn't register an offense + when using pattern matching + on case-match with identical trailing lines + registers and corrects an offense + on case-match with identical leading lines + registers and corrects an offense + on case-match with identical bodies + registers an offense and corrects + on case..in with identical bodies and assigning to a variable used in `case` condition + doesn't register an offense + on case-match without else + doesn't register an offense + on case-match with empty when + doesn't register an offense + when one of the case-match branches is empty + does not register an offense + on if..else with identical leading lines + registers and corrects an offense + with a ternary + registers an offense + on case with identical leading lines + registers and corrects an offense + on if..elsif with no else + doesn't register an offense + with empty brace + does not raise any error + on if..else with identical bodies + registers and corrects an offense + on case with identical bodies + registers an offense and corrects + on case without else + doesn't register an offense + on if..else with slightly different trailing lines + doesn't register an offense + on case with identical trailing lines + registers and corrects an offense + when one of the case branches is empty + does not register an offense + +RuboCop::Cop::Lint::ScriptPermission + with stdin + skips investigation + with file permission 0755 + accepts with shebang line + accepts with blank + accepts without shebang line + with file permission 0644 + registers an offense for script permission + if autocorrection is off + leaves the file intact + +RuboCop::Cop::Style::HashAsLastArrayItem + when EnforcedStyle is braces + does not register an offense when the array is all hashes + does not register an offense when hash is not inside array + does not register an offense when the hash is empty + does not register an offense when hash with braces + does not register an offense when using double splat operator + registers an offense and corrects when hash without braces + when EnforcedStyle is no_braces + does not register an offense when the array is all hashes + does not register an offense when passing an implicit array to a setter + does not register an offense when hash is not the last element + registers an offense and corrects when hash with braces and trailing comma and new line + does not register an offense when hash without braces + does not register an offense when hash is not inside array + registers an offense and corrects when hash with braces and trailing comma + does not register an offense when the hash is empty + registers an offense and corrects when hash with braces + +RuboCop::Cop::Style::BlockDelimiters + BracesRequiredMethods + other methods + allows braces + autocorrects { and } to do and end + BracesRequiredMethods methods + allows braces + registers an offense with do + EnforcedStyle: semantic + registers an offense for a multi-line block with do-end if the return value is passed to a method + registers an offense for a multi-line block with do-end if the return value is attribute-assigned + accepts a multi-line block with do-end if it is the return value of its scope + accepts a multi-line block with braces when chained + accepts a multi-line functional block with do-end if it is an ignored method by regex + accepts a single line block with {} if used in a logical and + accepts a multi-line block with braces if it is the return value of its scope + accepts a multi-line functional block with do-end if it is a known procedural method + accepts a single line block with {} followed by a safe navigation method call + registers an offense for a multi-line block with braces if the return value is not used + accepts a multi-line block with braces if the return value is assigned + accepts a single line block with {} if used in an irange + autocorrects do-end to {} with appropriate spacing + accepts a single line block with {} if used in an array + accepts a single line block with {} if used in a logical or + accepts a multi-line block with braces when passed to a known functional method + autocorrects do-end with `rescue` to {} if it is a functional block + allows {} if it is a known functional method + autocorrects do-end with `ensure` to {} if it is a functional block + accepts a single line block with {} if used in an erange + accepts a multi-line block with braces when passed to a method + accepts a multi-line functional block with do-end if it is an ignored method + registers an offense for a multi-line block with do-end if the return value is assigned + autocorrects do-end to {} if it is a functional block and does not change the meaning + autocorrects do-end to {} if it is a functional block + allows {} if it is a known procedural method + accepts a single line block with {} if used in an if statement + with a procedural one-line block + with AllowBracesOnProceduralOneLiners true + accepts a single line procedural block with braces + accepts a single line procedural do-end block + with AllowBracesOnProceduralOneLiners false or unset + accepts a single line block with do-end if it is procedural + registers an offense for a single line procedural block + with a procedural multi-line block + autocorrects { and } to do and end with appropriate spacing + autocorrects { and } to do and end + EnforcedStyle: always_braces + registers an offense for a multi-line block with do-end + autocorrects do-end with `rescue` to {} if it is a functional block + autocorrects do-end with `ensure` to {} if it is a functional block + accepts a multi-line block that needs braces to be valid ruby + does not autocorrect do-end if {} would change the meaning + accepts a multi-line functional block with do-end if it is an ignored method by regex + registers an offense for multi-lined do-end blocks when combined with attribute assignment + registers an offense for multi-line chained do-end blocks + accepts a multi-line functional block with do-end if it is an ignored method + registers an offense for a single line block with do-end + accepts a single line block with braces + when there are braces around a multi-line block + allows when combined with attribute assignment + allows in the simple case + allows when the block is being chained + EnforcedStyle: braces_for_chaining + accepts a multi-line block that needs braces to be valid ruby + allows do/end inside Hash[] + accepts a multi-line block with do-end + autocorrects do-end with `ensure` to {} if it is a functional block + allows chaining to } inside of Hash[] + accepts a multi-line functional block with {} if it is an ignored method + registers an offense for multi-line chained do-end blocks + accepts a multi-line functional block with {} if it is an ignored method by regex + autocorrects do-end with `rescue` to {} if it is a functional block + allows when :[] is chained + disallows {} with no chain inside of Hash[] + registers an offense for a single line block with do-end + accepts a single line block with braces + Ruby >= 2.7 + accepts a multi-line numblock that needs braces to be valid ruby + accepts a multi-line numblock with do-end + accepts a single line numblock with braces + registers an offense for a single line numblock with do-end + when there are braces around a multi-line block + allows when the block is being chained with attribute assignment + registers an offense when combined with attribute assignment + registers an offense in the simple case + allows when the block is being chained + with safe navigation + registers an offense for multi-line chained do-end blocks + EnforcedStyle: line_count_based + registers an offense for a single line block with do-end + autocorrects do-end for single line blocks to { and } + accepts a multi-line block with do-end + does not autocorrect do-end if {} would change the meaning + does not autocorrect {} if do-end would change the meaning + accepts a single line block with braces + accepts a multi-line block that needs braces to be valid ruby + when there are braces around a multi-line block + registers an offense when there is a comment after the closing brace and block body is empty + accepts a multi-line functional block with {} if it is an ignored method by regex + does not autocorrect {} if do-end would introduce a syntax error + accepts braces if do-end would change the meaning + registers an offense for braces if do-end would not change the meaning + registers an offense and keep chained block when there is a comment after the closing brace and block body is not empty + accepts a multi-line functional block with {} if it is an ignored method + registers an offense in the simple case + autocorrects { and } to do and end + can handle special method names such as []= and done? + registers an offense when there is a comment after the closing brace and block body is not empty + autocorrects adjacent curly braces correctly + registers an offense when combined with attribute assignment + registers an offense when there is a comment after the closing brace and using method chain + with a single line do-end block with an inline `rescue` + autocorrects properly + Ruby >= 2.7 + accepts a multi-line numblock that needs braces to be valid ruby + accepts a multi-line numblock with do-end + registers an offense for a single line numblock with do-end + accepts a single line numblock with braces + +RuboCop::Cop::Layout::SpaceInsideHashLiteralBraces + registers an offense for hashes with no spaces if so configured + registers an offense for correct + opposite + can handle interpolation in a braceless hash literal + accepts hash literals with no braces + accepts hashes with spaces by default + with space inside empty braces allowed + registers an offense for empty braces with no space inside + accepts empty braces with space inside + when using method argument that both key and value are hash literals + registers hashes with no spaces + offending hash following empty hash + registers an offense on both sides + on { key: "{" } + does not register an offense + with newline inside empty braces not allowed + registers an offense + when EnforcedStyle is no_space + accepts multiline hash + registers an offense for opposite + correct + registers an offense for hashes with spaces + accepts hashes with no spaces + accepts multiline hash with comment + when using method argument that both key and value are hash literals + accepts hashes with no spaces + with space inside empty braces not allowed + accepts empty braces with no space inside + registers an offense for empty braces with space inside + on Hash[{ x: 1 } => [1]] + does not register an offense + when EnforcedStyle is compact + registers offenses for hashes with no spaces + doesn't register an offense for non-nested hashes with spaces + registers an offense for opposite + correct + accepts multiline hash with comment + registers an offense for nested hashes with spaces + accepts multiline hash + +RuboCop::Cop::Layout::HeredocArgumentClosingParenthesis + correct cases + accepts simple correct case + accepts double correct case + accepts hash correct case + accepts double correct case nested + accepts method with heredoc argument of proc correct case + accepts correct case with other param before + accepts correct case with other param after + accepts double correct case new line + accepts method chain with heredoc argument correct case + accepts when there is an argument between a heredoc argument and the closing paretheses + invocation after the HEREDOC + ignores random call + ignores random call after + ignores tr + incorrect cases + incorrect case with other param after + detects + nested incorrect case + detects + double incorrect case new line chained calls + detects + incorrect case in array with spaced out comma + detects + incorrect case with other param before constructor + detects + simple incorrect case with call after trailing comma + detects + incorrect case in array with double heredoc and spaced out comma + detects + simple incorrect case comma with spaces and comma in heredoc + detects + simple incorrect case squiggles + detects + double incorrect case + detects + simple incorrect case comma + detects + complex chained incorrect case with multiple calls + detects and fixes the first + incorrect case in array with nested calls and double heredoc and spaced out comma + detects + incorrect case with other param before + detects + double case new line + detects and fixes + simple incorrect case + detects + complex incorrect case with multiple calls + detects and fixes the first + detects and fixes the second + simple incorrect case comma with spaces + detects + incorrect case nested method call with comma + detects + incorrect case with other param before constructor and raise call + detects + simple incorrect case hash + detects + simple incorrect case with call after + detects + +RuboCop::Cop::Layout::ExtraSpacing + when AllowBeforeTrailingComments is + true + allows it + doesn't interfere with AllowForAlignment + being true + such as aligning comments on non-adjacent lines + allows it + such as aligning trailing comments + allows it + such as aligning tokens with empty line between + allows it + such as lining up assignments + allows it + such as aligning = on lines where there are trailing comments + allows it + such as aligning with the same character + allows it + such as aligning long assignment expressions that include line breaks + allows it + such as lining up assignments with empty lines and comments in between + allows it + such as lining up different kinds of assignments + allows it + being false + such as aligning with the same character + registers offense(s) + such as aligning trailing comments + does not register an offense + such as aligning = on lines where there are trailing comments + registers offense(s) + such as lining up assignments + registers offense(s) + such as aligning comments on non-adjacent lines + registers offense(s) + such as lining up different kinds of assignments + registers offense(s) + such as lining up assignments with empty lines and comments in between + registers offense(s) + such as aligning long assignment expressions that include line breaks + registers offense(s) + such as aligning tokens with empty line between + does not register an offense + false + regsiters offense + does not trigger on only one space before comment + when ForceEqualSignAlignment is true + register offenses and correct consecutive attribute assignments which are not aligned + registers an offense and corrects consecutive assignments that are not aligned + does not register an offense if assignments are separated by blanks + does not register alignment errors on outdented lines + does not register an offense when optarg equals is not aligned with assignment equals sign + does not register an offense if assignments are aligned + registers an offense and corrects consecutive aref assignments which are not aligned + register offenses and correct consecutive operator assignments which are not aligned + does not register offenses for multiple complex nested assignments + register offenses and correct complex nested assignments + aligns the first assignment with the following assignment + when AllowForAlignment is false + registers an offense and corrects alignment with token not preceded by space + ignores whitespace inside a string + ignores whitespace at the beginning of the line + accepts aligned values of an implicit hash literal + registers an offense and corrects extra spacing before a unary plus in an argument list + ignores trailing whitespace + registers an offense and corrects double extra spacing in variable assignment + registers an offense and corrects extra space before a float + accepts space between key and value in a hash with hash rockets + registers an offense and corrects extra spacing in class inheritance + when spaces are present in a single-line hash literal + registers an offense and corrects hashes with hash rockets + registers an offense and corrects hashes with symbol keys + with extra spacing for alignment purposes + such as lining up assignments + registers offense(s) + such as lining up assignments with empty lines and comments in between + registers offense(s) + such as aligning comments on non-adjacent lines + registers offense(s) + such as aligning long assignment expressions that include line breaks + registers offense(s) + such as aligning = on lines where there are trailing comments + registers offense(s) + such as aligning tokens with empty line between + registers offense(s) + such as lining up different kinds of assignments + registers offense(s) + such as aligning trailing comments + registers offense(s) + such as aligning with the same character + registers offense(s) + when AllowForAlignment is true + ignores whitespace at the beginning of the line + accepts aligned values of an implicit hash literal + registers an offense and corrects extra spacing in class inheritance + registers an offense and corrects alignment with token not preceded by space + accepts space between key and value in a hash with hash rockets + ignores whitespace inside a string + registers an offense and corrects extra space before a float + registers an offense and corrects extra spacing before a unary plus in an argument list + registers an offense and corrects double extra spacing in variable assignment + ignores trailing whitespace + with extra spacing for alignment purposes + such as aligning trailing comments + allows it + such as aligning with the same character + allows it + such as aligning comments on non-adjacent lines + allows it + such as lining up different kinds of assignments + allows it + such as lining up assignments + allows it + such as lining up assignments with empty lines and comments in between + allows it + such as aligning = on lines where there are trailing comments + allows it + such as aligning tokens with empty line between + allows it + such as aligning long assignment expressions that include line breaks + allows it + when spaces are present in a single-line hash literal + registers an offense and corrects hashes with hash rockets + registers an offense and corrects hashes with symbol keys + +RuboCop::Cop::Style::QuotedSymbols + configured with `single_quotes` + behaves like enforce single quotes + registers an offense and corrects for an escaped quote within double quotes + accepts single quotes + accepts single quoted symbol with an escaped quote + accepts double quotes with interpolation + registers an offense and corrects for double quotes in hash keys + registers an offense and corrects for double quotes without interpolation + accepts unquoted symbols + accepts double quotes when interpolating a global variable + accepts single quotes with double quotes + accepts single quotes with line breaks + registers an offense and corrects escape characters properly + accepts double quotes when interpolating a class variable + accepts double quotes when unicode control sequence is used + accepts double quotes when interpolating an instance variable + accepts double quotes when control characters are used + accepts double quotes with line breaks + accepts double quotes with some other special symbols + accepts double quotes with escape sequences + accepts double quotes with single quotes + hash with hashrocket style + accepts properly quoted symbols + corrects wrong quotes + configured with `double_quotes` + behaves like enforce double quotes + accepts double quotes with interpolation + accepts double quotes with line breaks + accepts single quotes with double quotes + accepts double quotes with single quotes + registers an offense and corrects for an escaped quote within single quotes + accepts double quotes when interpolating an instance variable + accepts double quotes with escape sequences + accepts double quotes when interpolating a class variable + registers an offense for single quotes + accepts double quotes + accepts unquoted symbols + registers an offense and corrects escape characters properly + accepts double quotes when interpolating a global variable + accepts double quoted symbol with an escaped quote + accepts single quotes with line breaks + hash with hashrocket style + corrects wrong quotes + accepts properly quoted symbols + configured with `same_as_string_literals` + when Style/StringLiterals is configured with single_quotes + behaves like enforce single quotes + accepts double quotes with line breaks + accepts double quotes when interpolating a class variable + accepts double quotes when interpolating a global variable + accepts double quotes with some other special symbols + accepts double quotes with escape sequences + accepts single quotes with double quotes + accepts double quotes with interpolation + accepts single quoted symbol with an escaped quote + accepts double quotes when interpolating an instance variable + registers an offense and corrects for double quotes without interpolation + accepts single quotes with line breaks + accepts unquoted symbols + registers an offense and corrects for an escaped quote within double quotes + registers an offense and corrects escape characters properly + accepts double quotes when unicode control sequence is used + registers an offense and corrects for double quotes in hash keys + accepts double quotes when control characters are used + accepts double quotes with single quotes + accepts single quotes + hash with hashrocket style + corrects wrong quotes + accepts properly quoted symbols + when Style/StringLiterals is configured with double_quotes + behaves like enforce double quotes + accepts double quotes with line breaks + accepts double quotes when interpolating a global variable + accepts single quotes with line breaks + accepts double quotes with escape sequences + registers an offense for single quotes + accepts double quotes when interpolating an instance variable + registers an offense and corrects escape characters properly + accepts double quotes + accepts double quotes when interpolating a class variable + accepts double quotes with single quotes + registers an offense and corrects for an escaped quote within single quotes + accepts double quoted symbol with an escaped quote + accepts unquoted symbols + accepts single quotes with double quotes + accepts double quotes with interpolation + hash with hashrocket style + accepts properly quoted symbols + corrects wrong quotes + when Style/StringLiterals is disabled + behaves like enforce single quotes + accepts double quotes with single quotes + accepts double quotes when unicode control sequence is used + registers an offense and corrects for double quotes without interpolation + registers an offense and corrects for an escaped quote within double quotes + accepts double quotes with some other special symbols + accepts double quotes with interpolation + accepts double quotes when interpolating an instance variable + accepts single quoted symbol with an escaped quote + accepts double quotes when interpolating a class variable + registers an offense and corrects for double quotes in hash keys + accepts double quotes when interpolating a global variable + accepts double quotes when control characters are used + accepts single quotes + accepts double quotes with line breaks + registers an offense and corrects escape characters properly + accepts unquoted symbols + accepts single quotes with line breaks + accepts single quotes with double quotes + accepts double quotes with escape sequences + hash with hashrocket style + corrects wrong quotes + accepts properly quoted symbols + +RuboCop::Cop::Style::Not + parenthesizes when `not` is applied to a ternary op + parenthesizes when `not` is applied to or + registers an offense for not + uses the reverse operator when `not` is applied to a comparison + parenthesizes when `not` is applied to and + does not register an offense for ! + parenthesizes when `not` would change the meaning of a binary exp + autocorrects "not" with ! + autocorrects "not" followed by parens with ! + +RuboCop::Cop::Style::VariableInterpolation + registers an offense for interpolated regexp nth back references + registers an offense for interpolated global variables in symbol + registers an offense for interpolated regexp back references + registers an offense for interpolated global variables in string + registers an offense for interpolated class variables + does not register an offense for variables in expressions + registers an offense for interpolated global variables in regexp + registers an offense for interpolated instance variables + registers an offense for interpolated global variables in backticks + +RuboCop::Formatter::TapFormatter + #finished + when any offenses are detected + reports all detected offenses for all failed files + when no offenses are detected + does not report offenses + #report_file + when the source contains multibyte characters + displays text containing the offending source line + #file_finished + when any offenses are detected + prints "not ok" + when no offenses are detected + prints "ok" + +RuboCop::Cop::Style::StringLiteralsInInterpolation + configured with double quotes preferred + registers an offense for single quotes within embedded expression + registers an offense for single quotes within embedded expression in a heredoc string + when configured with a bad value + fails + configured with single quotes preferred + accepts double quotes on a static string + can handle a built-in constant parsed as string + accepts double quotes on static strings within a method + can handle character literals + registers an offense for double quotes within embedded expression in a heredoc string + accepts double quotes on a broken static string + registers an offense for double quotes within embedded expression + +RuboCop::Cop::Layout::CommentIndentation + when allow_for_alignment is true + accepts comments with extra indentation if aligned with comment on previous line + registers offenses and corrects before __END__ but not after + registers an offense and corrects + near various kinds of brackets + is unaffected by closing bracket that does not begin a line + accepts correctly indented comments + around program structure keywords + accepts correctly indented comments + with a blank line following the comment + accepts a correctly indented comment + on outer level + registers an offense and corrects an incorrectly indented (1) comment + registers an offense and corrects an incorrectly indented (2) comment + accepts a comment that follows code + registers an offense for each incorrectly indented comment + accepts a correctly indented comment + registers an offense and corrects a documentation comment + when allow_for_alignment is false + registers offenses and corrects before __END__ but not after + registers an offense and corrects + registers an offense for comments with extra indentation + on outer level + registers an offense and corrects an incorrectly indented (1) comment + registers an offense and corrects a documentation comment + registers an offense and corrects an incorrectly indented (2) comment + registers an offense for each incorrectly indented comment + accepts a comment that follows code + accepts a correctly indented comment + near various kinds of brackets + is unaffected by closing bracket that does not begin a line + accepts correctly indented comments + around program structure keywords + accepts correctly indented comments + with a blank line following the comment + accepts a correctly indented comment + +RuboCop::Cop::Lint::Void + accepts void op == by itself without a begin block + accepts void op - if on last line + registers an offense for void op % if not on last line + accepts void op != if on last line + registers an offense for void var @var if not on last line + registers an offense for void op != if not on last line + accepts void op <=> if on last line + accepts percent-x commands + registers an offense for void literal in a method definition + registers an offense for void op < if not on last line + accepts void op * by itself without a begin block + accepts void unary op - by itself without a begin block + accepts void op == if on last line + accepts method with irange block + registers an offense for void op + if not on last line + registers an offense for void op <=> if not on last line + accepts void op % by itself without a begin block + registers an offense for void sign op + if not on last line + accepts backtick commands + accepts void op / by itself without a begin block + accepts void op > by itself without a begin block + accepts void op < if on last line + accepts void op / if on last line + accepts void op * if on last line + accepts method with erange block + registers an offense for void unary op ! if not on last line + accepts empty block + accepts void op <=> by itself without a begin block + accepts void op % if on last line + registers an offense for void op - if not on last line + accepts void op >= if on last line + registers an offense for void lit /test/ if not on last line + registers an offense for void op / if not on last line + accepts void op >= by itself without a begin block + accepts void op < by itself without a begin block + accepts void op + if on last line + registers an offense for void op > if not on last line + registers an offense for void op === if not on last line + registers an offense for void `defined?` if not on last line + registers an offense for void op <= if not on last line + accepts void op - by itself without a begin block + accepts void unary op ! if on last line + registers two offenses for void literals in a `#each` method + accepts void op > if on last line + registers an offense for void var VAR if not on last line + registers two offenses for void literals in an initialize method + registers an offense for void op == if not on last line + registers two offenses for void literals in a setter method + accepts void unary op ! by itself without a begin block + accepts void unary op ~ by itself without a begin block + accepts void op != by itself without a begin block + accepts void unary op + by itself without a begin block + accepts void op <= by itself without a begin block + registers an offense for void lit 1 if not on last line + registers an offense for void op >= if not on last line + accepts void op === if on last line + registers an offense for void var @@var if not on last line + registers an offense for void lit 2.0 if not on last line + accepts void unary op - if on last line + registers an offense for void lit :test if not on last line + registers an offense for void op * if not on last line + accepts void unary op ~ if on last line + accepts void op + by itself without a begin block + registers an offense for void lit {} if not on last line + registers an offense for void lit [1] if not on last line + registers an offense for void unary op ~ if not on last line + accepts void op === by itself without a begin block + handles explicit begin blocks + accepts short call syntax + handles `#each` block with single expression + registers two offenses for void literals in a `for` + registers an offense for void var var if not on last line + registers an offense for void var $var if not on last line + registers an offense for void sign op - if not on last line + registers an offense for void `self` if not on last line + accepts void unary op + if on last line + accepts void op <= if on last line + registers two offenses for void literals in `#tap` method + when not checking for methods with no side effects + does not register an offense for void nonmutating methods + Ruby 2.7 + registers two offenses for void literals in `#tap` method + when checking for methods with no side effects + registers an offense for chained methods + registers an offense if not on last line + +RuboCop::Cop::Lint::SafeNavigationWithEmpty + in a conditional + registers an offense and corrects on `&.empty?` + does not register an offense on `.empty?` + outside a conditional + registers no offense + +RuboCop::Cop::Metrics::PerceivedComplexity + when Max is 1 + counts else in a case with no argument + registers an offense for a case/when block + registers an offense for and + registers an offense for or + accepts an empty `define_method` + accepts a method with no decision points + counts only a single method + registers an offense for a case/when block without an expression after case + accepts an empty method + registers an offense for elsif and else blocks + registers an offense for an if modifier + accepts complex code outside of methods + deals with nested if blocks containing && and || + registers an offense for a `define_method` + registers an offense for a ternary operator + does not count unknown block calls + registers an offense for a rescue block + registers an offense for && + registers an offense for a for block + registers an offense for || + registers an offense for an unless modifier + counts known iterating block + registers an offense for an until block + registers an offense for a while block + when AllowedMethods is enabled + does not register an offense when defining a class method + does not register an offense when using `define_method` + does not register an offense when defining an instance method + when AllowedPatterns is enabled + does not register an offense when defining an instance method + does not register an offense when defining a class method + does not register an offense when using `define_method` + when Max is 2 + counts stupid nested if and else blocks + +RuboCop::Formatter::Colorizable + #white + invokes #colorize(string, white + #colorize + when the global Rainbow.enabled is false + and the formatter's output is not a tty + does nothing + and the formatter's output is a tty + does nothing + when the global Rainbow.enabled is true + and the formatter's output is a tty + colorizes the passed string + and the formatter's output is not a tty + does nothing + and output is not a tty, but --color option was provided + colorizes the passed string + #magenta + invokes #colorize(string, magenta + #black + invokes #colorize(string, black + #yellow + invokes #colorize(string, yellow + #green + invokes #colorize(string, green + #blue + invokes #colorize(string, blue + #red + invokes #colorize(string, red + #cyan + invokes #colorize(string, cyan + +RuboCop::Cop::Layout::MultilineAssignmentLayout + new_line style + allows multi-line assignments on separate lines + registers an offense when the rhs is on the same line + registers an offense when the rhs is on the same line in setters + registers an offense when the rhs is on the same line in []= + registers an offense for masgn with multi-line lhs + ignores arrays + configured supported types + allows supported types to be configured + when supported types is block + registers an offense when multi-line assignments using block definition is on the same line + allows multi-line block defines on separate lines + allows multi-line assignments when using block definition on separate lines + allows multi-line assignments when using shovel operator + same_line style + ignores arrays + allows multi-line assignments on the same line + registers an offense when the rhs is a different line in []= + registers an offense for masgn with multi-line lhs + registers an offense when the rhs is a different line in setters + registers an offense when the rhs is a different line + when supported types is block + allows multi-line assignments when using shovel operator + allows multi-line block defines on separate lines + registers an offense when multi-line assignments using block definition on separate lines + allows when multi-line assignments using block definition is on the same line + configured supported types + allows supported types to be configured + +RuboCop::Cop::Style::RedundantRegexpEscape + with a single-line %r!! regexp + with escaped delimiters inside a character-class + does not register an offense + without escapes + does not register an offense + with escaped delimiters outside a character-class + does not register an offense + with escaped delimiters and regexp options + does not register an offense + with a single-line %r@@ regexp + with escaped delimiters inside a character-class + does not register an offense + with escaped delimiters outside a character-class + does not register an offense + with escaped delimiters and regexp options + does not register an offense + without escapes + does not register an offense + with a single-line %r__ regexp + with escaped delimiters inside a character-class + does not register an offense + with escaped delimiters and regexp options + does not register an offense + without escapes + does not register an offense + with escaped delimiters outside a character-class + does not register an offense + with a single-line %r{} regexp + with redundantly-escaped slashes + registers an offense and corrects + without escapes + does not register an offense + with an escaped { or } outside a character class + does not register an offense + with an escaped { or } inside a character class + does not register an offense + with a multi-line %r// regexp + with escaped slashes + does not register an offense + without escapes + does not register an offense + with a single-line %r^^ regexp + with escaped delimiters and regexp options + does not register an offense + with escaped delimiters inside a character-class + does not register an offense + without escapes + does not register an offense + with escaped delimiters outside a character-class + does not register an offense + with a single-line `//` regexp + with an escaped ']' inside a character class + does not register an offense + with an escaped 't' outside a character class + does not register an offense + with an escaped 'b' inside a character class + does not register an offense + with an escaped '+' inside a character class inside a group + registers an offense and corrects + with an escaped 'W' inside a character class + does not register an offense + with an escaped 'x41' outside a character class + does not register an offense + with an escaped 'u0041' outside a character class + does not register an offense + with an escaped 'O' outside a character class + does not register an offense + with an escaped 'K' outside a character class + does not register an offense + with an escape inside an interpolated string + does not register an offense + with an escaped 'P{alpha}' outside a character class + does not register an offense + with a backreference + does not register an offense + with an escaped 'a' inside a character class + does not register an offense + with an escaped 'C-c' outside a character class + does not register an offense + with an escaped 'K' inside a character class + does not register an offense + with an escaped 'V' inside a character class + does not register an offense + with an escaped 'm' outside a character class + does not register an offense + with an escaped 'B' outside a character class + does not register an offense + with an escaped 'J' inside a character class + does not register an offense + with an escaped 'z' inside a character class + does not register an offense + with an escaped 'Z' outside a character class + does not register an offense + with an escaped 'T' inside a character class + does not register an offense + with an escaped character class and following escaped char + does not register an offense + with an escaped 'A' inside a character class + does not register an offense + with an escaped 'q' inside a character class + does not register an offense + with an escaped 'G' inside a character class + does not register an offense + with an escaped 'h' inside a character class + does not register an offense + with an escaped 'cc' outside a character class + does not register an offense + with an escaped 'D' outside a character class + does not register an offense + with an uppercase metacharacter outside a character class + does not register an offense + with an escaped 'f' inside a character class + does not register an offense + with an escaped 'Q' inside a character class + does not register an offense + with an escaped '?' outside a character class + does not register an offense + with an escaped 'e' outside a character class + does not register an offense + with an escaped 'r' outside a character class + does not register an offense + with an escaped 'l' outside a character class + does not register an offense + with an escaped 'Y' inside a character class + does not register an offense + with an escaped 'l' inside a character class + does not register an offense + with an escaped interpolation inside a character class + does not register an offense + with an escaped 'U' outside a character class + does not register an offense + with an escaped 'v' outside a character class + does not register an offense + with an escaped 'E' outside a character class + does not register an offense + with an escaped 'y' outside a character class + does not register an offense + with an escaped '.' outside a character class + does not register an offense + with an escaped 'i' outside a character class + does not register an offense + with an escaped 'B' inside a character class + does not register an offense + with an escaped 'X' inside a character class + does not register an offense + with an uppercase metacharacter inside a character class + does not register an offense + with an escaped 'J' outside a character class + does not register an offense + with an escaped ' ' inside a character class + does not register an offense + with an escaped ')' outside a character class + does not register an offense + with an escaped 'L' inside a character class + does not register an offense + with an escaped '|' inside a character class + registers an offense and corrects + with an escaped '{' inside a character class + registers an offense and corrects + with an escaped 'P{alpha}' inside a character class + does not register an offense + with an escaped 'v' inside a character class + does not register an offense + with an escaped 'z' outside a character class + does not register an offense + with an escaped 'p{alpha}' inside a character class + does not register an offense + with an escaped 'H' inside a character class + does not register an offense + with an escaped '(' outside a character class + does not register an offense + with an escaped '.' inside a character class + registers an offense and corrects + with an escaped 'M-a' outside a character class + does not register an offense + with an escaped 'M-a' inside a character class + does not register an offense + with an escaped '*' outside a character class + does not register an offense + with an escaped '-' inside a character class + registers an offense and corrects + with an escaped '#' outside a character class + does not register an offense + with an escaped 'j' inside a character class + does not register an offense + with an escaped 'N' inside a character class + does not register an offense + with a nested character class then allowed escape + does not register an offense + with an escaped '}' inside a character class + registers an offense and corrects + with a free-spaced mode regex + with a commented [ and ] + does not register an offense + with a commented redundant escape on a single line + does not register an offense + with a commented redundant escape + does not register an offense + with redundant escape preceded by an escaped comment + registers offenses and corrects + with an escaped 'e' inside a character class + does not register an offense + with a character class and following escaped char + does not register an offense + with an escaped . inside a character class beginning with : + registers an offense and corrects + with an escaped '|' outside a character class + does not register an offense + with an escaped 'd' outside a character class + does not register an offense + with an escaped 'N' outside a character class + does not register an offense + with an escaped 'f' outside a character class + does not register an offense + with an escaped 's' inside a character class + does not register an offense + with regexp options and a redundant escape + registers offenses and corrects + with an escaped 'd' inside a character class + does not register an offense + with an escaped 'D' inside a character class + does not register an offense + with an escaped 'I' inside a character class + does not register an offense + with an escaped '\' outside a character class + does not register an offense + with an escaped 'o' outside a character class + does not register an offense + with an escaped 't' inside a character class + does not register an offense + with an escaped 'F' outside a character class + does not register an offense + with an escaped '-' character being the last character inside a character class + registers an offense and corrects + with an escaped 'n101' outside a character class + does not register an offense + with an escaped 'S' outside a character class + does not register an offense + with an escaped '$' inside a character class + registers an offense and corrects + with an escaped 'n101' inside a character class + does not register an offense + with an escaped 'w' inside a character class + does not register an offense + with an escaped '-' character being the first character inside a character class + registers an offense and corrects + with an escaped 'O' inside a character class + does not register an offense + with an escaped interpolation outside a character class + does not register an offense + with an escaped ']' outside a character class + does not register an offense + with an escaped 'R' outside a character class + does not register an offense + with an escaped 'C-c' inside a character class + does not register an offense + with an escaped '}' outside a character class + does not register an offense + with a POSIX character class then disallowed escape inside a character class + registers an offense and corrects + with an escaped 'R' inside a character class + does not register an offense + with an escaped '[' outside a character class + does not register an offense + with an escaped 'L' outside a character class + does not register an offense + with an escaped 'h' outside a character class + does not register an offense + with an escaped '?' inside a character class + registers an offense and corrects + with an escaped '^' outside a character class + does not register an offense + with an escaped 'Z' inside a character class + does not register an offense + with an escaped '+' outside a character class + does not register an offense + with an interpolated unnecessary-escape regexp + registers an offense and corrects + with an escaped 's' outside a character class + does not register an offense + with an escaped 'Y' outside a character class + does not register an offense + with an escaped 'p{alpha}' outside a character class + does not register an offense + with an invalid g escape + does not register an offense + with multiple escaped metachars inside a character class + registers offenses and corrects + with an escaped 'j' outside a character class + does not register an offense + with an escaped 'u{0041}' inside a character class + does not register an offense + with escaped slashes + does not register an offense + with a POSIX character class then allowed escape inside a character class + does not register an offense + with an escaped 'S' inside a character class + does not register an offense + with a line continuation + does not register an offense + with an escaped 'o' inside a character class + does not register an offense + with an escaped '*' inside a character class + registers an offense and corrects + with an escaped 'cc' inside a character class + does not register an offense + with a line continuation within a character class + does not register an offense + with an escaped 'm' inside a character class + does not register an offense + with an escaped 'A' outside a character class + does not register an offense + without escapes + does not register an offense + with an escaped 'u0041' inside a character class + does not register an offense + with an escaped 'W' outside a character class + does not register an offense + with an escaped 'x41' inside a character class + does not register an offense + with an escaped 'H' outside a character class + does not register an offense + with an escaped 'I' outside a character class + does not register an offense + with an escaped 'T' outside a character class + does not register an offense + with an escaped ' +' outside a character class + does not register an offense + with an escaped 'u{0041}' outside a character class + does not register an offense + with an escaped '\' inside a character class + does not register an offense + with an escaped 'E' inside a character class + does not register an offense + with an escaped 'G' outside a character class + does not register an offense + with an escaped ')' inside a character class + registers an offense and corrects + with an escaped '{' outside a character class + does not register an offense + with an escaped 'X' outside a character class + does not register an offense + with an escaped '^' inside a character class + does not register an offense + with an escaped '$' outside a character class + does not register an offense + with an escaped ' ' outside a character class + does not register an offense + with an escaped 'y' inside a character class + does not register an offense + with a nested character class containing redundant escape + registers an offense and corrects + with an escaped '+' inside a character class + registers an offense and corrects + with an interpolation followed by redundant escapes + registers offenses and corrects + with an escaped 'b' outside a character class + does not register an offense + with an escaped 'F' inside a character class + does not register an offense + with an escaped '[' inside a character class + does not register an offense + with an escaped 'a' outside a character class + does not register an offense + with an escaped 'Q' outside a character class + does not register an offense + with an escaped 'q' outside a character class + does not register an offense + with an escaped 'w' outside a character class + does not register an offense + with an escaped 'U' inside a character class + does not register an offense + with an escaped '(' inside a character class + registers an offense and corrects + with an escaped '-' outside a character class + registers an offense and corrects + with an escaped 'i' inside a character class + does not register an offense + with an escaped 'V' outside a character class + does not register an offense + with an escaped '#' inside a character class + does not register an offense + with an escaped 'r' inside a character class + does not register an offense + with multibyte characters + removes the escape character at the right position + with a multi-line %r{} regexp + with a # inside a character class + does not register an offense + without escapes + does not register an offense + with a redundant escape after a line with comment + registers an offense and corrects + with redundantly-escaped slashes + registers an offense and corrects + with a single-line %r// regexp + without escapes + does not register an offense + with escaped slashes + does not register an offense + with a single-line %r() regexp + with escaped delimiters and regexp options + does not register an offense + without escapes + does not register an offense + with escaped delimiters inside a character-class + does not register an offense + with escaped delimiters outside a character-class + does not register an offense + with a single-line %r<> regexp + with escaped delimiters outside a character-class + does not register an offense + with escaped delimiters inside a character-class + does not register an offense + with escaped delimiters and regexp options + does not register an offense + without escapes + does not register an offense + with a single-line %r~~ regexp + with escaped delimiters outside a character-class + does not register an offense + without escapes + does not register an offense + with escaped delimiters inside a character-class + does not register an offense + with escaped delimiters and regexp options + does not register an offense + +RuboCop::Cop::Lint::RandOne + behaves like no offense + Kernel.rand + does not register an offense + behaves like no offense + rand + does not register an offense + behaves like offenses + Kernel.rand(-1.0) + registers an offense + behaves like no offense + rand(2) + does not register an offense + behaves like no offense + Kernel.rand(-1..1) + does not register an offense + behaves like offenses + Kernel.rand(1) + registers an offense + behaves like offenses + Kernel.rand(-1) + registers an offense + behaves like no offense + Kernel.rand 2 + does not register an offense + behaves like offenses + rand(-1.0) + registers an offense + behaves like no offense + ::Kernel.rand + does not register an offense + behaves like offenses + Kernel.rand 1.0 + registers an offense + behaves like offenses + rand(1.0) + registers an offense + behaves like offenses + rand(-1) + registers an offense + behaves like offenses + rand 1 + registers an offense + behaves like offenses + ::Kernel.rand(1) + registers an offense + behaves like no offense + rand(-1..1) + does not register an offense + +RuboCop::Cop::Lint::MixedRegexpCaptureTypes + does not register offense to a regexp with named capture and non-capturing group + does not register offense to a regexp with named capture only + does not register offense when using a Regexp cannot be processed by regexp_parser gem + does not register offense to a regexp with numbered capture only + registers an offense when both of named and numbered captures are used + when containing a non-regexp literal + does not register an offense when containing a lvar + does not register an offense when containing a constant + does not register an offense when containing a gvar + does not register an offense when containing a method + does not register an offense when containing a cvar + does not register an offense when containing a ivar + +RuboCop::Cop::Style::WordArray + with a custom WordRegex configuration + registers an offense for arrays of email addresses + when the WordRegex configuration is not a Regexp + still parses the code without raising an error + when EnforcedStyle is array + autocorrects a %W() array which uses escapes + autocorrects a %w() array which uses single quotes + doesn't fail on strings which are not valid UTF-8 + autocorrects a %W() array which uses string interpolation + autocorrects a %W() array which uses string with hyphen + registers an offense for an empty %w() array + does not register an offense for arrays of strings with spaces + does not register an offense for arrays of strings with hyphens + autocorrects multiline %w() array + does not register an offense for arrays of double quoted strings + doesn't fail with `encoding: binary + autocorrects a %w() array which uses string with hyphen + does not register an offense for arrays of single quoted strings + registers an offense for a %w() array + with a WordRegex configuration which accepts almost anything + uses %w for strings which only appear to have an escape + uses %W when autocorrecting strings with non-printable chars + with a treacherous WordRegex configuration + doesn't break when words contain whitespace + doesn't break when words contain delimiters + when PreferredDelimiters is specified + autocorrects an array with delimiters + with non-default MinSize + does not autocorrect arrays of one symbol if MinSize > 1 + when EnforcedStyle is percent + registers an offense in a non-ambiguous block context + registers an offense for arrays of strings containing hyphens + does not register an offense for a %w() array containing non word characters + registers an offense for arrays of double quoted strings + does not register an offense for array of non-words + does not register an offense for array starting with %w + autocorrects an array of words in multiple lines + registers an offense for an array with comments outside of it + doesn't fail in wacky ways when multiple cop instances are used + registers an offense for arrays with character constants + does not register an offense for array with empty strings + autocorrects an array of words + autocorrects an array with one element + detects when the cop must be disabled to avoid offenses + does not register offense for array with allowed number of strings + does not register an offense for an array with comments in it + uses %W when autocorrecting strings with embedded newlines and tabs + registers an offense for a %w() array containing spaces + does not register an offense on non-word strings + keeps the line breaks in place after autocorrect + registers an offense for strings with newline and tab escapes + autocorrects an array of words using partial newlines + detects right value of MinSize to use for --auto-gen-config + corrects properly when there is an extra trailing comma + registers an offense for arrays of single quoted strings + autocorrects an array of words and character constants + does not register an offense for array containing non-string + when the default external encoding is UTF-8 + registers an offense for arrays of unicode word characters + when the default external encoding is US-ASCII + registers an offense for arrays of unicode word characters + +RuboCop::Cop::InternalAffairs::OffenseLocationKeyword + does not register an offense when the `loc` is on a different node + does not register an offense when the `loc` is on a child node + when `node.loc.selector` is passed + registers an offense + registers an offense if message argument is passed + +RuboCop::Cop::Layout::FirstParameterIndentation + consistent style + no paren method defs + ignores with hash args + ignores + single line method defs + ignores with hash args + ignores + valid indentation on multi-line defs + accepts correctly indented first element + accepts correctly indented first element hash + invalid indentation on multi-line defs + normal arguments + registers an offense and corrects incorrectly indented first element + hash arguments + registers an offense and corrects incorrectly indented first element + hash arguments static method def + registers an offense and corrects incorrectly indented first element + valid indentation on static multi-line defs + accepts correctly indented first element hash + accepts correctly indented first element + align_parentheses style + single line method defs + ignores + ignores with hash args + invalid indentation on multi-line defs + normal arguments + registers an offense and corrects incorrectly indented first element + hash arguments + registers an offense and corrects incorrectly indented first element + hash arguments static def + registers an offense and corrects incorrectly indented first element + valid indentation on multi-line defs + accepts correctly indented first element + accepts correctly indented first element hash + no paren method defs + ignores + ignores with hash args + +RuboCop::Cop::Lint::RegexpAsCondition + does not register an offense for a regexp literal outside conditions + registers an offense and corrects for a regexp literal in `if` condition + does not register an offense for a regexp literal with `=~` operator + +RuboCop::Cop::Lint::UselessMethodDefinition + does not register an offense when non-constructor contains only comments + does not register an offense for empty constructor + does not register an offense when `super` arguments differ from method arguments + does not register an offense for method containing additional code to `super` + does not register an offense for empty class level `initialize` method + registers an offense and corrects for method containing only `super` call + does not register an offense for constructor containing additional code to `super` + does not register an offense when method definition contains optional argument + does not register an offense when method definition contains optional keyword argument + does not register an offense for constructor with only comments + +RuboCop::Cop::Style::RedundantBegin + reports an offense for single line def with redundant begin block + accepts a def with a begin block after a statement + does not register an offense when using `begin` for logical operator conditions + registers and corrects an offense when using modifier `if` single statement in `begin` block + reports an offense when assigning nested `begin` blocks + reports an offense for defs with redundant begin block + does not register an offense when using `begin` with multiple statement for or assignment + reports an offense when multi-line `begin` block has single statement with modifier condition + accepts when multi-line `begin` block has multiple statements with modifier condition + does not register an offense when using `begin` with `rescue` + reports an offense for def with redundant begin block + registers an offense and corrects when using `begin` without `rescue` or `ensure` + registers and corrects an offense when using multi-line `if` in `begin` block + does not register an offense when using `begin` for or assignment and method call + doesn't modify spacing when autocorrecting + does not register an offense when using `begin` with `while` + reports an offense when assigning nested blocks which contain `begin` blocks + does not register an offense when using `begin` with `ensure` + does not register an offense when using `begin` with `until` + does not register an offense when using `begin` for method argument + accepts a defs with required begin block + registers and corrects an offense when using `begin` with single statement for or assignment + autocorrects when there are trailing comments + does not register an offense when using `begin` with no statements for or assignment + registers and corrects an offense when using `begin` with single statement that called a block for or assignment + does not register an offense when using `begin` for assignment + accepts a def with required begin block + accepts when one-liner `begin` block has multiple statements with modifier condition + reports an offense when multi-line `begin` block has single statement and it is inside condition + does not register an offense when using `begin` for semantic operator conditions + reports an offense when one-liner `begin` block has single statement with modifier condition + does not register an offense when using body of `begin` is empty + < Ruby 2.5 + accepts a do-end block with a begin-end + >= ruby 2.5 + registers an offense for a do-end block with redundant begin-end + accepts super with block + accepts a block with a begin block after a statement + accepts a stabby lambda with a begin-end + accepts a {} block with a begin-end + Ruby 2.7 + reports an offense when assigning nested blocks which contain `begin` blocks + when using endless method definition + registers when `begin` block has a single statement + accepts when `begin` block has no statements + accepts when `begin` block has multiple statements + +RuboCop::Cop::Lint::UselessTimes + registers an offense and corrects with 0.times + does not register an offense for an integer > 1 + registers an offense and corrects with 0.times with block arg + registers an offense and corrects with 1.times with block arg + registers an offense and corrects with negative times + registers an offense and corrects when there is a blank line in the method definition + registers an offense and corrects when 1.times with empty block argument + registers an offense and corrects with negative times with block arg + registers an offense and corrects with 1.times with method chain + registers an offense and corrects with 1.times + short-form method + does not adjust surrounding space + registers an offense and corrects with 0.times + does not register an offense for an integer > 1 + registers an offense and corrects with negative times + registers an offense and corrects with 1.times + multiline block + does not try to correct a block if the block arg is changed in parallel assignment + does not try to correct a block if the block arg is changed + correctly handles a multiline block with 1.times + corrects a block that changes another lvar + within indentation + corrects properly when removing multiline + corrects properly when replacing + corrects properly when removing single line + inline `Integer#times` calls + does not try to correct `1.times` + does not try to correct `0.times` + +RuboCop::Cop::Layout::SpaceAfterSemicolon + does not crash if semicolon is the last character of the file + registers an offense and corrects semicolon without space after it + inside block braces + when EnforcedStyle for SpaceInsideBlockBraces is space + registers an offense and corrects no space between a semicolon and a closing brace + behaves like common behavior + accepts a space between a semicolon and a closing brace + when EnforcedStyle for SpaceInsideBlockBraces is no_space + accepts no space between a semicolon and a closing brace + behaves like common behavior + accepts a space between a semicolon and a closing brace + +RuboCop::Cop::Style::NilLambda + block lambda + properly corrects single line + registers an offense when returning nil with `break` + does not register an offense when not returning nil + registers an offense when returning nil implicitly + does not remove block params or change spacing + registers an offense when returning nil with `next` + registers an offense when returning nil with `return` + does not register an offense when doing more than returning nil + Proc.new + properly corrects single line + registers an offense when returning nil with `next` + registers an offense when returning nil with `return` + does not register an offense when not returning nil + registers an offense when returning nil with `break` + does not remove block params or change spacing + does not register an offense when doing more than returning nil + registers an offense when returning nil implicitly + stabby lambda + registers an offense when returning nil with `next` + registers an offense when returning nil with `return` + does not register an offense when doing more than returning nil + registers an offense when returning nil with `break` + registers an offense when returning nil implicitly + properly corrects multiline + does not register an offense when not returning nil + proc + registers an offense when returning nil with `break` + registers an offense when returning nil implicitly + does not register an offense when doing more than returning nil + registers an offense when returning nil with `return` + does not remove block params or change spacing + does not register an offense when not returning nil + registers an offense when returning nil with `next` + properly corrects single line + +RuboCop::Cop::Style::TrailingBodyOnModule + autocorrects with comment after body + registers offense with multi-line module + registers an offense when body trails after module definition + registers offense when module definition uses semicolon + autocorrects when there are multiple semicolons + accepts regular module + when module is not on first line of processed_source + autocorrects offense + +RuboCop::Cop::VariableForce + #process_node + when processing lvar node + when the variable is not yet declared + does not raise error + when processing a regexp with a line break at the start of capture parenthesis + does not raise an error + when processing an empty regex + does not raise an error + when processing a regex with regopt + does not raise an error + +RuboCop::Cop::Lint::UselessSetterCall + is not confused by operators ending with = + accepts exception assignments without exploding + with singleton method ending with setter call on local object + registers an offense and corrects + when a lvar does not contain any object passed as argument by binary-operator-assignment at the end of the method + registers an offense and corrects + when a lvar possibly contains an object passed as argument by logical-operator-assignment at the end of the method + accepts the setter call on the lvar + with method ending with setter call on local object + registers an offense and corrects + when a lvar contains an object passed as argument at the end of the method + accepts the setter call on the lvar + when a lvar contains an object passed as argument by multiple-assignment at the end of the method + accepts the setter call on the lvar + with method ending with setter call on argument + accepts + when a lvar does not contain any object passed as argument with multiple-assignment at the end of the method + registers an offense and corrects + with method ending with square bracket setter on local object + registers an offense and corrects + with method ending with ivar assignment + accepts + when a lvar contains a non-local object returned by a method + accepts + when a lvar contains a local object instantiated with literal + registers an offense and corrects for the setter call on the lvar + when a lvar declared as an argument is no longer the passed object at the end of the method + registers an offense and corrects for the setter call on the lvar + with method ending with setter call on ivar + accepts + +RuboCop::Cop::Layout::EmptyLinesAroundBeginBody + registers an offense for rescue body ending + registers an offense for begin body ending with a blank + registers an offense for begin body starting in method + registers an offense for begin body starting with rescue + accepts begin block without empty line + accepts begin block without empty line in a method + registers an offense for begin body starting with a blank + registers many offenses with complex begin-end + registers an offense for ensure body ending + registers an offense for else body ending + registers an offense for begin body ending in method + +RuboCop::Cop::VisibilityHelp + #node_visibility + with visibility block public + is expected to eq :public + without visibility block + is expected to eq :public + with inline private with symbol + is expected to eq :private + with inline private + is expected to eq :private + with visibility block private + is expected to eq :private + with visibility block private after public + is expected to eq :private + with inline public + is expected to eq :public + +RuboCop::Cop::Lint::OrAssignmentToConstant + does not register an offense with or-assignment to a class variable + does not register an offense with or-assignment to an attribute + does not register an offense with or-assignment to a global variable + registers an offense with or-assignment to a constant + does not register an offense with or-assignment to an instance variable + does not register an offense with or-assignment to a local variable + does not register an offense with plain assignment to a constant + +RuboCop::Cop::Style::DateTime + registers an offense when using DateTime for current time + does not register an offense when using DateTime for historic date + does not register an offense when using Time for current time + does not register an offense when using Date for modern date + registers an offense when using ::DateTime for current time + registers an offense when using DateTime for modern date + does not register an offense when using DateTime in another namespace + does not register an offense when using ::DateTime for historic date + when configured to allow #to_datetime + does not register an offense + when configured to not allow #to_datetime + registers an offense + +RuboCop::Cop::Layout::MultilineHashKeyLineBreaks + without line break after opening bracket + registers an offense and corrects nested hashes + registers an offense and corrects when key starts on same line as another + when on same line + does not add any offenses + with line break after opening bracket + registers an offense and corrects when key starts on same line as another + when on different lines than brackets but keys on one + does not add any offenses + when on all keys on one line different than brackets + does not add any offenses + when key starts on same line as another with rockets + adds an offense + +RuboCop::Cop::Lint::DuplicateCaseCondition + accepts non-redundant case expressions + registers multiple offenses for repeated multi-value conditionals + accepts similar but not equivalent && expressions + registers an offense for subsequent repeated case conditionals + registers an offense for repeated case conditionals + registers multiple offenses for multiple repeated case conditionals + accepts trivial case expressions + registers an offense for repeated logical operator when expressions + accepts non-redundant case expressions with an else expression + +RuboCop::Cop::Style::RandomWithOffset + does not register an offense when using rand(erange).pred with a non-integer range value + registers an offense when using ::Kernel.rand + does not register an offense when using range with triple dots + does not register an offense when using rand(irange).succ with a non-integer range value + registers an offense when using rand(int).pred + registers an offense when using offset - rand(int) + does not register an offense when using offset - rand(erange) with a non-integer range value + registers an offense when using rand(int) + offset + registers an offense when using offset - rand(erange) + registers an offense when using rand(int) - offset + registers an offense when using offset + Random.rand(int) + registers an offense when using Random.rand + registers an offense when using rand(irange).succ + registers an offense when using ::Random.rand(int).pred + registers an offense when using offset - ::Random.rand(int) + registers an offense when using Random.rand(int).succ + registers an offense when using rand(erange) + offset + registers an offense when using rand(irange) + offset + does not register an offense when using rand(irange) + offset with a non-integer range value + does not register an offense when using range with double dots + registers an offense when using ::Random.rand + registers an offense when using rand(int).next + registers an offense when using rand(erange) - offset + registers an offense when using rand(irange) - offset + registers an offense when using rand(erange).succ + registers an offense when using offset - rand(irange) + registers an offense when using rand(int).succ + registers an offense when using offset + rand(int) + registers an offense when using Kernel.rand + +RuboCop::Cop::Layout::FirstArgumentIndentation + when EnforcedStyle is consistent_relative_to_receiver + when IndentationWidth:Width is 2 + does not view chained call as an outer method call + registers an offense and corrects an over-indented first argument + does not register an offense when argument has expected indent width and the method is preceded by double splat + does not view []= as an outer method call + registers an offense and corrects lines affected by other offenses + registers an offense and corrects an under-indented first argument + accepts method calls with no arguments + does not register an offense when argument has expected indent width and the method is preceded by splat + accepts a first argument that is not preceded by a line break + accepts operator calls + when the receiver contains a line break + accepts a correctly indented first argument preceded by an empty line + registers an offense and corrects an over-indented 1st argument + accepts a correctly indented first argument + when preceded by a comment line + registers an offense and corrects an under-indented first argument + accepts a correctly indented first argument + for assignment + register an offense and corrects a correctly indented first argument and does not care about the second argument + with line break + registers an offense and corrects an under-indented first argument + accepts a correctly indented first argument + when IndentationWidth:Width is 4 + registers an offense and corrects an over-indented first argument + for method calls within method calls + with outer parentheses + indents all relative to the receiver + registers an offense and corrects an over-indented 1st argument + without outer parentheses + indents all relative to the receiver + accepts a first argument with special indentation + when indentation width is overridden for this cop only + accepts a correctly indented first argument + registers an offense and corrects an over-indented first argument + when EnforcedStyle is special_for_inner_method_call_in_parentheses + for method calls within method calls + without outer parentheses + accepts a first argument with consistent style indentation + with outer parentheses + accepts a correctly indented first argument in interpolation + accepts a correctly indented first argument with fullwidth characters + registers an offense and corrects an over-indented first argument + registers an offense and corrects an under-indented first argument + when IndentationWidth:Width is 2 + does not view []= as an outer method call + registers an offense and corrects an over-indented first argument of `super` + registers an offense and corrects an over-indented first argument + registers an offense and corrects an under-indented first argument + accepts method calls with no arguments + registers an offense and corrects an over-indented first argument on a plus sign method name + does not view chained call as an outer method call + registers an offense and corrects an over-indented first argument on an alphanumeric method name + registers an offense and corrects lines affected by another offense + registers an offense and corrects an over-indented first argument on a pipe method name + accepts a first argument that is not preceded by a line break + accepts operator calls + when using safe navigation operator + registers an offense and corrects an under-indented 1st argument + for assignment + accepts a correctly indented first argument and does not care about the second argument + with line break + registers an offense and corrects an under-indented first argument + accepts a correctly indented first argument + for a setter call + accepts an unindented value + when the receiver contains a line break + registers an offense and corrects an over-indented first argument + accepts a correctly indented first argument + accepts a correctly indented first argument preceded by an empty line + when preceded by a comment line + accepts a correctly indented first argument + registers an offense and corrects an under-indented first argument + when indentation width is overridden for this cop only + accepts a correctly indented first argument + registers an offense and corrects an over-indented first argument + when IndentationWidth:Width is 4 + registers an offense and corrects an over-indented first argument + when EnforcedStyle is special_for_inner_method_call + for method calls within method calls + without outer parentheses + accepts a first argument with special indentation + with outer parentheses + registers an offense and corrects an over-indented first argument + when IndentationWidth:Width is 2 + registers an offense and corrects lines affected by another offense + accepts a first argument that is not preceded by a line break + registers an offense and corrects an over-indented first argument of `super` + registers an offense and corrects an over-indented first argument on a pipe method name + registers an offense and corrects an under-indented first argument + does not view []= as an outer method call + registers an offense and corrects an over-indented first argument + accepts operator calls + accepts method calls with no arguments + registers an offense and corrects an over-indented first argument on an alphanumeric method name + does not view chained call as an outer method call + registers an offense and corrects an over-indented first argument on a plus sign method name + for assignment + accepts a correctly indented first argument and does not care about the second argument + with line break + accepts a correctly indented first argument + registers an offense and corrects an under-indented first argument + when the receiver contains a line break + accepts a correctly indented first argument preceded by an empty line + accepts a correctly indented first argument + registers an offense and corrects an over-indented first argument + when preceded by a comment line + registers an offense and corrects an under-indented first argument + accepts a correctly indented first argument + for a setter call + accepts an unindented value + when using safe navigation operator + registers an offense and corrects an under-indented 1st argument + when indentation width is overridden for this cop only + registers an offense and corrects an over-indented first argument + accepts a correctly indented first argument + when IndentationWidth:Width is 4 + registers an offense and corrects an over-indented first argument + when EnforcedStyle is consistent + when indentation width is overridden for this cop only + registers an offense and corrects an over-indented first argument + accepts a correctly indented first argument + when IndentationWidth:Width is 2 + registers an offense and corrects an over-indented first argument on a plus sign method name + accepts method calls with no arguments + registers an offense and corrects an under-indented first argument + does not view chained call as an outer method call + accepts operator calls + accepts a first argument that is not preceded by a line break + registers an offense and corrects an over-indented first argument on a pipe method name + registers an offense and corrects an over-indented first argument of `super` + registers an offense and corrects an over-indented first argument on an alphanumeric method name + registers an offense and corrects lines affected by another offense + does not view []= as an outer method call + registers an offense and corrects an over-indented first argument + when using safe navigation operator + registers an offense and corrects an under-indented 1st argument + when the receiver contains a line break + accepts a correctly indented first argument preceded by an empty line + registers an offense and corrects an over-indented first argument + accepts a correctly indented first argument + when preceded by a comment line + accepts a correctly indented first argument + registers an offense and corrects an under-indented first argument + for a setter call + accepts an unindented value + for assignment + accepts a correctly indented first argument and does not care about the second argument + with line break + registers an offense and corrects an under-indented first argument + accepts a correctly indented first argument + when IndentationWidth:Width is 4 + registers an offense and corrects an over-indented first argument + for method calls within method calls + accepts first argument indented relative to previous line + registers an offense and corrects an over-indented first argument + +RuboCop::Cop::Lint::RedundantRequireStatement + registers an offense when using requiring `enumerator` + registers an offense when using requiring `enumerator` with modifier form + registers an offense when using requiring `enumerator` in condition + target ruby version <= 2.1 + does not register an offense when using requiring `rational`, `complex` + target ruby version >= 2.1 + register an offense and corrects when using requiring `thread` or already redundant features + target ruby version <= 2.4 + does not register an offense when using requiring `pp` + target ruby version <= 2.0 + does not register an offense when using requiring `thread` + target ruby version >= 3.1 + registers an offense and corrects when using requiring `fiber` or already redundant features + target ruby version >= 3.2 + registers an offense and corrects when using requiring `set` + target ruby version >= 2.7 + registers an offense when using requiring `ruby2_keywords` or already redundant features + target ruby version < 3.1 + does not register an offense and corrects when using requiring `fiber` + target ruby version >= 2.2 + registers an offense when using requiring `rational`, `complex` + target ruby version >= 2.5 + register an offense and corrects when using requiring `pp` or already redundant features + target ruby version <= 2.6 + does not register an offense when using requiring `ruby2_keywords` + +RuboCop::Cop::Offense + overrides #to_s + has a few required attributes + redefines == to compare offenses based on their contents + does not blow up if a message contains % + is frozen + #severity + is frozen + offenses that span multiple lines + highlights the first line + #<=> + when receiver has {:line=>6, :cop=>"A"} and other has {:line=>5, :cop=>"B"} + returns 1 + when receiver has {:col=>6, :cop=>"A"} and other has {:col=>5, :cop=>"B"} + returns 1 + when receiver has {:line=>6} and other has {:line=>5} + returns 1 + when receiver has {:line=>6, :col=>4} and other has {:line=>5, :col=>5} + returns 1 + when receiver has {:line=>5, :col=>6} and other has {:line=>5, :col=>5} + returns 1 + when receiver has {:cop=>"B"} and other has {:cop=>"A"} + returns 1 + when receiver has {} and other has {} + returns 0 + #location + is frozen + #cop_name + is frozen + #severity_level + when severity is :info + is 1 + when severity is :refactor + is 2 + when severity is :fatal + is 6 + when unknown severity is passed + raises error + when the location is pseudo + returns a column + returns the last column + returns the first line + returns the last line + returns a line + returns a column length + returns a real column + returns a source line + returns a column range + returns a location with valid size and length + offenses that span part of a line + highlights the first line + #message + is frozen + +RuboCop::Cop::Style::SlicingWithRange + <= Ruby 2.5 + reports no offense for array slicing with -1 + >= Ruby 2.6 + reports no offense for array with range inside + reports an offense for slicing to ..-1 + reports an offense for slicing from expression to ..-1 + reports no offense for other methods + reports no offense for excluding end + >= Ruby 2.7 + reports no offense for startless + +RuboCop::Cop::Style::FloatDivision + EnforcedStyle is fdiv + registers offense and corrects for left coerce with calculations + registers offense and corrects for right coerce + registers offense and corrects for left coerce + does not register offense on usage of fdiv + registers offense and corrects for both coerce + EnforcedStyle is single_coerce + registers offense and corrects for both coerce + does not register offense for right coerce only + does not register offense for left coerce only + registers offense and corrects for left coerce with calculations + EnforcedStyle is right_coerce + registers offense and corrects for both coerce + does not register offense for right coerce + registers offense and corrects for left coerce + registers offense and corrects for left coerce with calculations + EnforcedStyle is left_coerce + registers offense and corrects for right coerce + registers offense and corrects for right coerce with calculations + registers offense and corrects for both coerce + does not register offense for left coerce + +RuboCop::Cop::Style::NegatedIf + does not blow up on a negated ternary operator + does not blow up for ternary ops + does not blow up for empty unless condition + does not blow up for empty if condition + with “postfix” style + does not register an offense for prefix + registers an offense for postfix + with “prefix” style + registers an offense for prefix + does not register an offense for postfix + with “both” style + is not confused by negated elsif + accepts an if where the condition is doubly negated + accepts an if where only part of the condition is negated + accepts an if/else with negative condition + autocorrects by replacing parenthesized if not with unless + registers an offense for if with "not" condition + registers an offense for if with exclamation point condition + +RuboCop::Cop::InternalAffairs::RedundantMethodDispatchNode + does not register an offense when using `node.send_node.arguments?` + does not register an offense when using `node.method_name` + registers an offense when using `node.send_node.method_name` + registers an offense when using `node.send_node.receiver` + does not register an offense when using `node.receiver` + does not register an offense when using `send_node.method_name` + +RuboCop::Cop::Style::WhileUntilModifier + behaves like condition modifier cop + for a multiline 'while' + corrects it if result fits in one line + handles one-line usage + accepts it if body spans more than one line + accepts it if single line would not fit on one line + doesn't break when used as RHS of instance var assignment + handles inline comments during autocorrection + accepts an empty body + corrects it when assignment is in body + doesn't break when used as RHS of constant assignment + doesn't break when used as RHS of class var assignment + accepts it when condition has local variable assignment + doesn't break when used as RHS of local var assignment + doesn't break when used as RHS of binary arithmetic + when Layout/LineLength is disabled + registers an offense even for a long modifier statement + accepts multiline condition in modifier form + registers an offense + when there is a comment on the first line and some code after the end keyword + does not register an offense + behaves like condition modifier cop + for a multiline 'until' + doesn't break when used as RHS of binary arithmetic + accepts it if body spans more than one line + corrects it when assignment is in body + doesn't break when used as RHS of constant assignment + doesn't break when used as RHS of instance var assignment + accepts an empty body + handles one-line usage + corrects it if result fits in one line + accepts it when condition has local variable assignment + handles inline comments during autocorrection + doesn't break when used as RHS of class var assignment + doesn't break when used as RHS of local var assignment + accepts it if single line would not fit on one line + when there is a comment on the first line and some code after the end keyword + does not register an offense + when Layout/LineLength is disabled + registers an offense even for a long modifier statement + accepts multiline condition in modifier form + registers an offense + +RuboCop::Formatter::HTMLFormatter + outputs the cached result in HTML + outputs the result in HTML + +RuboCop::Cop::InternalAffairs::LocationLineEqualityComparison + registers an offense and corrects when using `first_line` + registers an offense and corrects when using `source_range.first_line` + does not register an offense when using `same_line?` + registers and corrects an offense when comparing `#loc.source_range` with LHS and RHS + registers an offense and corrects when using `loc.first_line` + registers and corrects an offense when comparing `#loc.line` with LHS and RHS + +RuboCop::Cop::Style::AccessorGrouping + when EnforcedStyle is separated + does not register an offense for grouped accessors with comments + does not register an offense when using separated accessors + registers an offense and corrects when using grouped accessors with different access modifiers + registers an offense and corrects when using grouped accessors within eigenclass + registers an offense and corrects when the same accessor is given more than once in the same statement + registers an offense and corrects when using grouped accessors + does not register an offense if the same accessor is listed twice + when there are comments for attributes + registers and corrects an offense + when EnforcedStyle is grouped + does not register an offense when the same accessor is given more than once in the same statement + registers offense and corrects if at least two separate accessors without comments + registers an offense and corrects when using separated accessors with different access modifiers + registers an offense and correct if the same accessor is listed twice + registers an offense and corrects when using separated accessors + registers an offense and corrects when using separated accessors within eigenclass + does not register offense for accessors with comments + does not register an offense when using grouped accessors + +RuboCop::Cop::Style::MutableConstant + Strict: true + allows calls to freeze + freezes a heredoc + behaves like immutable objects + allows ::Struct.new to be ||= to a constant + allows ::Struct.new to be assigned to a constant + behaves like immutable objects + allows Struct.new(:a, :b) to be ||= to a constant + allows Struct.new(:a, :b) to be assigned to a constant + methods and operators that produce frozen objects + accepts operating on a constant and an interger + accepts operating on multiple integers + accepts checking fixed size + accepts operating on multiple floats + accepts assigning to an environment variable with a fallback + accepts comparison operators + accepts operating on a constant and a float + behaves like immutable objects + allows :sym to be ||= to a constant + allows :sym to be assigned to a constant + when assigning with multiple operator calls + registers an offense and corrects with parens and freeze + behaves like immutable objects + allows ::Namespace::OTHER_CONST to be ||= to a constant + allows ::Namespace::OTHER_CONST to be assigned to a constant + behaves like mutable objects + when assigning with = + registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows ENV['foo'] to be ||= to a constant + allows ENV['foo'] to be assigned to a constant + when assigning with an operator + behaves like operator methods + registers an offense and corrects with parens and freeze + behaves like operator methods + registers an offense and corrects with parens and freeze + behaves like operator methods + registers an offense and corrects with parens and freeze + behaves like operator methods + registers an offense and corrects with parens and freeze + behaves like operator methods + registers an offense and corrects with parens and freeze + behaves like operator methods + registers an offense and corrects with parens and freeze + behaves like mutable objects + when assigning with = + registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze + behaves like string literal + Ruby 2.7 or lower + when the frozen string literal comment is true + does not register an offense when using a multiline string + does not register an offense when using interpolated heredoc constant + behaves like immutable objects + allows <<~HERE + foo + bar +HERE + to be assigned to a constant + allows <<~HERE + foo + bar +HERE + to be ||= to a constant + behaves like immutable objects + allows "#{a}" to be ||= to a constant + allows "#{a}" to be assigned to a constant + when the frozen string literal comment is false + behaves like mutable objects + when assigning with ||= + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when the frozen string literal comment is missing + behaves like mutable objects + when assigning with ||= + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + Ruby 3.0 or higher + when the frozen string literal comment is missing + behaves like mutable objects + when assigning with = + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when the frozen string literal comment is false + behaves like mutable objects + when assigning with = + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when the frozen string literal comment is true + registers an offense when using a multiline string with interpolation + registers an offense when using interpolated heredoc constant + does not register an offense when using a multiline string + behaves like mutable objects + when assigning with = + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows <<~HERE + foo + bar +HERE + to be assigned to a constant + allows <<~HERE + foo + bar +HERE + to be ||= to a constant + splat expansion + expansion of a range + registers an offense and corrects to use to_a.freeze + with parentheses + registers an offense and corrects to use to_a.freeze + behaves like immutable objects + allows 1 to be ||= to a constant + allows 1 to be assigned to a constant + when assigning an array without brackets + does not insert brackets for %w() arrays + adds brackets when autocorrecting + operators that produce unfrozen objects + registers an offense when operating on a constant and a string + registers an offense when operating on multiple strings + behaves like mutable objects + when assigning with ||= + registers an offense for 'str' assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for 'str' assigned to a constant and corrects by adding .freeze + behaves like mutable objects + when assigning with ||= + registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows ::OTHER_CONST to be assigned to a constant + allows ::OTHER_CONST to be ||= to a constant + behaves like mutable objects + when assigning with ||= + registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows Namespace::OTHER_CONST to be assigned to a constant + allows Namespace::OTHER_CONST to be ||= to a constant + behaves like immutable objects + allows Struct.new(:node) do + def assignment? + true + end +end + to be ||= to a constant + allows Struct.new(:node) do + def assignment? + true + end +end + to be assigned to a constant + behaves like immutable objects + allows OTHER_CONST to be ||= to a constant + allows OTHER_CONST to be assigned to a constant + behaves like mutable objects + when assigning with = + registers an offense for Something.new assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for Something.new assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows ::ENV['foo'] to be assigned to a constant + allows ::ENV['foo'] to be ||= to a constant + behaves like immutable objects + allows 1.5 to be ||= to a constant + allows 1.5 to be assigned to a constant + behaves like immutable objects + allows Struct.new to be ||= to a constant + allows Struct.new to be assigned to a constant + Strict: false + allows method call assignments + behaves like mutable objects + when assigning with = + registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze + Ruby 2.7 or lower + when assigning a range (erange) without parenthesis + does not insert parenthesis to range enclosed in parentheses + adds parentheses when autocorrecting + when using shareable_constant_values + behaves like literals that are not frozen + behaves like mutable objects + when assigning with ||= + registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze + behaves like mutable objects + when assigning with = + registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze + behaves like mutable objects + when assigning with ||= + registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze + behaves like mutable objects + when assigning with ||= + registers an offense for 'str' assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for 'str' assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows 1 to be ||= to a constant + allows 1 to be assigned to a constant + behaves like immutable objects + allows 1.5 to be ||= to a constant + allows 1.5 to be assigned to a constant + behaves like mutable objects + when assigning with ||= + registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows ::ENV['foo'] to be assigned to a constant + allows ::ENV['foo'] to be ||= to a constant + behaves like immutable objects + allows :sym to be ||= to a constant + allows :sym to be assigned to a constant + behaves like immutable objects + allows ENV['foo'] to be ||= to a constant + allows ENV['foo'] to be assigned to a constant + behaves like immutable objects + allows FOO - BAR to be ||= to a constant + allows FOO - BAR to be assigned to a constant + behaves like immutable objects + allows FOO + BAR to be assigned to a constant + allows FOO + BAR to be ||= to a constant + behaves like immutable objects + allows 'foo' + 'bar' to be assigned to a constant + allows 'foo' + 'bar' to be ||= to a constant + behaves like literals that are not frozen + behaves like mutable objects + when assigning with ||= + registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows 1.5 to be ||= to a constant + allows 1.5 to be assigned to a constant + behaves like immutable objects + allows :sym to be assigned to a constant + allows :sym to be ||= to a constant + behaves like mutable objects + when assigning with = + registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows 'foo' + 'bar' to be assigned to a constant + allows 'foo' + 'bar' to be ||= to a constant + behaves like immutable objects + allows FOO + BAR to be ||= to a constant + allows FOO + BAR to be assigned to a constant + behaves like mutable objects + when assigning with ||= + registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows FOO - BAR to be assigned to a constant + allows FOO - BAR to be ||= to a constant + behaves like mutable objects + when assigning with = + registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze + behaves like mutable objects + when assigning with = + registers an offense for 'str' assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for 'str' assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows ::ENV['foo'] to be ||= to a constant + allows ::ENV['foo'] to be assigned to a constant + behaves like immutable objects + allows 1 to be assigned to a constant + allows 1 to be ||= to a constant + behaves like immutable objects + allows ENV['foo'] to be assigned to a constant + allows ENV['foo'] to be ||= to a constant + behaves like literals that are not frozen + behaves like immutable objects + allows ENV['foo'] to be assigned to a constant + allows ENV['foo'] to be ||= to a constant + behaves like immutable objects + allows :sym to be ||= to a constant + allows :sym to be assigned to a constant + behaves like immutable objects + allows 1.5 to be ||= to a constant + allows 1.5 to be assigned to a constant + behaves like mutable objects + when assigning with = + registers an offense for 'str' assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for 'str' assigned to a constant and corrects by adding .freeze + behaves like mutable objects + when assigning with = + registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze + behaves like mutable objects + when assigning with = + registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows FOO + BAR to be ||= to a constant + allows FOO + BAR to be assigned to a constant + behaves like mutable objects + when assigning with = + registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows 'foo' + 'bar' to be assigned to a constant + allows 'foo' + 'bar' to be ||= to a constant + behaves like immutable objects + allows ::ENV['foo'] to be assigned to a constant + allows ::ENV['foo'] to be ||= to a constant + behaves like immutable objects + allows 1 to be ||= to a constant + allows 1 to be assigned to a constant + behaves like mutable objects + when assigning with = + registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows FOO - BAR to be assigned to a constant + allows FOO - BAR to be ||= to a constant + behaves like literals that are not frozen + behaves like mutable objects + when assigning with = + registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows 1 to be assigned to a constant + allows 1 to be ||= to a constant + behaves like immutable objects + allows FOO - BAR to be assigned to a constant + allows FOO - BAR to be ||= to a constant + behaves like immutable objects + allows 1.5 to be assigned to a constant + allows 1.5 to be ||= to a constant + behaves like mutable objects + when assigning with = + registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows FOO + BAR to be assigned to a constant + allows FOO + BAR to be ||= to a constant + behaves like mutable objects + when assigning with = + registers an offense for 'str' assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for 'str' assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows ::ENV['foo'] to be ||= to a constant + allows ::ENV['foo'] to be assigned to a constant + behaves like mutable objects + when assigning with = + registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows :sym to be assigned to a constant + allows :sym to be ||= to a constant + behaves like immutable objects + allows 'foo' + 'bar' to be assigned to a constant + allows 'foo' + 'bar' to be ||= to a constant + behaves like immutable objects + allows ENV['foo'] to be assigned to a constant + allows ENV['foo'] to be ||= to a constant + behaves like mutable objects + when assigning with ||= + registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze + when assigning a regexp + registers an offense + when assigning a range (irange) without parenthesis + does not insert parenthesis to range enclosed in parentheses + adds parentheses when autocorrecting + when assigning an array without brackets + adds brackets when autocorrecting + does not insert brackets for %w() arrays + behaves like immutable objects + allows 1 to be ||= to a constant + allows 1 to be assigned to a constant + Ruby 3.0 or higher + raises offense when shareable_constant_value is specified as an inline comment + raises offense only for shareable_constant_value as none when set in the order of: literal, none and experimental_everything + when assigning a range (irange) + does not register an offense when with parenthesis + does not register an offense when without parenthesis + when assigning a range (erange) + does not register an offense when with parenthesis + does not register an offense when without parenthesis + when assigning a regexp + does not register an offense + when using shareable_constant_value + behaves like literals that are frozen + behaves like immutable objects + allows [1, 2, 3] to be assigned to a constant + allows [1, 2, 3] to be ||= to a constant + behaves like immutable objects + allows 1.5 to be assigned to a constant + allows 1.5 to be ||= to a constant + behaves like immutable objects + allows %w(a b c) to be ||= to a constant + allows %w(a b c) to be assigned to a constant + behaves like immutable objects + allows :sym to be assigned to a constant + allows :sym to be ||= to a constant + behaves like immutable objects + allows ::ENV['foo'] to be assigned to a constant + allows ::ENV['foo'] to be ||= to a constant + behaves like immutable objects + allows ENV['foo'] to be assigned to a constant + allows ENV['foo'] to be ||= to a constant + behaves like immutable objects + allows FOO + BAR to be assigned to a constant + allows FOO + BAR to be ||= to a constant + behaves like immutable objects + allows 'str' to be ||= to a constant + allows 'str' to be assigned to a constant + behaves like immutable objects + allows FOO - BAR to be ||= to a constant + allows FOO - BAR to be assigned to a constant + behaves like immutable objects + allows 1 to be assigned to a constant + allows 1 to be ||= to a constant + behaves like immutable objects + allows { a: 1, b: 2 } to be ||= to a constant + allows { a: 1, b: 2 } to be assigned to a constant + behaves like immutable objects + allows 'foo' + 'bar' to be assigned to a constant + allows 'foo' + 'bar' to be ||= to a constant + behaves like immutable objects + allows "top#{1 + 2}" to be ||= to a constant + allows "top#{1 + 2}" to be assigned to a constant + behaves like literals that are frozen + behaves like immutable objects + allows 'foo' + 'bar' to be ||= to a constant + allows 'foo' + 'bar' to be assigned to a constant + behaves like immutable objects + allows ::ENV['foo'] to be ||= to a constant + allows ::ENV['foo'] to be assigned to a constant + behaves like immutable objects + allows ENV['foo'] to be assigned to a constant + allows ENV['foo'] to be ||= to a constant + behaves like immutable objects + allows { a: 1, b: 2 } to be assigned to a constant + allows { a: 1, b: 2 } to be ||= to a constant + behaves like immutable objects + allows FOO - BAR to be ||= to a constant + allows FOO - BAR to be assigned to a constant + behaves like immutable objects + allows 1.5 to be ||= to a constant + allows 1.5 to be assigned to a constant + behaves like immutable objects + allows 'str' to be assigned to a constant + allows 'str' to be ||= to a constant + behaves like immutable objects + allows %w(a b c) to be ||= to a constant + allows %w(a b c) to be assigned to a constant + behaves like immutable objects + allows FOO + BAR to be ||= to a constant + allows FOO + BAR to be assigned to a constant + behaves like immutable objects + allows [1, 2, 3] to be assigned to a constant + allows [1, 2, 3] to be ||= to a constant + behaves like immutable objects + allows :sym to be ||= to a constant + allows :sym to be assigned to a constant + behaves like immutable objects + allows "top#{1 + 2}" to be assigned to a constant + allows "top#{1 + 2}" to be ||= to a constant + behaves like immutable objects + allows 1 to be ||= to a constant + allows 1 to be assigned to a constant + behaves like literals that are frozen + behaves like immutable objects + allows 'foo' + 'bar' to be ||= to a constant + allows 'foo' + 'bar' to be assigned to a constant + behaves like immutable objects + allows ::ENV['foo'] to be assigned to a constant + allows ::ENV['foo'] to be ||= to a constant + behaves like immutable objects + allows [1, 2, 3] to be ||= to a constant + allows [1, 2, 3] to be assigned to a constant + behaves like immutable objects + allows { a: 1, b: 2 } to be ||= to a constant + allows { a: 1, b: 2 } to be assigned to a constant + behaves like immutable objects + allows "top#{1 + 2}" to be ||= to a constant + allows "top#{1 + 2}" to be assigned to a constant + behaves like immutable objects + allows FOO + BAR to be assigned to a constant + allows FOO + BAR to be ||= to a constant + behaves like immutable objects + allows 1 to be ||= to a constant + allows 1 to be assigned to a constant + behaves like immutable objects + allows :sym to be assigned to a constant + allows :sym to be ||= to a constant + behaves like immutable objects + allows ENV['foo'] to be assigned to a constant + allows ENV['foo'] to be ||= to a constant + behaves like immutable objects + allows FOO - BAR to be ||= to a constant + allows FOO - BAR to be assigned to a constant + behaves like immutable objects + allows 'str' to be assigned to a constant + allows 'str' to be ||= to a constant + behaves like immutable objects + allows 1.5 to be assigned to a constant + allows 1.5 to be ||= to a constant + behaves like immutable objects + allows %w(a b c) to be ||= to a constant + allows %w(a b c) to be assigned to a constant + behaves like literals that are not frozen + behaves like mutable objects + when assigning with ||= + registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows 1 to be assigned to a constant + allows 1 to be ||= to a constant + behaves like mutable objects + when assigning with ||= + registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows FOO + BAR to be ||= to a constant + allows FOO + BAR to be assigned to a constant + behaves like immutable objects + allows 1.5 to be assigned to a constant + allows 1.5 to be ||= to a constant + behaves like immutable objects + allows ::ENV['foo'] to be ||= to a constant + allows ::ENV['foo'] to be assigned to a constant + behaves like mutable objects + when assigning with = + registers an offense for 'str' assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for 'str' assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows FOO - BAR to be ||= to a constant + allows FOO - BAR to be assigned to a constant + behaves like immutable objects + allows 'foo' + 'bar' to be assigned to a constant + allows 'foo' + 'bar' to be ||= to a constant + behaves like mutable objects + when assigning with ||= + registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for [1, 2, 3] assigned to a constant and corrects by adding .freeze + behaves like mutable objects + when assigning with = + registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows :sym to be assigned to a constant + allows :sym to be ||= to a constant + behaves like immutable objects + allows ENV['foo'] to be assigned to a constant + allows ENV['foo'] to be ||= to a constant + behaves like mutable objects + when assigning with = + registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for "top#{1 + 2}" assigned to a constant and corrects by adding .freeze + splat expansion + expansion of a range + registers an offense and corrects to use to_a.freeze + with parentheses + registers an offense and corrects to use to_a.freeze + behaves like mutable objects + when assigning with ||= + registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for %w(a b c) assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows ENV['foo'] to be ||= to a constant + allows ENV['foo'] to be assigned to a constant + behaves like string literal + Ruby 3.0 or higher + when the frozen string literal comment is missing + behaves like mutable objects + when assigning with = + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when the frozen string literal comment is false + behaves like mutable objects + when assigning with = + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when the frozen string literal comment is true + does not register an offense when using a multiline string + registers an offense when using interpolated heredoc constant + registers an offense when using a multiline string with interpolation + behaves like immutable objects + allows <<~HERE + foo + bar +HERE + to be ||= to a constant + allows <<~HERE + foo + bar +HERE + to be assigned to a constant + behaves like mutable objects + when assigning with = + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + Ruby 2.7 or lower + when the frozen string literal comment is false + behaves like mutable objects + when assigning with = + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when the frozen string literal comment is true + does not register an offense when using interpolated heredoc constant + does not register an offense when using a multiline string + behaves like immutable objects + allows <<~HERE + foo + bar +HERE + to be ||= to a constant + allows <<~HERE + foo + bar +HERE + to be assigned to a constant + behaves like immutable objects + allows "#{a}" to be ||= to a constant + allows "#{a}" to be assigned to a constant + when the frozen string literal comment is missing + behaves like mutable objects + when assigning with = + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + when assigning with ||= + registers an offense for "#{a}" assigned to a constant and corrects by adding .freeze + behaves like mutable objects + when assigning with ||= + registers an offense for 'str' assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for 'str' assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows FOO + BAR to be assigned to a constant + allows FOO + BAR to be ||= to a constant + behaves like mutable objects + when assigning with ||= + registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze + when assigning with = + registers an offense for { a: 1, b: 2 } assigned to a constant and corrects by adding .freeze + behaves like immutable objects + allows :sym to be ||= to a constant + allows :sym to be assigned to a constant + behaves like immutable objects + allows 1.5 to be assigned to a constant + allows 1.5 to be ||= to a constant + behaves like immutable objects + allows ::ENV['foo'] to be assigned to a constant + allows ::ENV['foo'] to be ||= to a constant + behaves like immutable objects + allows 'foo' + 'bar' to be assigned to a constant + allows 'foo' + 'bar' to be ||= to a constant + behaves like immutable objects + allows FOO - BAR to be ||= to a constant + allows FOO - BAR to be assigned to a constant + +RuboCop::Cop::InternalAffairs::MethodNameEndWith + does not register offense if argument for end_with? is some other string + registers offense if there is potentially usage of `predicate_method?` + registers offense if there is potentially usage of `bang_method?` + registers an offense if there is potentially usage of `assignment_method?` + registers offense if there is potentially usage of `bang_method?` with safe navigation operator + registers an offense if `method_name` is a variable and there is potentially usage of `assignment_method?` + Ruby >= 2.7 + does not register offense if argument for Symbol#end_with? is some other string + registers an offense if method_name is symbol with safe navigation operator + registers offense if argument for Symbol#end_with? is '?' + registers offense if argument for Symbol#end_with? is '!' + registers an offense if method_name is symbol + registers offense if argument for Symbol#end_with? is '!' with safe navigation operator + registers offense if argument for Symbol#end_with? is '?' with safe navigation operator + +RuboCop::Cop::Style::StringHashKeys + does not register an offense when string key is used in gsub + does not register an offense when string key is used in Open3.pipeline + autocorrects strings as keys into symbols with the correct syntax + registers an offense when using strings as keys + does not register an offense when string key is used in gsub! + does not register an offense when string key is used in IO.popen + does not register an offense when not using strings as keys + does not register an offense when string key is used in Open3.capture3 + registers an offense when using strings as keys mixed with other keys + +RuboCop::Cop::Lint::EmptyWhen + when `AllowComments: true` + accepts an empty when ... then body with a comment + registers an offense for missing when body without a comment + accepts an empty when body with a comment + when a `when` body is missing + registers an offense for missing when ... then body followed by else + registers an offense when case line has no expression + registers an offense for missing when body with a comment + registers an offense for missing when ... then body + registers an offense for missing when body followed by else + registers an offense for a missing when body + registers an offense for missing when body with a comment followed by else + when `AllowComments: false` + registers an offense for empty when body with a comment + when a `when` body is present + accepts case with when ... then statements + accepts case with when ... then statements and else clause + accepts case with when bodies and else clause + accepts with no case line expression + accepts case with when bodies + +RuboCop::Cop::Lint::DuplicateElsifCondition + registers multiple offenses for multiple repeated elsif conditions + does not register an offense for partially repeated elsif conditions + registers an offense for subsequent repeated elsif conditions + does not register an offense for non-repeated elsif conditions + registers an offense for repeated elsif conditions + +RuboCop::Cop::Style::GlobalStdStream + registers an offense and corrects when using std stream as const + does not register an offense when assigning other const to std stream gvar + does not register an offense when using non std stream const + does not register an offense when assigning std stream const to std stream gvar + +RuboCop::Cop::Style::UnpackFirst + ruby version >= 2.4 + registers offense + when using `#unpack` with `#slice` + when using `#unpack` with square brackets + when using `#unpack` with `#at` + when using `#unpack` with dot and square brackets + when using `#unpack` with `#first` + does not register offense + when using `#unpack` accessing second element + when using `#unpack1` + +RuboCop::Cop::Lint::AmbiguousRegexpLiteral + Ruby <= 2.7 + with `match_with_lvasgn` node + with parentheses + does not register an offense + with different parentheses + does not register an offense + without parentheses + registers an offense and corrects + without parentheses + registers an offense and corrects when multiple arguments + registers an offense and corrects when sending method without receiver takes a regexp argument + registers an offense and corrects when using block argument + registers an offense and corrects when nesting + registers an offense and corrects when sending method to regexp without argument + registers an offense and corrects when single argument + registers an offense and corrects when sending method to regexp with argument + registers an offense and corrects when sending method inside parens without receiver takes a regexp argument + registers an offense and corrects when sending method chain to regexp + registers an offense and corrects when using regexp without method call in a nested structure + registers an offense and corrects when using nested method arguments without parentheses + with parentheses + accepts + Ruby >= 3.0 + with `match_with_lvasgn` node + with different parentheses + does not register an offense + with parentheses + does not register an offense + without parentheses + registers an offense and corrects + with parentheses + accepts + without parentheses + registers an offense and corrects when sending method chain to regexp + registers an offense and corrects when single argument + registers an offense and corrects when using block argument + registers an offense and corrects when sending method to regexp with argument + registers an offense and corrects when using nested method arguments without parentheses + registers an offense and corrects when using regexp without method call in a nested structure + registers an offense and corrects when sending method inside parens without receiver takes a regexp argument + registers an offense and corrects when sending method without receiver takes a regexp argument + registers an offense and corrects when multiple arguments + registers an offense and corrects when nesting + registers an offense and corrects when sending method to regexp without argument + +RuboCop::Cop::Lint::RequireRelativeSelfPath + registers an offense when using `require_relative` with self file path argument (with ext) + does not register an offense when using `require_relative` without self file path argument + does not register an offense when using `require_relative` without argument + registers an offense when using `require_relative` with self file path argument + does not register an offense when the filename is the same but the extension does not match + does not register an offense when using a variable as an argument of `require_relative` + +RuboCop::Cop::Layout::SpaceInsideReferenceBrackets + when EnforcedStyle is space + registers an offense and corrects ref brackets with no leading whitespace + does not register offense for ref bcts with spaces that assign + registers an offense and correct third ref brackets with no trailing whitespace + does not register offense for array literals + accepts an array as a reference object + registers and corrects multiple offenses for multiple sets of ref brackets + accepts spaces in array brackets + registers an offense and corrects ref brackets with no trailing whitespace + registers an offense and corrects third ref brackets with no leading whitespace + registers an offense and corrects second ref brackets with no trailing whitespace + registers an offense and corrects second ref brackets with no leading whitespace + accepts square brackets called with method call syntax + registers an offense and corrects when a reference bracket with no leading whitespace is assigned by another reference bracket + registers an offense and corrects when a reference bracket is assigned by another reference bracket with no trailing whitespace + registers and corrects multiple offenses in one set of ref brackets + registers an offense and corrects when a reference bracket with no trailing whitespace is assigned by another reference bracket + accepts square brackets as method name + does not register offense for reference brackets with spaces + when EnforcedStyle is no_space + registers an offense and corrects ref brackets with leading whitespace + registers an offense and corrects outer ref brackets + registers an offense and corrects second ref brackets with leading whitespace + does not register offense for ref bcts with no spaces that assign + accepts square brackets as method name + registers an offense and corrects ref brackets with trailing whitespace + register and correct multiple offenses for multiple sets of ref brackets + registers an offense and corrects when a reference bracket with a trailing whitespace is assigned by another reference bracket + registers multiple offenses and corrects multiple sets of ref brackets + registers an offense and corrects when a reference bracket is assigned by another reference bracket with trailing whitespace + registers an offense and corrects when a reference bracket with a leading whitespace is assigned by another reference bracket + accepts extra spacing in array brackets + accepts square brackets called with method call syntax + does not register offense for non-empty brackets with newline inside + registers an offense and corrects third ref brackets with trailing whitespace + registers multiple offenses and corrects one set of ref brackets + registers an offense and corrects third ref brackets with leading whitespace + does not register offense for array literals + accepts an array as a reference object + registers an offense and corrects second ref brackets with trailing whitespace + does not register offense for reference brackets with no spaces + with space inside empty brackets not allowed + accepts empty brackets with no space inside + registers an offense and corrects empty brackets with 1 space inside + registers an offense and corrects empty brackets with newline inside + registers an offense and corrects empty brackets with multiple spaces inside + with space inside empty braces allowed + registers offense and corrects empty brackets with no space inside + accepts empty brackets with space inside + registers offense and corrects empty brackets with more than one space inside + registers offense and corrects empty brackets with newline inside + +RuboCop::Cop::Layout::RescueEnsureAlignment + accepts correctly aligned rescue/ensure with def + accepts aligned rescue in do-end block assigned to class + accepts end being misaligned + accepts aligned rescue in do-end block on operation assignment + accepts aligned rescue in do-end block on and-assignment + accepts the modifier form + accepts aligned rescue with do-end block that line break with trailing dot for method calls + accepts correctly aligned rescue in assigned begin-end block + accepts aligned rescue in do-end block assigned to instance variable + accepts aligned rescue in do-end block with `.()` call + accepts aligned rescue with do-end block that line break with leading dot for method calls + accepts aligned rescue in do-end block in a method + accepts aligned rescue in do-end block on multi-assignment + accepts correctly aligned rescue/ensure with def with no body + accepts aligned rescue in do-end block + accepts aligned rescue in assigned do-end block starting on newline + accepts aligned rescue in do-end block assigned to class variable + accepts correctly aligned rescue + accepts aligned rescue in do-end block assigned to global variable + accepts correctly aligned ensure + accepts rescue and ensure on the same line + accepts aligned rescue in do-end block on or-assignment + accepts aligned rescue do-end block assigned to local variable + excluded file + processes excluded files with issue + rescue in do-end block assigned to global variable + registers an offense + rescue with def + registers an offense + ensure with begin + registers an offense when ensure used with begin + ensure with class + registers an offense + rescue in assigned do-end block starting on newline + registers an offense + rescue in do-end block on or-assignment + registers an offense + rescue with begin + registers an offense + as RHS of assignment + `Layout/BeginEndAlignment` cop is not enabled + registers an offense and corrects for incorrect alignment + accepts multi-line, aligned + accepts multi-line, indented + when `EnforcedStyleAlignWith: start_of_line` of `Layout/BeginEndAlignment` cop + registers an offense and corrects for incorrect alignment + accepts multi-line, aligned + accepts multi-line, indented + when `EnforcedStyleAlignWith: begin` of `Layout/BeginEndAlignment` cop + registers an offense and corrects for incorrect alignment + accepts multi-line, aligned + accepts multi-line, indented + allows inline access modifier + with private modifier + ensure with defs + correct alignment + registers an offense + rescue with def + correct alignment + registers an offense + ensure with def + correct alignment + registers an offense + rescue with defs + registers an offense + correct alignment + with private_class_method modifier + rescue with def + registers an offense + correct alignment + rescue with defs + correct alignment + registers an offense + ensure with def + correct alignment + registers an offense + ensure with defs + registers an offense + correct alignment + with public_class_method modifier + rescue with defs + correct alignment + registers an offense + rescue with def + correct alignment + registers an offense + ensure with defs + registers an offense + correct alignment + ensure with def + registers an offense + correct alignment + rescue in do-end block assigned to class variable + registers an offense + rescue with do-end block + registers an offense + rescue in do-end block assigned to local variable + registers an offense + rescue in do-end block on operation assignment + registers an offense + ensure with module + registers an offense when ensure used with module + rescue with class + registers an offense when rescue used with class + rescue in do-end block on and-assignment + registers an offense + rescue in do-end block assigned to instance variable + registers an offense + ensure with def + registers an offense + rescue in do-end block on multi-assignment + registers an offense + ensure with defs + registers an offense + rescue in do-end block assigned to class + registers an offense + rescue with defs + registers an offense + when using zsuper with block + does not register an offense when correct alignment + registers and corrects an offense and corrects when incorrect alignment + allows inline expression before + rescue + registers an offense + ensure + registers an offense + rescue with module + registers an offense when rescue used with module + +RuboCop::Formatter::FileListFormatter + #file_finished + displays parsable text + +RuboCop::CLI --auto-gen-config + --auto-gen-config + does not include offense counts when --no-offense-counts is used + generates a todo list that removes the reports + can generate Exclude properties with a given limit + includes --auto-gen-only-exclude in the command comment when given + generates Exclude instead of Max when --auto-gen-only-exclude is used + does not generate configuration for the Syntax cop + can generate a todo list + honors rubocop:disable comments + overwrites an existing todo file + generates EnforcedStyle parameter if it solves all offenses + generates Exclude if no EnforcedStyle solves all offenses + does not include a timestamp when --no-auto-gen-timestamp is used + can be called when there are no files to inspection + when working in a subdirectory + can generate a todo list + when duplicated default configuration parameter + parameters are displayed without duplication + when existing config file has a YAML document start header + inserts `inherit_from` key after hearder + when different styles appear in different files + disables cop if --exclude-limit is exceeded + generates Exclude list if --exclude-limit is not exceeded + when .rubocop.yml inherits from another file + bases other cops' configuration on the code base's current maximum line length + when inheriting from a URL + when there is a single entry + can generate a todo list + when there are multiple entries + can generate a todo list + when .rubocop.yml doesn't inherit + bases other cops' configuration on the code base's current maximum line length + when cop is not safe to autocorrect + can generate a todo list, with the appropriate flag + when hash value omission enabled + generates Exclude if it solves all offenses + when .rubocop.yml is empty + bases other cops' configuration on the code base's current maximum line length + when .rubocop.yml inherits from another file and .rubocop_todo.yml + bases other cops' configuration on the code base's current maximum line length + when .rubocop.yml does not exist + bases other cops' configuration on the code base's current maximum line length + with Layout/LineLength:Max overridden + when .rubocop.yml has Layout/LineLength disabled + skips the cop from both phases of the run + when .rubocop.yml has Layout/LineLength:Max less than code base max + bases other cops' configuration on the overridden LineLength:Max + when .rubocop.yml has Layout/LineLength:Max more than code base max + bases other cops' configuration on the overridden LineLength:Max + when working with a cop who do not support autocorrection + can generate a todo list + when --config is used + can generate a todo list if default .rubocop.yml exists + can generate a todo list + when .rubocop.yml inherits from two other files + bases other cops' configuration on the code base's current maximum line length + for existing configuration with Exclude + leaves out Excludes that appear in .rubocop.yml but are merged globally + leaves out Excludes that appear in .rubocop.yml but are merged for the cop + generates Excludes that appear in .rubocop.yml + console output + displays report summary but no offenses + when .rubocop.yml inherits only from .rubocop_todo.yml + bases other cops' configuration on the code base's current maximum line length + when .rubocop.yml inherits only from .rubocop_todo.yml in an array + bases other cops' configuration on the code base's current maximum line length + when --no-exclude-limit is given + always prefers Exclude to Enabled -RuboCop::Cop::InternalAffairs::ExampleDescription - with `expect_correction` - registers an offense when given an improper description - in conjunction with expect_offense - registers an offense when given an improper description - when the description is invalid for both methods - registers an offense for the first method encountered - with `expect_offense` - does not register an offense when given an unexpected description - does not register an offense when given a proper description - registers an offense when given an improper description - with `expect_no_offenses` - registers an offense when given an improper description - does not crash when given a proper description that is split with + - does not register an offense when given a proper description - does not register an offense when given an unexpected description - when not making an expectation on offenses - does not register an offense - with `expect_no_corrections` - registers an offense when given an improper description - in conjunction with expect_offense - registers an offense when given an improper description +RuboCop::Cop::Layout::EmptyLinesAroundAccessModifier + EnforcedStyle is `around` + requires blank line after public + ignores comment line before private + ignores private with a right-hand-side condition + accepts missing blank line when at the beginning of filewhen specifying a superclass that breaks the line + accepts missing blank line when specifying `self` that breaks the line + accepts missing blank line when at the beginning of module + accepts missing blank line when specifying a superclass that breaks the line + accepts missing blank line when at the end of specifying a superclass + accepts missing blank line when at the end of specifying `self` + requires blank line before public + accepts missing blank line when specifying a superclass that breaks the line + accepts missing blank line when at the beginning of filewhen specifying a superclass that breaks the line + accepts only using access modifier + accepts missing blank line when at the end of specifying `self` + ignores private inside a method call + ignores comment line before public + accepts missing blank line when at the beginning of class + requires blank line after protected + recognizes blank lines with DOS style line endings + autocorrects blank line after #{access_modifier} with comment + accepts missing blank line when at the beginning of module + requires blank line when next line started with end + ignores an accessor with the same name as module_function above a method definition + accepts missing blank line when at the beginning of filewhen specifying a superclass that breaks the line + requires blank line when next line started with end + ignores module_function with a right-hand-side condition + autocorrects blank line after #{access_modifier} with comment + accepts missing blank line when at the end of block + recognizes blank lines with DOS style line endings + requires blank line before module_function + requires blank line after module_function + ignores protected with a right-hand-side condition + ignores public inside a method call + ignores module_function deep inside a method call + ignores an accessor with the same name as protected above a method definition + ignores private with block argument + accepts missing blank line when at the beginning of class + ignores comment line before protected + requires blank line when next line started with end + accepts missing blank line when at the beginning of module + accepts missing blank line when at the end of specifying `self` + requires blank line after private + ignores an accessor with the same name as private above a method definition + requires blank line after, but not before, private when at the beginning of class/module + ignores protected deep inside a method call + requires blank line after, but not before, public when at the beginning of class/module + accepts missing blank line when at the beginning of sclass + ignores protected inside a method call + accepts missing blank line when specifying `self` that breaks the line + accepts missing blank line when at the beginning of file and preceded by a comment + accepts missing blank line when at the beginning of file and preceded by a comment + ignores module_function with block argument + accepts missing blank line when at the beginning of file and preceded by a comment + accepts missing blank line when at the end of block + accepts missing blank line when at the beginning of sclass + accepts only using access modifier + accepts only using access modifier + requires blank line when next line started with end + ignores an accessor with the same name as public above a method definition + recognizes blank lines with DOS style line endings + accepts missing blank line when at the end of specifying a superclass + accepts missing blank line when at the beginning of module + accepts missing blank line when at the end of specifying a superclass + recognizes blank lines with DOS style line endings + accepts missing blank line when at the end of specifying `self` + accepts missing blank line when at the beginning of sclass + ignores module_function inside a method call + ignores private deep inside a method call + accepts missing blank line when at the end of specifying a superclass + requires blank line after, but not before, module_function when at the beginning of class/module + accepts missing blank line when specifying `self` that breaks the line + accepts missing blank line when specifying a superclass that breaks the line + ignores public with block argument + autocorrects blank line after #{access_modifier} with comment + autocorrects blank line after #{access_modifier} with comment + accepts missing blank line when at the beginning of class + accepts missing blank line when at the beginning of sclass + ignores public deep inside a method call + requires blank line after, but not before, protected when at the beginning of class/module + accepts missing blank line when specifying a superclass that breaks the line + ignores comment line before module_function + ignores public with a right-hand-side condition + accepts missing blank line when at the end of block + ignores protected with block argument + accepts missing blank line when specifying `self` that breaks the line + requires blank line before protected + requires blank line before private + accepts missing blank line when at the beginning of filewhen specifying a superclass that breaks the line + accepts only using access modifier + accepts missing blank line when at the end of block + accepts missing blank line when at the beginning of file and preceded by a comment + accepts missing blank line when at the beginning of class + at the beginning of block + for blocks defined with {} + accepts missing blank line + accepts missing blank line with arguments + for blocks defined with do + accepts missing blank line + accepts missing blank line with arguments + requires blank line after, but not before, protected + at the beginning of block + for blocks defined with {} + accepts missing blank line with arguments + accepts missing blank line + for blocks defined with do + accepts missing blank line + requires blank line after, but not before, public + accepts missing blank line with arguments + at the beginning of block + for blocks defined with {} + accepts missing blank line + accepts missing blank line with arguments + for blocks defined with do + accepts missing blank line + requires blank line after, but not before, module_function + accepts missing blank line with arguments + at the beginning of block + for blocks defined with {} + accepts missing blank line with arguments + accepts missing blank line + for blocks defined with do + requires blank line after, but not before, private + accepts missing blank line + accepts missing blank line with arguments + EnforcedStyle is `only_before` + accepts blank line after module_function + accepts missing blank line after private + accepts missing blank line after protected + registers an offense for missing blank line before module_function + registers an offense for missing blank line before protected + accepts blank line after public + registers an offense for missing blank line before public + does not register an offense when `end` immediately after protected + does not register an offense when `end` immediately after private + registers an offense for missing blank line before private + registers an offense for blank line after protected + registers an offense for blank line after private + Ruby 2.7 + registers an offense for missing around line before module_function + ignores protected with numblock argument + registers an offense for missing around line before private + ignores public with numblock argument + ignores module_function with numblock argument + registers an offense for missing around line before public + ignores private with numblock argument + registers an offense for missing around line before protected -RuboCop::Cop::Layout::IndentationWidth - with Width set to 2 - with module - leaves body unchanged if the first body line is on the same line with module keyword - when consistency style is indented_internal_methods - accepts normal non-indented internal methods of module functions - registers an offense for bad indentation of a module body - when consistency style is normal - accepts an empty module body - registers an offense for bad indentation of a module body - with block - accepts badly indented code if block end is not on separate line - registers an offense for bad indentation of `do` ... `ensure` ... `end` block - accepts an empty block body - registers an offense for bad indentation of a {} body - registers an offense for bad indentation of a do/end body - does not register an offense for good indentation of `do` ... `ensure` ... `end` block - accepts a correctly indented block body - Ruby 2.7 - registers an offense for bad indentation of a do-end body - registers an offense for bad indentation of a {} body - when using safe navigation operator - registers an offense for an if with setter - registers an offense for bad indentation of a {} body - when consistency style is indented_internal_methods - registers an offense for bad indentation in a do/end body - with case match - accepts case/in/else laid out as a table - accepts indented in/else plus indented body - accepts correctly indented case/in/else - accepts case/in/else with then beginning a line - accepts aligned values in `in` clause - registers an offense for bad indentation in a case/in body - registers an offense for bad indentation in a case/else body - accepts aligned value in `in` clause and `else` is empty - with if statement - accepts if/elsif/else/end laid out as a table - accepts indentation after if on new line after assignment - registers offense for bad indentation of modifier if in else - accepts `ensure` after an empty body - leaves rescue ; end unchanged - registers an offense for bad indentation of an if body - accepts `rescue` after an empty body - registers and corrects on offense for bad indentation - registers an offense for bad indentation of an else body - registers an offense for bad indentation of an else body when if and elsif body contains no code - registers an offense for bad indentation of an else body when if body contains no code - does not indent heredoc strings - accepts a correctly aligned if/elsif/else/end - handles lines with only whitespace - accepts a one line if statement - does not correct in scopes that contain block comments - accepts a correctly aligned if/elsif/else/end as a method argument - accepts `rescue`/`ensure` after an empty body - does not raise any error with empty braces - accepts an if/else branches with rescue clauses - accepts `ensure` after an empty def - registers an offense for bad indentation of an elsif body - leaves block unchanged if block end is not on its own line - registers offense for bad indentation of ternary inside else - accepts `rescue` after an empty def - accepts if/then/else/end laid out as another table - accepts an empty if - accepts `rescue`/`ensure` after an empty def - indents parenthesized expressions - with assignment - when alignment style is variable - and end is aligned randomly - registers an offense for a while - registers an offense for an until - registers an offense for an if - and end is aligned with keyword - registers an offense for a while - registers an offense for an if - registers an offense for an if with setter - registers an offense for an if with element assignment - registers an offense for an until - accepts an if/else in assignment on next line - and end is aligned with variable - accepts an if/else with chaining with a block after the end - accepts an if with end aligned with variable - accepts an if with end aligned with setter - accepts an if/else with chaining after the end - accepts an if with end aligned with element assignment - accepts an if/else - when alignment style is keyword - and end is aligned with keyword - accepts a while in assignment - accepts an if in assignment - accepts an until in assignment - accepts an if/else in assignment on next line - accepts an if/else in assignment - and end is aligned with variable - registers and corrects bad indentation - registers an offense for an if - registers an offense for a while - when alignment style is start_of_line - and end is aligned with keyword - registers an offense for an if with setter - accepts an if/else in assignment on next line - registers an offense for an until - registers an offense for an if - registers an offense for a while - registers an offense for an if with element assignment - and end is aligned randomly - registers an offense for an until - registers an offense for a while - registers an offense for an if - and end is aligned with variable - accepts an if/else with chaining after the end - accepts an if with end aligned with setter - accepts an if/else with chaining with a block after the end - accepts an if with end aligned with element assignment - accepts an if with end aligned with variable - accepts an if/else - with case - accepts case/when/else laid out as a table - registers an offense for bad indentation in a case/when body - registers an offense for bad indentation in a case/else body - accepts case/when/else with then beginning a line - accepts aligned values in when clause - accepts indented when/else plus indented body - accepts correctly indented case/when/else - with class - accepts an empty class body - leaves body unchanged if the first body line is on the same line with an opening of singleton class - leaves body unchanged if the first body line is on the same line with class keyword - registers an offense for bad indentation of a class body - when consistency style is normal - accepts indented public, protected, and private - registers offenses for indented_internal_methods indentation - when consistency style is indented_internal_methods - registers an offense for normal non-indented internal methods indentation - registers an offense for normal non-indented internal methods indentation when defined in a singleton class - with access modifier - registers an offense and corrects for bad modifier indentation before good method definition - registers an offense for bad indentation of sections - when consistency style is outdent - accepts access modifier is outdent - with for - registers an offense for bad indentation of a for body - accepts an empty for - with def/rescue/end - registers an offense for bad indentation of bodies - registers an offense for bad indent of defs bodies with a modifier - with while/until - registers an offense for bad indentation of an until body - accepts an empty while - registers an offense for bad indentation of begin/end/while - registers an offense for bad indentation of a while body - with unless - accepts an empty unless - registers an offense for bad indentation of an unless body - with def/defs - when end is aligned with start of line - accepts an empty defs body - registers an offense for bad indentation of a def body - registers an offense for bad indentation of a defs body - accepts an empty def body - with an assignment - when multiple modifiers and def are on the same line - registers an offense for bad indentation of a def body - accepts a correctly aligned body - registers an offense for bad indentation of a defs body - when multiple modifiers are used in a block anda method call is made at end of the block - accepts a correctly aligned body - registers an offense for bad indentation of a def - registers an offense for bad indentation of a def body - when modifier and def are on the same line - accepts a correctly aligned body - registers an offense for bad indentation of a defs body - registers an offense for bad indentation of a def body - when end is aligned with def - accepts an empty def body - registers an offense for bad indentation of a defs body - registers an offense for bad indentation of a def body - with an assignment - accepts an empty defs body - when modifier and def are on the same line - accepts a correctly aligned body - registers an offense for bad indentation of a defs body - registers an offense for bad indentation of a def body - with begin/rescue/else/ensure/end - registers an offense for bad indentation of bodies - with Width set to 4 - registers and corrects offense for bad indentation - with ignored patterns set - accepts unindented lines for those keywords - for a file with byte order mark - accepts correctly indented method definition - with if statement - registers an offense for bad indentation of an if body +RuboCop::Cop::InternalAffairs::RedundantLocationArgument + when location argument is not passed + does not register an offense + when location argument is passed + when location argument is :expression + registers an offense + removes default `location` when preceded by another keyword + removes default `location` surrounded by other keywords + when there is a message argument + registers an offense + when location argument does not equal to :expression + does not register an offense -RuboCop::CLI --autocorrect - can correct a problems and the problem it creates - does not crash `Layout/ArgumentAlignment` and offenses and accepts `Layout/FirstArgumentIndentation` when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `EnforcedStyle: consistent_relative_to_receiver` of `Layout/FirstArgumentIndentation` - can correct two empty lines at end of class body - corrects `Layout/DotPosition` and `Style/RedundantSelf` offenses - corrects IndentationWidth and IndentationConsistency offenseswhen using `EnforcedStyle: outdent` and `EnforcedStyle: indented_internal_methods` - corrects `EnforcedStyle: require_parentheses` of `Style/MethodCallWithArgsParentheses` with `Lint/AmbiguousOperator` - corrects when specifying `EnforcedStyle: with_first_argument` of `Layout/ArgumentAlignment` and `EnforcedHashRocketStyle: separator` of `Layout/HashAlignment` - corrects when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `Layout/HashAlignment` - corrects RedundantBegin offenses and fixes indentation etc - corrects `Lint/UnusedMethodArgument` with `Style/ExplicitBlockArgument` - does not crash when using Lint/SafeNavigationWithEmpty and Layout/EmptyLinesAroundBlockBody - corrects when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `EnforcedStyle: consistent` of `Layout/FirstArgumentIndentation` - properly corrects when `Style/SoleNestedConditional` and one of `Style/NegatedIf` or `Style/NegatedUnless` detect offenses - corrects TrailingCommaIn(Array|Hash)Literal and Multiline(Array|Hash)BraceLayout offenses - corrects `Lint/Lambda` and `Lint/UnusedBlockArgument` offenses - does not crash Lint/SafeNavigationWithEmpty and offenses and accepts Style/SafeNavigation when checking `foo&.empty?` in a conditional - can correct empty line inside special form of nested modules - corrects LineEndConcatenation offenses leaving the RedundantInterpolation offense unchanged - corrects when specifying `EnforcedStyle: with_first_argument` of `Layout/ArgumentAlignment` and `EnforcedColonStyle: separator` of `Layout/HashAlignment` (`EnforcedColonStyle` is array) - corrects when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `Layout/HashAlignment` and `Layout/FirstHashElementIndentation` - corrects Tab and IndentationConsistency offenses - corrects Layout/RedundantLineBreak and Layout/SingleLineBlockChain offenses - corrects `EnforcedStyle: require_parentheses` of `Style/MethodCallWithArgsParentheses` with `Layout/SpaceBeforeFirstArg` - can correct MethodDefParentheses and other offense - corrects `EnforcedStyle: require_parentheses` of `Style/MethodCallWithArgsParentheses` with `EnforcedStyle: conditionals` of `Style/AndOr` - can be disabled for any cop in configuration - does not say [Corrected] if correction is not possible - can correct TrailingEmptyLines and TrailingWhitespace offenses - can correct two problems with blocks - does not hang SpaceAfterPunctuation and SpaceInsideArrayLiteralBrackets - does not correct SpaceAroundOperators in a hash that would be changed back - corrects `Layout/SpaceAroundOperators` and `Layout/ExtraSpacing` offenses when using `ForceEqualSignAlignment: true` - does not hang SpaceAfterPunctuation and SpaceInsideParens - corrects `EnforcedStyle: require_parentheses` of `Style/MethodCallWithArgsParentheses` with `Style/NestedParenthesizedCalls` - corrects `Layout/DotPosition` and `Layout/SingleLineBlockChain` offenses - corrects IndentationWidth and IndentationConsistency offenses - corrects `Style/SoleNestedConditional` with `Style/InverseMethods` and `Style/IfUnlessModifier` - can correct single line methods - says [Correctable] if correction is unsafe - avoids adding extra spaces when both `Style/Semicolon` and `Style/SingleLineMethods`both apply - can correct HashSyntax and SpaceAroundOperators offenses - indents the elements of a hash in hash based on the parent hash key when the parent hash is a method argument and has following other sibling pairs - corrects InitialIndentation offenses - breaks line at the beginning of trailing class/module body without removing a semicolon in the bodywhen using `Style/TrailingBodyOnClass` and `Style/TrailingBodyOnModule` - corrects Style/BlockDelimiters offenses when specifyingLayout/SpaceInsideBlockBraces together - corrects `Style/RedundantBegin` with `Style/MultilineMemoization` - can correct indentation and another thing - corrects `EnforcedStyle: require_parentheses` of `Style/MethodCallWithArgsParentheses` with `Style/RescueModifier` - corrects Lint/ParenthesesAsGroupedExpression and offenses and accepts Style/RedundantParentheses - corrects IndentationWidth, RedundantBegin, and RescueEnsureAlignment offenses - can correct SpaceAfterComma and HashSyntax offenses - handles different SpaceInsideBlockBraces and SpaceInsideHashLiteralBraces - corrects Style/Next and Style/SafeNavigation offenses - properly autocorrects when `Style/TernaryParentheses` requires parentheses that `Style/RedundantParentheses` would otherwise remove - registers an offense and corrects when using `Layout/ArgumentAlignment`, `Layout/FirstArgumentIndentation`, and `Layout/FirstMethodArgumentLineBreak` and specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `EnforcedStyle: consistent` of `Layout/FirstArgumentIndentation` - corrects `Style/IfUnlessModifier` with `Style/SoleNestedConditional` - plays nicely with default cops in complex ExtraSpacing scenarios - corrects `EnforcedStyle: hash_rockets` of `Style/HashSyntax` with `Layout/HashAlignment` - corrects code with indentation problems - corrects RedundantCopDisableDirective offenses - does not crash when using `Layout/CaseIndentation` and `Layout/ElseAlignment` - corrects Style/InverseMethods and Style/Not offenses - consistently quotes symbol keys in a hash using `Lint/SymbolConversion` with `EnforcedStyle: consistent` and `Style/QuotedSymbols` - does not correct ExtraSpacing in a hash that would be changed back - does not crash `Layout/ArgumentAlignment` and offenses and accepts `Layout/FirstArgumentIndentation` when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `EnforcedStyle: special_for_inner_method_call` of `Layout/FirstArgumentIndentation` - can correct MethodCallWithoutArgsParentheses and EmptyLiteral offenses - corrects only IndentationWidth without crashing - corrects `Naming/RescuedExceptionsVariableName` and `, `Style/RescueStandardError`and `Lint/OverwriteByRescue` offenses - can change block comments and indent them - does not crash `Layout/ArgumentAlignment` and offenses and accepts `Layout/FirstArgumentIndentation` when specifying `EnforcedStyle: with_fixed_indentation` of `Layout/ArgumentAlignment` and `EnforcedStyle: special_for_inner_method_call_in_parentheses` of `Layout/FirstArgumentIndentation` - can correct WordArray and SpaceAfterComma offenses - corrects Style/BlockDelimiters offenses when specifyingLayout/SpaceBeforeBlockBraces with `EnforcedStyle: no_space` together - corrects `Style/TernaryParentheses` offenses and accepts `Lint/ParenthesesAsGroupedExpression` - corrects IndentationWidth and IndentationConsistency offenseswithout correcting `Style/TrailingBodyOnClass` - does not correct Style/IfUnlessModifier offense disabled by a comment directive and does not fire Lint/RedundantCopDisableDirective offense even though that directive would make the modifier form too long - corrects `EnforcedStyle: line_count_based` of `Style/BlockDelimiters` with `Style/CommentedKeyword` and `Layout/BlockEndNewline` - corrects properly when both `Style/MapToHash` and `Style/HashTransformKeys`or `Style/HashTransformValues` registers - corrects SymbolProc and SpaceBeforeBlockBraces offenses - corrects HeredocArgumentClosingParenthesis offenses and ignores TrailingCommaInArguments offense - can correct two problems in the same place - corrects when specifying `EnforcedStyle: with_first_argument` of `Layout/ArgumentAlignment` and `EnforcedColonStyle: separator` of `Layout/HashAlignment` - corrects `Style/InverseMethods` offenses when specifying `IncludeSemanticChanges: false` of `Style/NonNilCheck` and `EnforcedStyle: comparison` of `Style/NilComparison` - honors Exclude settings in individual cops - can correct IndentHash offenses with separator style - can correct HashSyntax when --only is used - corrects indentation for a begin/rescue/else/ensure/end block properly - trailing comma cops - when the style is `consistent_comma` - corrects TrailingCommaInLiteral and TrailingCommaInArguments without producing a double comma - when the style is `comma` - corrects TrailingCommaInLiteral and TrailingCommaInArguments without producing a double comma - space_inside_bracket cops - when array style is no_space & reference style is space - corrects SpaceInsideArrayLiteralBrackets and SpaceInsideReferenceBrackets - when array style is space & reference style is no space - corrects SpaceInsideArrayLiteralBrackets and SpaceInsideReferenceBrackets - when array style is compact & reference style is no_space - corrects SpaceInsideArrayLiteralBrackets and SpaceInsideReferenceBrackets - when array style is compact & reference style is space - corrects SpaceInsideArrayLiteralBrackets and SpaceInsideReferenceBrackets - when BlockDelimiters has line_count_based style - corrects SpaceBeforeBlockBraces, SpaceInsideBlockBraces offenses - when BlockDelimiters has semantic style - corrects SpaceBeforeBlockBraces, SpaceInsideBlockBraces offenses - when BlockDelimiters has braces_for_chaining style - corrects SpaceBeforeBlockBraces, SpaceInsideBlockBraces offenses - caching - with no offenses in the cache - doesn't correct offenses - with an offense in the cache - corrects offenses +RuboCop::Cop::Style::Sample + behaves like offense + registers an offense for shuffle.first(2) + behaves like accepts + accepts shuffle.at(2) + behaves like accepts + accepts shuffle[2..-3] + behaves like offense + registers an offense for shuffle(random: foo).last(bar) + behaves like accepts + accepts shuffle[foo, bar] + behaves like offense + registers an offense for shuffle.at(0) + behaves like accepts + accepts shuffle[foo..bar] + behaves like offense + registers an offense for shuffle.slice(0...3) + behaves like offense + registers an offense for shuffle.last(3) + behaves like offense + registers an offense for shuffle.at(-1) + behaves like accepts + accepts shuffle.map { |e| e } + behaves like accepts + accepts shuffle[2..3] + behaves like offense + registers an offense for shuffle.first(foo) + behaves like accepts + accepts shuffle[2] + behaves like accepts + accepts shuffle.at(foo) + behaves like accepts + accepts shuffle.slice(foo..3) + behaves like accepts + accepts shuffle.slice(foo, bar) + behaves like accepts + accepts shuffle.slice(2..3) + behaves like accepts + accepts shuffle.slice(2..-3) + behaves like accepts + accepts shuffle(random: Random.new)[2, 3] + behaves like accepts + accepts shuffle.slice(-4..-3) + behaves like offense + registers an offense for shuffle[0..3] + behaves like accepts + accepts shuffle[-4..-3] + behaves like accepts + accepts shuffle.join([5, 6, 7]) + behaves like accepts + accepts sample + behaves like accepts + accepts shuffle[foo] + behaves like accepts + accepts shuffle[foo, 3] + behaves like offense + registers an offense for shuffle.last(bar) + behaves like offense + registers an offense for shuffle(random: Random.new).first + behaves like accepts + accepts shuffle(random: Random.new).find(&:odd?) + behaves like offense + registers an offense for shuffle.slice(0) + behaves like offense + registers an offense for shuffle.slice(-1) + behaves like accepts + accepts shuffle[3, 3] + behaves like offense + registers an offense for shuffle(random: Random.new).first(2) + Ruby >= 2.7 + behaves like offense + registers an offense for shuffle[...3] + behaves like offense + registers an offense for shuffle.last + behaves like accepts + accepts shuffle.slice(foo) + behaves like offense + registers an offense for shuffle[0, 3] + behaves like accepts + accepts shuffle(random: Random.new)[2] + behaves like offense + registers an offense for shuffle(random: Random.new)[0..3] + behaves like offense + registers an offense for shuffle.first + behaves like accepts + accepts shuffle.slice(foo..bar) + behaves like accepts + accepts shuffle.slice(foo, 3) + behaves like offense + registers an offense for shuffle.slice(0..3) + behaves like accepts + accepts shuffle.slice(3, 3) + behaves like offense + registers an offense for shuffle[0...3] + Ruby >= 2.6 + behaves like accepts + accepts shuffle[3..] + behaves like accepts + accepts shuffle[3...] + behaves like accepts + accepts shuffle(random: Random.new) + behaves like accepts + accepts shuffle[foo..3] + behaves like accepts + accepts shuffle + behaves like offense + registers an offense for shuffle.slice(0, 3) + behaves like offense + registers an offense for shuffle[-1] + behaves like offense + registers an offense for shuffle[0] + behaves like accepts + accepts shuffle.slice(2) -RuboCop::Cop::Style::ClassEqualityComparison - registers an offense and corrects when comparing class using `equal?` for equality - registers an offense and corrects when comparing double quoted class name for equality - registers an offense and corrects when comparing single quoted class name for equality - registers an offense and corrects when comparing `Module#name` for equality - registers an offense and corrects when comparing class using `==` for equality - registers an offense and corrects when comparing class using `eql?` for equality - does not register an offense when using `instance_of?` - with instance variable comparison in module - registers and corrects an offense - when AllowedMethods is enabled - does not register an offense when comparing class for equality - with String comparison in module - registers and corrects an offense - when AllowedPatterns is enabled - does not register an offense when comparing class for equality +RuboCop::Cop::Layout::MultilineMethodCallIndentation + when EnforcedStyle is aligned + accepts indented methods in LHS of []= assignment + accepts indented methods inside and outside a block + registers an offense and corrects no indentation of second line + accepts aligned methods in if condition + accepts no extra indentation of third line + does not check binary operations when string wrapped with + + does not check binary operations when string wrapped with backslash + registers an offense and corrects misaligned methods in local variable assignment + registers an offense and corrects misaligned methods in unless condition + accepts indentation relative to first receiver + registers an offense and corrects extra indentation of third line + registers an offense and corrects extra indentation of 3rd line in typical RSpec code + registers an offense and corrects misaligned method in []= call + registers an offense and corrects misaligned methods in until condition + accepts aligned method in assignment + block + assignment + registers an offense and corrects misaligned methods in if condition + accepts aligned methods in assignment + accepts correctly aligned methods in assignment + accepts aligned methods in constant assignment + registers an offense and corrects unaligned methods in assignment + registers an offense and corrects misaligned methods in while condition + registers an offense and corrects one space indentation of 3rd line + accepts aligned methods in if + assignment + accepts indented methods in ordinary statement + accepts indented and aligned methods in binary operation + accepts indented methods in for body + doesn't fail on unary operators + accepts correctly aligned methods in operands + accepts indented method when there is nothing to align with + accepts even indentation of consecutive lines in typical RSpec code + registers an offense and corrects one space indentation of 2nd line + registers an offense and corrects proc call without a selector + registers an offense and corrects the emacs ruby-mode 1.1 indentation of an expression in an array + accepts alignment of method with assignment and operator-like method + registers an offense and corrects 3 spaces indentation of 2nd line + doesn't crash on unaligned multiline lambdas + accepts aligned methods in operator assignment + accepts aligned methods in a begin..end block + accepts alignment inside a grouped expression + accepts aligned method in return + accepts any indentation of parameters to #[] + accepts an expression where the first method spans multiple lines + for semantic alignment + doesn't fail on a chain of aref calls + accepts 3 aligned methods + registers an offense and corrects unaligned method in block body + accepts method being aligned with method + accepts aligned method even when an aref is in the chain + accepts aligned method even when an aref is first in the chain + accepts aligned method with blocks in operation assignment + accepts key access to hash + accepts method being aligned with method in assignment + registers an offense and corrects unaligned methods + accepts methods being aligned with method that is an argument in assignment + accepts methods being aligned with method that is an argument + accepts nested method calls + >= Ruby 2.7 + accepts methods being aligned with method that is an argumentwhen using numbered parameter + when EnforcedStyle is indented_relative_to_receiver + doesn't fail on unary operators + accepts indentation of consecutive lines in typical RSpec code + doesn't crash on unaligned multiline lambdas + accepts correctly indented methods in operation + registers an offense and corrects the emacs ruby-mode 1.1 indentation of an expression in an array + registers an offense and corrects extra indentation of 3rd line + accepts alignment inside a grouped expression + accepts indented methods in ordinary statement + registers an offense and corrects no indentation of second line + registers an offense and corrects 3 spaces indentation of second line + accepts indentation relative to first receiver + accepts alignment of method with assignment and operator-like method + accepts an expression where the first method spans multiple lines + does not register an offense when multiline method chain has expected indent width and the method is preceded by splat + registers an offense and corrects extra indentation of 3rd line in typical RSpec code + accepts no extra indentation of third line + accepts indented methods in for body + accepts any indentation of parameters to #[] + accepts indented methods in LHS of []= assignment + registers an offense and corrects one space indentation of 2nd line + does not register an offense when multiline method chain has expected indent width and the method is preceded by double splat + accepts indented methods inside and outside a block + registers an offense and corrects proc call without a selector + for possible semantic alignment + accepts indented methods + when EnforcedStyle is indented + accepts alignment of method with assignment and operator-like method + accepts normal indentation of method parameters + registers an offense and corrects one space indentation of 2nd line + registers an offense for a 2 space indentation of until condition + accepts indented methods in unless body + accepts even indentation of consecutive lines in typical RSpec code + accepts indentation of assignment to a with rhs on same line + registers an offense and corrects 0 space indentation inside square brackets + accepts indented methods in while body + accepts indented methods in if body + accepts indented methods in until body + registers an offense and corrects correct + unrecognized style + accepts indented methods inside and outside a block + accepts indentation relative to first receiver + registers an offense and corrects 1 space indentation of 3rd line + accepts special indentation of for expression + accepts indented methods in for body + accepts any indentation of method parameters + registers an offense for a 2 space indentation of if condition + registers an offense and corrects the emacs ruby-mode 1.1 indentation of an expression in an array + accepts normal indentation inside grouped expression + accepts indented methods in if condition + accepts alignment inside a grouped expression + accepts an expression where the first method spans multiple lines + accepts double indentation of unless condition + accepts indentation of assignment to obj.a with newline after = + accepts double indentation of until condition + registers an offense and corrects extra indentation of third line + accepts indentation of assignment to a with newline after = + accepts special indentation of return if condition + accepts no extra indentation of third line + registers an offense and corrects 3 spaces indentation of 2nd line + accepts correctly indented methods in operation + registers an offense for a 2 space indentation of unless condition + accepts indented methods in ordinary statement + registers an offense and corrects wrong indentation of for expression + accepts indentation of assignment to a[:key] with newline after = + accepts special indentation of return unless condition + registers an offense and corrects proc call without a selector + accepts indentation of assignment to a[:key] with rhs on same line + accepts indented methods in LHS of []= assignment + doesn't fail on unary operators + registers an offense and corrects aligned methods in if condition + registers an offense and corrects extra indentation of 3rd line in typical RSpec code + accepts indentation of assignment to obj.a[:key] with newline after = + doesn't crash on unaligned multiline lambdas + accepts double indentation of if condition + registers an offense and corrects aligned operators in assignment + accepts any indentation of parameters to #[] + registers an offense and corrects no indentation of second line + registers an offense for a 2 space indentation of while condition + accepts double indentation of while condition + when indentation width is overridden for this cop + accepts indented methods in if body + accepts indented methods + accepts indentation of assignment + accepts indented methods in while body + registers an offense for a 4 space indentation of if condition + accepts indentation of until condition which is offset by a single normal indentation step + registers an offense for a 4 space indentation of unless condition + registers an offense for a 4 space indentation of until condition + accepts correctly indented methods in operation + accepts indentation of unless condition which is offset by a single normal indentation step + registers an offense for a 4 space indentation of while condition + accepts indented methods in if condition + accepts indentation of if condition which is offset by a single normal indentation step + accepts indented methods in unless body + accepts indentation of while condition which is offset by a single normal indentation step + accepts indented methods in until body + for possible semantic alignment + accepts indented methods -RuboCop::Cop::Layout::SpaceAroundMethodCallOperator - does not register an offense when no method call operator - does not register an offense when using `__ENCODING__` - dot operator - registers an offense and corrects when space before method call - does not register an offense when no space around method call - registers an offense and corrects when space around multiple method call operator - registers an offense and corrects when spaces after `Proc#call` shorthand call - registers an offense and corrects when spaces around method call - registers an offense and corrects when space around intermediate method call operator - registers an offense and corrects when space before first method call operator - registers an offense and corrects when spaces before method call - registers an offense and corrects when space after last method call operator - registers an offense and corrects when spaces after method call - registers an offense and corrects when space after method call - registers an offense and corrects when space after first method call operator - does not register an offense when no space around any `.` operators - registers an offense and corrects when space before last method call operator - when there is a space between `.` operator and a comment - registers an offense when there is a space before `.` - does not register an offense when there is not a space before `.` - when multi line method call - registers an offense and corrects when space before method call - registers an offense and corrects when space before method call in suffix chaining - does not register an offense when no space after the `.` - safe navigation operator - registers an offense and corrects when spaces before method call - registers an offense and corrects when space before first method call operator - registers an offense and corrects when spaces after method call - registers an offense and corrects when space around intermediate method call operator - registers an offense and corrects when space after method call - registers an offense and corrects when space before last method call operator - registers an offense and corrects when space before method call - does not register an offense when no space around method call - registers an offense and corrects when space around multiple method call operator - registers an offense and corrects when space after last method call operator - does not register an offense when no space around any `.` operators - registers an offense and corrects when space after first method call operator - registers an offense and corrects when spaces around method call - when multi line method call - registers an offense and corrects when space before method call in suffix chaining - does not register an offense when no space after the `&.` - registers an offense and corrects when space before method call - :: operator - does not register an offense when no space around method call - registers an offense and corrects when space after method call - registers an offense and corrects when space around multiple method call operator - registers an offense and corrects when spaces after method call - does not register an offense if no space with conditionals - registers an offense and corrects when space after first operator with assignment - registers an offense and corrects when space after last method call operator - does not register an offense when no space around any `.` operators - does not register an offense if no space before `::` operator with assignment - does not register an offense if no space before `::` operator with inheritance - registers an offense and corrects when multiple spaces with assignment - registers an offense and corrects when space around intermediate method call operator - when multi line method call - registers an offense and corrects when space before method call - does not register an offense when no space after the `::` +RuboCop::Cop::Style::RescueModifier + handles modifier rescue in a method + registers an offense for modifier rescue + does not register an offense for nested normal rescue + handles modifier rescue in normal rescue + registers an offense for modifier rescue around parallel assignment + does not register an offense for normal rescue with ensure + handles parentheses around a rescue modifier + handles more complex expression with modifier rescue + does not register an offense for normal rescue + when a singleton method has implicit begin + handles modifier rescue in body of implicit begin + accepts normal rescue + autocorrect + corrects doubled rescue modifiers + corrects complex rescue modifier + excluded file + processes excluded files with issue + when an instance method has implicit begin + handles modifier rescue in body of implicit begin + accepts normal rescue -RuboCop::Cop::Style::MinMax - with an array literal containing calls to `#min` and `#max` - when the expression is used in a parallel assignment - registers an offense if the receivers match - does not register an offense if there are additional elements - does not register an offense if the receiver is implicit - does not register an offense if the receivers do not match - when the expression stands alone - does not register an offense if the receiver is implicit - does not register an offense if there are additional elements - does not register an offense if the receivers do not match - registers an offense if the receivers match - when the expression is used as a return value - does not register an offense if the receiver is implicit - does not register an offense if there are additional elements - does not register an offense if the receivers do not match - registers an offense if the receivers match +RuboCop::Cop::Layout::SpaceInsideParens + when EnforcedStyle is no_space + accepts parentheses with line break + accepts parentheses in block parameter list + accepts parentheses with no spaces + registers an offense for spaces inside parens + registers an offense for space around heredoc start + accepts parentheses with comment and line break + when EnforcedStyle is space + accepts empty parentheses without spaces + accepts parentheses with line break + registers an offense in block parameter list with no spaces + accepts parentheses with comment and line break + registers an offense for space inside empty parens + registers an offense for no spaces inside parens + accepts parentheses with spaces + registers an offense for no space around heredoc start + when EnforcedStyle is compact + registers an offense in block parameter list with no spaces + registers an offense for space between consecutive brackets + accepts parentheses with comment and line break + accepts two consecutive right parentheses + registers an offense for no spaces inside parens + accepts three consecutive left parentheses + accepts three consecutive right parentheses + accepts parentheses with spaces + accepts empty parentheses without spaces + registers an offense for no space around heredoc start + accepts parentheses with line break + registers an offense for space inside empty parens + accepts two consecutive left parentheses + registers multiple offense for a missing and extra space between consecutive brackets -RuboCop::Cop::Style::NumberedParameters - >= Ruby 2.7 - EnforcedStyle: allow_single_line - registers an offense when using numbered parameters with multi-line blocks - does not register an offense when using numbered parameters with single-line blocks - EnforcedStyle: disallow - does an offense when using numbered parameters even with single-line blocks +RuboCop::Formatter::DisabledConfigFormatter + when exclude_limit option is omitted + disables the cop with 15 offending files + when there's .rubocop.yml + merges in excludes from .rubocop.yml + when exclude_limit option is passed + respects the file exclusion list limit + with autocorrect supported cop + adds a comment about --autocorrect option + when no files are inspected + creates a .rubocop_todo.yml even in such case + when any offenses are detected + displays YAML configuration disabling all cops with offenses RuboCop::Cop::Naming::FileName - with snake_case names which use ? and ! - does not register an offense with snake_case file names with non-rb extension does not register an offense + with dotfiles + does not register an offense with camelCase file names without file extension registers an offense - with snake_case file names without file extension - does not register an offense - with acronym class name + with snake_case file names ending in .rb does not register an offense - with include acronym name + with non-ascii characters in filename does not register an offense when CheckDefinitionPathHierarchy is false - with a matching module containing a non-matching class - does not register an offense - with a non-matching module containing a matching class - does not register an offense on a file with a non-matching class registers an offense - on a file with a matching class - does not register an offense + on a file with a non-matching struct + registers an offense + on an empty file + registers an offense on a file with a matching struct does not register an offense - with a non-matching module containing a matching struct + with a non-matching module containing a matching class does not register an offense with a matching module containing a non-matching struct does not register an offense - on a file with a non-matching struct - registers an offense in a non-matching directory, but with a matching class does not register an offense - on an empty file - registers an offense - with snake_case file names with multiple extensions - does not register an offense - with snake_case names which use + - does not register an offense - with non-snake-case file names with a shebang + with a matching module containing a non-matching class + does not register an offense + on a file with a matching class + does not register an offense + with a non-matching module containing a matching struct + does not register an offense + with snake_case file names without file extension does not register an offense - when IgnoreExecutableScripts is disabled - registers an offense when ExpectMatchingDefinition is true - on a file which defines a Struct with a block - in a matching directory under lib - does not register an offense - in a directory with multiple instances of spec + on a file which uses Name::Spaced::Module syntax + in a matching directory under spec does not register an offense - in a directory elsewhere which only matches the module name + in a directory with multiple instances of lib does not register an offense + in a directory elsewhere which does not match the module name + registers an offense in a matching directory under src does not register an offense - in a non-matching directory under src - registers an offense - in a matching directory under test + in a matching directory under lib does not register an offense in a directory with multiple instances of src does not register an offense - in a directory with multiple instances of test + in a directory elsewhere which only matches the module name does not register an offense - in a matching directory under spec + in a directory with multiple instances of test does not register an offense in a non-matching directory under test registers an offense - in a directory elsewhere which does not match the module name - registers an offense - in a non-matching directory under spec - registers an offense - in a directory with multiple instances of lib - does not register an offense - in a non-matching directory under lib - registers an offense - on an empty file - registers an offense - on a file which defines a nested class - in a directory with multiple instances of src + in a directory with multiple instances of spec does not register an offense in a non-matching directory under src registers an offense - in a directory elsewhere which does not match the module name + in a non-matching directory under lib registers an offense - in a directory with multiple instances of test - does not register an offense in a matching directory under test does not register an offense - in a non-matching directory under test + in a non-matching directory under spec registers an offense - in a directory with multiple instances of spec - does not register an offense + on a file which defines multiple classes in a non-matching directory under lib registers an offense - in a matching directory under src - does not register an offense - in a directory with multiple instances of lib - does not register an offense - in a matching directory under lib - does not register an offense - in a directory elsewhere which only matches the module name - does not register an offense - in a matching directory under spec + in a directory with multiple instances of spec does not register an offense - in a non-matching directory under spec - registers an offense - on a file which defines no class or module at all - under spec - registers an offense - under src - registers an offense - under lib when not added to root - registers an offense - under lib - registers an offense - under test - registers an offense - under some other random directory + in a non-matching directory under test registers an offense - on a file which uses Name::Spaced::Module syntax in a non-matching directory under spec registers an offense + in a matching directory under test + does not register an offense in a non-matching directory under src registers an offense - in a directory with multiple instances of src + in a matching directory under src does not register an offense - in a directory with multiple instances of spec + in a directory elsewhere which only matches the module name does not register an offense in a matching directory under spec does not register an offense - in a non-matching directory under lib - registers an offense in a directory with multiple instances of lib does not register an offense - in a matching directory under test + in a directory elsewhere which does not match the module name + registers an offense + in a directory with multiple instances of src does not register an offense - in a matching directory under src + in a directory with multiple instances of test does not register an offense in a matching directory under lib does not register an offense - in a directory with multiple instances of test + on a file which defines a Struct without a block + in a matching directory under lib does not register an offense - in a directory elsewhere which only matches the module name + in a directory with multiple instances of src does not register an offense - in a directory elsewhere which does not match the module name - registers an offense in a non-matching directory under test registers an offense - on a file which defines multiple classes - in a non-matching directory under src - registers an offense + in a directory with multiple instances of test + does not register an offense in a directory with multiple instances of lib does not register an offense in a matching directory under test does not register an offense + in a matching directory under src + does not register an offense + in a non-matching directory under lib + registers an offense + in a non-matching directory under spec + registers an offense in a directory elsewhere which does not match the module name registers an offense + in a non-matching directory under src + registers an offense in a matching directory under spec does not register an offense - in a matching directory under lib + in a directory with multiple instances of spec does not register an offense + in a directory elsewhere which only matches the module name + does not register an offense + on a file which defines a Struct with a block in a non-matching directory under lib registers an offense + in a matching directory under spec + does not register an offense in a non-matching directory under test registers an offense - in a directory with multiple instances of spec - does not register an offense in a directory elsewhere which only matches the module name does not register an offense - in a matching directory under src - does not register an offense + in a non-matching directory under src + registers an offense in a non-matching directory under spec registers an offense - in a directory with multiple instances of src + in a matching directory under lib + does not register an offense + in a directory elsewhere which does not match the module name + registers an offense + in a matching directory under src + does not register an offense + in a matching directory under test does not register an offense in a directory with multiple instances of test does not register an offense - on a file which defines a Struct without a block - in a directory elsewhere which only matches the module name + in a directory with multiple instances of src does not register an offense - in a non-matching directory under src - registers an offense - in a matching directory under src + in a directory with multiple instances of lib does not register an offense - in a non-matching directory under lib - registers an offense in a directory with multiple instances of spec does not register an offense - in a matching directory under spec - does not register an offense + on a file which defines a nested class in a directory with multiple instances of test does not register an offense + in a matching directory under spec + does not register an offense in a non-matching directory under spec registers an offense + in a matching directory under lib + does not register an offense in a directory elsewhere which does not match the module name registers an offense in a directory with multiple instances of lib does not register an offense in a non-matching directory under test registers an offense - in a matching directory under test - does not register an offense in a directory with multiple instances of src does not register an offense - in a matching directory under lib - does not register an offense - on a file which defines a nested module + in a non-matching directory under src + registers an offense in a matching directory under test does not register an offense - in a non-matching directory under src + in a non-matching directory under lib registers an offense - in a directory with multiple instances of lib + in a matching directory under src + does not register an offense + in a directory with multiple instances of spec does not register an offense in a directory elsewhere which only matches the module name does not register an offense - in a non-matching directory under test + on a file which defines a nested module + in a directory with multiple instances of lib + does not register an offense + in a matching directory under src + does not register an offense + in a matching directory under spec + does not register an offense + in a non-matching directory under spec registers an offense in a matching directory under lib does not register an offense - in a non-matching directory under lib - registers an offense in a directory with multiple instances of test does not register an offense - in a directory elsewhere which does not match the module name - registers an offense - in a non-matching directory under spec - registers an offense in a directory with multiple instances of src does not register an offense - in a matching directory under spec + in a matching directory under test does not register an offense - in a directory with multiple instances of spec + in a non-matching directory under test + registers an offense + in a non-matching directory under lib + registers an offense + in a directory elsewhere which does not match the module name + registers an offense + in a directory elsewhere which only matches the module name does not register an offense - in a matching directory under src + in a directory with multiple instances of spec does not register an offense + in a non-matching directory under src + registers an offense + on a file which defines no class or module at all + under some other random directory + registers an offense + under spec + registers an offense + under test + registers an offense + under lib + registers an offense + under src + registers an offense + under lib when not added to root + registers an offense on an empty file with a space in its filename registers an offense + on an empty file + registers an offense + with camelCase file names ending in .rb + registers an offense when the file is specified in AllCops/Include with a non-snake_case file name does not register an offense + with include acronym name + does not register an offense + with non-snake-case file names with a shebang + does not register an offense + when IgnoreExecutableScripts is disabled + registers an offense when Regex is set - with a matching name - does not register an offense with a non-matching name registers an offense - with snake_case file names ending in .rb + with a matching name + does not register an offense + with snake_case names which use ? and ! does not register an offense with acronym namespace does not register an offense - with dotfiles + with snake_case file names with multiple extensions does not register an offense - with non-ascii characters in filename + with acronym class name does not register an offense - with camelCase file names ending in .rb + with snake_case names which use + + does not register an offense + +RuboCop::Cop::Gemspec::DeprecatedAttributeAssignment + behaves like deprecated attributes + registers and corrects an offense when using `s.rubygems_version =` + does not register an offense when using `rubygems_version =` and receiver is not `Gem::Specification.new` block variable + does not register an offense when using `s.rubygems_version =` outside `Gem::Specification.new` + registers and corrects an offense when using `spec.rubygems_version =` + behaves like deprecated attributes with addition + registers and corrects an offense when using `s.rubygems_version +=` + registers and corrects an offense when using `spec.rubygems_version +=` + behaves like deprecated attributes + registers and corrects an offense when using `s.rubygems_version =` + does not register an offense when using `s.rubygems_version =` outside `Gem::Specification.new` + registers and corrects an offense when using `spec.rubygems_version =` + does not register an offense when using `rubygems_version =` and receiver is not `Gem::Specification.new` block variable + behaves like deprecated attributes + does not register an offense when using `s.rubygems_version =` outside `Gem::Specification.new` + registers and corrects an offense when using `s.rubygems_version =` + registers and corrects an offense when using `spec.rubygems_version =` + does not register an offense when using `rubygems_version =` and receiver is not `Gem::Specification.new` block variable + behaves like deprecated attributes + does not register an offense when using `rubygems_version =` and receiver is not `Gem::Specification.new` block variable + registers and corrects an offense when using `spec.rubygems_version =` + registers and corrects an offense when using `s.rubygems_version =` + does not register an offense when using `s.rubygems_version =` outside `Gem::Specification.new` + +RuboCop::Cop::Style::BarePercentLiterals + when EnforcedStyle is percent_q + and strings are dynamic + accepts %q + accepts heredoc + accepts __FILE__ + accepts regular expressions + accepts '' + accepts "" string with interpolation + accepts %Q() + accepts "" + registers an offense for %() + and strings are static + accepts %Q() + accepts "" + accepts "" string with interpolation + accepts '' + accepts __FILE__ + registers an offense for %() + accepts %q + accepts heredoc + accepts regular expressions + when EnforcedStyle is bare_percent + and strings are dynamic + accepts '' + accepts %q + accepts __FILE__ + accepts "" string with interpolation + accepts regular expressions + accepts "" + accepts heredoc + accepts %() + registers an offense for %Q() + and strings are static + registers an offense for %Q() + accepts "" + accepts '' + accepts heredoc + accepts %q + accepts "" string with interpolation + accepts regular expressions + accepts %() + accepts __FILE__ + +RuboCop::Cop::Style::FormatStringToken + ignores placeholder arguments + ignores percent escapes + ignores time format and unrelated `format` method using + supports flags and modifiers + ignores time format (when used as argument to strftime) + ignores time format (when used as argument to strptime) + handles dstrs + ignores __FILE__ + ignores regexp + works inside hashes + ignores `%r` regexp + ignores http links + ignores xstr + ignores time format when it is stored in a variable + behaves like enforced styles for format string tokens + when enforced style is annotated + sets the enforced style to annotated after inspecting "%s" + registers offenses for template style + #correctable_sequence? + supports dynamic string with interpolation + detects when the cop must be disabled to avoid offenses + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + registers offense for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when enforced style is template + does not register offenses for annotated style + #correctable_sequence? + configures the enforced style to template after inspecting "%{a}" + supports dynamic string with interpolation + detects when the cop must be disabled to avoid offenses + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when enforced style is unannotated + #correctable_sequence? + behaves like enforced styles for format string tokens + when enforced style is template + #correctable_sequence? + supports dynamic string with interpolation + detects when the cop must be disabled to avoid offenses + configures the enforced style to template after inspecting "%{a}" + does not register offenses for annotated style + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when enforced style is unannotated + #correctable_sequence? + when enforced style is annotated + sets the enforced style to annotated after inspecting "%s" + supports dynamic string with interpolation + detects when the cop must be disabled to avoid offenses + #correctable_sequence? + registers offenses for template style + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + registers offense for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + behaves like enforced styles for format string tokens + when enforced style is annotated + sets the enforced style to annotated after inspecting "%s" + #correctable_sequence? + detects when the cop must be disabled to avoid offenses + supports dynamic string with interpolation + registers offenses for template style + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + registers offense for dual unannotated + does not register offenses for single unannotated + when enforced style is template + detects when the cop must be disabled to avoid offenses + does not register offenses for annotated style + #correctable_sequence? + configures the enforced style to template after inspecting "%{a}" + supports dynamic string with interpolation + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when enforced style is unannotated + #correctable_sequence? + behaves like enforced styles for format string tokens + when enforced style is unannotated + #correctable_sequence? + when enforced style is annotated + registers offenses for template style + #correctable_sequence? + detects when the cop must be disabled to avoid offenses + supports dynamic string with interpolation + sets the enforced style to annotated after inspecting "%s" + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + registers offense for dual unannotated + does not register offenses for single unannotated + when enforced style is template + does not register offenses for annotated style + configures the enforced style to template after inspecting "%{a}" + #correctable_sequence? + detects when the cop must be disabled to avoid offenses + supports dynamic string with interpolation + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + behaves like enforced styles for format string tokens + when enforced style is template + configures the enforced style to template after inspecting "%{a}" + registers offenses for annotated style + supports dynamic string with interpolation + #correctable_sequence? + detects when the cop must be disabled to avoid offenses + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + registers offense for dual unannotated + when enforced style is unannotated + #correctable_sequence? + when enforced style is annotated + #correctable_sequence? + registers offenses for template style + supports dynamic string with interpolation + sets the enforced style to annotated after inspecting "%s" + detects when the cop must be disabled to avoid offenses + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + registers offense for dual unannotated + behaves like enforced styles for format string tokens + when enforced style is template + detects when the cop must be disabled to avoid offenses + #correctable_sequence? + supports dynamic string with interpolation + configures the enforced style to template after inspecting "%{a}" + does not register offenses for annotated style + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when enforced style is unannotated + #correctable_sequence? + when enforced style is annotated + detects when the cop must be disabled to avoid offenses + registers offenses for template style + #correctable_sequence? + supports dynamic string with interpolation + sets the enforced style to annotated after inspecting "%s" + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + registers offense for dual unannotated + does not register offenses for single unannotated + behaves like enforced styles for format string tokens + when enforced style is template + configures the enforced style to template after inspecting "%{a}" + detects when the cop must be disabled to avoid offenses + does not register offenses for annotated style + #correctable_sequence? + supports dynamic string with interpolation + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when enforced style is unannotated + #correctable_sequence? + when enforced style is annotated + supports dynamic string with interpolation + #correctable_sequence? + registers offenses for template style + detects when the cop must be disabled to avoid offenses + sets the enforced style to annotated after inspecting "%s" + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + registers offense for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + behaves like enforced styles for format string tokens + when enforced style is unannotated + #correctable_sequence? + when enforced style is annotated + #correctable_sequence? + supports dynamic string with interpolation + sets the enforced style to annotated after inspecting "%s" + registers offenses for template style + detects when the cop must be disabled to avoid offenses + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + registers offense for dual unannotated + does not register offenses for single unannotated + when enforced style is template + #correctable_sequence? + supports dynamic string with interpolation + detects when the cop must be disabled to avoid offenses + configures the enforced style to template after inspecting "%{a}" + does not register offenses for annotated style + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + behaves like enforced styles for format string tokens + when enforced style is annotated + #correctable_sequence? + detects when the cop must be disabled to avoid offenses + registers offenses for template style + supports dynamic string with interpolation + sets the enforced style to annotated after inspecting "%s" + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + registers offense for dual unannotated + does not register offenses for single unannotated + when enforced style is unannotated + #correctable_sequence? + when enforced style is template + supports dynamic string with interpolation + detects when the cop must be disabled to avoid offenses + does not register offenses for annotated style + #correctable_sequence? + configures the enforced style to template after inspecting "%{a}" + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + does not register offenses for dual unannotated + behaves like enforced styles for format string tokens + when enforced style is unannotated + #correctable_sequence? + when enforced style is annotated + #correctable_sequence? + sets the enforced style to annotated after inspecting "%s" + registers offenses for template style + supports dynamic string with interpolation + detects when the cop must be disabled to avoid offenses + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + registers offense for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when enforced style is template + does not register offenses for annotated style + supports dynamic string with interpolation + detects when the cop must be disabled to avoid offenses + configures the enforced style to template after inspecting "%{a}" + #correctable_sequence? + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when enforced style is template + gives a helpful error message + when enforced style is annotated + gives a helpful error message + when AllowedPatterns is disabled + registers an offense + when AllowedMethods is enabled + does not register an offense + does not register an offense for value in nested structure + registers an offense for different method call within ignored method + when AllowedMethods is disabled + registers an offense + when AllowedPatterns is enabled + does not register an offense + registers an offense for different method call within ignored method + does not register an offense for value in nested structure + behaves like enforced styles for format string tokens + when enforced style is annotated + supports dynamic string with interpolation + registers offenses for template style + #correctable_sequence? + sets the enforced style to annotated after inspecting "%s" + detects when the cop must be disabled to avoid offenses + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + registers offense for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when enforced style is unannotated + #correctable_sequence? + when enforced style is template + does not register offenses for annotated style + detects when the cop must be disabled to avoid offenses + supports dynamic string with interpolation + configures the enforced style to template after inspecting "%{a}" + #correctable_sequence? + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for dual unannotated + does not register offenses for single unannotated + behaves like enforced styles for format string tokens + when enforced style is template + configures the enforced style to template after inspecting "%{a}" + #correctable_sequence? + does not register offenses for annotated style + detects when the cop must be disabled to avoid offenses + supports dynamic string with interpolation + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when enforced style is unannotated + #correctable_sequence? + when enforced style is annotated + supports dynamic string with interpolation + registers offenses for template style + sets the enforced style to annotated after inspecting "%s" + detects when the cop must be disabled to avoid offenses + #correctable_sequence? + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + registers offense for dual unannotated + behaves like enforced styles for format string tokens + when enforced style is template + supports dynamic string with interpolation + #correctable_sequence? + does not register offenses for annotated style + configures the enforced style to template after inspecting "%{a}" + detects when the cop must be disabled to avoid offenses + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when enforced style is unannotated + #correctable_sequence? + when enforced style is annotated + supports dynamic string with interpolation + detects when the cop must be disabled to avoid offenses + registers offenses for template style + #correctable_sequence? + sets the enforced style to annotated after inspecting "%s" + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + registers offense for dual unannotated + behaves like enforced styles for format string tokens + when enforced style is annotated + detects when the cop must be disabled to avoid offenses + registers offenses for template style + sets the enforced style to annotated after inspecting "%s" + supports dynamic string with interpolation + #correctable_sequence? + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + registers offense for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when enforced style is unannotated + #correctable_sequence? + when enforced style is template + #correctable_sequence? + detects when the cop must be disabled to avoid offenses + configures the enforced style to template after inspecting "%{a}" + does not register offenses for annotated style + supports dynamic string with interpolation + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + does not register offenses for dual unannotated + behaves like enforced styles for format string tokens + when enforced style is annotated + registers offenses for template style + #correctable_sequence? + detects when the cop must be disabled to avoid offenses + sets the enforced style to annotated after inspecting "%s" + supports dynamic string with interpolation + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + registers offense for dual unannotated + does not register offenses for single unannotated + when enforced style is template + supports dynamic string with interpolation + #correctable_sequence? + detects when the cop must be disabled to avoid offenses + configures the enforced style to template after inspecting "%{a}" + does not register offenses for annotated style + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when enforced style is unannotated + #correctable_sequence? + behaves like enforced styles for format string tokens + when enforced style is annotated + registers offenses for template style + sets the enforced style to annotated after inspecting "%s" + supports dynamic string with interpolation + #correctable_sequence? + detects when the cop must be disabled to avoid offenses + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + registers offense for dual unannotated + does not register offenses for single unannotated + when enforced style is unannotated + #correctable_sequence? + when enforced style is template + configures the enforced style to template after inspecting "%{a}" + supports dynamic string with interpolation + detects when the cop must be disabled to avoid offenses + #correctable_sequence? + does not register offenses for annotated style + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when enforced style is unannotated + gives a helpful error message + behaves like enforced styles for format string tokens + when enforced style is annotated + #correctable_sequence? + detects when the cop must be disabled to avoid offenses + registers offenses for template style + supports dynamic string with interpolation + sets the enforced style to annotated after inspecting "%s" + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + registers offense for dual unannotated + when enforced style is unannotated + #correctable_sequence? + when enforced style is template + supports dynamic string with interpolation + does not register offenses for annotated style + detects when the cop must be disabled to avoid offenses + #correctable_sequence? + configures the enforced style to template after inspecting "%{a}" + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for dual unannotated + does not register offenses for single unannotated + behaves like enforced styles for format string tokens + when enforced style is unannotated + #correctable_sequence? + when enforced style is annotated + detects when the cop must be disabled to avoid offenses + supports dynamic string with interpolation + sets the enforced style to annotated after inspecting "%s" + registers offenses for template style + #correctable_sequence? + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for dual unannotated + does not register offenses for single unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + registers offense for dual unannotated + when enforced style is template + does not register offenses for annotated style + configures the enforced style to template after inspecting "%{a}" + supports dynamic string with interpolation + detects when the cop must be disabled to avoid offenses + #correctable_sequence? + behaves like maximum allowed unannotated + when MaxUnannotatedPlaceholdersAllowed is 2 + does not register offenses for single unannotated + does not register offenses for dual unannotated + when MaxUnannotatedPlaceholdersAllowed is 1 + does not register offenses for single unannotated + does not register offenses for dual unannotated + +RuboCop::Cop::Lint::RescueException + registers an offense for rescue from Exception + does not register an offense for rescue with a module prefix + registers an offense for rescue with StandardError, Exception + registers an offense for rescue with Exception => e + does not register an offense for rescue with no class and => e + does not crash when the splat operator is used in a rescue + registers an offense for rescue with ::Exception + does not register an offense for rescue with no class + does not register an offense for rescue with other classes + does not crash when the namespace of a rescued class is in a local variable + does not register an offense for rescue with other class + +RuboCop::Cop::Security::JSONLoad + registers an offense and corrects JSON.load + allows JSON.parse + does not register an offense for JSON under another namespace + registers an offense and corrects JSON.restore + allows JSON.dump + +RuboCop::Cop::Lint::EmptyFile + does not register an offense when the file contains comments + registers an offense when the file is empty + does not register an offense when the file contains code + when AllowComments is false + registers an offense when the file contains comments + +RuboCop::Cop::Naming::InclusiveLanguage + strings + does not register offenses and not raise `ArgumentError` for invalid byte sequence in UTF-8 + registers an offense for an interpolated string + registers an offense in a heredoc + registers an offense for a multiline string + when CheckStrings config is false + does not register offenses for strings + variables + when CheckVariables config is false + does not register offenses for variables + when CheckVariables config is true + registers offenses for instance variables + registers offenses for global variables + registers offenses for class variables + filepath + multiple offenses in filename + registers an offense with all problematic words + one offense in filename + registers an offense + offense in directory name + registers an offense for a director + CheckFilepaths is false + does not register an offense + allowed use + does not register an offense for an allowed use + offense after an allowed use + registers an offense at the correct location + flagged term matching + registers an offense when using a flagged term with mixed case + registers an offense for a partial word match + registers an offense when using a flagged term + multiple offenses on a line + registers an offense for each word + regex + registers an offense for a flagged term matched with a regexp + disable default flagged term + ignores flagged terms that are set to nil + WholeWord: true + only flags when the term is a whole word + symbols + when CheckSymbols is true + registers an offense + when CheckSymbols is false + does not register an offense + identifiers + when CheckIdentifiers config is false + does not register offenses for identifiers + when CheckIdentifiers config is true + registers an offense + suggestions + flagged term with one suggestion + includes the suggestion in the offense message + flagged term with three or more suggestions + includes all suggestions in the message + flagged term with two suggestions + includes both suggestions in the offense message + comments + registers an offense in a single line comment + registers an offense in a block comment + when CheckComments is false + does not register an offense + constants + when CheckConstants config is false + does not register offenses for constants + when CheckConstants config is true + registers offenses for constants + +RuboCop::Formatter::GitHubActionsFormatter + #finished + when no offenses are detected + does not print anything + when message contains % + escapes message + when file is relative to the current directory + reports offenses as error with the relative path + when offenses are detected + reports offenses as errors + when fail level is defined + reports offenses below fail level as warnings + reports offenses above or at fail level as errors + +RuboCop::ConfigObsoletion::RenamedCop + #message + when the cop has been moved to a new department + is expected to start with "The `Style/MyCop` cop has been moved to `Layout/MyCop`" + when the cop has changed names but in a new department + is expected to start with "The `Style/MyCop` cop has been renamed to `Layout/NewCop`" + when the cop has changed names but in the same department + is expected to start with "The `Style/MyCop` cop has been renamed to `Style/NewCop`" + +RuboCop::Cop::Naming::HeredocDelimiterNaming + when the delimiter contains non-letter characters + does not register an offense when delimiter contains an underscore + does not register an offense when delimiter contains a number + with a naked heredoc + registers an offense with a non-meaningful delimiter + does not register an offense with a meaningful delimiter + with a non-interpolated heredoc + when using single quoted delimiters + registers an offense with a non-meaningful delimiter + does not register an offense with a meaningful delimiter + when using non-word delimiters + registers an offense + when using back tick delimiters + does not register an offense with a meaningful delimiter + registers an offense with a non-meaningful delimiter + when using double quoted delimiters + does not register an offense with a meaningful delimiter + registers an offense with a non-meaningful delimiter + with a squiggly heredoc + does not register an offense with a meaningful delimiter + registers an offense with a non-meaningful delimiter + with an interpolated heredoc + registers an offense with a non-meaningful delimiter + does not register an offense with a meaningful delimiter + with multiple heredocs starting on the same line + registers an offense with a trailing non-meaningful delimiter + does not register an offense with meaningful delimiters + registers an offense with a leading non-meaningful delimiter + +RuboCop::Cop::Style::CollectionMethods + registers an offense for detect with proc param + accepts member? without a block + registers an offense for detect with block + registers an offense for inject with block + registers an offense for find_all with proc param + registers an offense for collect with block + accepts detect without a block + registers an offense for collect with an argument and proc param + registers an offense for find_all with an argument and proc param + accepts inject without a block + registers an offense for inject with proc param + accepts collect without a block + registers an offense for member? with an argument and proc param + registers an offense for member? with block + registers an offense for find_all with block + registers an offense for collect with proc param + registers an offense for detect with an argument and proc param + registers an offense for inject with an argument and proc param + registers an offense for member? with proc param + accepts find_all without a block + Ruby 2.7 + registers an offense for collect with numblock + Ruby 2.7 + registers an offense for find_all with numblock + for methods that accept a symbol as implicit block + registers an offense with an argument and final symbol param + registers an offense with a final symbol param + Ruby 2.7 + registers an offense for detect with numblock + Ruby 2.7 + registers an offense for member? with numblock + Ruby 2.7 + registers an offense for inject with numblock + for methods that do not accept a symbol as implicit block + does not register an offense for a final symbol param with extra args + does not register an offense for a final symbol param + +RuboCop::RemoteConfig + .inherit_from_remote + when the remote includes file starting with `./` + returns remote includes URI + .file + does not download the file if cache lifetime has not been reached + downloads the file if cache lifetime has been reached + downloads the file if the file does not exist + when remote URL is configured with basic auth + does not download the file if cache lifetime has not been reached + downloads the file if cache lifetime has been reached + downloads the file if the file does not exist + when the remote URL responds with 404 + raises error + when the remote URL responds with 500 + raises error + when the remote URL responds with not modified + reuses the existing cached file + when remote URL is configured with token auth + does not download the file if cache lifetime has not been reached + downloads the file if the file does not exist + downloads the file if cache lifetime has been reached + when the remote URL responds with 404 + raises error + when the remote URL responds with 500 + raises error + when the remote URL responds with redirect + follows the redirect and downloads the file + when the network is inaccessible + reuses the existing cached file + +RuboCop::Cop::Style::LambdaCall + when style is set to braces + autocorrects x.call asdf, x123 to x.(asdf, x123) + registers an offense for correct + multiple opposite styles + accepts a call without receiver + autocorrects x.call to x.() + registers an offense for opposite + correct + registers an offense for x.call() + when style is set to call + registers an offense for correct + multiple opposite styles + registers an offense for correct + opposite + registers an offense for x.() + +RuboCop::Cop::Style::SymbolProc + registers an offense for a block with parameterless method call on param + registers an offense when receiver is an array literal and using `select` with a block + autocorrects correctly when there are no arguments in parentheses + accepts block when method in body is not called on block arg + accepts empty block body + accepts block with more than 1 arguments + autocorrects correctly when args have a trailing comma + does not crash with a bare method call + does not register an offense when receiver is a array literal and using `min` with a block + accepts block with splat params + accepts block with a block argument + accepts a block with an unused argument with an method call + autocorrects multiple aliases with symbols as proc + accepts ::Proc.new with 1 argument + accepts lambda with 1 argument + accepts proc with 1 argument + registers an offense when receiver is a hash literal and using `min` with a block + accepts block with adding a comma after the sole argument + registers an offense for safe navigation operator + registers an offense when receiver is some value and using `reject` with a block + does not register an offense when receiver is a hash literal and using `select` with a block + accepts Proc.new with 1 argument + accepts a block with an unused argument with an lvar + registers an offense when receiver is an array literal and using `reject` with a block + accepts block with no arguments + registers an offense when receiver is a hash literal and using `max` with a block + does not register an offense when receiver is a array literal and using `max` with a block + registers an offense when receiver is some value and using `select` with a block + does not register an offense when receiver is a hash literal and using `reject` with a block + registers an offense for a block when method in body is unary -/+ + accepts block with more than 1 expression in body + when AllowedPatterns is enabled + accepts ignored method + numblocks + accepts proc with 1 numbered parameter + does not register an offense when receiver is a hash literal and using `select` with a numblock + accepts lambda with 1 numbered parameter + accepts ::Proc.new with 1 numbered parameter + registers an offense when receiver is an array literal and using `reject` with a numblock + accepts block with multiple numbered parameters + registers an offense when receiver is some value and using `reject` with a numblock + registers an offense when receiver is some value and using `select` with a numblock + registers an offense for a block with a numbered parameter + does not register an offense when receiver is a array literal and using `max` with a numblock + registers an offense when receiver is an hash literal and using `min` with a numblock + does not register an offense when receiver is a array literal and using `min` with a numblock + accepts block with only second numbered parameter + registers an offense when receiver is an array literal and using `select` with a numblock + registers an offense when receiver is an hash literal and using `max` with a numblock + does not register an offense when receiver is a hash literal and using `reject` with a numblock + accepts Proc.new with 1 numbered parameter + AllowComments: true + accepts block with parameterless method call on param and contains a comment + registers an offense for a block with parameterless method call on paramand not contains a comment + when `super` has no arguments + registers an offense + when `AllowMethodsWithArguments: true` + when method has arguments + does not register an offense + when method has no arguments + registers an offense + when `super` has arguments + does not register an offense + when AllowedMethods is enabled + accepts ignored method + when the method has arguments registers an offense + when `AllowMethodsWithArguments: false` + when `super` has arguments + registers an offense + when method has arguments + registers an offense -RuboCop::Cop::Lint::ElseLayout - does not register an offense if the entire if is on a single line - accepts empty braces - accepts proper else - accepts modifier forms - registers an offense and corrects for elsifs - accepts ternary ops - registers an offense and corrects for expr on same line as else - registers an offense and corrects for the entire else body being on the same line - registers and corrects an offense when using multiple `elsif`s - does not register an offense for an elsif with no body +RuboCop::Cop::Naming::MethodName + accepts for non-ascii characters + when configured for camelCase + registers an offense for camel case methods names in attr. + accepts class emitter method in a class + accepts class emitter method in a class, even when it is defined inside another method + accepts unary operator definitions + registers an offense for snake case in names + registers an offense for singleton snake_case method within class + accepts class emitter method in a module, even when it is defined inside another method + registers an offense for capitalized camel case + registers an offense for correct + opposite + accepts camel case in instance method name + accepts class emitter method in a module + accepts operator definitions + registers an offense for mixed snake case and camel case in attr. + registers an offense for singleton upper case method without corresponding class + accepts camel case in singleton method name + registers an offense for snake case name in attr. + accepts one line methods + registers an offense for mixed snake case and camel case in attr. + registers an offense for mixed snake case and camel case + accepts camel case names in attr. + registers an offense for capitalized camel case name in attr. + when specifying `AllowedPatterns` + does not register an offense for snake case method name matching `AllowedPatterns` + does not register an offense for camel case method name matching `AllowedPatterns` + does not register an offense for snake case method name in attr. + does not register an offense for camel case method name in attr. + when configured for snake_case + accepts operator definitions + registers an offense for singleton camelCase method within class + registers an offense for capitalized camel case + accepts snake case in attr. + registers an offense for opposite + correct + registers an offense for camel case in instance method name + accepts unary operator definitions + registers an offense for camel case method names in attr. + accepts class emitter method in a module + registers an offense for singleton upper case method without corresponding class + accepts class emitter method in a class, even when it is defined inside another method + accepts one line methods + accepts snake case in names + registers an offense for mixed snake case and camel case + registers an offense for camel case in singleton method name + registers an offense for camel case methods names in attr. + registers an offense for mixed snake case and camel case in attr. + accepts class emitter method in a module, even when it is defined inside another method + registers an offense for mixed snake case and camel case in attr. + registers an offense for capitalized camel case name in attr. + accepts class emitter method in a class + when specifying `AllowedPatterns` + does not register an offense for camel case method name matching `AllowedPatterns` + does not register an offense for camel case method name in attr. + does not register an offense for snake case method name in attr. + does not register an offense for snake case method name matching `AllowedPatterns` -RuboCop::Cop::Lint::EnsureReturn - does not check when ensure block has no body - registers an offense when returning multiple values in `ensure` - does not register an offense for return outside ensure - registers an offense and corrects for return with argument in ensure - registers an offense and corrects for return in ensure +RuboCop::Cop::Style::EachWithObject + does not blow up for reduce with no arguments + finds inject and reduce with passed in and returned hash + correctly autocorrects + ignores inject and reduce with empty body + ignores inject/reduce with assignment to accumulator param in block + ignores inject and reduce with condition as body + ignores inject and reduce with passed in, but not returned hash + correctly autocorrects with return value only + ignores inject and reduce passed in symbol + when a simple literal is passed as initial value + ignores inject/reduce + Ruby 2.7 + finds inject and reduce with passed in and returned hash and numblock -RuboCop::Cop::Style::FileWrite - registers an offense for and corrects the `File.open` with multiline write block (mode 'w') - does not register an offense for the `File.open` with multiline write block when not writing to the block variable - registers an offense for and corrects `File.open(filename, 'w+b').write(content)` - registers an offense for and corrects the `File.open` with multiline write block (mode 'w+b') - registers an offense for and corrects the `File.open` with multiline write block (mode 'wt') with heredoc - registers an offense for and corrects `File.open(filename, 'w+t').write(content)` - registers an offense for and corrects the `File.open` with inline write block (mode 'w+t') - registers an offense for and corrects the `File.open` with multiline write block (mode 'wb') with heredoc - registers an offense for and corrects `::File.open(filename, 'wt').write(content)` - registers an offense for and corrects the `File.open` with inline write block (mode 'w+') - registers an offense for and corrects the `File.open` with multiline write block (mode 'w') with heredoc - registers an offense for and corrects the `File.open` with multiline write block (mode 'wt') - registers an offense for and corrects the `File.open` with inline write block (mode 'w') - registers an offense for and corrects the `File.open` with inline write block (mode 'wt') - registers an offense for and corrects the `File.open` with multiline write block (mode 'w+t') with heredoc - registers an offense for and corrects `::File.open(filename, 'w').write(content)` - registers an offense for and corrects `::File.open(filename, 'w+t').write(content)` - registers an offense for and corrects `File.open(filename, 'w+').write(content)` - registers an offense for and corrects the `File.open` with multiline write block (mode 'w+') - registers an offense for and corrects the `File.open` with inline write block (mode 'wb') - registers an offense for and corrects `File.open(filename, 'w').write(content)` - registers an offense for and corrects `File.open(filename, 'wt').write(content)` - registers an offense for and corrects `::File.open(filename, 'w+').write(content)` - registers an offense for and corrects the `File.open` with multiline write block (mode 'w+b') with heredoc - does not register an offense when a splat argument is passed to `f.write` - registers an offense for and corrects the `File.open` with inline write block (mode 'w+b') - registers an offense for and corrects the `File.open` with multiline write block (mode 'wb') - registers an offense for and corrects `::File.open(filename, 'wb').write(content)` - registers an offense for and corrects the `File.open` with multiline write block (mode 'w+') with heredoc - registers an offense for and corrects `::File.open(filename, 'w+b').write(content)` - registers an offense for and corrects the `File.open` with multiline write block (mode 'w+t') - registers an offense for and corrects `File.open(filename, 'wb').write(content)` +RuboCop::Cop::Layout::SpaceBeforeSemicolon + does not register an offense for no space before semicolons + registers an offense and corrects more than one space before a semicolon + registers an offense and corrects space before semicolon + heredocs + registers an offense and corrects + inside block braces + when EnforcedStyle for SpaceInsideBlockBraces is space + accepts a space between an opening brace and a semicolon + behaves like common behavior + accepts no space between an opening brace and a semicolon + when EnforcedStyle for SpaceInsideBlockBraces is no_space + registers an offense and corrects a space between an opening brace and a semicolon + behaves like common behavior + accepts no space between an opening brace and a semicolon -RuboCop::MagicComment - returns nil for frozen_string_literal when comment is # shareable_constant_value: literal - returns nil for encoding when comment is # incoding: utf-8 - returns nil for typed when comment is # -*- frozen-string-literal: true -*- - returns "utf-8" for encoding when comment is # eNcOdInG: utf-8 - returns nil for frozen_string_literal when comment is # typed:strict - returns nil for shareable_constant_value when comment is # frozen_string_literal: invalid - returns nil for shareable_constant_value when comment is # coding: utf-8 - returns nil for shareable_constant_value when comment is CSV.generate(encoding: Encoding::UTF_8) do |csv| - returns nil for shareable_constant_value when comment is # encoding: utf-8 - returns "stateless-iso-2022-jp-kddi" for encoding when comment is # encoding: stateless-iso-2022-jp-kddi - returns nil for encoding when comment is # frozen-string-literal: true - returns true for frozen_string_literal when comment is # frozen_string_literal:true - returns nil for encoding when comment is # shareable_constant_value:literal - returns nil for typed when comment is # frozen_string_literal: false - returns true for frozen_string_literal when comment is # -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- - returns nil for shareable_constant_value when comment is # vim: filetype=ruby,fileencoding=ascii-8bit - returns nil for shareable_constant_value when comment is # -*- coding: ASCII-8BIT; typed: strict -*- - returns nil for encoding when comment is # FROZEN-STRING-LITERAL: true - returns nil for shareable_constant_value when comment is # typed: strong - returns nil for shareable_constant_value when comment is # -*- frozen-string-literal: true -*- - returns "ascii-8bit" for encoding when comment is #vim: filetype=ruby, fileencoding=ascii-8bit, typed=strict - returns nil for encoding when comment is #typed:strict - returns nil for shareable_constant_value when comment is # typed: strict - returns nil for shareable_constant_value when comment is # fRoZeN-sTrInG_lItErAl: true - returns nil for encoding when comment is # typed:strict - returns nil for frozen_string_literal when comment is # - returns nil for encoding when comment is # typed: ignore - returns nil for encoding when comment is # sHaReaBLE-CoNstANT-ValUE: literal - returns nil for frozen_string_literal when comment is #vim: filetype=ruby, fileencoding=ascii-8bit, typed=strict - returns "none" for shareable_constant_value when comment is # shareable_constant_value: none - returns nil for frozen_string_literal when comment is # coding: utf-8 - returns "ascii-8bit" for encoding when comment is # -*- encoding : ascii-8bit -*- - returns nil for typed when comment is # SHAREABLE-CONSTANT-VALUE: literal - returns nil for shareable_constant_value when comment is # - returns nil for typed when comment is # frozen_string_literal: true encoding: ascii-8bit - returns "literal" for shareable_constant_value when comment is # sHaReaBLE-CoNstANT-ValUE: literal - returns nil for frozen_string_literal when comment is # incoding: utf-8 - returns nil for typed when comment is # frozen_string_literal:true - returns "invalid" for frozen_string_literal when comment is # frozen_string_literal: invalid - returns nil for shareable_constant_value when comment is # typed: false - returns true for frozen_string_literal when comment is # -*- frozen-string-literal: true -*- - returns "ascii-8bit" for encoding when comment is # coding: utf-8 -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- - returns nil for frozen_string_literal when comment is # ENCODING: utf-8 - returns nil for typed when comment is # shareable-constant-value: literal - returns nil for frozen_string_literal when comment is # xyz shareable_constant_value: literal - returns true for frozen_string_literal when comment is # FROZEN-STRING-LITERAL: true - returns nil for shareable_constant_value when comment is # FROZEN-STRING-LITERAL: true - returns nil for encoding when comment is # @typed - returns nil for typed when comment is # eNcOdInG: utf-8 - returns "ascii-8bit" for encoding when comment is # encoding: ascii-8bit frozen_string_literal: true - returns nil for frozen_string_literal when comment is # shareable_constant_value: experimental_copy - returns nil for shareable_constant_value when comment is # coding: utf-8 - returns nil for typed when comment is # shareable_constant_value:literal - returns nil for frozen_string_literal when comment is # frozen_string_literal: true encoding: ascii-8bit - returns true for frozen_string_literal when comment is # fRoZeN-sTrInG_lItErAl: true - returns nil for frozen_string_literal when comment is # coding: utf-8 vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for typed when comment is # @typed - returns nil for frozen_string_literal when comment is # vim: filetype=python, fileencoding=ascii-8bit - returns nil for shareable_constant_value when comment is # ENCODING: utf-8 - returns nil for typed when comment is # encoding: stateless-iso-2022-jp-kddi - returns "literal" for shareable_constant_value when comment is # shareable_constant_value: literal - returns nil for frozen_string_literal when comment is # encoding: stateless-iso-2022-jp-kddi - returns nil for encoding when comment is # frozen_string_literal: invalid - returns nil for encoding when comment is CSV.generate(encoding: Encoding::UTF_8) do |csv| - returns nil for frozen_string_literal when comment is # encoding: ascii-8bit frozen_string_literal: true - returns "experimental_copy" for shareable_constant_value when comment is # shareable_constant_value: experimental_copy - returns "literal" for shareable_constant_value when comment is # SHAREABLE-CONSTANT-VALUE: literal - returns "ascii-8bit" for encoding when comment is #vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for shareable_constant_value when comment is #typed:strict - returns nil for typed when comment is # vim:fileencoding=utf-8 - returns "utf-8" for encoding when comment is # ENCODING: utf-8 - returns nil for typed when comment is # shareable_constant_value: literal - returns nil for typed when comment is # -*- encoding : ascii-8bit -*- - returns "utf-8" for encoding when comment is # coding: utf-8 - returns "ignore" for typed when comment is # typed: ignore - returns nil for frozen_string_literal when comment is # typed: false - returns nil for typed when comment is # vim: filetype=ruby, fileencoding=ascii-8bit - returns "utf-8" for encoding when comment is # encoding: utf-8 - returns nil for encoding when comment is # typed: strict - returns nil for encoding when comment is # vim:fileencoding=utf-8 - returns false for frozen_string_literal when comment is # frozen_string_literal: false - returns "strong" for typed when comment is # typed: strong - returns nil for frozen_string_literal when comment is # coding: utf-8 - returns nil for shareable_constant_value when comment is # vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for frozen_string_literal when comment is # eNcOdInG: utf-8 - returns "literal" for shareable_constant_value when comment is # shareable-constant-value: literal - returns nil for encoding when comment is # frozen_string_literal:true - returns nil for shareable_constant_value when comment is # @typed - returns nil for frozen_string_literal when comment is # vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for shareable_constant_value when comment is # typed:strict - returns nil for encoding when comment is # typed: true - returns nil for shareable_constant_value when comment is # frozen_string_literal: true - returns nil for encoding when comment is # xyz shareable_constant_value: literal - returns nil for frozen_string_literal when comment is # -*- coding: ASCII-8BIT; typed: strict -*- - returns "strict" for typed when comment is # typed:strict - returns nil for encoding when comment is # fRoZeN-sTrInG_lItErAl: true - returns nil for frozen_string_literal when comment is # shareable_constant_value:literal - returns nil for frozen_string_literal when comment is # typed: ignore - returns "strict" for typed when comment is #typed:strict - returns nil for shareable_constant_value when comment is # encoding: stateless-iso-2022-jp-kddi - returns nil for typed when comment is # coding: utf-8 - returns nil for shareable_constant_value when comment is # coding: utf-8 vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for typed when comment is # - returns nil for typed when comment is # fRoZeN-sTrInG_lItErAl: true - returns nil for frozen_string_literal when comment is # @typed - returns nil for typed when comment is # coding: utf-8 -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- - returns nil for typed when comment is # encoding: utf-8 - returns nil for encoding when comment is # typed: false - returns "utf-8" for encoding when comment is # coding: utf-8 - returns "ascii-8bit" for encoding when comment is # -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- - returns nil for encoding when comment is # typed: strong - returns nil for frozen_string_literal when comment is CSV.generate(encoding: Encoding::UTF_8) do |csv| - returns "experimental_everything" for shareable_constant_value when comment is # shareable_constant_value: experimental_everything - returns nil for typed when comment is # shareable_constant_value: experimental_everything - returns nil for shareable_constant_value when comment is # typed: ignore - returns nil for typed when comment is # vim: filetype=python, fileencoding=ascii-8bit - returns nil for frozen_string_literal when comment is # encoding: utf-8 - returns nil for shareable_constant_value when comment is # xyz shareable_constant_value: literal - returns nil for shareable_constant_value when comment is # vim: filetype=python, fileencoding=ascii-8bit - returns "ascii-8bit" for encoding when comment is # -*- coding: ASCII-8BIT; typed: strict -*- - returns nil for typed when comment is # frozen_string_literal: true - returns nil for frozen_string_literal when comment is # shareable_constant_value: none - returns nil for typed when comment is # xyz shareable_constant_value: literal - returns nil for typed when comment is # incoding: utf-8 - returns nil for encoding when comment is # shareable_constant_value: experimental_copy - returns "ascii-8bit" for encoding when comment is # vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for frozen_string_literal when comment is # SHAREABLE-CONSTANT-VALUE: literal - returns nil for encoding when comment is # shareable_constant_value: experimental_everything - returns "true" for typed when comment is # typed: true - returns nil for typed when comment is # xyz shareable_constant_value: literal xyz - returns nil for shareable_constant_value when comment is # vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for shareable_constant_value when comment is # -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- - returns nil for shareable_constant_value when comment is # -*- encoding : ascii-8bit -*- - returns nil for shareable_constant_value when comment is # frozen_string_literal:true - returns nil for frozen_string_literal when comment is # vim: filetype=ruby,fileencoding=ascii-8bit - returns nil for encoding when comment is # shareable_constant_value: literal - returns nil for typed when comment is # shareable_constant_value: none - returns nil for typed when comment is # coding: utf-8 - returns "strict" for typed when comment is # typed: strict - returns nil for frozen_string_literal when comment is # xyz shareable_constant_value: literal xyz - returns nil for typed when comment is # shareable_constant_value: experimental_copy - returns nil for typed when comment is # frozen-string-literal: true - returns nil for frozen_string_literal when comment is # vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for encoding when comment is # shareable_constant_value: none - returns nil for shareable_constant_value when comment is # frozen_string_literal: false - returns nil for shareable_constant_value when comment is # coding: utf-8 -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- - returns "ascii-8bit" for encoding when comment is # vim: filetype=python, fileencoding=ascii-8bit - returns nil for typed when comment is # encoding: ascii-8bit frozen_string_literal: true - returns nil for typed when comment is # vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for encoding when comment is # vim: filetype=ruby,fileencoding=ascii-8bit - returns nil for shareable_constant_value when comment is # xyz shareable_constant_value: literal xyz - returns nil for frozen_string_literal when comment is #vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for shareable_constant_value when comment is # typed: true - returns nil for typed when comment is #vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for shareable_constant_value when comment is #vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for frozen_string_literal when comment is # typed: strict - returns nil for shareable_constant_value when comment is # frozen_string_literal: true - returns nil for shareable_constant_value when comment is # frozen-string-literal: true - returns nil for frozen_string_literal when comment is # typed: true - returns nil for encoding when comment is # xyz shareable_constant_value: literal xyz - returns true for frozen_string_literal when comment is # frozen-string-literal: true - returns true for frozen_string_literal when comment is # frozen_string_literal: true - returns true for frozen_string_literal when comment is # frozen_string_literal: true - returns nil for typed when comment is # vim: filetype=ruby,fileencoding=ascii-8bit - returns nil for frozen_string_literal when comment is # -*- encoding : ascii-8bit -*- - returns nil for encoding when comment is # -*- frozen-string-literal: true -*- - returns nil for typed when comment is # -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- - returns nil for frozen_string_literal when comment is # sHaReaBLE-CoNstANT-ValUE: literal - returns nil for frozen_string_literal when comment is # vim:fileencoding=utf-8 - returns nil for frozen_string_literal when comment is #typed:strict - returns nil for encoding when comment is # - returns nil for frozen_string_literal when comment is # shareable-constant-value: literal - returns nil for encoding when comment is # shareable-constant-value: literal - returns nil for frozen_string_literal when comment is # typed: strong - returns nil for encoding when comment is # SHAREABLE-CONSTANT-VALUE: literal - returns nil for typed when comment is # FROZEN-STRING-LITERAL: true - returns "ascii-8bit" for encoding when comment is # frozen_string_literal: true encoding: ascii-8bit - returns nil for shareable_constant_value when comment is # eNcOdInG: utf-8 - returns nil for frozen_string_literal when comment is # shareable_constant_value: experimental_everything - returns nil for shareable_constant_value when comment is # frozen_string_literal: true encoding: ascii-8bit - returns nil for typed when comment is # frozen_string_literal: true - returns nil for typed when comment is # coding: utf-8 vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for typed when comment is # sHaReaBLE-CoNstANT-ValUE: literal - returns true for frozen_string_literal when comment is # coding: utf-8 -*- encoding: ASCII-8BIT; frozen_string_literal: true -*- - returns nil for encoding when comment is # frozen_string_literal: true - returns nil for shareable_constant_value when comment is # vim:fileencoding=utf-8 - returns nil for typed when comment is # frozen_string_literal: invalid - returns nil for encoding when comment is # frozen_string_literal: false - returns nil for shareable_constant_value when comment is #vim: filetype=ruby, fileencoding=ascii-8bit, typed=strict - returns "utf-8" for encoding when comment is # coding: utf-8 vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for encoding when comment is # frozen_string_literal: true - returns nil for typed when comment is #vim: filetype=ruby, fileencoding=ascii-8bit, typed=strict - returns "false" for typed when comment is # typed: false - returns "literal" for shareable_constant_value when comment is # shareable_constant_value:literal - returns nil for shareable_constant_value when comment is # encoding: ascii-8bit frozen_string_literal: true - returns nil for typed when comment is # -*- coding: ASCII-8BIT; typed: strict -*- - returns nil for shareable_constant_value when comment is # incoding: utf-8 - returns nil for typed when comment is CSV.generate(encoding: Encoding::UTF_8) do |csv| - returns "ascii-8bit" for encoding when comment is # vim: filetype=ruby, fileencoding=ascii-8bit - returns nil for typed when comment is # ENCODING: utf-8 - #valid? - with an empty string - is expected to equal false - with a non magic comment - is expected to equal false - with an shareable constant value comment - is expected to equal true - with an frozen string literal comment - is expected to equal true - with an encoding comment - is expected to equal true - #valid_shareable_constant_value? - when given comment specified as `literal` - is expected to equal true - when given comment specified as `experimental_copy` - is expected to equal true - when given comment specified as `experimental_everything` - is expected to equal true - when given comment specified as `none` - is expected to equal true - when given comment is not specified - is expected to equal false - when given comment specified as unknown value - is expected to equal false - #without - simple format - when the entire comment is a single value - is expected to eq "" - when the comment contains a different magic value - is expected to eq "# frozen-string-literal: true" - vim format - when the comment has multiple tokens - is expected to eq "# vim: filetype=ruby" - emacs format - with one token - is expected to eq "" - with multiple tokens - is expected to eq "# -*- frozen_string_literal: true -*-" +RuboCop::Cop::Style::YodaCondition + enforce yoda + accepts arrays of numbers on both sides + registers an offense for boolean literal on right + accepts numbers on both sides + accepts string literal on right of case equality check + accepts safe navigation on right + accepts method call on receiver on right + accepts number on left of <=> + accepts assignment + accepts subtraction on right of comparison + accepts negation + registers an offense for number on right + registers an offense for string literal on right + accepts string literal on left + registers an offense for nil on right + accepts instance variable on right + accepts global variable on right + accepts class variable on right + registers an offense for number on right of comparison + accepts variable on right after assignment + accepts accessor and variable on right in boolean expression + with EnforcedStyle: require_for_equality_operators_only + accepts mixed order in comparisons + registers an offense for negated equality check + accepts nil on right of comparison + registers an offense for equality check + accepts number on right of comparison + within an if or ternary statement + registers an offense number on right in if condition + registers an offense for number on right in modifier if + registers an offense for number on right of >= in ternary condition + registers an offense number on right of comparison in if condition + registers an offense for nil on right in ternary condition + registers an offense for number on right of <= in ternary condition + enforce not yoda + accepts array of numbers on both sides + accepts __FILE__ on left in program name check + accepts number on left of <=> + accepts assignment + registers an offense number on left + registers an offense for nil on left + accepts method call on receiver on left + accepts class variable on left + accepts instance variable on left + accepts interpolated regex on left + accepts variable on left after assign + accepts interpolated string on left + accepts safe navigation on left + accepts __FILE__ on left in negated program name check + accepts global variable on left + registers an offense number on left of comparison + registers an offense for boolean literal on left + accepts number on both sides + accepts accessor and variable on left in boolean expression + registers an offense for string literal on left + accepts negation + accepts subtraction expression on left of comparison + accepts string literal on left of case equality check + accepts string literal on right + within an if or ternary statement + registers an offense for number on left of >= in ternary condition + registers an offense for nil on left in ternary condition + registers an offense for number on left of comparison in if condition + registers an offense for number on left in if condition + registers an offense for number on left of <= in ternary condition + registers an offense for number on left in modifier if + with EnforcedStyle: forbid_for_equality_operators_only + accepts number on left of comparison + registers an offense for negated equality check + accepts nil on left of comparison + registers an offense for equality check + accepts mixed order in comparisons -RuboCop::Cop::Layout::MultilineMethodCallIndentation - when EnforcedStyle is aligned - doesn't crash on unaligned multiline lambdas - accepts indented methods inside and outside a block - registers an offense and corrects misaligned methods in while condition - accepts indented methods in ordinary statement - accepts correctly aligned methods in operands - accepts aligned methods in if condition - registers an offense and corrects misaligned methods in unless condition - does not check binary operations when string wrapped with + - accepts aligned methods in operator assignment - accepts indented methods in for body - registers an offense and corrects misaligned method in []= call - registers an offense and corrects 3 spaces indentation of 2nd line - registers an offense and corrects no indentation of second line - accepts correctly aligned methods in assignment - accepts no extra indentation of third line - accepts alignment inside a grouped expression - accepts even indentation of consecutive lines in typical RSpec code - registers an offense and corrects extra indentation of third line - accepts indented method when there is nothing to align with - accepts any indentation of parameters to #[] - accepts aligned methods in if + assignment - doesn't fail on unary operators - registers an offense and corrects proc call without a selector - registers an offense and corrects the emacs ruby-mode 1.1 indentation of an expression in an array - accepts indentation relative to first receiver - registers an offense and corrects one space indentation of 3rd line - accepts aligned method in return - accepts an expression where the first method spans multiple lines - registers an offense and corrects misaligned methods in if condition - accepts aligned methods in a begin..end block - accepts alignment of method with assignment and operator-like method - registers an offense and corrects unaligned methods in assignment - registers an offense and corrects extra indentation of 3rd line in typical RSpec code - accepts indented and aligned methods in binary operation - accepts aligned methods in assignment - does not check binary operations when string wrapped with backslash - accepts aligned methods in constant assignment - registers an offense and corrects misaligned methods in until condition - accepts aligned method in assignment + block + assignment - registers an offense and corrects one space indentation of 2nd line - accepts indented methods in LHS of []= assignment - registers an offense and corrects misaligned methods in local variable assignment - for semantic alignment - accepts aligned method even when an aref is in the chain - accepts methods being aligned with method that is an argument in assignment - accepts 3 aligned methods - accepts method being aligned with method in assignment - registers an offense and corrects unaligned methods - accepts key access to hash - accepts aligned method even when an aref is first in the chain - accepts methods being aligned with method that is an argument - accepts aligned method with blocks in operation assignment - accepts method being aligned with method - registers an offense and corrects unaligned method in block body - doesn't fail on a chain of aref calls - accepts nested method calls +RuboCop::Cop::Layout::FirstHashElementIndentation + when the HashAlignment style is separator for => + accepts correctly indented first pair + registers an offense and corrects incorrectly indented first pair with => + registers an offense and corrects incorrectly indented } + when hash is method argument + and argument are not surrounded by parentheses + accepts indent based on the start of the line where the left brace iswhen the right brace and its following pair is on the same line + accepts single line hash with braces + accepts a correctly indented multi-line hash with braces + accepts indent based on the left brace when the outer hash key and the left brace is not on the same line + accepts braceless hash + registers an offense for the first inner hash member not based on the start of line when the outer hash pair has no following siblings + registers an offense for a hash that is a value of a multi pairs hashwhen the indent of its elements is not based on the hash key + registers an offense for incorrectly indented multi-line hash with braces + and arguments are surrounded by parentheses + and EnforcedStyle is special_inside_parentheses + registers an offense for incorrectly indented hash that is the value of a single pair hash + accepts indent based on the preceding left parenthesiswhen the right brace and its following pair is on the same line + accepts special indentation for first argument + registers an offense and corrects 'align_braces' indentation + accepts special indentation for second argument + accepts normal indentation for hash within hash + accepts indent based on the left brace when the outer hash key and the left brace is not on the same line + registers an offense and corrects 'consistent' indentation + registers an offense for a hash that is a value of a multi pairs hashwhen the indent of its elements is not based on the hash key + when using safe navigation operator + registers an offense and corrects 'consistent' indentation + and EnforcedStyle is consistent + accepts normal indentation for first argument + accepts indent based on the start of the line where the left brace iswhen the right brace and its following pair is on the same line + accepts normal indentation for second argument + registers an offense for a hash that is a value of a multi pairs hashwhen the indent of its elements is not based on the hash key + accepts indent based on the left brace when the outer hash key and the left brace is not on the same line + registers an offense for incorrectly indented hash that is the value of a single pair hash + registers an offense and corrects incorrect indentation + when EnforcedStyle is align_braces + accepts an empty hash + accepts a first pair on the same line as the left brace + registers an offense and corrects incorrectly indented } + registers an offense for incorrectly indented hash that is the value of a single pair hash + accepts several pairs per line + accepts single line hash + accepts correctly indented first pair + registers an offense for a hash that is a value of a multi pairs hashwhen the indent of its elements is not based on the hash key + when 'special_inside_parentheses' style is used + registers an offense and corrects incorrect indentation + when 'consistent' style is used + registers an offense and corrects incorrect indentation + when hash is right hand side in assignment + accepts several pairs per line + accepts correctly indented first pair + accepts single line hash + accepts a first pair on the same line as the left brace + registers an offense and corrects incorrectly indented first pair + accepts an empty hash + when indentation width is overridden for this cop + accepts correctly indented first pair + registers an offense and corrects incorrectly indented first pair + when hash is operand + registers an offense and corrects incorrectly indented } + registers an offense and corrects incorrectly indented first pair + accepts correctly indented first pair + when hash is argument to setter + registers an offense and corrects incorrectly indented first pair + accepts correctly indented first pair + when the HashAlignment style is separator for : + accepts correctly indented first pair + registers an offense and corrects incorrectly indented first pair with : + registers an offense and corrects incorrectly indented } + +RuboCop::Cop::Style::CombinableLoops + when for loop + does not register an offense when each branch contains the same single loop over the same collection + registers an offense when looping over the same data as previous loop + does not register an offense when the same loops are interleaved with some code + does not register an offense when the same loop method is used over different collections + when looping method + does not register an offense when the same loop method is used over different collections + registers an offense when looping over the same data as previous loop + does not register an offense for when the same method with different arguments and safe navigation + does not register an offense when different loop methods are used over the same collection + does not register an offense when each branch contains the same single loop over the same collection + does not register an offense when the same loops are interleaved with some code + does not register an offense for when the same method with different arguments + Ruby 2.7 + registers an offense when looping over the same data as previous loop in numblocks + +RuboCop::Cop::Style::ClassAndModuleChildren + nested style + registers an offense for not nested classes when namespace is defined as a class + registers an offense for not nested classes with explicit superclass + accepts :: in parent class on inheritance + accepts cbase module name + registers an offense for not nested modules + registers an offense for not nested classes when namespace is defined as a module + registers an offense for partially nested modules + accepts cbase class name + accepts nested children + preserves comments + registers an offense for partially nested classes + registers an offense for not nested classes + compact style + preserves comments between classes + registers a offense for classes with nested one-liner children + registers an offense for modules with partially nested children + registers a offense for classes with nested children + accepts nesting for classes with an explicit superclass + accepts compact style for classes/modules + correctly indents heavily nested children + accepts nesting for classes/modules with more than one child + registers an offense for classes with partially nested children + registers a offense for modules with nested children + registers and offense for deeply nested children + accepts class/module with single method + +RuboCop::Cop::Layout::SpaceBeforeComment + accepts a doc comment + accepts an EOL comment with a preceding space + registers an offense and corrects after a heredoc + accepts a comment that begins a line + registers an offense and corrects missing space before an EOL comment + +RuboCop::Cop::Style::EmptyLambdaParameter + accepts a keyword lambda + does not crash on a super + registers an offense for an empty block parameter with a lambda + +RuboCop::Cop::Layout::ElseAlignment + accepts a ternary if + with if statement + accepts a one line if statement + registers an offense for misaligned elsif + registers an offense for misaligned else + accepts indentation after else when if is on new line after assignment + accepts a correctly aligned if/elsif/else/end + accepts an if/else branches with rescue clauses + with assignment + when alignment style is keyword by choice + and end is aligned with keyword + accepts an until in assignment + accepts a while in assignment + accepts an if/else in assignment + accepts an if/else in assignment on next line + accepts an if in assignment + and end is aligned with variable + registers an offense for an if + when alignment style is variable + and end is aligned with variable + accepts an if-else with end aligned with setter + accepts an if/else with chaining with a block after the end + accepts an if/else with chaining after the end + accepts an if/else + accepts an if-elsif-else with end aligned with setter + accepts an if with end aligned with element assignment + and end is aligned with keyword + registers an offense for an if + registers an offense for an if with element assignment + registers offenses for an if with setter + for a file with byte order mark + accepts a correctly aligned if/elsif/else/end + with unless + accepts an empty unless + accepts a correctly aligned else in an otherwise empty unless + registers an offense for misaligned else + with def/defs + accepts an empty def body + accepts an empty defs body + when modifier and def are on the same line + accepts a correctly aligned body + registers an offense for else not aligned with private + with def/rescue/else/ensure/end + registers an offense for misaligned else + accepts a correctly aligned else + with def/rescue/else/end + accepts a correctly aligned else + registers an offense for misaligned else + with begin/rescue/else/ensure/end + registers an offense for misaligned else + accepts a correctly aligned else + with case + accepts correctly aligned case/when/else + accepts case without else + registers an offense for misaligned else + accepts else aligned with when but not with case + >= Ruby 2.7 + with case match + accepts correctly aligned case/when/else + registers an offense for misaligned else + accepts correctly aligned empty else + accepts case match without else + ensure/rescue/else in Block Argument + accepts a correctly aligned else + registers an offense for misaligned else + accepts a correctly aligned else with assignment + +RuboCop::Cop::InternalAffairs::ExampleHeredocDelimiter + when unexpected heredoc delimiter is used at non RuboCop specific expectation + does not register an offense + when expected heredoc delimiter is used at RuboCop specific expectation + does not register an offense + when unexpected heredoc delimiter is used in single-line heredoc + registers an offense + when unexpected heredoc delimiter is used in multi-line heredoc + registers an offense + when unexpected heredoc delimiter is used but heredoc body contains an expected delimiter line + does not register an offense + +RuboCop::Cop::Style::ZeroLengthPredicate + with arrays + registers an offense for `array.length == 0` + registers an offense for `0 == array.length` + registers an offense for `1 > array.length` + registers an offense for `array.size < 1` + registers an offense for `array.size > 0` + registers an offense for `0 < array.size` + registers an offense for `array.length < 1` + registers an offense for `array.size != 0` + registers an offense for `0 < array.length + registers an offense for `0 == array.size` + registers an offense for `array.length != 0` + registers an offense for `0 != array.size` + registers an offense for `array.length > 0` + registers an offense for `array.size == 0` + registers an offense for `0 != array.length` + registers an offense for `1 > array.size` + when name of the variable is `size` or `length` + accepts comparison + accepts equality check + accepts inequality check + when inspecting a File::Stat object + does not register an offense with ::File + does not register an offense + with strings + registers an offense for `string.size == 0` + registers an offense for `0 != string.size` + registers an offense for `0 == string.size` + registers an offense for `string.size != 0` + with collection variables + registers an offense for `collection.size != 0` + registers an offense for `0 != collection.size` + registers an offense for `collection.size == 0` + registers an offense for `0 == collection.size` + with hashes + registers an offense for `hash.size == 0` + registers an offense for `0 == hash.size + registers an offense for `0 != hash.size` + registers an offense for `hash.size != 0` + when inspecting a StringIO object + when initialized with a string + does not register an offense + does not register an offense with top-level ::StringIO + when initialized without arguments + does not register an offense + does not register an offense with top-level ::StringIO + when inspecting a Tempfile object + does not register an offense + does not register an offense with top-level ::Tempfile + +RuboCop::Cop::Layout::MultilineMethodDefinitionBraceLayout + ignores implicit defs + ignores single-line defs + ignores defs without params + new_line style + opening brace on separate line from first element + detects closing brace on same line as last element + allows closing brace on separate line from last multiline element + allows closing brace on separate line from last element + opening brace on same line as first element + detects closing brace on same line as last multiline element + autocorrects closing brace on same line as last element + allows closing brace on different line from multi-line element + allows closing brace on different line from last element + heredoc + detects heredoc structures that are safe to add to + ignores heredocs that could share a last line + symmetrical style + opening brace on same line as first element + allows closing brace on same line as last element + autocorrects closing brace on different line from last element + detects closing brace on different line from last element + allows closing brace on same line as last multiline element + opening brace on separate line from first element + allows closing brace on separate line from last multiline element + allows closing brace on separate line from last element + detects closing brace on same line as last element + same_line style + opening brace on separate line from first element + allows closing brace on same line as last multiline element + detects closing brace on different line from last element + allows closing brace on same line as last element + opening brace on same line as first element + detects closing brace on different line from multiline element + autocorrects closing brace on different line as last element + allows closing brace on same line as multi-line element + allows closing brace on same line from last element + +RuboCop::Cop::Lint::ToJSON + does not register an offense when using `#to_json` with arguments + registers an offense and corrects using `#to_json` without arguments + +RuboCop::Cop::Style::ExponentialNotation + EnforcedStyle is engineering + registers an offense for mantissa smaller than -1000 + registers no offense for a mantissa equal to 1 + registers an offense for a mantissa greater than -0.1 + registers no offense for a negative mantissa + registers no offense for a negative exponent + registers no offense for a float smaller than 1 + registers no offense for a regular float + registers an offense for exponent equal to -2 + registers no offense for a large mantissa + registers an offense for mantissa smaller than 0.1 + registers an offense for exponent equal to 4 + EnforcedStyle is scientific + registers an offense for mantissa equal to 10 + registers no offense for a negative exponent + registers no offense for a regular float + registers an offense for mantissa smaller than 1 + registers no offense for a float smaller than 1 + registers no offense for a negative mantissa + registers no offense for a mantissa equal to 1 + registers an offense for mantissa greater than 10 + registers no offense for a mantissa between 1 and 10 + EnforcedStyle is integral + registers no offense for negative exponent + registers no offense for a float smaller than 1 + registers no offense for an integral mantissa + registers no offense for negative mantissa + registers an offense for decimal mantissa + registers no offense for a regular float + registers an offense for mantissa divisible by 10 + +RuboCop::Cop::Style::HashSyntax + configured to enforce ruby 1.9 style with no mixed keys + UseHashRocketsWithSymbolValues disabled + registers offense for hash rocket syntax when new is possible + registers an offense for hash rockets in method calls + accepts new syntax in method calls + registers an offense when keys have special symbols in them + accepts an empty hash + registers an offense when keys have different types and styles + accepts hash rockets when keys have different types + accepts new syntax when keys are interpolated string + accepts new syntax in a hash literal + registers an offense when keys start with a digit + registers an offense for mixed syntax when new is possible + registers an offense when keys have whitespaces in them + ruby < 2.2 + accepts hash rockets when keys have whitespaces in them + registers an offense when keys start with a digit and mix styles + registers an offense when keys have special symbols and mix styles + accepts hash rockets when keys have special symbols in them + registers an offense when keys have whitespaces and mix styles + accepts hash rockets when keys start with a digit + UseHashRocketsWithSymbolValues enabled + autocorrects to hash rockets when all elements have symbol value + registers an offense when any element uses a symbol for the value + registers an offense when any element has a symbol value in method calls + registers an offense when keys have special symbols in them + registers an offense for mixed syntax when new is possible + registers an offense for hash rockets in method calls + registers offense for hash rocket syntax when new is possible + registers an offense when keys have different types and styles + accepts new syntax when keys are interpolated string + accepts hash rockets when keys have different types + registers an offense when keys start with a digit + registers an offense when keys have whitespaces in them + accepts new syntax in a hash literal + accepts an empty hash + accepts new syntax in method calls + ruby < 2.2 + registers an offense when keys start with a digit and mix styles + accepts hash rockets when keys have whitespaces in them + accepts hash rockets when keys start with a digit + accepts hash rockets when keys have special symbols in them + registers an offense when keys have special symbols and mix styles + registers an offense when keys have whitespaces and mix styles + configured to accept both shorthand and explicit use of hash literal value + Ruby <= 3.0 + does not register an offense when hash key and hash value are the same + Ruby >= 3.1 + does not register an offense when hash key and hash value are not the same + does not register an offense when hash key and hash value are the same + does not register an offense when hash key and hash value are partially the same + does not register an offense when hash values are omitted + configured to enforce ruby19 style + with SpaceAroundOperators disabled + autocorrects even if there is no space around => + with SpaceAroundOperators enabled + autocorrects even if it interferes with SpaceAroundOperators + preserves quotes during autocorrection + accepts new syntax in method calls + accepts hash rockets when keys have different types + registers offense when keys start with an uppercase letter + registers an offense when symbol keys have strings in them + autocorrects a missing space when hash is used as argument + registers an offense for hash rockets in method calls + accepts an empty hash + accepts hash rockets when symbol keys end with = + registers offense for hash rocket syntax when new is possible + accepts hash rockets when symbol characters are not supported + accepts new syntax in a hash literal + registers an offense for mixed syntax when new is possible + if PreferHashRocketsForNonAlnumEndingSymbols is true + accepts hash rockets when symbols end with ! + accepts hash rockets when symbols end with ? + if PreferHashRocketsForNonAlnumEndingSymbols is false + registers an offense for hash rockets when symbols end with ? + registers an offense for hash rockets when symbols end with ! + ruby < 2.2 + accepts hash rockets when symbol keys have string in them + when using a return value uses `return` + registers an offense and corrects when not enclosed in parentheses + registers an offense and corrects when enclosed in parentheses + configured to use hash rockets when symbol values are found + accepts hash in ruby19 style with no symbol values + accepts ruby19 syntax when no elements have symbol values + registers an offense when any element uses a symbol for the value + registers an offense for hashes with elements on multiple lines + registers an offense when using hash rockets and no elements have a symbol value + accepts an empty hash + autocorrects to hash rockets when all elements have symbol value + accepts ruby19 syntax when no elements have symbol values in method calls + accepts both hash rockets and ruby19 syntax in the same code + registers an offense when any element has a symbol value in method calls + configured to enforce no mixed keys + registers an offense when keys have whitespaces and mix styles + accepts hash rockets when keys have whitespaces in them + accepts new hash style + autocorrects mixed key hashes + accepts hash rockets in method calls + registers an offense for mixed syntax when new is possible + registers an offense when keys have different types and styles + accepts the hash rocket syntax when new is possible + registers an offense when keys have special symbols and mix styles + accepts hash rockets when keys have different types + accepts new syntax in method calls + accepts hash rockets when keys have special symbols in them + accepts new syntax in a hash literal + accepts old hash rockets style + accepts an empty hash + registers an offense when keys start with a digit and mix styles + accepts hash rockets when keys start with a digit + configured to enforce hash rockets style + registers an offense for mixed syntax + accepts hash rockets in a hash literal + accepts hash rockets in method calls + registers an offense for 1.9 style in method calls + registers offense for Ruby 1.9 style + accepts an empty hash + UseHashRocketsWithSymbolValues has no impact + does not register an offense when there is a symbol value + configured to enforce shorthand syntax style + Ruby <= 3.0 + does not register an offense when hash key and hash value are the same + Ruby >= 3.1 + does not register an offense when symbol hash key and string hash value are the same + does not register an offense when lvar hash key and hash value are the same + registers and corrects an offense when hash key and hash value are the same and it in the method bodyand an expression follows + does not register an offense when hash key and hash value are partially the same + does not register an offense when hash key and hash value are not the same + does not register an offense when symbol hash key and hash value (lvar) are not the same + does not register an offense when with parentheses call expr follows assignment expr + does not register an offense when with parentheses call expr follows + registers and corrects an offense when hash key and hash value are the same and it in the method body + does not register an offense when hash key and hash value are the same but the value ends `?` + does not register an offense when hash key and hash value are the same but the value ends `!` + does not register an offense when method call hash key and hash value are the same + registers an offense when hash key and hash value are not the same and method with `[]` is called + does not register an offense when `return` with one line `if` condition follows (without parentheses) + registers and corrects an offense when hash key and hash value are partially the same + does not register an offense when one line `if` condition follows (without parentheses) + registers and corrects an offense when `Hash[foo: foo]` and an expression follows + registers an offense when one line `if` condition follows (with parentheses) + registers and corrects an offense when hash key and hash value are the same + does not register an offense when call expr without arguments and with a block follows + does not register an offense when call expr with argument and a block follows + registers an offense when one line `until` condition follows (with parentheses) + registers and corrects an offense when hash key and hash value (lvar) are the same + does not register an offense when one line `until` condition follows (without parentheses) + does not register an offense when hash values are omitted + registers and corrects an offense when `Hash[foo: foo]` + does not register an offense when without parentheses call expr follows after nested method call + does not register an offense when hash pattern matching + does not register an offense when without parentheses call expr follows + when hash roket syntax + does not register an offense + configured to disallow mixing of implicit and explicit hash literal value + Ruby >= 3.1 + registers an offense when all hash values are present, but can all be omitted + registers an offense when some hash values are omitted but they can all be omitted + does not register an offense when all hash values are present, but only some values can be omitted + does not register an offense when all hash values are present, but no values can be omitted + does not register an offense when all hash values are omitted + registers an offense when some hash values are omitted but they cannot all be omitted + Ruby <= 3.0 + does not register an offense when all hash key and hash values are the same + configured to enforce explicit hash value syntax style + Ruby >= 3.1 + does not register an offense when hash key and hash value are not the same + does not register an offense when hash key and hash value are the same + registers and corrects an offense when hash values are omitted + registers and corrects an offense when hash key and hash value are partially the same + Ruby <= 3.0 + does not register an offense when hash key and hash value are the same + +RuboCop::Cop::Gemspec::DuplicatedAssignment + does not register an offense when using `<<` twice + registers an offense when using `name=` twice with `cbase` + registers an offense when using `required_ruby_version=` twice + does not register an offense when `name=` method call is not block value + does not register an offense when using `spec.add_dependency` twice + registers an offense when using `version=` twice + registers an offense when using `name=` twice + +RuboCop::Cop::Generator + #snake_case + converts "FooBar" to snake_case + converts "RSpecFoo/Bar" to snake_case + converts "RSpec/Foo" to snake_case + converts "Lint" to snake_case + converts "FooBar/Baz" to snake_case + converts "RSpec" to snake_case + #write_source + refuses to overwrite existing files + generates a helpful source file with the name filled in + #inject_config + when it is the first in alphabetical order + inserts the cop + when it is the last in alphabetical order + inserts the cop + with version provided + uses the provided version + when it is the middle in alphabetical order + inserts the cop + compliance with rubocop + generates a cop file that has no offense (PENDING: Temporarily skipped with xit) + generates a spec file that has no offense (PENDING: Temporarily skipped with xit) + nested departments + generates source and spec files correctly namespaced within departments + #write_spec + generates a helpful starting spec file with the class filled in + refuses to overwrite existing files + #todo + provides a checklist for implementing the cop + .new + does not accept an unqualified cop + +RuboCop::Cop::Style::NestedTernaryOperator + accepts a non-nested ternary operator within an if + registers an offense and corrects for a nested ternary operator expression + registers an offense and corrects for a nested ternary operator expression with no parentheses on the outside + can handle multiple nested ternaries + registers an offense and corrects for a nested ternary operator expression with block + +RuboCop::Cop::Style::MissingRespondToMissing + allows method_missing and respond_to_missing? implemented as class methods + registers an offense respond_to_missing? is implemented as a class method and method_missing is implemented as an instance method + allows method_missing and respond_to_missing? when defined with inline access modifier and method_missing is not qualified by inline access modifier + registers an offense when respond_to_missing? is not implemented + allows method_missing and respond_to_missing? implemented as instance methods + registers an offense respond_to_missing? is implemented as an instance method and method_missing is implemented as a class method + registers an offense when method_missing is implemented as a class methods + allows method_missing and respond_to_missing? when defined with inline access modifier + +RuboCop::Cop::Gemspec::RequireMFA + when the gemspec is blank + does not register an offense + when the specification is blank + registers an offense and corrects + with rubygems_mfa_required: true + does not register an offense + with rubygems_mfa_required: false + registers an offense and corrects + when there are other metadata keys + and `rubygems_mfa_required` is not included + registers an offense and corrects + and `rubygems_mfa_required` is included + does not register an offense + when the specification has an non-hash metadata + registers an offense but does not correct + when the specification has a metadata hash but no rubygems_mfa_required key + registers an offense and corrects + with rubygems_mfa_required: false by key access + registers an offense and corrects + when metadata is set by key assignment + and `rubygems_mfa_required` is not included + registers an offense + and `rubygems_mfa_required` is included + does not register an offense + +RuboCop::Cop::Style::EmptyHeredoc + registers an offense when using empty `<= Ruby 2.7 + corrects comparison methods in case in + with end alignment to keyword + corrects comparison methods in unless else + corrects comparison methods in case when + corrects comparison methods in if elsif else + >= Ruby 2.7 + corrects comparison methods in case in + behaves like comparison methods + registers an offense for comparison methods in ternary operations + with end alignment to start_of_line + corrects comparison methods in unless else + corrects comparison methods in if elsif else + corrects comparison methods in case when + >= Ruby 2.7 + corrects comparison methods in case in + with end alignment to keyword + corrects comparison methods in case when + corrects comparison methods in unless else + corrects comparison methods in if elsif else + >= Ruby 2.7 + corrects comparison methods in case in + behaves like all variable types + allows assignment to the return of a ternary + registers an offense assigning any variable type in if else + allows assignment to the return of if else + registers an offense assigning any variable type in case when + allows assignment to the return of case when + registers an offense assigning any variable type in ternary + behaves like all assignment types + for a local variable lval + registers an offense for assignment using += in ternary + with end alignment to keyword + for a local variable lval + registers an offense for assignment using += in if else + registers an offense for assignment using += in case when + for a class variable lval + registers an offense for assignment using += in if else + registers an offense for assignment using += in case when + for a constant lval + registers an offense for assignment using += in if else + registers an offense for assignment using += in case when + for a instance variable lval + registers an offense for assignment using += in if else + registers an offense for assignment using += in case when + for a global variable lval + registers an offense for assignment using += in if else + registers an offense for assignment using += in case when + for a global variable lval + registers an offense for assignment using += in ternary + for a class variable lval + registers an offense for assignment using += in ternary + with end alignment to start_of_line + for a local variable lval + registers an offense for assignment using += in case when + registers an offense for assignment using += in if else + for a global variable lval + registers an offense for assignment using += in if else + registers an offense for assignment using += in case when + for a constant lval + registers an offense for assignment using += in if else + registers an offense for assignment using += in case when + for a class variable lval + registers an offense for assignment using += in if else + registers an offense for assignment using += in case when + for a instance variable lval + registers an offense for assignment using += in if else + registers an offense for assignment using += in case when + for a instance variable lval + registers an offense for assignment using += in ternary + for a constant lval + registers an offense for assignment using += in ternary + behaves like all variable types + registers an offense assigning any variable type in ternary + allows assignment to the return of a ternary + registers an offense assigning any variable type in case when + allows assignment to the return of case when + allows assignment to the return of if else + registers an offense assigning any variable type in if else + behaves like all assignment types + for a instance variable lval + registers an offense for assignment using &&= in ternary + for a class variable lval + registers an offense for assignment using &&= in ternary + with end alignment to keyword + for a instance variable lval + registers an offense for assignment using &&= in case when + registers an offense for assignment using &&= in if else + for a class variable lval + registers an offense for assignment using &&= in case when + registers an offense for assignment using &&= in if else + for a global variable lval + registers an offense for assignment using &&= in if else + registers an offense for assignment using &&= in case when + for a constant lval + registers an offense for assignment using &&= in if else + registers an offense for assignment using &&= in case when + for a local variable lval + registers an offense for assignment using &&= in if else + registers an offense for assignment using &&= in case when + for a global variable lval + registers an offense for assignment using &&= in ternary + for a local variable lval + registers an offense for assignment using &&= in ternary + for a constant lval + registers an offense for assignment using &&= in ternary + with end alignment to start_of_line + for a instance variable lval + registers an offense for assignment using &&= in if else + registers an offense for assignment using &&= in case when + for a constant lval + registers an offense for assignment using &&= in if else + registers an offense for assignment using &&= in case when + for a local variable lval + registers an offense for assignment using &&= in if else + registers an offense for assignment using &&= in case when + for a global variable lval + registers an offense for assignment using &&= in case when + registers an offense for assignment using &&= in if else + for a class variable lval + registers an offense for assignment using &&= in if else + registers an offense for assignment using &&= in case when + for if elsif else if else + autocorrects the outer offense later + autocorrects the inner offense first + IncludeTernaryExpressions false + allows assignment in ternary operation + with nested conditionals + does not consider branches of nested ifs + eventually autocorrects all branches + behaves like all assignment types + for a instance variable lval + registers an offense for assignment using = in ternary + for a constant lval + registers an offense for assignment using = in ternary + for a class variable lval + registers an offense for assignment using = in ternary + with end alignment to start_of_line + for a local variable lval + registers an offense for assignment using = in case when + registers an offense for assignment using = in if else + for a instance variable lval + registers an offense for assignment using = in if else + registers an offense for assignment using = in case when + for a class variable lval + registers an offense for assignment using = in if else + registers an offense for assignment using = in case when + for a global variable lval + registers an offense for assignment using = in case when + registers an offense for assignment using = in if else + for a constant lval + registers an offense for assignment using = in case when + registers an offense for assignment using = in if else + for a global variable lval + registers an offense for assignment using = in ternary + with end alignment to keyword + for a instance variable lval + registers an offense for assignment using = in case when + registers an offense for assignment using = in if else + for a global variable lval + registers an offense for assignment using = in case when + registers an offense for assignment using = in if else + for a constant lval + registers an offense for assignment using = in if else + registers an offense for assignment using = in case when + for a class variable lval + registers an offense for assignment using = in case when + registers an offense for assignment using = in if else + for a local variable lval + registers an offense for assignment using = in case when + registers an offense for assignment using = in if else + for a local variable lval + registers an offense for assignment using = in ternary + behaves like all variable types + registers an offense assigning any variable type in ternary + registers an offense assigning any variable type in case when + registers an offense assigning any variable type in if else + allows assignment to the return of if else + allows assignment to the return of case when + allows assignment to the return of a ternary + behaves like all assignment types + for a class variable lval + registers an offense for assignment using <<= in ternary + for a local variable lval + registers an offense for assignment using <<= in ternary + with end alignment to start_of_line + for a local variable lval + registers an offense for assignment using <<= in if else + registers an offense for assignment using <<= in case when + for a constant lval + registers an offense for assignment using <<= in case when + registers an offense for assignment using <<= in if else + for a instance variable lval + registers an offense for assignment using <<= in case when + registers an offense for assignment using <<= in if else + for a global variable lval + registers an offense for assignment using <<= in if else + registers an offense for assignment using <<= in case when + for a class variable lval + registers an offense for assignment using <<= in if else + registers an offense for assignment using <<= in case when + with end alignment to keyword + for a class variable lval + registers an offense for assignment using <<= in if else + registers an offense for assignment using <<= in case when + for a instance variable lval + registers an offense for assignment using <<= in if else + registers an offense for assignment using <<= in case when + for a global variable lval + registers an offense for assignment using <<= in if else + registers an offense for assignment using <<= in case when + for a local variable lval + registers an offense for assignment using <<= in if else + registers an offense for assignment using <<= in case when + for a constant lval + registers an offense for assignment using <<= in if else + registers an offense for assignment using <<= in case when + for a constant lval + registers an offense for assignment using <<= in ternary + for a global variable lval + registers an offense for assignment using <<= in ternary + for a instance variable lval + registers an offense for assignment using <<= in ternary + autocorrect + corrects assignment to unbracketed array in if else + preserves comments during correction in if else + corrects =~ in ternary operations + preserves comments during correction in case when else + multiple assignment + does not register an offense in if else + does not register an offense in case when + aref assignment + corrects if..else + with different indices + doesn't register an offense + constant assignment + corrects if..else with namespaced constant + corrects if..else with top-level constant + self.attribute= assignment + corrects if..else + with different receivers + doesn't register an offense + assignment from a method + corrects case when + corrects unless else + corrects if else + behaves like all assignment types + for a constant lval + registers an offense for assignment using ^= in ternary + for a class variable lval + registers an offense for assignment using ^= in ternary + with end alignment to keyword + for a local variable lval + registers an offense for assignment using ^= in if else + registers an offense for assignment using ^= in case when + for a global variable lval + registers an offense for assignment using ^= in case when + registers an offense for assignment using ^= in if else + for a class variable lval + registers an offense for assignment using ^= in case when + registers an offense for assignment using ^= in if else + for a instance variable lval + registers an offense for assignment using ^= in if else + registers an offense for assignment using ^= in case when + for a constant lval + registers an offense for assignment using ^= in case when + registers an offense for assignment using ^= in if else + for a instance variable lval + registers an offense for assignment using ^= in ternary + for a global variable lval + registers an offense for assignment using ^= in ternary + with end alignment to start_of_line + for a instance variable lval + registers an offense for assignment using ^= in if else + registers an offense for assignment using ^= in case when + for a class variable lval + registers an offense for assignment using ^= in case when + registers an offense for assignment using ^= in if else + for a global variable lval + registers an offense for assignment using ^= in if else + registers an offense for assignment using ^= in case when + for a local variable lval + registers an offense for assignment using ^= in if else + registers an offense for assignment using ^= in case when + for a constant lval + registers an offense for assignment using ^= in if else + registers an offense for assignment using ^= in case when + for a local variable lval + registers an offense for assignment using ^= in ternary + behaves like all assignment types + with end alignment to keyword + for a constant lval + registers an offense for assignment using |= in if else + registers an offense for assignment using |= in case when + for a global variable lval + registers an offense for assignment using |= in if else + registers an offense for assignment using |= in case when + for a class variable lval + registers an offense for assignment using |= in case when + registers an offense for assignment using |= in if else + for a instance variable lval + registers an offense for assignment using |= in if else + registers an offense for assignment using |= in case when + for a local variable lval + registers an offense for assignment using |= in case when + registers an offense for assignment using |= in if else + for a global variable lval + registers an offense for assignment using |= in ternary + for a local variable lval + registers an offense for assignment using |= in ternary + for a class variable lval + registers an offense for assignment using |= in ternary + for a instance variable lval + registers an offense for assignment using |= in ternary + with end alignment to start_of_line + for a global variable lval + registers an offense for assignment using |= in case when + registers an offense for assignment using |= in if else + for a local variable lval + registers an offense for assignment using |= in if else + registers an offense for assignment using |= in case when + for a constant lval + registers an offense for assignment using |= in case when + registers an offense for assignment using |= in if else + for a class variable lval + registers an offense for assignment using |= in if else + registers an offense for assignment using |= in case when + for a instance variable lval + registers an offense for assignment using |= in case when + registers an offense for assignment using |= in if else + for a constant lval + registers an offense for assignment using |= in ternary + behaves like all assignment types + for a constant lval + registers an offense for assignment using -= in ternary + for a instance variable lval + registers an offense for assignment using -= in ternary + for a local variable lval + registers an offense for assignment using -= in ternary + for a class variable lval + registers an offense for assignment using -= in ternary + with end alignment to keyword + for a instance variable lval + registers an offense for assignment using -= in case when + registers an offense for assignment using -= in if else + for a global variable lval + registers an offense for assignment using -= in if else + registers an offense for assignment using -= in case when + for a local variable lval + registers an offense for assignment using -= in case when + registers an offense for assignment using -= in if else + for a class variable lval + registers an offense for assignment using -= in if else + registers an offense for assignment using -= in case when + for a constant lval + registers an offense for assignment using -= in if else + registers an offense for assignment using -= in case when + with end alignment to start_of_line + for a constant lval + registers an offense for assignment using -= in case when + registers an offense for assignment using -= in if else + for a local variable lval + registers an offense for assignment using -= in if else + registers an offense for assignment using -= in case when + for a instance variable lval + registers an offense for assignment using -= in case when + registers an offense for assignment using -= in if else + for a class variable lval + registers an offense for assignment using -= in case when + registers an offense for assignment using -= in if else + for a global variable lval + registers an offense for assignment using -= in if else + registers an offense for assignment using -= in case when + for a global variable lval + registers an offense for assignment using -= in ternary + behaves like else followed by new conditional without else + allows if elsif else unless + behaves like comparison methods + registers an offense for comparison methods in ternary operations + with end alignment to start_of_line + corrects comparison methods in case when + corrects comparison methods in if elsif else + corrects comparison methods in unless else + >= Ruby 2.7 + corrects comparison methods in case in + with end alignment to keyword + corrects comparison methods in if elsif else + corrects comparison methods in unless else + corrects comparison methods in case when + >= Ruby 2.7 + corrects comparison methods in case in + behaves like comparison methods + registers an offense for comparison methods in ternary operations + with end alignment to start_of_line + corrects comparison methods in case when + corrects comparison methods in unless else + corrects comparison methods in if elsif else + >= Ruby 2.7 + corrects comparison methods in case in + with end alignment to keyword + corrects comparison methods in if elsif else + corrects comparison methods in unless else + corrects comparison methods in case when + >= Ruby 2.7 + corrects comparison methods in case in + behaves like all variable types + allows assignment to the return of case when + registers an offense assigning any variable type in case when + allows assignment to the return of if else + allows assignment to the return of a ternary + registers an offense assigning any variable type in if else + registers an offense assigning any variable type in ternary + behaves like all assignment types + for a global variable lval + registers an offense for assignment using ||= in ternary + for a local variable lval + registers an offense for assignment using ||= in ternary + with end alignment to start_of_line + for a global variable lval + registers an offense for assignment using ||= in if else + registers an offense for assignment using ||= in case when + for a local variable lval + registers an offense for assignment using ||= in if else + registers an offense for assignment using ||= in case when + for a instance variable lval + registers an offense for assignment using ||= in case when + registers an offense for assignment using ||= in if else + for a class variable lval + registers an offense for assignment using ||= in case when + registers an offense for assignment using ||= in if else + for a constant lval + registers an offense for assignment using ||= in if else + registers an offense for assignment using ||= in case when + with end alignment to keyword + for a instance variable lval + registers an offense for assignment using ||= in if else + registers an offense for assignment using ||= in case when + for a constant lval + registers an offense for assignment using ||= in if else + registers an offense for assignment using ||= in case when + for a class variable lval + registers an offense for assignment using ||= in case when + registers an offense for assignment using ||= in if else + for a local variable lval + registers an offense for assignment using ||= in case when + registers an offense for assignment using ||= in if else + for a global variable lval + registers an offense for assignment using ||= in case when + registers an offense for assignment using ||= in if else + for a class variable lval + registers an offense for assignment using ||= in ternary + for a instance variable lval + registers an offense for assignment using ||= in ternary + for a constant lval + registers an offense for assignment using ||= in ternary + behaves like all assignment types + for a instance variable lval + registers an offense for assignment using &= in ternary + with end alignment to keyword + for a class variable lval + registers an offense for assignment using &= in if else + registers an offense for assignment using &= in case when + for a global variable lval + registers an offense for assignment using &= in if else + registers an offense for assignment using &= in case when + for a instance variable lval + registers an offense for assignment using &= in case when + registers an offense for assignment using &= in if else + for a local variable lval + registers an offense for assignment using &= in case when + registers an offense for assignment using &= in if else + for a constant lval + registers an offense for assignment using &= in if else + registers an offense for assignment using &= in case when + for a constant lval + registers an offense for assignment using &= in ternary + with end alignment to start_of_line + for a constant lval + registers an offense for assignment using &= in if else + registers an offense for assignment using &= in case when + for a global variable lval + registers an offense for assignment using &= in if else + registers an offense for assignment using &= in case when + for a instance variable lval + registers an offense for assignment using &= in case when + registers an offense for assignment using &= in if else + for a class variable lval + registers an offense for assignment using &= in case when + registers an offense for assignment using &= in if else + for a local variable lval + registers an offense for assignment using &= in case when + registers an offense for assignment using &= in if else + for a global variable lval + registers an offense for assignment using &= in ternary + for a class variable lval + registers an offense for assignment using &= in ternary + for a local variable lval + registers an offense for assignment using &= in ternary + behaves like all variable types + allows assignment to the return of a ternary + registers an offense assigning any variable type in if else + allows assignment to the return of if else + registers an offense assigning any variable type in case when + allows assignment to the return of case when + registers an offense assigning any variable type in ternary + behaves like all assignment types + for a global variable lval + registers an offense for assignment using **= in ternary + with end alignment to start_of_line + for a local variable lval + registers an offense for assignment using **= in case when + registers an offense for assignment using **= in if else + for a constant lval + registers an offense for assignment using **= in if else + registers an offense for assignment using **= in case when + for a instance variable lval + registers an offense for assignment using **= in case when + registers an offense for assignment using **= in if else + for a global variable lval + registers an offense for assignment using **= in case when + registers an offense for assignment using **= in if else + for a class variable lval + registers an offense for assignment using **= in case when + registers an offense for assignment using **= in if else + for a class variable lval + registers an offense for assignment using **= in ternary + for a instance variable lval + registers an offense for assignment using **= in ternary + for a local variable lval + registers an offense for assignment using **= in ternary + with end alignment to keyword + for a class variable lval + registers an offense for assignment using **= in case when + registers an offense for assignment using **= in if else + for a instance variable lval + registers an offense for assignment using **= in if else + registers an offense for assignment using **= in case when + for a local variable lval + registers an offense for assignment using **= in case when + registers an offense for assignment using **= in if else + for a constant lval + registers an offense for assignment using **= in if else + registers an offense for assignment using **= in case when + for a global variable lval + registers an offense for assignment using **= in if else + registers an offense for assignment using **= in case when + for a constant lval + registers an offense for assignment using **= in ternary + behaves like all assignment types + with end alignment to start_of_line + for a constant lval + registers an offense for assignment using >>= in case when + registers an offense for assignment using >>= in if else + for a class variable lval + registers an offense for assignment using >>= in case when + registers an offense for assignment using >>= in if else + for a global variable lval + registers an offense for assignment using >>= in case when + registers an offense for assignment using >>= in if else + for a instance variable lval + registers an offense for assignment using >>= in if else + registers an offense for assignment using >>= in case when + for a local variable lval + registers an offense for assignment using >>= in case when + registers an offense for assignment using >>= in if else + for a local variable lval + registers an offense for assignment using >>= in ternary + for a class variable lval + registers an offense for assignment using >>= in ternary + with end alignment to keyword + for a constant lval + registers an offense for assignment using >>= in case when + registers an offense for assignment using >>= in if else + for a local variable lval + registers an offense for assignment using >>= in case when + registers an offense for assignment using >>= in if else + for a instance variable lval + registers an offense for assignment using >>= in case when + registers an offense for assignment using >>= in if else + for a class variable lval + registers an offense for assignment using >>= in case when + registers an offense for assignment using >>= in if else + for a global variable lval + registers an offense for assignment using >>= in case when + registers an offense for assignment using >>= in if else + for a instance variable lval + registers an offense for assignment using >>= in ternary + for a constant lval + registers an offense for assignment using >>= in ternary + for a global variable lval + registers an offense for assignment using >>= in ternary + assignment as the last statement + allows multiple assignment in if elsif else when the last assignment is the same and the earlier assignments do not appear in all branches + allows more than variable assignment in if elsif else + allows multiple assignment in case when else when the last assignment is the same and the earlier assignments do not appear in all branches + allows assignment in if elsif else with some branches only containing variable assignment and others containing more than variable assignment + allows multiple assignment in if elsif elsif else + allows more than variable assignment in if else + allows variable assignment in unless else with more than variable assignment + allows multiple assignment in if else + allows multiple assignments in case when with multiple whens + allows multiple assignments in case when if there are uniq variables in the when branches + allows multiple assignment in unless else + allows multiple assignment in case statements when the last assignment is the same and the earlier assignments do not appear in all branches + allows multiple assignments in case when with only one when + allows multiple assignment in if elsif else + allows variable assignment in case when else with more than variable assignment + behaves like allows out of order multiple assignment in if elsif else + allows out of order multiple assignment in if elsif else + multiple assignment in only one branch + allows multiple assignment is in elsif + allows multiple assignment is in if + does not register an offense when multiple assignment is in else + behaves like comparison methods + registers an offense for comparison methods in ternary operations + with end alignment to keyword + corrects comparison methods in if elsif else + corrects comparison methods in unless else + corrects comparison methods in case when >= Ruby 2.7 - accepts methods being aligned with method that is an argumentwhen using numbered parameter - when EnforcedStyle is indented_relative_to_receiver - registers an offense and corrects no indentation of second line - registers an offense and corrects the emacs ruby-mode 1.1 indentation of an expression in an array - accepts alignment of method with assignment and operator-like method - does not register an offense when multiline method chain has expected indent width and the method is preceded by double splat - accepts any indentation of parameters to #[] - accepts correctly indented methods in operation - accepts indented methods in LHS of []= assignment - accepts indentation relative to first receiver - accepts alignment inside a grouped expression - accepts an expression where the first method spans multiple lines - accepts indented methods in for body - accepts indented methods inside and outside a block - registers an offense and corrects extra indentation of 3rd line - accepts indented methods in ordinary statement - registers an offense and corrects extra indentation of 3rd line in typical RSpec code - does not register an offense when multiline method chain has expected indent width and the method is preceded by splat - accepts no extra indentation of third line - registers an offense and corrects proc call without a selector - registers an offense and corrects one space indentation of 2nd line - doesn't fail on unary operators - registers an offense and corrects 3 spaces indentation of second line - doesn't crash on unaligned multiline lambdas - accepts indentation of consecutive lines in typical RSpec code - for possible semantic alignment - accepts indented methods - when EnforcedStyle is indented - accepts no extra indentation of third line - registers an offense for a 2 space indentation of unless condition - accepts indentation of assignment to a with newline after = - accepts indented methods in if condition - accepts indented methods in if body - accepts any indentation of parameters to #[] - accepts double indentation of until condition - accepts double indentation of while condition - accepts normal indentation of method parameters - accepts indentation of assignment to a[:key] with newline after = - accepts indentation of assignment to obj.a[:key] with newline after = - accepts indented methods in ordinary statement - accepts even indentation of consecutive lines in typical RSpec code - accepts indented methods in until body - registers an offense for a 2 space indentation of if condition - accepts double indentation of unless condition - accepts alignment of method with assignment and operator-like method - registers an offense and corrects no indentation of second line - accepts indented methods inside and outside a block - registers an offense for a 2 space indentation of while condition - registers an offense and corrects aligned methods in if condition - accepts any indentation of method parameters - registers an offense and corrects one space indentation of 2nd line - accepts indentation of assignment to obj.a with newline after = - registers an offense and corrects extra indentation of 3rd line in typical RSpec code - accepts indentation of assignment to a with rhs on same line - accepts special indentation of return if condition - accepts indented methods in LHS of []= assignment - registers an offense and corrects 1 space indentation of 3rd line - accepts correctly indented methods in operation - accepts indentation of assignment to a[:key] with rhs on same line - accepts indented methods in for body - registers an offense for a 2 space indentation of until condition - registers an offense and corrects aligned operators in assignment - doesn't crash on unaligned multiline lambdas - registers an offense and corrects wrong indentation of for expression - accepts special indentation of for expression - accepts double indentation of if condition - accepts special indentation of return unless condition - accepts indented methods in while body - registers an offense and corrects 3 spaces indentation of 2nd line - registers an offense and corrects correct + unrecognized style - accepts an expression where the first method spans multiple lines - registers an offense and corrects 0 space indentation inside square brackets - accepts indented methods in unless body - doesn't fail on unary operators - registers an offense and corrects proc call without a selector - registers an offense and corrects the emacs ruby-mode 1.1 indentation of an expression in an array - accepts alignment inside a grouped expression - registers an offense and corrects extra indentation of third line - accepts indentation relative to first receiver - accepts normal indentation inside grouped expression - for possible semantic alignment - accepts indented methods - when indentation width is overridden for this cop - registers an offense for a 4 space indentation of if condition - accepts indentation of while condition which is offset by a single normal indentation step - accepts indented methods in while body - accepts indentation of if condition which is offset by a single normal indentation step - accepts indented methods - accepts correctly indented methods in operation - accepts indented methods in unless body - accepts indentation of unless condition which is offset by a single normal indentation step - registers an offense for a 4 space indentation of unless condition - accepts indentation of until condition which is offset by a single normal indentation step - accepts indented methods in if condition - accepts indented methods in if body - accepts indentation of assignment - registers an offense for a 4 space indentation of while condition - accepts indented methods in until body - registers an offense for a 4 space indentation of until condition - -RuboCop::Cop::Lint::UnreachableCode - registers an offense for `redo` in all `if` and `elsif` branches - accepts `throw` is in `if` branch only - registers an offense for `exit!` in `begin` - registers an offense for `exit` in `begin` - registers an offense for `exit` in all `if` branches with other expressions - registers an offense for `break` before other statements - accepts code with conditional `exit!` - accepts `throw` is not in `elsif` branch - registers an offense for `return` in all `if` branches - accepts code with conditional `fail` - registers an offense for `return` in all `if` and `elsif` branches - registers an offense for `raise` in `begin` - accepts `throw` is in `case` branch without else - registers an offense for `exit!` in all `if` branches - accepts `raise` as the final expression - registers an offense for `exit` before other statements - registers an offense for `throw` in all `if` and `elsif` branches - registers an offense for `raise` in all `if` branches - registers an offense for `redo` before other statements - accepts `exit!` is in `else` branch only - registers an offense for `raise` before other statements - registers an offense for `retry` in all `if` branches - accepts `raise` is in all `if` branches - accepts `next` is not in `elsif` branch - accepts `throw` is in `if`, and without `else` - accepts `raise` is in `case` branch without else - registers an offense for `fail` in all `if` and `elsif` branches - registers an offense for `redo` in all `if` branches - accepts `throw` as the final expression - accepts `redo` is in `if`, and without `else` - registers an offense for `abort` in all `if` branches - accepts `throw` is in `else` branch only - accepts `next` as the final expression - registers an offense for `exit!` in all `if` branches with other expressions - accepts `exit!` is in `if` branch only - accepts `return` is in all `if` branches - registers an offense for `retry` in all `if` branches with other expressions - accepts `exit!` is in `if`, and without `else` - accepts `fail` is in all `if` branches - registers an offense for `break` in all `if` branches - accepts `raise` is not in `elsif` branch - registers an offense for `throw` in `begin` - accepts `return` is in `case` branch without else - accepts `exit` is in `if`, and without `else` - registers an offense for `next` in all `if` and `elsif` branches - accepts `exit` is not in `elsif` branch - registers an offense for `abort` in `begin` - registers an offense for `return` in all `case` branches - accepts code with conditional `throw` - accepts `fail` is in `case` branch without else - registers an offense for `exit` in all `if` branches - registers an offense for `raise` in all `case` branches - accepts `abort` is in all `if` branches - registers an offense for `next` in all `case` branches - registers an offense for `next` in all `if` branches - registers an offense for `exit!` before other statements - accepts `return` is not in `elsif` branch - registers an offense for `retry` in `begin` - accepts `abort` is in `else` branch only - accepts `next` is in all `if` branches - accepts `raise` is in `if` branch only - accepts code with conditional `next` - accepts code with conditional `raise` - registers an offense for `fail` in all `if` branches with other expressions - accepts `fail` is in `else` branch only - accepts `raise` is in `if`, and without `else` - accepts `exit!` as the final expression - accepts `exit!` is not in `elsif` branch - registers an offense for `abort` in all `if` and `elsif` branches - accepts `exit` is in all `if` branches - registers an offense for `return` in `begin` - accepts `exit!` is in all `if` branches - accepts `fail` is in `if`, and without `else` - registers an offense for `throw` in all `if` branches - accepts `abort` is in `if` branch only - registers an offense for `fail` in `begin` - accepts `redo` is not in `elsif` branch - accepts `next` is in `case` branch without else - accepts `exit` as the final expression - registers an offense for `throw` in all `if` branches with other expressions - accepts `abort` is in `case` branch without else - registers an offense for `next` in all `if` branches with other expressions - accepts `exit` is in `if` branch only - accepts `break` is in all `if` branches - accepts `redo` is in all `if` branches - registers an offense for `next` in `begin` - accepts `next` is in `if` branch only - accepts `retry` is in all `if` branches - registers an offense for `next` before other statements - accepts `throw` is in all `if` branches - registers an offense for `abort` in all `if` branches with other expressions - accepts `break` is in `if` branch only - accepts `break` is not in `elsif` branch - registers an offense for `exit` in all `case` branches - accepts `retry` as the final expression - accepts `abort` as the final expression - accepts `exit` is in `case` branch without else - registers an offense for `exit` in all `if` and `elsif` branches - registers an offense for `fail` in all `case` branches - accepts `return` is in `if` branch only - accepts `redo` as the final expression - registers an offense for `retry` in all `if` and `elsif` branches - registers an offense for `retry` before other statements - accepts `break` is in `else` branch only - registers an offense for `redo` in all `case` branches - registers an offense for `fail` before other statements - registers an offense for `exit!` in all `case` branches - registers an offense for `break` in `begin` - accepts `break` is in `case` branch without else - registers an offense for `raise` in all `if` branches with other expressions - accepts `break` is in `if`, and without `else` - accepts `retry` is in `if`, and without `else` - registers an offense for `break` in all `case` branches - registers an offense for `throw` before other statements - registers an offense for `raise` in all `if` and `elsif` branches - registers an offense for `break` in all `if` and `elsif` branches - accepts `retry` is in `else` branch only - accepts `retry` is not in `elsif` branch - accepts `return` is in `if`, and without `else` - accepts `exit!` is in `case` branch without else - accepts code with conditional `redo` - accepts `return` as the final expression - accepts `next` is in `else` branch only - registers an offense for `return` in all `if` branches with other expressions - accepts `break` as the final expression - accepts `return` is in `else` branch only - accepts `raise` is in `else` branch only - accepts code with conditional `return` - registers an offense for `fail` in all `if` branches - accepts `fail` is in `if` branch only - accepts `abort` is in `if`, and without `else` - registers an offense for `retry` in all `case` branches - accepts `redo` is in `if` branch only - accepts `exit` is in `else` branch only - accepts `next` is in `if`, and without `else` - accepts code with conditional `break` - accepts `redo` is in `else` branch only - accepts code with conditional `retry` - registers an offense for `abort` in all `case` branches - accepts `retry` is in `if` branch only - registers an offense for `exit!` in all `if` and `elsif` branches - registers an offense for `throw` in all `case` branches - accepts code with conditional `exit` - accepts `fail` is not in `elsif` branch - accepts code with conditional `abort` - registers an offense for `return` before other statements - accepts `retry` is in `case` branch without else - accepts `abort` is not in `elsif` branch - accepts `fail` as the final expression - registers an offense for `redo` in `begin` - registers an offense for `abort` before other statements - registers an offense for `redo` in all `if` branches with other expressions - accepts `redo` is in `case` branch without else - registers an offense for `break` in all `if` branches with other expressions - -RuboCop::RemoteConfig - .file - downloads the file if cache lifetime has been reached - does not download the file if cache lifetime has not been reached - downloads the file if the file does not exist - when the network is inaccessible - reuses the existing cached file - when remote URL is configured with token auth - downloads the file if cache lifetime has been reached - does not download the file if cache lifetime has not been reached - downloads the file if the file does not exist - when the remote URL responds with 404 - raises error - when remote URL is configured with basic auth - downloads the file if the file does not exist - downloads the file if cache lifetime has been reached - does not download the file if cache lifetime has not been reached - when the remote URL responds with 500 - raises error - when the remote URL responds with 404 - raises error - when the remote URL responds with redirect - follows the redirect and downloads the file - when the remote URL responds with 500 - raises error - when the remote URL responds with not modified - reuses the existing cached file - .inherit_from_remote - when the remote includes file starting with `./` - returns remote includes URI - -RuboCop::Cop::Lint::DuplicateElsifCondition - registers an offense for repeated elsif conditions - registers an offense for subsequent repeated elsif conditions - registers multiple offenses for multiple repeated elsif conditions - does not register an offense for non-repeated elsif conditions - does not register an offense for partially repeated elsif conditions - -RuboCop::Cop::Style::BarePercentLiterals - when EnforcedStyle is bare_percent - and strings are dynamic - accepts heredoc - registers an offense for %Q() - accepts regular expressions - accepts '' - accepts %q - accepts "" string with interpolation - accepts "" - accepts %() - accepts __FILE__ - and strings are static - accepts %q - accepts "" string with interpolation - accepts %() - accepts heredoc - accepts "" - accepts __FILE__ - registers an offense for %Q() - accepts regular expressions - accepts '' - when EnforcedStyle is percent_q - and strings are dynamic - accepts %q - accepts regular expressions - accepts __FILE__ - accepts "" - registers an offense for %() - accepts heredoc - accepts '' - accepts %Q() - accepts "" string with interpolation - and strings are static - accepts '' - accepts __FILE__ - accepts %q - accepts "" - accepts regular expressions - accepts %Q() - registers an offense for %() - accepts heredoc - accepts "" string with interpolation - -RuboCop::Cop::Lint::RedundantRequireStatement - registers an offense when using requiring `enumerator` with modifier form - registers an offense when using requiring `enumerator` - registers an offense when using requiring `enumerator` in condition - target ruby version >= 2.1 - register an offense and corrects when using requiring `thread` or already redundant features - target ruby version >= 2.7 - registers an offense when using requiring `ruby2_keywords` or already redundant features - target ruby version >= 3.1 - registers an offense and corrects when using requiring `fiber` or already redundant features - target ruby version >= 3.2 - registers an offense and corrects when using requiring `set` - target ruby version <= 2.4 - does not register an offense when using requiring `pp` - target ruby version >= 2.2 - registers an offense when using requiring `rational`, `complex` - target ruby version < 3.1 - does not register an offense and corrects when using requiring `fiber` - target ruby version <= 2.6 - does not register an offense when using requiring `ruby2_keywords` - target ruby version >= 2.5 - register an offense and corrects when using requiring `pp` or already redundant features - target ruby version <= 2.0 - does not register an offense when using requiring `thread` - target ruby version <= 2.1 - does not register an offense when using requiring `rational`, `complex` - -RuboCop::Cop::Style::CommentedKeyword - does not register an offense if AST contains # symbol - checks a long comment in less than one second - registers an offense and corrects when commenting on the same line as `begin` - does not register an offense if there are no comments after keywords - does not register an offense for certain comments - accepts keyword letter sequences that are not keywords - registers an offense and corrects when commenting on indented keywords - registers an offense and corrects when commenting on the same line as `class` - registers an offense and corrects when commenting on the same line as `module` - registers an offense and corrects when commenting on the same line as `def` - registers an offense and corrects for one-line cases - registers an offense and corrects when commenting after keyword with spaces - registers an offense and corrects when commenting on the same line as `end` - -RuboCop::Cop::Style::RedundantException - accepts rescue w/ non redundant error - reports an offense for a fail with RuntimeError.new - reports an offense for a raise with ::RuntimeError - reports an offense for a raise with ::RuntimeError.new - accepts a raise with RuntimeError if it does not have 2 args - accepts a fail with RuntimeError if it does not have 2 args - reports an offense for a fail with ::RuntimeError.new - reports an offense for a raise with ::RuntimeError.new - reports an offense for a fail with ::RuntimeError - reports an offense for a fail with RuntimeError and () - accepts a raise with ::RuntimeError if it does not have 2 args - reports an offense for a fail with ::RuntimeError.new - reports an offense for a fail with RuntimeError.new - reports an offense for a raise with RuntimeError.new - reports an offense for a raise with RuntimeError - accepts rescue w/ non redundant error - reports an offense for a fail with RuntimeError - reports an offense for a fail with ::RuntimeError and () - reports an offense for a raise with ::RuntimeError and () - accepts rescue w/ non redundant error - accepts a fail with ::RuntimeError if it does not have 2 args - reports an offense for a raise with RuntimeError.new - accepts rescue w/ non redundant error - reports an offense for a raise with RuntimeError and () - -RuboCop::Cop::Layout::LineContinuationLeadingSpace - EnforcedStyle: leading - registers offenses when 1st and 2nd line has trailing spaces - puts the offense message in correct position also on indented line - registers an offense when 1st line has one trailing space - marks the correct range when string is a block method argument - marks the correct range when string is a positional method argument - registers offense in the right location when 1st line is not the string - registers an offense when 1st line has multiple trailing spaces - interpolated strings - registers offenses when 1st line has trailing spaces and 2nd line is interpolated - registers offenses when 1st line has leading spaces and 1st line is interpolated - registers no offense for correctly formatted multiline interpolated string - registers no offense on interpolated string alone - registers no offense on doubly interpolated string alone - registers no offense for correctly formatted multiline interpolation - registers an offense for incorrectly formatted multiline interpolated string - EnforcedStyle: trailing - marks the correct range when string is a positional method argument - marks the correct range when string is a block method argument - registers offenses when 2nd and 3rd line has leading spaces - registers an offense when 2nd line has multiple leading spaces - registers an offense when 2nd line has one leading space - registers offense in the right location when 1st line is not the string - puts the offense message in correct position also on indented line - interpolated strings - registers no offense on interpolated string alone - registers no offense on doubly interpolated string alone - registers an offense for incorrectly formatted multiline interpolated string - registers no offense for correctly formatted multiline interpolation - registers offenses when 2nd line has leading spaces and 1st line is interpolated - registers no offense for correctly formatted multiline interpolated string - registers offenses when 2nd line has leading spaces and 2nd line is interpolated - -RuboCop::Cop::Style::RedundantSelfAssignmentBranch - does not register an offense when self-assigning redundant else ternary branch for ivar - does not register an offense when using only if branch - does not register an offense when self-assigning redundant else ternary branch for cvar - does not register an offense when lhs is not variable - registers and corrects an offense when self-assigning redundant else branch and empty else branch - does not register an offense when using `elsif` and self-assigning the value of `then` branch - does not register an offense when self-assigning redundant else branch and multiline if branch - does not register an offense when not self-assigning redundant branches - does not register an offense when self-assigning redundant else ternary branch for gvar - registers and corrects an offense when self-assigning redundant else branch - registers and corrects an offense when self-assigning redundant if ternary branch - does not register an offense when self-assigning redundant else branch and multiline else branch - registers and corrects an offense when self-assigning redundant if branch - does not register an offense when multi assignment - does not register an offense when using `elsif` and self-assigning the value of `elsif` branch - does not register an offense when using `elsif` and self-assigning the value of `else` branch - registers and corrects an offense when self-assigning redundant else ternary branch - registers and corrects an offense when self-assigning redundant else branch and empty if branch - -RuboCop::Cop::Lint::EmptyInPattern - when `AllowComments: false` - registers an offense for empty `in` body with a comment - when a `in` body is missing - registers an offense for missing `in` ... then `body` followed by `else` - registers an offense for missing `in` body with a comment followed by `else` - registers an offense for missing `in` body with a comment - registers an offense for missing `in` body followed by `else` - registers an offense for missing `in` ... `then` body - registers an offense for a missing `in` body - when a `in` body is present - accepts `case` with `in` bodies - accepts `case` with `in` ... `then` statements and else clause - accepts `case` with `in` bodies and `else` clause - accepts `case` with `in` ... `then` statements - when `AllowComments: true` - registers an offense for empty `in` when comment is in another branch - accepts an empty `in` body with a comment + corrects comparison methods in case in + with end alignment to start_of_line + corrects comparison methods in unless else + corrects comparison methods in if elsif else + corrects comparison methods in case when + >= Ruby 2.7 + corrects comparison methods in case in + behaves like all assignment types + for a instance variable lval + registers an offense for assignment using *= in ternary + for a class variable lval + registers an offense for assignment using *= in ternary + for a local variable lval + registers an offense for assignment using *= in ternary + for a constant lval + registers an offense for assignment using *= in ternary + with end alignment to keyword + for a class variable lval + registers an offense for assignment using *= in case when + registers an offense for assignment using *= in if else + for a constant lval + registers an offense for assignment using *= in case when + registers an offense for assignment using *= in if else + for a local variable lval + registers an offense for assignment using *= in case when + registers an offense for assignment using *= in if else + for a global variable lval + registers an offense for assignment using *= in case when + registers an offense for assignment using *= in if else + for a instance variable lval + registers an offense for assignment using *= in if else + registers an offense for assignment using *= in case when + for a global variable lval + registers an offense for assignment using *= in ternary + with end alignment to start_of_line + for a instance variable lval + registers an offense for assignment using *= in if else + registers an offense for assignment using *= in case when + for a global variable lval + registers an offense for assignment using *= in case when + registers an offense for assignment using *= in if else + for a local variable lval + registers an offense for assignment using *= in if else + registers an offense for assignment using *= in case when + for a class variable lval + registers an offense for assignment using *= in if else + registers an offense for assignment using *= in case when + for a constant lval + registers an offense for assignment using *= in case when + registers an offense for assignment using *= in if else + behaves like comparison methods + registers an offense for comparison methods in ternary operations + with end alignment to start_of_line + corrects comparison methods in if elsif else + corrects comparison methods in unless else + corrects comparison methods in case when + >= Ruby 2.7 + corrects comparison methods in case in + with end alignment to keyword + corrects comparison methods in unless else + corrects comparison methods in if elsif else + corrects comparison methods in case when + >= Ruby 2.7 + corrects comparison methods in case in + behaves like all variable types + registers an offense assigning any variable type in ternary + registers an offense assigning any variable type in case when + allows assignment to the return of if else + allows assignment to the return of case when + registers an offense assigning any variable type in if else + allows assignment to the return of a ternary + behaves like comparison methods + registers an offense for comparison methods in ternary operations + with end alignment to start_of_line + corrects comparison methods in unless else + corrects comparison methods in case when + corrects comparison methods in if elsif else + >= Ruby 2.7 + corrects comparison methods in case in + with end alignment to keyword + corrects comparison methods in case when + corrects comparison methods in unless else + corrects comparison methods in if elsif else + >= Ruby 2.7 + corrects comparison methods in case in + behaves like all assignment types + for a global variable lval + registers an offense for assignment using %= in ternary + for a class variable lval + registers an offense for assignment using %= in ternary + with end alignment to keyword + for a global variable lval + registers an offense for assignment using %= in case when + registers an offense for assignment using %= in if else + for a instance variable lval + registers an offense for assignment using %= in case when + registers an offense for assignment using %= in if else + for a local variable lval + registers an offense for assignment using %= in case when + registers an offense for assignment using %= in if else + for a constant lval + registers an offense for assignment using %= in if else + registers an offense for assignment using %= in case when + for a class variable lval + registers an offense for assignment using %= in if else + registers an offense for assignment using %= in case when + for a instance variable lval + registers an offense for assignment using %= in ternary + for a local variable lval + registers an offense for assignment using %= in ternary + with end alignment to start_of_line + for a instance variable lval + registers an offense for assignment using %= in if else + registers an offense for assignment using %= in case when + for a local variable lval + registers an offense for assignment using %= in if else + registers an offense for assignment using %= in case when + for a constant lval + registers an offense for assignment using %= in if else + registers an offense for assignment using %= in case when + for a global variable lval + registers an offense for assignment using %= in case when + registers an offense for assignment using %= in if else + for a class variable lval + registers an offense for assignment using %= in case when + registers an offense for assignment using %= in if else + for a constant lval + registers an offense for assignment using %= in ternary + behaves like comparison methods + registers an offense for comparison methods in ternary operations + with end alignment to keyword + corrects comparison methods in case when + corrects comparison methods in if elsif else + corrects comparison methods in unless else + >= Ruby 2.7 + corrects comparison methods in case in + with end alignment to start_of_line + corrects comparison methods in case when + corrects comparison methods in if elsif else + corrects comparison methods in unless else + >= Ruby 2.7 + corrects comparison methods in case in + configured to check conditions with multiple statements + allows assignment in multiple branches when it is wrapped in a modifier + registers an offense for multiple assignment when an earlier assignment is is protected by a modifier + autocorrect + corrects multiple assignment in if else + corrects multiple assignment in if elsif else with multiple elsifs + corrects multiple assignment in case when + corrects multiple assignment in case when with multiple whens + corrects assignment in an if statement that is nested in unless else + corrects multiple assignment in if elsif else + corrects multiple assignment in unless else + assignment as the last statement + registers offense for multiple assignment in unless else + registers offense for multiple assignment in if elsif elsif else + registers an offense in unless else with more than variable assignment + registers an offense in if elsif else with more than variable assignment + registers an offense for multiple assignment in if elsif else + registers offense for multiple assignments in case when with only one when + registers an offense in case when else with more than variable assignment + registers an offense in if else with more than variable assignment + registers an offense in if elsif else with some branches only containing variable assignment and others containing more than variable assignment + registers offense for multiple assignments in case when with multiple whens + register an offense for multiple assignment in if else + behaves like allows out of order multiple assignment in if elsif else + allows out of order multiple assignment in if elsif else + multiple assignment in only one branch + registers an offense when multiple assignment is in elsif + registers an offense when multiple assignment is in else + registers an offense when multiple assignment is in if + correction would exceed max line length + allows assignment to the same variable in if else if the correction would create a line longer than the configured LineLength + allows assignment to the same variable in if else if the correction would cause the condition to exceed the configured LineLength + allows assignment to the same variable in case when else if the correction would create a line longer than the configured LineLength + behaves like comparison methods + registers an offense for comparison methods in ternary operations + with end alignment to start_of_line + corrects comparison methods in if elsif else + corrects comparison methods in case when + corrects comparison methods in unless else + >= Ruby 2.7 + corrects comparison methods in case in + with end alignment to keyword + corrects comparison methods in case when + corrects comparison methods in unless else + corrects comparison methods in if elsif else + >= Ruby 2.7 + corrects comparison methods in case in + EndAlignment configured to start_of_line + autocorrect + uses proper end alignment in unless + uses proper end alignment in case + uses proper end alignment in if + behaves like comparison methods + registers an offense for comparison methods in ternary operations + with end alignment to keyword + corrects comparison methods in if elsif else + corrects comparison methods in case when + corrects comparison methods in unless else + >= Ruby 2.7 + corrects comparison methods in case in + with end alignment to start_of_line + corrects comparison methods in if elsif else + corrects comparison methods in unless else + corrects comparison methods in case when + >= Ruby 2.7 + corrects comparison methods in case in + empty branch + allows an empty when branch with an else + allows assignment in unless without an else + allows assignment in case when without an else + allows if elsif without else + allows assignment in if without an else + allows an empty elsif statement + allows case with an empty else + allows an empty if statement + behaves like else followed by new conditional without else + allows if elsif else if + behaves like all variable types + registers an offense assigning any variable type in if else + allows assignment to the return of case when + registers an offense assigning any variable type in ternary + allows assignment to the return of if else + allows assignment to the return of a ternary + registers an offense assigning any variable type in case when + behaves like all assignment types + for a class variable lval + registers an offense for assignment using << in ternary + for a constant lval + registers an offense for assignment using << in ternary + for a instance variable lval + registers an offense for assignment using << in ternary + for a global variable lval + registers an offense for assignment using << in ternary + with end alignment to keyword + for a global variable lval + registers an offense for assignment using << in if else + registers an offense for assignment using << in case when + for a class variable lval + registers an offense for assignment using << in if else + registers an offense for assignment using << in case when + for a constant lval + registers an offense for assignment using << in case when + registers an offense for assignment using << in if else + for a local variable lval + registers an offense for assignment using << in if else + registers an offense for assignment using << in case when + for a instance variable lval + registers an offense for assignment using << in case when + registers an offense for assignment using << in if else + for a local variable lval + registers an offense for assignment using << in ternary + with end alignment to start_of_line + for a local variable lval + registers an offense for assignment using << in case when + registers an offense for assignment using << in if else + for a constant lval + registers an offense for assignment using << in case when + registers an offense for assignment using << in if else + for a instance variable lval + registers an offense for assignment using << in case when + registers an offense for assignment using << in if else + for a global variable lval + registers an offense for assignment using << in if else + registers an offense for assignment using << in case when + for a class variable lval + registers an offense for assignment using << in case when + registers an offense for assignment using << in if else + behaves like all assignment types + for a class variable lval + registers an offense for assignment using /= in ternary + for a local variable lval + registers an offense for assignment using /= in ternary + for a global variable lval + registers an offense for assignment using /= in ternary + with end alignment to start_of_line + for a constant lval + registers an offense for assignment using /= in case when + registers an offense for assignment using /= in if else + for a global variable lval + registers an offense for assignment using /= in case when + registers an offense for assignment using /= in if else + for a instance variable lval + registers an offense for assignment using /= in case when + registers an offense for assignment using /= in if else + for a class variable lval + registers an offense for assignment using /= in if else + registers an offense for assignment using /= in case when + for a local variable lval + registers an offense for assignment using /= in if else + registers an offense for assignment using /= in case when + for a constant lval + registers an offense for assignment using /= in ternary + with end alignment to keyword + for a class variable lval + registers an offense for assignment using /= in case when + registers an offense for assignment using /= in if else + for a constant lval + registers an offense for assignment using /= in if else + registers an offense for assignment using /= in case when + for a instance variable lval + registers an offense for assignment using /= in if else + registers an offense for assignment using /= in case when + for a local variable lval + registers an offense for assignment using /= in if else + registers an offense for assignment using /= in case when + for a global variable lval + registers an offense for assignment using /= in case when + registers an offense for assignment using /= in if else + for a instance variable lval + registers an offense for assignment using /= in ternary -RuboCop::Cop::Style::CollectionCompact - does not register an offense when using `compact/compact!` - registers an offense and corrects when using `reject` and receiver is a variable - registers an offense and corrects when using `reject` on array to reject nils - registers an offense and corrects when using `reject` with block pass arg on array to reject nils - does not register an offense when using `reject` to not to rejecting nils - registers an offense and corrects when using `reject` on hash to reject nils - registers an offense and corrects when using `select/select!` to reject nils - registers an offense and corrects when using `reject` with block pass arg and no parentheses - when without receiver - does not register an offense and corrects when using `select/select!` to reject nils - does not register an offense and corrects when using `reject` on array to reject nils - Ruby <= 3.0 - does not register an offense and corrects when using `to_enum.reject` on array to reject nils - does not register an offense and corrects when using `lazy.reject` on array to reject nils - Ruby >= 3.1 - registers an offense and corrects when using `lazy.reject` on array to reject nils - registers an offense and corrects when using `to_enum.reject` on array to reject nils +RuboCop::Cop::Layout::LeadingCommentSpace + accepts =begin/=end comments + registers an offense and corrects comment without leading space + does not register an offense for #! on first line + does not register an offense for more than one space + registers an offense and corrects #! after the first line + does not register an offense for more than one # + accepts sprockets directives + does not register an offense for # followed by no text + does not register an offense for only #s + Doxygen style + when config option is disabled + registers an offense and corrects using Doxygen style + when config option is enabled + does not register offense when using Doxygen style + Gemfile Ruby comment + when config option is enabled + file named Gemfile + does not register an offense when using ruby config as comment + file not named Gemfile + registers an offense when using ruby config as comment + when config option is disabled + registers an offense when using ruby config as comment + RDoc syntax + registers an offense when starting `:` + does not register an offense when using `#++` or `#--` + file not named config.ru + registers an offense and corrects #\ on first line + registers an offense and corrects #\ after the first line + file named config.ru + does not register an offense for #\ on first line + registers an offense and corrects for #\ after the first line -RuboCop::Cop::Naming::MethodName - accepts for non-ascii characters - when configured for camelCase - registers an offense for mixed snake case and camel case - accepts class emitter method in a class - accepts class emitter method in a module, even when it is defined inside another method - accepts operator definitions - accepts unary operator definitions - registers an offense for snake case name in attr. - accepts class emitter method in a class, even when it is defined inside another method - registers an offense for snake case in names - accepts camel case names in attr. - accepts camel case in instance method name - registers an offense for correct + opposite - accepts class emitter method in a module - registers an offense for singleton snake_case method within class - accepts camel case in singleton method name - registers an offense for singleton upper case method without corresponding class - registers an offense for capitalized camel case - accepts one line methods - registers an offense for mixed snake case and camel case in attr. - registers an offense for mixed snake case and camel case in attr. - registers an offense for camel case methods names in attr. - registers an offense for capitalized camel case name in attr. - when specifying `AllowedPatterns` - does not register an offense for snake case method name matching `AllowedPatterns` - does not register an offense for snake case method name in attr. - does not register an offense for camel case method name in attr. - does not register an offense for camel case method name matching `AllowedPatterns` - when configured for snake_case - accepts snake case in names - registers an offense for singleton camelCase method within class - accepts snake case in attr. - registers an offense for singleton upper case method without corresponding class - registers an offense for opposite + correct - registers an offense for capitalized camel case name in attr. - accepts class emitter method in a class - registers an offense for camel case in singleton method name - accepts unary operator definitions - registers an offense for mixed snake case and camel case - accepts one line methods - registers an offense for camel case methods names in attr. - accepts class emitter method in a module - registers an offense for capitalized camel case - accepts class emitter method in a class, even when it is defined inside another method - registers an offense for camel case in instance method name - registers an offense for mixed snake case and camel case in attr. - registers an offense for camel case method names in attr. - registers an offense for mixed snake case and camel case in attr. - accepts operator definitions - accepts class emitter method in a module, even when it is defined inside another method - when specifying `AllowedPatterns` - does not register an offense for snake case method name in attr. - does not register an offense for camel case method name in attr. - does not register an offense for camel case method name matching `AllowedPatterns` - does not register an offense for snake case method name matching `AllowedPatterns` +RuboCop::Cop::Lint::ConstantResolution + registers an offense not qualifying a namespace const + registers an offense not qualifying a const + registers no offense qualifying a namespace const + registers no offense when qualifying a const + with Ignore set + registers no offense when qualifying a const + registers no offense when an unqualified namespace const + registers no offense with an unqualified const + registers an with a namespace const + registers an offense not qualifying another const + registers no offense qualifying a namespace const + module & class definitions + does not register offense + with Only set + registers no with a namespace const + registers no offense qualifying a namespace const + registers an offense with an unqualified const + registers no offense when qualifying a const + registers no offense not qualifying another const + registers an offense when an unqualified namespace const -RuboCop::Cop::Lint::UnifiedInteger - target ruby version >= 2.4 - when Bignum - without any decorations - registers an offense - with MyNamespace - does not register an offense - when explicitly specified as toplevel constant - registers an offense - target ruby version < 2.4 - when Fixnum - with MyNamespace - does not register an offense - without any decorations - registers an offense and autocorrects - when explicitly specified as toplevel constant - registers an offense - target ruby version >= 2.4 - when Fixnum - without any decorations - registers an offense - when explicitly specified as toplevel constant - registers an offense - with MyNamespace - does not register an offense - target ruby version < 2.4 - when Bignum - with MyNamespace - does not register an offense - when explicitly specified as toplevel constant - registers an offense - without any decorations - registers an offense and autocorrects - when Integer - with MyNamespace - does not register an offense - when explicitly specified as toplevel constant - does not register an offense - without any decorations - does not register an offense +RuboCop::Cop::Naming::AsciiIdentifiers + when AsciiConstants is false + accepts identifiers with only ascii chars + does not get confused by an empty file + registers an offense for a variable name with mixed chars + does not get confused by a byte order mark + accepts constants with only ascii chars + registers an offense for a variable name with non-ascii chars + when AsciiConstants is true + registers an offense for a variable name with non-ascii chars + registers an offense for a constant name with non-ascii chars + does not get confused by an empty file + registers an offense for a variable name with mixed chars + accepts identifiers with only ascii chars + does not get confused by a byte order mark -RuboCop::Cop::Lint::AmbiguousRegexpLiteral - Ruby <= 2.7 - with `match_with_lvasgn` node - without parentheses - registers an offense and corrects - with parentheses - does not register an offense - with different parentheses - does not register an offense - without parentheses - registers an offense and corrects when using block argument - registers an offense and corrects when single argument - registers an offense and corrects when sending method without receiver takes a regexp argument - registers an offense and corrects when using regexp without method call in a nested structure - registers an offense and corrects when sending method to regexp without argument - registers an offense and corrects when sending method chain to regexp - registers an offense and corrects when sending method inside parens without receiver takes a regexp argument - registers an offense and corrects when sending method to regexp with argument - registers an offense and corrects when nesting - registers an offense and corrects when multiple arguments - registers an offense and corrects when using nested method arguments without parentheses - with parentheses - accepts - Ruby >= 3.0 - without parentheses - registers an offense and corrects when sending method without receiver takes a regexp argument - registers an offense and corrects when single argument - registers an offense and corrects when using regexp without method call in a nested structure - registers an offense and corrects when multiple arguments - registers an offense and corrects when sending method to regexp without argument - registers an offense and corrects when sending method to regexp with argument - registers an offense and corrects when using block argument - registers an offense and corrects when nesting - registers an offense and corrects when using nested method arguments without parentheses - registers an offense and corrects when sending method inside parens without receiver takes a regexp argument - registers an offense and corrects when sending method chain to regexp - with parentheses - accepts - with `match_with_lvasgn` node - with parentheses - does not register an offense - without parentheses - registers an offense and corrects - with different parentheses - does not register an offense +RuboCop::Cop::InternalAffairs::NodeMatcherDirective + retains indentation properly when inserting + autocorrects with the right arguments if the pattern includes arguments + inserts a blank line between multiple pattern matchers + registers an offense if the matcher does not have a directive but has preceding comments + does not register an offense if called with a dynamic method name + does not register an offense if called with a dynamic method name + does not register an offense if the directive is in a comment block + autocorrects with the right arguments if the pattern includes arguments + registers an offense if the matcher has multiple directives + registers an offense if the matcher does not have a directive but has preceding comments + inserts a blank line between multiple pattern matchers + registers an offense if the matcher does not have a directive + registers an offense if the directive name does not match the actual name + inserts a blank line between multiple multi-line pattern matchers + retains indentation properly when correcting + does not register an offense if the node matcher already has a directive + retains indentation properly when inserting + registers an offense if the matcher does not have a directive and a method call is used for a pattern argument + does not register an offense if the node matcher already has a directive + autocorrects with the right arguments if the pattern references a non-contiguous argument + registers an offense if the directive name does not match the actual name + does not insert a blank line if one already exists + registers an offense if the matcher does not have a directive and a method call is used for a pattern argument + registers an offense if the matcher does not have a directive + does not register an offense if the directive is in a comment block + inserts a blank line between multiple multi-line pattern matchers + autocorrects with the right arguments if the pattern references a non-contiguous argument + retains indentation properly when correcting + registers an offense if the matcher has multiple directives + does not insert a blank line if one already exists -RuboCop::Cop::Style::MissingElse - UnlessElse disabled - given an if-statement +RuboCop::Cop::Style::EmptyElse + configured to warn on empty else + given a case statement with an else-clause with side-effects doesn't register an offense - with no else-clause - registers an offense with a completely empty else-clause + behaves like autocorrect + MissingElse is disabled + does autocorrection + MissingElse is case + does not autocorrect + MissingElse is if + does autocorrection + MissingElse is both + does not autocorrect + with no else-clause doesn't register an offense with an else-clause containing only the literal nil doesn't register an offense given an unless-statement with a completely empty else-clause - doesn't register an offense + behaves like autocorrect + MissingElse is case + does autocorrection + MissingElse is both + does not autocorrect + MissingElse is if + does not autocorrect + MissingElse is disabled + does autocorrection with an else-clause with side-effects doesn't register an offense with an else-clause containing only the literal nil doesn't register an offense with no else-clause - registers an offense - given a case statement - with a completely empty else-clause doesn't register an offense + given an if-statement with no else-clause - registers an offense - with an else-clause containing only the literal nil - doesn't register an offense - with an else-clause with side-effects doesn't register an offense - >= Ruby 2.7 - does not register an offense - UnlessElse enabled - given an if-statement + with an empty comment + does not autocorrect with a completely empty else-clause + using semicolons + behaves like autocorrect + MissingElse is case + does autocorrection + MissingElse is both + does not autocorrect + MissingElse is if + does not autocorrect + MissingElse is disabled + does autocorrection + not using semicolons + behaves like autocorrect + MissingElse is if + does not autocorrect + MissingElse is case + does autocorrection + MissingElse is both + does not autocorrect + MissingElse is disabled + does autocorrection + with an else-clause with side-effects doesn't register an offense - with no else-clause - registers an offense + in an if-statement + behaves like autocorrect + MissingElse is case + does autocorrection + MissingElse is both + does not autocorrect + MissingElse is disabled + does autocorrection + MissingElse is if + does not autocorrect with an else-clause containing only the literal nil doesn't register an offense - with an else-clause with side-effects - doesn't register an offense - >= Ruby 2.7 - does not register an offense + configured to warn on nil in else given a case statement with an else-clause with side-effects doesn't register an offense with an else-clause containing only the literal nil - doesn't register an offense + when the result is assigned to a variable + behaves like autocorrect + MissingElse is if + does autocorrection + MissingElse is both + does not autocorrect + MissingElse is case + does not autocorrect + MissingElse is disabled + does autocorrection + using semicolons + behaves like autocorrect + MissingElse is if + does autocorrection + MissingElse is case + does not autocorrect + MissingElse is disabled + does autocorrection + MissingElse is both + does not autocorrect with a completely empty else-clause doesn't register an offense with no else-clause - registers an offense - given an unless-statement - with an else-clause with side-effects - doesn't register an offense - with a completely empty else-clause doesn't register an offense + given an unless-statement with no else-clause doesn't register an offense - with an else-clause containing only the literal nil - doesn't register an offense - configured to warn only on empty if - given a case statement with a completely empty else-clause doesn't register an offense - with an else-clause containing only the literal nil - doesn't register an offense - with no else-clause - doesn't register an offense with an else-clause with side-effects doesn't register an offense - >= Ruby 2.7 - does not register an offense - given an if-statement with an else-clause containing only the literal nil - doesn't register an offense - with no else-clause - registers an offense + behaves like autocorrect + MissingElse is case + does autocorrection + MissingElse is both + does not autocorrect + MissingElse is disabled + does autocorrection + MissingElse is if + does not autocorrect + given an if-statement with an else-clause with side-effects doesn't register an offense - with a completely empty else-clause + with no else-clause doesn't register an offense - given an unless-statement with a completely empty else-clause doesn't register an offense - with no else-clause - registers an offense with an else-clause containing only the literal nil - doesn't register an offense - with an else-clause with side-effects - doesn't register an offense - EmptyElse enabled and set to warn on nil - >= Ruby 2.7 - does not register an offense + when the result is assigned to a variable + behaves like autocorrect + MissingElse is if + does not autocorrect + MissingElse is both + does not autocorrect + MissingElse is case + does autocorrection + MissingElse is disabled + does autocorrection + when standalone + behaves like autocorrect + MissingElse is disabled + does autocorrection + MissingElse is case + does autocorrection + MissingElse is if + does not autocorrect + MissingElse is both + does not autocorrect + with an else-clause containing only the literal nil using semicolons + with one elsif + behaves like autocorrect + MissingElse is both + does not autocorrect + MissingElse is disabled + does autocorrection + MissingElse is if + does not autocorrect + MissingElse is case + does autocorrection + with multiple elsifs + behaves like autocorrect + MissingElse is both + does not autocorrect + MissingElse is case + does autocorrection + MissingElse is disabled + does autocorrection + MissingElse is if + does not autocorrect + when `AllowComments: true` given an if-statement - with no else-clause + with comment and empty else-clause + doesn't register an offense + with not comment and empty else-clause registers an offense - with an else-clause with side-effects + with not comment and nil else-clause + registers an offense + with comment and nil else-clause doesn't register an offense - with a completely empty else-clause + given a case statement + with not comment and empty else-clause + registers an offense + with comment and nil else-clause doesn't register an offense - with an else-clause containing only the literal nil + with comment and empty else-clause doesn't register an offense + with not comment and nil else-clause + registers an offense given an unless-statement - with an else-clause with side-effects - doesn't register an offense - with no else-clause + with not comment and empty else-clause registers an offense - with a completely empty else-clause - doesn't register an offense - with an else-clause containing only the literal nil - doesn't register an offense - given a case statement - with a completely empty else-clause + with comment and empty else-clause doesn't register an offense - with an else-clause containing only the literal nil + with comment and nil else-clause doesn't register an offense - with no else-clause + with not comment and nil else-clause registers an offense - with an else-clause with side-effects - doesn't register an offense - configured to warn only on empty case - >= Ruby 2.7 - does not register an offense + with nested if and case statement + behaves like autocorrect + MissingElse is both + does not autocorrect + MissingElse is case + does not autocorrect + MissingElse is if + does autocorrection + MissingElse is disabled + does autocorrection + configured to warn on empty else and nil in else given an if-statement - with an else-clause with side-effects - doesn't register an offense - with an else-clause containing only the literal nil - doesn't register an offense with no else-clause doesn't register an offense - with a completely empty else-clause - doesn't register an offense - given a case statement + with an else-clause containing only the literal nil + with multiple elsifs + behaves like autocorrect + MissingElse is if + does not autocorrect + MissingElse is disabled + does autocorrection + MissingElse is both + does not autocorrect + MissingElse is case + does autocorrection + with one elsif + behaves like autocorrect + MissingElse is if + does not autocorrect + MissingElse is both + does not autocorrect + MissingElse is disabled + does autocorrection + MissingElse is case + does autocorrection with an else-clause with side-effects doesn't register an offense with a completely empty else-clause - doesn't register an offense - with an else-clause containing only the literal nil - doesn't register an offense - with no else-clause - registers an offense + behaves like autocorrect + MissingElse is disabled + does autocorrection + MissingElse is if + does not autocorrect + MissingElse is both + does not autocorrect + MissingElse is case + does autocorrection given an unless-statement with an else-clause with side-effects doesn't register an offense - with a completely empty else-clause - doesn't register an offense with no else-clause doesn't register an offense - with an else-clause containing only the literal nil - doesn't register an offense - EmptyElse enabled and set to warn on empty - given a case statement - with no else-clause - registers an offense with a completely empty else-clause - doesn't register an offense + behaves like autocorrect + MissingElse is case + does autocorrection + MissingElse is if + does not autocorrect + MissingElse is disabled + does autocorrection + MissingElse is both + does not autocorrect with an else-clause containing only the literal nil - doesn't register an offense + behaves like autocorrect + MissingElse is if + does not autocorrect + MissingElse is disabled + does autocorrection + MissingElse is both + does not autocorrect + MissingElse is case + does autocorrection + given a case statement with an else-clause with side-effects doesn't register an offense - given an if-statement - with an else-clause containing only the literal nil - doesn't register an offense with a completely empty else-clause - doesn't register an offense - with an else-clause with side-effects - doesn't register an offense + behaves like autocorrect + MissingElse is disabled + does autocorrection + MissingElse is if + does autocorrection + MissingElse is both + does not autocorrect + MissingElse is case + does not autocorrect with no else-clause - registers an offense - >= Ruby 2.7 - does not register an offense - given an unless-statement - with a completely empty else-clause - doesn't register an offense - with an else-clause with side-effects doesn't register an offense with an else-clause containing only the literal nil - doesn't register an offense - with no else-clause - registers an offense - -RuboCop::Cop::Layout::LeadingCommentSpace - does not register an offense for only #s - does not register an offense for more than one # - does not register an offense for more than one space - accepts =begin/=end comments - registers an offense and corrects comment without leading space - does not register an offense for # followed by no text - accepts sprockets directives - does not register an offense for #! on first line - registers an offense and corrects #! after the first line - file named config.ru - registers an offense and corrects for #\ after the first line - does not register an offense for #\ on first line - RDoc syntax - registers an offense when starting `:` - does not register an offense when using `#++` or `#--` - Doxygen style - when config option is disabled - registers an offense and corrects using Doxygen style - when config option is enabled - does not register offense when using Doxygen style - file not named config.ru - registers an offense and corrects #\ after the first line - registers an offense and corrects #\ on first line - Gemfile Ruby comment - when config option is disabled - registers an offense when using ruby config as comment - when config option is enabled - file not named Gemfile - registers an offense when using ruby config as comment - file named Gemfile - does not register an offense when using ruby config as comment - -RuboCop::Formatter::Colorizable - #red - invokes #colorize(string, red - #colorize - when the global Rainbow.enabled is true - and output is not a tty, but --color option was provided - colorizes the passed string - and the formatter's output is not a tty - does nothing - and the formatter's output is a tty - colorizes the passed string - when the global Rainbow.enabled is false - and the formatter's output is a tty - does nothing - and the formatter's output is not a tty - does nothing - #green - invokes #colorize(string, green - #cyan - invokes #colorize(string, cyan - #white - invokes #colorize(string, white - #blue - invokes #colorize(string, blue - #magenta - invokes #colorize(string, magenta - #black - invokes #colorize(string, black - #yellow - invokes #colorize(string, yellow - -RuboCop::Cop::Layout::MultilineHashKeyLineBreaks - without line break after opening bracket - registers an offense and corrects when key starts on same line as another - registers an offense and corrects nested hashes - when on same line - does not add any offenses - with line break after opening bracket - registers an offense and corrects when key starts on same line as another - when on different lines than brackets but keys on one - does not add any offenses - when key starts on same line as another with rockets - adds an offense - when on all keys on one line different than brackets - does not add any offenses - -RuboCop::Cop::Style::MultilineMemoization - EnforcedStyle: braces - with a single line memoization - allows expression on first line - allows expression on the following line - with a multiline memoization - without braces - when the expression is wrapped in `begin` and `end` keywords - registers an offense for begin...end block on first line - registers an offense for begin...end block on following line - with a multiline memoization - without a `begin` and `end` block - allows with another block on the first line - allows with a conditional on the following line - allows with another block on the following line - allows with a conditional on the first line - EnforcedStyle: keyword - with a single line memoization - allows expression on first line - allows expression on the following line - with a multiline memoization - without a `begin` and `end` block - allows with a conditional on the following line - allows with another block on the first line - allows with another block on the following line - allows with a conditional on the first line - with a multiline memoization - without a `begin` and `end` block - when the expression is wrapped in parentheses - registers an offense with multiline expression - registers an offense when expression starts on first line - registers an offense when expression starts on following line - -RuboCop::Cop::Style::BeginBlock - reports an offense for a BEGIN block - -RuboCop::Cop::Lint::DeprecatedOpenSSLConstant - does not register an offense with cipher constant and argument is a variable - registers an offense with cipher constant and double quoted string argument and corrects - does not register an offense with cipher constant and send argument is a method - does not register an offense when building digest using an algorithm string and nested digest constants - does not register an offense when using ::Digest class methods with an algorithm string and value - registers an offense with cipher constant and one argument and corrects - registers an offense with cipher constant and no arguments and corrects - registers an offense with cipher constant and `cbc` argument and corrects - does not register an offense with cipher constant and argument is a constant - does not register an offense when building digest using an algorithm string - registers an offense with cipher constant and two arguments and corrects - registers an offense with AES + blocksize constant and mode argument and corrects - registers an offense with cipher constant and no arguments and corrects - registers an offense with cipher constant and no arguments and corrects - registers an offense with AES + blocksize constant and corrects - does not register an offense when using cipher with a string - registers an offense when building an instance using an digest constant and corrects - registers an offense with cipher constant and no arguments and corrects - registers an offense when using an digest constant with chained methods and corrects - registers an offense when using ::Digest class methods on an algorithm constant and corrects - when used in a block - registers an offense when using ::Digest class methods on an algorithm constant and corrects - -RuboCop::Cop::Style::Dir - when using `#expand_path` and `#dirname` - registers an offense - registers an offense with ::File - when using `#dirname` and `#realpath` - registers an offense with ::File - registers an offense - -RuboCop::Cop::Naming::ConstantName - does not check names if rhs is a `Struct.new` with conditional assign - registers an offense for camel case in const name - does not check names if rhs is a `Struct.new` - does not check names if rhs is a method call - registers an offense for camel case in const namewhen using frozen object assignment - allows screaming snake case in const name - registers an offense for snake case in const name - does not check names if rhs is a `Class.new` - allows screaming snake case with POSIX upper case characters - does not check names if rhs is a `Class.new` with conditional assign - registers offenses for camel case in multiple const assignment - does not check names if rhs is a method call with conditional assign - registers 1 offense if rhs is offending const assignment - does not check names if rhs is a method call with block - registers an offense for non-POSIX upper case in const name - allows screaming snake case in multiple const assignment - checks qualified const names - does not check if rhs is another constant - registers an offense for camel case in const namewhen using frozen range assignment - does not check if rhs is a non-offensive const assignment - when a rhs is a conditional expression - when conditional branches contain only constants - does not check names - when conditional branches contain only string values - registers an offense - when conditional branches contain a value other than a constant - does not check names - -RuboCop::Cop::Style::ExponentialNotation - EnforcedStyle is scientific - registers an offense for mantissa equal to 10 - registers no offense for a mantissa equal to 1 - registers no offense for a regular float - registers no offense for a negative exponent - registers an offense for mantissa smaller than 1 - registers an offense for mantissa greater than 10 - registers no offense for a mantissa between 1 and 10 - registers no offense for a float smaller than 1 - registers no offense for a negative mantissa - EnforcedStyle is engineering - registers no offense for a negative exponent - registers an offense for mantissa smaller than 0.1 - registers no offense for a float smaller than 1 - registers no offense for a regular float - registers no offense for a mantissa equal to 1 - registers no offense for a negative mantissa - registers an offense for exponent equal to -2 - registers an offense for a mantissa greater than -0.1 - registers an offense for mantissa smaller than -1000 - registers no offense for a large mantissa - registers an offense for exponent equal to 4 - EnforcedStyle is integral - registers no offense for negative mantissa - registers no offense for a float smaller than 1 - registers no offense for a regular float - registers no offense for an integral mantissa - registers no offense for negative exponent - registers an offense for decimal mantissa - registers an offense for mantissa divisible by 10 - -RuboCop::Cop::Naming::VariableNumber - when CheckSymbols is false - does not register an offense for snake case numbering in symbol - when configured for non integer - registers an offense for normal case numbering in method name - registers an offense for normal case numbering in symbol - registers an offense for snake case numbering in symbol - registers an offense for normal case numbering in method parameter - registers an offense for normal case numbering in method camel case parameter - registers an offense for snake case numbering in method camel case parameter - registers an offense for snake case numbering in method name - registers an offense for snake case numbering in method parameter - behaves like accepts integer symbols - accepts integer symbol - accepts integer symbol array literal - behaves like offense - registers an offense for @myAttribute1 in non_integer - behaves like accepts - accepts @@foo in non_integer - behaves like accepts - accepts fooBar in non_integer - behaves like accepts - accepts localone in non_integer - behaves like offense - registers an offense for @local_1 in non_integer - behaves like offense - registers an offense for myAttribute_1 in non_integer - behaves like accepts - accepts local_ in non_integer - behaves like offense - registers an offense for _myLocal1 in non_integer - behaves like offense_array - registers an offense for ["a_1", "aone"] in non_integer - behaves like accepts - accepts @foo in non_integer - behaves like accepts - accepts @__foo__ in non_integer - behaves like accepts - accepts _1 in non_integer - behaves like accepts - accepts _ in non_integer - behaves like offense - registers an offense for myAttribute1 in non_integer - behaves like accepts - accepts local_one in non_integer - behaves like offense - registers an offense for local1 in non_integer - behaves like offense - registers an offense for @myAttribute_1 in non_integer - behaves like accepts - accepts _foo in non_integer - behaves like accepts - accepts emparejó in non_integer - behaves like offense - registers an offense for _myLocal_1 in non_integer - behaves like offense - registers an offense for @local1 in non_integer - behaves like offense - registers an offense for local_1 in non_integer - when configured for snake_case - registers an offense for normal case numbering in symbol - registers an offense for normal case numbering in a global variable name - registers an offense for normal case numbering in method parameter - does not register an offense for snake case numbering in symbol - registers an offense for normal case numbering in method name - registers an offense for normal case numbering in method camel case parameter - behaves like accepts - accepts local_1 in snake_case - behaves like offense - registers an offense for camelCase1 in snake_case - behaves like offense - registers an offense for aB1 in snake_case - behaves like offense - registers an offense for @camelCase1 in snake_case - behaves like offense - registers an offense for @@local1 in snake_case - behaves like accepts - accepts local_12 in snake_case - behaves like accepts - accepts a_1_b_1 in snake_case - behaves like accepts - accepts emparejó in snake_case - behaves like accepts - accepts local_123 in snake_case - behaves like accepts - accepts _ in snake_case - behaves like offense - registers an offense for _unused1 in snake_case - behaves like accepts - accepts aB_1 in snake_case - behaves like offense - registers an offense for local1 in snake_case - behaves like accepts - accepts @__foo__ in snake_case - behaves like offense - registers an offense for @local1 in snake_case - behaves like accepts - accepts _foo in snake_case - behaves like accepts - accepts @foo in snake_case - behaves like accepts - accepts _1 in snake_case - behaves like accepts - accepts local_ in snake_case - behaves like accepts - accepts a_1_b in snake_case - behaves like offense_array - registers an offense for ["a1", "a_2"] in snake_case - behaves like accepts integer symbols - accepts integer symbol array literal - accepts integer symbol - when AllowedPatterns is set - does not register an offense for a instance variable name that matches an allowed pattern - registers an offense for a local variable name that does not match an allowed pattern - registers an offense for a instance variable name that does not match an allowed pattern - registers an offense for a class variable name that does not match an allowed pattern - does not register an offense for a global variable name that matches an allowed pattern - registers an offense for a global variable name that does not match an allowed pattern - does not register an offense for a class variable name that matches an allowed pattern - registers an offense for a symbol that does not match an allowed pattern - registers an offense for a method name that does not match an allowed pattern - does not register an offense for a symbol that matches an allowed pattern - does not register an offense for a method name that matches an allowed pattern - does not register an offense for a local variable name that matches an allowed pattern - when CheckMethodNames is false - does not register an offense for snake case numbering in method name - when configured for normal - registers an offense for snake case numbering in method parameter - registers an offense for snake case numbering in a global variable name - does not register an offense for normal case numbering in symbol - registers an offense for snake case numbering in method camel case parameter - registers an offense for snake case numbering in method name - registers an offense for snake case numbering in symbol - behaves like offense - registers an offense for @local_1 in normalcase - behaves like accepts - accepts foo10_bar in normalcase - behaves like accepts - accepts user_1_id in normalcase - behaves like accepts - accepts local_ in normalcase - behaves like offense - registers an offense for myAttribute_1 in normalcase - behaves like accepts - accepts _1 in normalcase - behaves like accepts - accepts emparejó in normalcase - behaves like offense - registers an offense for @@local_1 in normalcase - behaves like offense - registers an offense for @myAttribute_1 in normalcase - behaves like accepts - accepts @__foo__ in normalcase - behaves like accepts - accepts sha256 in normalcase - behaves like offense - registers an offense for local_1 in normalcase - behaves like accepts - accepts localFOO1 in normalcase - behaves like accepts - accepts target_u2f_device in normalcase - behaves like accepts - accepts local1 in normalcase - behaves like accepts - accepts _foo in normalcase - behaves like accepts integer symbols - accepts integer symbol - accepts integer symbol array literal - behaves like accepts - accepts user1_id in normalcase - behaves like offense - registers an offense for sha_256 in normalcase - behaves like offense - registers an offense for _myLocal_1 in normalcase - behaves like offense - registers an offense for local_FOO_1 in normalcase - behaves like accepts - accepts snake_case in normalcase - behaves like offense_array - registers an offense for ["a_1", "a2"] in normalcase - behaves like offense - registers an offense for localFOO_1 in normalcase - behaves like accepts - accepts _ in normalcase - behaves like accepts - accepts @foo in normalcase - when AllowedIdentifiers is set - does not register an offense for a instance variable name that is allowed - does not register an offense for a method name that is allowed - does not register an offense for a global variable name that is allowed - does not register an offense for a local variable name that is allowed - does not register an offense for a symbol that is allowed - does not register an offense for a class variable name that is allowed - -RuboCop::DirectiveComment - #directive_count - when cops and departments used - is expected to eq 4 - when few department used - is expected to eq 3 - when few cops used - is expected to eq 2 - #in_directive_department? - when cop department disabled - is expected to equal true - when cop disabled - is expected to equal false - when another department disabled - is expected to equal false - #disabled_all? - when disabled specific cops - is expected to equal false - when enabled specific cops - is expected to equal false - when disabled all cops - is expected to equal true - when enabled all cops - is expected to equal false - #match_captures - when todo - is expected to eq ["todo", "all", nil, nil] - when enable - is expected to eq ["enable", "Foo/Bar", nil, "Foo/"] - when disable - is expected to eq ["disable", "all", nil, nil] - when typo - is expected to be nil - #enabled? - when disable - is expected to equal false - when todo - is expected to equal false - when enable - is expected to equal true - #department_names - when only department specified - is expected to eq ["Foo"] - when department and cops specified - is expected to eq ["Foo"] - when only cop specified - is expected to eq [] - when all cops mentioned - is expected to eq [] - when couple departments specified - is expected to eq ["Foo", "Baz"] - #line_number - returns line number for directive - #single_line? - when does NOT relate to single line - is expected to equal false - when relates to single line - is expected to equal true - #all_cops? - when mentioned specific cops - is expected to equal false - when mentioned all - is expected to equal true - #disabled? - when disable - is expected to equal true - when todo - is expected to equal true - when enable - is expected to equal false - #cop_names - when couple departments specified - is expected to eq ["Foo/Bar", "Foo/Baz", "Baz/Bar"] - when only cop specified - is expected to eq ["Foo/Bar"] - when all cops mentioned - is expected to eq ["all_names"] - when department and cops specified - is expected to eq ["Foo/Bar", "Foo/Baz", "Baz/Cop"] - when only department specified - is expected to eq ["Foo/Bar", "Foo/Baz"] - when redundant directive cop department specified - is expected to eq ["Lint/One", "Lint/Two"] - .before_comment - when line has NO code - is expected to eq "" - when line has code - is expected to eq "def foo " - #enabled_all? - when enabled specific cops - is expected to equal false - when disabled all cops - is expected to equal false - when disabled specific cops - is expected to equal false - when enabled all cops - is expected to equal true - #overridden_by_department? - when cop is overridden by it's department - is expected to equal true - when cop is not overridden by it's department - is expected to equal false - when there are no cops - is expected to equal false - when there are no departments - is expected to equal false - #match? - when disabled all cops - is expected to equal true - when cop names are same but have duplicated names - is expected to equal true - when cop names are superset of names - is expected to equal false - when cop names are same but in a different order - is expected to equal true - when cop names are subset of names - is expected to equal false - when cop names are same as in the comment - is expected to equal true - when there are no cop names - is expected to equal false - -RuboCop::Cop::InternalAffairs::SingleLineComparison - registers and corrects an offense when comparing `loc.last_line` with `loc.first_line` - registers and corrects an offense when negative comparing `last_line` with `first_line` - registers and corrects an offense when comparing `loc.line` with `loc.last_line` - registers and corrects an offense when comparing `first_line` with `last_line` - registers and corrects an offense when comparing `loc.last_line` with `loc.line` - registers and corrects an offense when comparing `source_range.last_line` with `source_range.first_line` - registers and corrects an offense when negative comparing `first_line` with `last_line` - does not register an offense when the receivers are not a match - registers and corrects an offense when comparing `source_range.first_line` with `source_range.last_line` - does not register an offense when comparing the same line - registers and corrects an offense when comparing `last_line` with `first_line` - registers and corrects an offense when comparing `loc.first_line` with `loc.last_line` - -RuboCop::Cop::Lint::DuplicateMagicComment - does not register an offense when encoding and frozen magic comments are not duplicated - registers an offense when different encoding magic comments are duplicated - does not register an offense when encoding magic comments are not duplicated - does not register an offense when frozen magic comments are not duplicated - registers an offense when encoding and frozen magic comments are duplicated - registers an offense when same encoding magic comments are duplicated - registers an offense when frozen magic comments are duplicated - -RuboCop::Cop::Security::IoMethods - when using `File` receiver - behaves like accepts - does not register an offense when using `File.readlines(path)` - behaves like accepts - does not register an offense when using `File.foreach(path) { |x| puts x }` - behaves like accepts - does not register an offense when using `File.binwrite(path, "hi")` - behaves like accepts - does not register an offense when using `File.binread(path)` - behaves like accepts - does not register an offense when using `File.read(path)` - when using `IO` receiver and string argument - registers and corrects an offense when using `foreach` - behaves like offense - registers and corrects an offense when using `binwrite` - behaves like offense - registers and corrects an offense when using `read` - behaves like offense - registers and corrects an offense when using `readlines` - behaves like offense - registers and corrects an offense when using `binwrite` - behaves like offense - registers and corrects an offense when using `write` - when using no receiver - behaves like accepts - does not register an offense when using `read("command")` - behaves like accepts - does not register an offense when using `binwrite("command", "hi")` - behaves like accepts - does not register an offense when using `foreach("command") { |x| puts x }` - behaves like accepts - does not register an offense when using `write("command", "hi")` - behaves like accepts - does not register an offense when using `readlines("command")` - when using `IO` receiver and variable argument - registers and corrects an offense when using `foreach` - behaves like offense - registers and corrects an offense when using `binwrite` - behaves like offense - registers and corrects an offense when using `binread` - behaves like offense - registers and corrects an offense when using `readlines` - behaves like offense - registers and corrects an offense when using `write` - behaves like offense - registers and corrects an offense when using `read` - when using `IO` receiver and string argument that starts with a pipe character (`" | command"`) - behaves like accepts - does not register an offense when using `IO.readlines(" | command")` - behaves like accepts - does not register an offense when using `IO.foreach(" | command") { |x| puts x }` - behaves like accepts - does not register an offense when using `IO.binwrite(" | command", "hi")` - behaves like accepts - does not register an offense when using `IO.read(" | command")` - behaves like accepts - does not register an offense when using `IO.write(" | command", "hi")` - when using `IO` receiver and string argument that starts with a pipe character (`"| command"`) - behaves like accepts - does not register an offense when using `IO.read("| command")` - behaves like accepts - does not register an offense when using `IO.write("| command", "hi")` - behaves like accepts - does not register an offense when using `IO.readlines("| command")` - behaves like accepts - does not register an offense when using `IO.foreach("| command") { |x| puts x }` - behaves like accepts - does not register an offense when using `IO.binwrite("| command", "hi")` - -RuboCop::Cop::Layout::EmptyLines - does not register an offense for empty lines in a string - does not register an offense for heredocs with empty lines inside - does not register an offense for comments - does not register an offense when there are no tokens - registers an offense for consecutive empty lines - -RuboCop::Runner - how formatter is invoked - #file_started - sends file specific information hash - sends a file path - the passed path - is frozen - invocation order - is called in the proper sequence - #started - sends all file paths - the passed files paths - is frozen - #file_finished - sends an array of detected offenses for the file - sends a file path - the passed path - is frozen - #finished - when RuboCop is interrupted by user - sends only processed file paths - when RuboCop finished inspecting all files normally - sends all file paths - the passed files paths - is frozen - -RuboCop::Cop::Layout::BeginEndAlignment - accepts matching puts 1; begin ... end - accepts matching begin ... end - registers an offense for mismatched begin end and autocorrects - when EnforcedStyleAlignWith is start_of_line - accepts matching puts 1; begin ... end - accepts matching var = begin ... end - registers an offense for mismatched begin end and autocorrects - registers an offense for mismatched var << begin end and autocorrects - -RuboCop::Cop::Style::ReturnNil - when enforced style is `return` - does not register an offense for returning others - registers an offense for return nil - does not register an offense for return nil from iterators - when enforced style is `return_nil` - registers an offense for return - does not register an offense for returning others - -RuboCop::Cop::Lint::SelfAssignment - registers an offense when using global var self-assignment - does not register an offense when using constant var or-assignment for constant from another scope - registers an offense when using constant var self-assignment - does not register an offense when using multiple var assignment through splat - does not register an offense when using multiple var assignment through method call - registers an offense when using shorthand-and var self-assignment - registers an offense when using class var self-assignment - does not register an offense when using local var assignment - registers an offense when using instance var self-assignment - does not register an offense when using multiple var assignment - does not register an offense when using constant var assignment for constant from another scope - registers an offense when using multiple var self-assignment through array - registers an offense when using local var self-assignment - does not register an offense when using shorthand-or var assignment - does not register an offense when using global var assignment - does not register an offense when using shorthand-and var assignment - registers an offense when using shorthand-or var self-assignment - does not register an offense when using instance var assignment - does not register an offense when using class var assignment - registers an offense when using multiple var self-assignment + behaves like autocorrect + MissingElse is case + does not autocorrect + MissingElse is disabled + does autocorrection + MissingElse is if + does autocorrection + MissingElse is both + does not autocorrect -RuboCop::Cop::Style::WhenThen - accepts ; separating statements in the body of when - registers an offense for when b; - registers an offense for when b, c; - when inspecting a case statement with an empty branch - does not register an offense +RuboCop::Server::CLI + when using `--no-server` option + returns exit status 0 + when using exclusive `--server-status` option + returns exit status 2 and display an error message + when not using any server options + returns exit status 0 + when not using any server options and specifying `--server` in .rubocop file + returns exit status 0 and display an information message + when using exclusive `--restart-server` option + returns exit status 2 and display an error message + when using `--restart-server` option + returns exit status 0 and display an information and a warning messages + when using exclusive `--start-server` option + returns exit status 2 and display an error message + when using server option with `--cache-root path` option + returns exit status 0 and display an error message + when using exclusive `--stop-server` option + returns exit status 2 and display an error message + when using `--server-status` option + returns exit status 0 and display an information message + when using multiple server options + returns exit status 2 and display an error message + when using `--start-server` option + returns exit status 0 and display an information message + when using server option with `--cache-root=path` option + returns exit status 0 and display an information message + when using `--stop-server` option + returns exit status 0 and display a warning message + when not using any server options and specifying `--server` in `RUBOCOP_OPTS` environment variable + returns exit status 0 and display an information message + when using `--server` option + returns exit status 0 and display an information message -RuboCop::Cop::Metrics::BlockNesting - accepts `Max` levels of nesting - accepts if/elsif - nested `while` - registers an offense - Multiple nested `ifs` at same level - registers 2 offenses - `Max + 2` levels of `if` nesting - registers an offense - nested `for` - registers an offense - nested `rescue` - registers an offense - `Max + 1` levels of `if` nesting - registers an offense - when CountBlocks is true - nested inline block - registers an offense - nested multiline block - registers an offense - nested modifier `until` - registers an offense - nested `case` - registers an offense - nested modifier `while` - registers an offense - when CountBlocks is false - accepts nested inline blocks - accepts nested multiline blocks - nested `until` - registers an offense +RuboCop::Cop::Lint::Debugger + does not register an offense for a byebug in comments + does not register an offense for a save_and_open_page in comments + does not register an offense for a pry_remote method + does not register an offense for a byebug method + does not register an offense for a remote_pry in comments + does not register an offense for a save_and_open_screenshot in comments + does not register an offense for a pry method + does not register an offense for a save_and_open_screenshot method + does not register an offense for a debugger method + does not register an offense for a remote_byebug method + does not register an offense for a pry in comments + does not register an offense for a console in comments + does not register an offense for a remote_pry method + does not register an offense for a remote_byebug in comments + does not register an offense for a binding method that is not disallowed + does not register an offense for a pry_remote in comments + does not register an offense for a debugger in comments + does not register an offense for a irb method + does not register an offense for a irb in comments + does not register an offense for a console method + does not register an offense for a save_and_open_page method + when a method group is disabled with false + does not register an offense for a Pry debugger call + does register an offense for another group + with the DebuggerMethods configuration + does not register an offense for a byebug call + registers an offense for a `custom_debugger` call + nested custom configurations + registers an offense for a `custom_debugger call + with a const chain + registers an offense for a `Foo::Bar::Baz.debug` call + with a method chain + registers an offense for a `debugger.foo.bar` call + with a const chain and a method chain + registers an offense for a `Foo::Bar::Baz.debug.this.code` call + rails + registers an offense for a debugger with an argument call + registers an offense for a debugger with ::Kernel call + registers an offense for a debugger call + registers an offense for a debugger with Kernel call + byebug + registers an offense for a byebug call + registers an offense for a Kernel.remote_byebug call + registers an offense for a remote_byebug call + registers an offense for a Kernel.byebug call + registers an offense for a byebug with an argument call + debug.rb + registers an offense for a `binding.break` with `Kernel` call + registers an offense for a `binding.b` with `Kernel` call + registers an offense for a `break` binding call + registers an offense for a `b` binding call + pry + registers an offense for a pry_remote binding call + registers an offense for a Pry.rescue call + registers an offense for a pry binding call + does not register an offense for a `rescue` call without Pry + does not register an offense for a `pry` call without binding + registers an offense for a binding.pry with Kernel call + registers an offense for a remote_pry binding call + registers an offense for a pry_remote binding with an argument call + registers an offense for a pry binding with an argument call + registers an offense for a remote_pry binding with an argument call + when a method group is disabled with nil + does not register an offense for a Pry debugger call + does register an offense for another group + capybara + registers an offense for save_and_open_screenshot + registers an offense for save_and_open_page + with an argument + registers an offense for save_and_open_page + registers an offense for save_and_open_screenshot + RubyJard + registers an offense for a jard call + built-in methods + registers an offense for a binding.irb with Kernel call + registers an offense for a irb binding call + web console + does not register an offense for `console` without a receiver + registers an offense for a `binding.console` call -RuboCop::Cop::Layout::SpaceAfterMethodName - registers offense and corrects class def with space before parenthesis - accepts a defs without arguments - accepts class method def with arguments but no parentheses - accepts a def with arguments but no parentheses - accepts a def without arguments - registers an offense and corrects def with space before the parenthesis - accepts an assignment def with arguments but no parentheses - registers offense and corrects assignment def with space before parenthesis +RuboCop::Cop::Registry + exposes the number of stored cops + can filter down to one type + can be cloned + exposes cop departments + can filter down to all but one type + exposes a mapping of cop names to cop classes + exposes a list of cop names + #cops + exposes a list of cops + with cops having the same inner-most module + exposes both cops + #enabled + selects cops which are enabled in the config + overrides config if :only includes the cop + selects only safe cops if :safe passed + when new cops are introduced + overrides config if :only includes the cop + does not include them + when specifying `NewCops: enable` option in .rubocop.yml + includes them + when specifying `NewCops: pending` option in .rubocop.yml + does not include them + when specifying `--enable-pending-cops` command-line option + includes them + when specifying `NewCops: disable` option in .rubocop.yml + includes them because command-line option takes precedence over .rubocop.yml + when specifying `--disable-pending-cops` command-line option + does not include them + when specifying `NewCops: enable` option in .rubocop.yml + does not include them because command-line option takes precedence over .rubocop.yml + when specifying `NewCops: disable` option in .rubocop.yml + does not include them + names_for_department + returns array of cops for specified department + #qualified_cop_name + gives back already properly qualified names + emits a warning when namespace is incorrect + qualifies names with the correct namespace + raises an error when a cop name is ambiguous + returns the provided name if no namespace is found + qualifies names without a namespace + #contains_cop_matching? + returns false for cops not included in the store + can find cops matching a given name + #department? + returns false for other names + returns true for department name + when dismissing a cop class + allows re-listing + disallows it if done too late + allows it if done rapidly RuboCop::Cop::Layout::MultilineHashBraceLayout + ignores single-line hashes ignores implicit hashes ignores empty hashes - ignores single-line hashes behaves like multiline literal brace layout trailing comma symmetrical style opening brace on same line as first element @@ -28496,1675 +30080,119 @@ and a comment after the last element detects closing brace on separate line from last element behaves like multiline literal brace layout + new_line style + opening brace on same line as first element + autocorrects closing brace on same line as last element + allows closing brace on different line from multi-line element + allows closing brace on different line from last element + detects closing brace on same line as last multiline element + opening brace on separate line from first element + allows closing brace on separate line from last element + detects closing brace on same line as last element + allows closing brace on separate line from last multiline element same_line style + opening brace on separate line from first element + allows closing brace on same line as last multiline element + detects closing brace on different line from last element + allows closing brace on same line as last element opening brace on same line as first element - allows closing brace on same line as multi-line element - autocorrects closing brace on different line as last element detects closing brace on different line from multiline element + autocorrects closing brace on different line as last element + allows closing brace on same line as multi-line element allows closing brace on same line from last element with a chained call on the closing brace - and a comment after the last element - detects closing brace on separate line from last elementbut does not autocorrect the closing brace but no comment after the last element autocorrects the closing brace + and a comment after the last element + detects closing brace on separate line from last elementbut does not autocorrect the closing brace + symmetrical style opening brace on separate line from first element + detects closing brace on same line as last element + allows closing brace on separate line from last multiline element + allows closing brace on separate line from last element + opening brace on same line as first element + autocorrects closing brace on different line from last element allows closing brace on same line as last element detects closing brace on different line from last element allows closing brace on same line as last multiline element + with a chained call on the closing brace + but no comment after the last element + autocorrects the closing brace + and a comment after the last element + detects closing brace on separate line from last elementbut does not autocorrect the closing brace heredoc detects heredoc structures that are safe to add to ignores heredocs that could share a last line - new_line style + +RuboCop::Cop::Layout::MultilineMethodCallBraceLayout + ignores implicit calls + ignores calls without arguments + ignores calls with a multiline empty brace + ignores single-line calls + ignores calls with an empty brace + when EnforcedStyle is new_line + still ignores single-line calls + ignores single-line calls with multi-line receiver + ignores single-line calls with multi-line receiver with leading dot + when comment present before closing brace + corrects closing brace without crashing + behaves like multiline literal brace layout + heredoc + detects heredoc structures that are safe to add to + ignores heredocs that could share a last line + same_line style opening brace on same line as first element - allows closing brace on different line from multi-line element - allows closing brace on different line from last element - detects closing brace on same line as last multiline element - autocorrects closing brace on same line as last element + allows closing brace on same line as multi-line element + autocorrects closing brace on different line as last element + detects closing brace on different line from multiline element + allows closing brace on same line from last element + with a chained call on the closing brace + but no comment after the last element + autocorrects the closing brace + and a comment after the last element + detects closing brace on separate line from last elementbut does not autocorrect the closing brace + opening brace on separate line from first element + allows closing brace on same line as last multiline element + detects closing brace on different line from last element + allows closing brace on same line as last element + symmetrical style opening brace on separate line from first element + detects closing brace on same line as last element allows closing brace on separate line from last multiline element allows closing brace on separate line from last element - detects closing brace on same line as last element - symmetrical style opening brace on same line as first element - allows closing brace on same line as last element - autocorrects closing brace on different line from last element detects closing brace on different line from last element + autocorrects closing brace on different line from last element allows closing brace on same line as last multiline element + allows closing brace on same line as last element with a chained call on the closing brace - and a comment after the last element - detects closing brace on separate line from last elementbut does not autocorrect the closing brace but no comment after the last element autocorrects the closing brace + and a comment after the last element + detects closing brace on separate line from last elementbut does not autocorrect the closing brace + new_line style + opening brace on same line as first element + allows closing brace on different line from last element + autocorrects closing brace on same line as last element + detects closing brace on same line as last multiline element + allows closing brace on different line from multi-line element opening brace on separate line from first element + detects closing brace on same line as last element allows closing brace on separate line from last multiline element allows closing brace on separate line from last element - detects closing brace on same line as last element - -RuboCop::Cop::Naming::ClassAndModuleCamelCase - registers an offense for underscore in class and module name - allows module_parent method - accepts CamelCase names - is not fooled by qualified names - custom allowed names - does not register offense for multiple allowed names - -RuboCop::Cop::Style::CommandLiteral - when EnforcedStyle is set to mixed - a multi-line %x string without backticks - is accepted - a multi-line %x string with backticks - is accepted - a multi-line ` string with backticks - registers an offense without autocorrection - a single-line %x string without backticks - registers an offense and corrects to backticks - a single-line ` string without backticks - is accepted - a single-line ` string with backticks - registers an offense without autocorrection - when configured to allow inner backticks - is accepted - a multi-line ` string without backticks - registers an offense and corrects to %x - a single-line %x string with backticks - is accepted - when configured to allow inner backticks - registers an offense without autocorrection - when EnforcedStyle is set to percent_x - a multi-line ` string with backticks - registers an offense without autocorrection - a single-line %x string with backticks - is accepted - a single-line %x string without backticks - is accepted - a multi-line %x string with backticks - is accepted - a single-line ` string without backticks - registers an offense and corrects to %x - a single-line ` string with backticks - registers an offense without autocorrection - a multi-line ` string without backticks - registers an offense and corrects to %x - a multi-line %x string without backticks - is accepted - when PercentLiteralDelimiters is configured with curly braces - respects the configuration when autocorrecting - when PercentLiteralDelimiters is configured and a default exists - ignores the default when autocorrecting - %x commands with other delimiters than parentheses - registers an offense - when PercentLiteralDelimiters only has a default - respects the configuration when autocorrecting - heredoc commands - is ignored - when EnforcedStyle is set to backticks - a multi-line ` string without backticks - is accepted - a single-line %x string with backticks - is accepted - when configured to allow inner backticks - registers an offense without autocorrection - a single-line %x string without backticks - registers an offense and corrects to backticks - a single-line ` string with backticks - registers an offense without autocorrection - when configured to allow inner backticks - is accepted - a multi-line ` string with backticks - registers an offense without autocorrection - when configured to allow inner backticks - is accepted - a single-line ` string without backticks - is accepted - a multi-line %x string with backticks - is accepted - when configured to allow inner backticks - registers an offense without autocorrection - a multi-line %x string without backticks - registers an offense and corrects to backticks - -RuboCop::Cop::Metrics::Utils::AbcSizeCalculator - #calculate - with ||= - is expected to eq "<2, 0, 1>" - with a known iterating block - is expected to eq "<2, 4, 2>" - with .foo = - is expected to eq "<1, 2, 0>" - when counting repeated calls - is expected to eq "<1, 4, 0>" - method with arguments - is expected to eq "<4, 0, 0>" - multiple assignment with method setters - is expected to eq "<3, 5, 0>" - same with extra condition - is expected to eq "<2, 9, 5>" - when discounting repeated calls - when root receiver is a var - is expected to eq "<3, 9, 0>" - when some calls have arguments - is expected to eq "<1, 7, 0>" - when root receiver is self/nil - is expected to eq "<2, 9, 1>" - multiple assignment - is expected to eq "<3, 1, 0>" - with a block - is expected to eq "<2, 3, 0>" - assignment with ternary operator - is expected to eq "<2, 6, 2>" - same but with 7 arguments - is expected to eq "<9, 3, 0>" - multiple calls with return - is expected to eq "<0, 3, 0>" - equivalent to multiple assignment with method setters - is expected to eq "<3, 5, 0>" - with &.foo - is expected to eq "<0, 4, 2>" - with repeated lvar receivers - is expected to eq "<3, 5, 3>" - with &&= - is expected to eq "<2, 0, 1>" - with a yield - is expected to eq "<0, 1, 0>" - with ||= on a constant - is expected to eq "<1, 0, 1>" - with += for setters - is expected to eq "<1, 2, 0>" - if and arithmetic operations - is expected to eq "<2, 8, 4>" - with += - is expected to eq "<2, 0, 0>" - with []= - is expected to eq "<2, 1, 0>" - with unused assignments - is expected to eq "<2, 1, 0>" - elsif vs else if - else if - is expected to eq "<0, 5, 4>" - elsif - is expected to eq "<0, 5, 3>" - with a for - is expected to eq "<2, 1, 1>" - -RuboCop::Cop::Layout::SpaceAroundKeyword - behaves like missing after - registers an offense for missing space after keyword in `a rescue""` and autocorrects - behaves like accept before - accepts `+` before keyword in `a+begin end` - behaves like accept around - accepts `[]` around keyword in `[begin end]` - behaves like accept before - accepts `=` before keyword in `a=begin end` - behaves like accept around - accepts `{}` around keyword in `loop {next}` - behaves like missing after - registers an offense for missing space after keyword in `END{}` and autocorrects - behaves like accept after - accepts `(` after keyword in `return(1)` - behaves like accept before - accepts `>` before keyword in `a>begin end` - behaves like missing after - registers an offense for missing space after keyword in `super{}` and autocorrects - behaves like accept before - accepts `!` before keyword in `!super.method` - behaves like missing before - registers an offense for missing space before keyword in `1or 2` - behaves like missing after - registers an offense for missing space after keyword in `1 and(2)` and autocorrects - behaves like missing after - registers an offense for missing space after keyword in `next""` and autocorrects - behaves like missing after - registers an offense for missing space after keyword in `1 or(2)` and autocorrects - behaves like accept before - accepts `-` before keyword in `a-begin end` - behaves like missing before - registers an offense for missing space before keyword in `a do "a"end` - behaves like missing after - registers an offense for missing space after keyword in `unless""; end` and autocorrects - behaves like accept after - accepts `(` after keyword in `super(1)` - behaves like accept after - accepts `\` after keyword in `test do\ -end` - behaves like accept after - accepts `(` after keyword in `defined?(1)` - behaves like accept after - accepts `{` after keyword in `loop{}` - behaves like missing before - registers an offense for missing space before keyword in `case ""when a; end` - behaves like missing before - registers an offense for missing space before keyword in `if a; ""else end` - behaves like missing after - registers an offense for missing space after keyword in `if""; end` and autocorrects - behaves like missing before - registers an offense for missing space before keyword in `if ""then a end` - behaves like missing before - registers an offense for missing space before keyword in `if a; ""elsif b; end` - behaves like missing after - registers an offense for missing space after keyword in `return""` and autocorrects - behaves like missing after - registers an offense for missing space after keyword in `if a; else"" end` and autocorrects - behaves like accept after - accepts `.` after keyword in `begin end.inspect` - behaves like missing before - registers an offense for missing space before keyword in `1until ""` - behaves like accept before - accepts `*` before keyword in `a*begin end` - behaves like accept after - accepts `(` after keyword in `yield(1)` - >= Ruby 2.7 - behaves like missing before - registers an offense for missing space before keyword in `""in a` - behaves like missing after - registers an offense for missing space after keyword in `a in""` and autocorrects - behaves like missing after - registers an offense for missing space after keyword in `case a; in""; end` and autocorrects - behaves like accept after - accepts `\n` after keyword in `test do -end` - behaves like accept after - accepts `+` after keyword in `+begin end` - behaves like accept around - accepts `()` around keyword in `(next)` - behaves like missing before - registers an offense for missing space before keyword in `1and 2` - behaves like accept before - accepts `=*` before keyword in `a=*begin end` - behaves like missing before - registers an offense for missing space before keyword in `for x in [] do "x"end` - behaves like accept after - accepts `#` after keyword in `next#comment` - behaves like missing after - registers an offense for missing space after keyword in `begin"" end` and autocorrects - behaves like accept after - accepts `[` after keyword in `super[1]` - behaves like missing after - registers an offense for missing space after keyword in `begin ensure"" end` and autocorrects - behaves like accept around - accepts `;` around keyword in `test do;end` - behaves like accept before - accepts `|` before keyword in `loop { |x|break }` - behaves like accept after - accepts `(` after keyword in `break(1)` - behaves like missing after - registers an offense for missing space after keyword in `a do|x| end` and autocorrects - behaves like accept after - accepts `::` after keyword in `super::ModuleName` - behaves like missing before - registers an offense for missing space before keyword in `begin ""ensure end` - behaves like missing before - registers an offense for missing space before keyword in `begin "a"end` - behaves like missing before - registers an offense for missing space before keyword in `a "b"do end` - behaves like accept before - accepts `||` before keyword in `a||begin end` - behaves like accept around - accepts `[]` around keyword in `a[begin end]` - behaves like missing after - registers an offense for missing space after keyword in `BEGIN{}` and autocorrects - behaves like accept after - accepts `.` after keyword in `yield.method` - behaves like missing after - registers an offense for missing space after keyword in `break""` and autocorrects - behaves like accept after - accepts `(` after keyword in `next(1)` - behaves like missing after - registers an offense for missing space after keyword in `super""` and autocorrects - behaves like missing after - registers an offense for missing space after keyword in `case a; when b; else"" end` and autocorrects - behaves like missing after - registers an offense for missing space after keyword in `defined?1` and autocorrects - behaves like missing after - registers an offense for missing space after keyword in `yield""` and autocorrects - &. - behaves like accept after - accepts `&.` after keyword in `yield&.foo` - behaves like accept after - accepts `&.` after keyword in `super&.foo` - behaves like accept around - accepts `{}` around keyword in `"#{begin end}"` - behaves like missing before - registers an offense for missing space before keyword in `begin rescue; ""else end` - behaves like accept before - accepts `==` before keyword in `a==begin end` - behaves like missing after - registers an offense for missing space after keyword in `case"" when 1; end` and autocorrects - behaves like missing after - registers an offense for missing space after keyword in `begin+1 end` and autocorrects - behaves like missing before - registers an offense for missing space before keyword in `while 1 do "x"end` - behaves like accept after - accepts `(` after keyword in `not(1)` - behaves like accept before - accepts `**` before keyword in `a**begin end` - >= Ruby 2.7 - behaves like missing after - registers an offense for missing space after keyword in `case""; in 1; end` and autocorrects - behaves like accept before - accepts `!` before keyword in `!yield.method` - behaves like accept before - accepts `<` before keyword in `a= Ruby 3.0 - behaves like accept before - accepts `=>` before keyword in `""=> a` - behaves like accept after - accepts `=>` after keyword in `a =>""` - behaves like missing before - registers an offense for missing space before keyword in `1while ""` - behaves like missing before - registers an offense for missing space before keyword in `if a; "b"end` - behaves like missing after - registers an offense for missing space after keyword in `for x in [] do"x" end` and autocorrects - behaves like missing after - registers an offense for missing space after keyword in `begin rescue; else"" end` and autocorrects - >= Ruby 2.7 - behaves like missing after - registers an offense for missing space after keyword in `case a; in b; else"" end` and autocorrects - behaves like missing before - registers an offense for missing space before keyword in `case a; in "pattern"if "condition"; else "" end` - behaves like missing after - registers an offense for missing space after keyword in `case a; in "pattern" unless"condition"; else "" end` and autocorrects - behaves like missing before - registers an offense for missing space before keyword in `case a; in b; ""else end` - behaves like missing after - registers an offense for missing space after keyword in `case a; in "pattern" if"condition"; else "" end` and autocorrects - behaves like missing before - registers an offense for missing space before keyword in `case a; in "pattern"unless "condition"; else "" end` - behaves like missing after - registers an offense for missing space after keyword in `case a when""; end` and autocorrects - behaves like missing after - registers an offense for missing space after keyword in `if a; elsif""; end` and autocorrects - behaves like missing before - registers an offense for missing space before keyword in `case a; when b; ""else end` - behaves like accept after - accepts `rescue` after keyword in `begin; rescue(Error); end` - behaves like missing before - registers an offense for missing space before keyword in `until 1 do "x"end` - behaves like missing after - registers an offense for missing space after keyword in `1 while""` and autocorrects - behaves like missing after - registers an offense for missing space after keyword in `if a then"" end` and autocorrects - behaves like missing before - registers an offense for missing space before keyword in `until 1do end` - behaves like accept before - accepts `+` before keyword in `a+begin; end.method` - behaves like accept before - accepts `&&` before keyword in `a&&begin end` - behaves like missing after - registers an offense for missing space after keyword in `while 1 do"x" end` and autocorrects - behaves like missing before - registers an offense for missing space before keyword in `while 1do end` - behaves like missing after - registers an offense for missing space after keyword in `1 until""` and autocorrects - behaves like missing before - registers an offense for missing space before keyword in `""rescue a` - behaves like missing before - registers an offense for missing space before keyword in `for x in []do end` - -RuboCop::Cop::Security::JSONLoad - allows JSON.parse - allows JSON.dump - registers an offense and corrects JSON.load - does not register an offense for JSON under another namespace - registers an offense and corrects JSON.restore - -RuboCop::Cop::Corrector - #rewrite - allows removal of characters from range ending - accepts a node instead of a range - allows insertion after a source range - allows removal of characters from range beginning - allows insertion before and after a source range - allows insertion before a source range - allows removal of characters preceding range - allows replacement of a range - allows removal of a range - raises a useful error if not given a node or a range - when range is from incorrect source - raises exception from remove - raises exception from remove_trailing - raises exception from remove_leading - raises exception from insert_after - raises exception from replace - raises exception from remove_preceding - raises exception from insert_before - -RuboCop::Cop::Layout::RescueEnsureAlignment - accepts aligned rescue in do-end block assigned to instance variable - accepts correctly aligned rescue in assigned begin-end block - accepts aligned rescue in do-end block with `.()` call - accepts correctly aligned rescue/ensure with def with no body - accepts aligned rescue in do-end block on and-assignment - accepts aligned rescue in do-end block on multi-assignment - accepts correctly aligned ensure - accepts correctly aligned rescue/ensure with def - accepts aligned rescue in do-end block on or-assignment - accepts aligned rescue in do-end block - accepts aligned rescue in do-end block on operation assignment - accepts aligned rescue in assigned do-end block starting on newline - accepts aligned rescue in do-end block assigned to class - accepts aligned rescue with do-end block that line break with trailing dot for method calls - accepts the modifier form - accepts aligned rescue in do-end block in a method - accepts end being misaligned - accepts aligned rescue with do-end block that line break with leading dot for method calls - accepts aligned rescue do-end block assigned to local variable - accepts aligned rescue in do-end block assigned to global variable - accepts rescue and ensure on the same line - accepts aligned rescue in do-end block assigned to class variable - accepts correctly aligned rescue - rescue with defs - registers an offense - rescue in do-end block assigned to instance variable - registers an offense - rescue in do-end block assigned to class - registers an offense - ensure with module - registers an offense when ensure used with module - ensure with class - registers an offense - rescue with do-end block - registers an offense - ensure with def - registers an offense - when using zsuper with block - registers and corrects an offense and corrects when incorrect alignment - does not register an offense when correct alignment - rescue with begin - registers an offense - as RHS of assignment - `Layout/BeginEndAlignment` cop is not enabled - accepts multi-line, aligned - accepts multi-line, indented - registers an offense and corrects for incorrect alignment - when `EnforcedStyleAlignWith: begin` of `Layout/BeginEndAlignment` cop - accepts multi-line, aligned - accepts multi-line, indented - registers an offense and corrects for incorrect alignment - when `EnforcedStyleAlignWith: start_of_line` of `Layout/BeginEndAlignment` cop - accepts multi-line, indented - accepts multi-line, aligned - registers an offense and corrects for incorrect alignment - rescue in do-end block assigned to global variable - registers an offense - ensure with begin - registers an offense when ensure used with begin - allows inline access modifier - with private_class_method modifier - ensure with defs - registers an offense - correct alignment - ensure with def - registers an offense - correct alignment - rescue with defs - registers an offense - correct alignment - rescue with def - correct alignment - registers an offense - with public_class_method modifier - rescue with defs - correct alignment - registers an offense - rescue with def - correct alignment - registers an offense - ensure with def - registers an offense - correct alignment - ensure with defs - correct alignment - registers an offense - with private modifier - rescue with defs - correct alignment - registers an offense - rescue with def - registers an offense - correct alignment - ensure with def - registers an offense - correct alignment - ensure with defs - registers an offense - correct alignment - rescue with class - registers an offense when rescue used with class - excluded file - processes excluded files with issue - rescue in do-end block on multi-assignment - registers an offense - rescue in assigned do-end block starting on newline - registers an offense - ensure with defs - registers an offense - rescue with module - registers an offense when rescue used with module - rescue in do-end block on or-assignment - registers an offense - rescue in do-end block assigned to class variable - registers an offense - rescue in do-end block assigned to local variable - registers an offense - allows inline expression before - ensure - registers an offense - rescue - registers an offense - rescue in do-end block on and-assignment - registers an offense - rescue in do-end block on operation assignment - registers an offense - rescue with def - registers an offense - -RuboCop::Cop::Style::LambdaCall - when style is set to call - registers an offense for correct + multiple opposite styles - registers an offense for x.() - registers an offense for correct + opposite - when style is set to braces - autocorrects x.call asdf, x123 to x.(asdf, x123) - registers an offense for correct + multiple opposite styles - registers an offense for opposite + correct - registers an offense for x.call() - accepts a call without receiver - autocorrects x.call to x.() - -RuboCop::RakeTask - running tasks - will not error when result is not 0 and fail_on_error is false - uses the default formatter from .rubocop.yml if no formatter option is given - runs with default options - allows nested arrays inside formatters, options, and requires - runs with specified options if a block is given - exits when result is not 0 and fail_on_error is true - autocorrect - runs with --autocorrect - runs with --autocorrect-all - runs with with the options that were passed to its parent task - defining tasks - creates a named task and a named autocorrect task - creates a rubocop task and a rubocop autocorrect task - creates a named task and a named auto_correct task - creates a rubocop task and a rubocop auto_correct task - -RuboCop::Cop::Style::RedundantPercentQ - accepts %q at the beginning of a section of a double quoted string with interpolation - accepts %q containing string interpolation - accepts %q at the beginning of a double quoted string with interpolation - accepts a heredoc string that contains %q - accepts %Q at the beginning of a double quoted string with interpolation - accepts %Q at the beginning of a section of a double quoted string with interpolation - with %Q strings - accepts regular expressions starting with %Q - accepts a string with single quotes and double quotes - autocorrects for strings that are concatenated with backslash - accepts a string with double quotes and an escaped normal character - registers an offense for static string without quotes - registers an offense for static string with only double quotes - accepts a string with double quotes and an escaped special character - registers an offense for dynamic string without quotes - accepts a dynamic %Q string with double quotes - with %q strings - autocorrects for strings that are concatenated with backslash - registers an offense for only single quotes - accepts a string with single quotes and double quotes - registers an offense for no quotes - accepts a string with escaped non-backslash characters - registers an offense for a string containing escaped backslashes - accepts a string with escaped backslash and non-backslash characters - accepts regular expressions starting with %q - registers an offense for only double quotes - -RuboCop::Cop::Style::Documentation - registers an offense for non-empty class with encoding comment - registers an offense for non-empty cbase class - registers an offense for non-empty class with directive comment - does not consider comment followed by empty line to be class documentation - accepts non-empty class with documentation - registers an offense for compact-style nested module - registers an offense for non-empty class with annotation comment - accepts non-empty module with documentation - does not raise an error for an implicit match conditional - accepts non-empty class with annotation comment followed by other comment - registers an offense for non-namespace - registers an offense if the comment line contains code - registers an offense for compact-style nested class - registers an offense for empty module without documentation - accepts namespace module which defines constants - accepts namespace class without documentation - accepts non-empty class with comment that ends with an annotation - accepts empty class without documentation - accepts namespace class which defines constants - registers an offense for non-empty class - accepts namespace module without documentation - registers offense for non-empty class with frozen string comment - registers an offense for a deeply nested class - without documentation - macro-only class - does not register offense with single macro - does not register offense with multiple macros - registers offense for macro with other methods - with non-empty class - with constants visibility declaration content - does not register an offense - with non-empty module - with constants visibility declaration content - does not register an offense - with # :nodoc: - registers an offense for nested module without documentation - accepts non-namespace module without documentation - accepts non-namespace class without documentation - registers an offense for nested class without documentation - accepts compact-style nested class without documentation - accepts compact-style nested module without documentation - with `all` modifier - accepts nested class without documentation - with `all` modifier - accepts nested module without documentation - on a subclass - accepts non-namespace subclass without documentation - registers an offense for nested subclass without documentation - when AllowedConstants is configured - ignores the constants in the config - with `all` modifier - accepts nested subclass without documentation - sparse and trailing comments - ignores sparse comments inside module node - ignores comments after class node end - ignores comments after module node end - ignores sparse comments inside class node - -RuboCop::Cop::Style::AndOr - when style is always - autocorrects "or" with an assignment on the left - autocorrects "or" with || and doesn't add extra parentheses - autocorrects "and" with && and adds parentheses to expr - autocorrects "or" with || in method calls (3) - also warns on until (or) - autocorrects "or" with || in method calls - warns on short-circuit (or) - also warns on until (and) - also warns on non short-circuit (or) - autocorrects "and" with && in method calls (3) - autocorrects "and" with && in method calls - autocorrects "and" with && in method calls (2) - warns on short-circuit (and) - autocorrects "or" inside def - autocorrects "or" with an assignment on the right - registers an offense for "or" - autocorrects "or" with || and adds parentheses to expr - also warns on non short-circuit (and) (unless) - also warns on while (or) - autocorrects "and" with an Enumerable accessor on either side - autocorrects "or" with || in method calls (2) - autocorrects "and" inside def - autocorrects "and" with && in method calls (4) - autocorrects "and" with && and doesn't add extra parentheses - registers an offense for "and" - autocorrects "or" with || in method calls (4) - also warns on non short-circuit (and) - also warns on while (and) - also warns on non short-circuit (or) (unless) - with !obj.method arg on left - autocorrects "and" with && and adds parens - when `or` precedes `&&` - registers an offense and corrects - with obj.method= arg on left - autocorrects "and" with && and adds parens - with a file which contains __FILE__ - autocorrects "or" with || - with !obj.method arg on right - autocorrects "and" with && and adds parens - with `not` expression on right - autocorrects "and" with && and adds parens - with predicate method with arg without space on right - autocorrects "or" with || and adds parens - autocorrects "and" with && and adds parens - with one predicate method without space on right and another method - autocorrects "or" with || and adds parens - autocorrects "and" with && and adds parens - when `and` precedes `or` - registers an offense and corrects - within a nested begin node - autocorrects "and" with && and adds parens - with two predicate methods with args without spaces on right - autocorrects "or" with || and adds parens - autocorrects "and" with && and adds parens - when `and` precedes `||` - registers an offense and corrects - when left hand side is a comparison method - autocorrects "and" with && and adds parens - when `or` precedes `and` - registers an offense and corrects - with !variable on left - doesn't crash and burn - with `not` expression on left - autocorrects "and" with && and adds parens - with obj.method = arg on left - autocorrects "and" with && and adds parens - within a nested begin node with one child only - autocorrects "and" with && and adds parens - when style is conditionals - registers an offense for "or" in post-while condition - registers an offense for "and" in post-until condition - accepts || outside of conditional - accepts "or" in post-while body - accepts "or" in until body - accepts "and" in if body - accepts "or" in post-until body - registers an offense for "and" in post-while condition - registers an offense for "or" in until condition - accepts "or" outside of conditional - accepts "and" in post-while body - accepts "and" in until body - accepts && outside of conditional - registers an offense for "or" in if condition - accepts "and" in post-until body - accepts || inside of conditional - accepts "and" in while body - accepts "or" in while body - accepts && inside of conditional - registers an offense for "and" in if condition - accepts "or" in if body - accepts "and" outside of conditional - registers an offense for "or" in post-until condition - registers an offense for "and" in while condition - registers an offense for "or" in while condition - registers an offense for "and" in until condition - -RuboCop::Cop::Gemspec::DeprecatedAttributeAssignment - behaves like deprecated attributes - does not register an offense when using `s.rubygems_version =` outside `Gem::Specification.new` - registers and corrects an offense when using `s.rubygems_version =` - does not register an offense when using `rubygems_version =` and receiver is not `Gem::Specification.new` block variable - registers and corrects an offense when using `spec.rubygems_version =` - behaves like deprecated attributes - registers and corrects an offense when using `spec.rubygems_version =` - registers and corrects an offense when using `s.rubygems_version =` - does not register an offense when using `rubygems_version =` and receiver is not `Gem::Specification.new` block variable - does not register an offense when using `s.rubygems_version =` outside `Gem::Specification.new` - behaves like deprecated attributes - registers and corrects an offense when using `s.rubygems_version =` - does not register an offense when using `s.rubygems_version =` outside `Gem::Specification.new` - does not register an offense when using `rubygems_version =` and receiver is not `Gem::Specification.new` block variable - registers and corrects an offense when using `spec.rubygems_version =` - behaves like deprecated attributes - does not register an offense when using `rubygems_version =` and receiver is not `Gem::Specification.new` block variable - registers and corrects an offense when using `s.rubygems_version =` - does not register an offense when using `s.rubygems_version =` outside `Gem::Specification.new` - registers and corrects an offense when using `spec.rubygems_version =` - behaves like deprecated attributes with addition - registers and corrects an offense when using `spec.rubygems_version +=` - registers and corrects an offense when using `s.rubygems_version +=` - -RuboCop::Cop::Lint::AmbiguousRange - for an erange - can handle an endless range - registers an offense and corrects when the entire range is parenthesized but contains complex boundaries - registers an offense and corrects when not parenthesized - does not register an offense if the range is parenthesized - can handle a beginningless range - does not register an offense for `self` - does not register an offense for a constant - registers an offense and corrects when one side is parenthesized but the other is not - does not register an offense for a variable - does not register an offense if the range is composed of literals - registers an offense and corrects when there are clauses on both sides - method calls - with RequireParenthesesForMethodChains: true - does not register an offense for a chained method call with parens - registers an offense for a chained method call without parens - behaves like common behavior - does not register an offense for a non-chained method call - requires parens when calling a method on a basic literal - does not register an offense for a unary + - does not register an offense for a unary - - with RequireParenthesesForMethodChains: false - does not register an offense for a chained method call without parens - does not register an offense for a chained method call with parens - behaves like common behavior - requires parens when calling a method on a basic literal - does not register an offense for a unary + - does not register an offense for a non-chained method call - does not register an offense for a unary - - for an irange - does not register an offense if the range is composed of literals - does not register an offense if the range is parenthesized - registers an offense and corrects when not parenthesized - registers an offense and corrects when the entire range is parenthesized but contains complex boundaries - can handle an endless range - does not register an offense for a variable - does not register an offense for `self` - can handle a beginningless range - does not register an offense for a constant - registers an offense and corrects when one side is parenthesized but the other is not - registers an offense and corrects when there are clauses on both sides - method calls - with RequireParenthesesForMethodChains: true - does not register an offense for a chained method call with parens - registers an offense for a chained method call without parens - behaves like common behavior - does not register an offense for a non-chained method call - does not register an offense for a unary - - does not register an offense for a unary + - requires parens when calling a method on a basic literal - with RequireParenthesesForMethodChains: false - does not register an offense for a chained method call with parens - does not register an offense for a chained method call without parens - behaves like common behavior - requires parens when calling a method on a basic literal - does not register an offense for a unary - - does not register an offense for a non-chained method call - does not register an offense for a unary + - -RuboCop::Cop::Naming::BinaryOperatorParameterName - does not register an offense for arg named _other - registers an offense and corrects for `#eql?` when argument is not named other - registers an offense and corrects for `#equal?` when argument is not named other - registers an offense and corrects when assigned to argument in method body - does not register an offense for []= - registers an offense and corrects for `#+` when argument is not named other - does not register an offense for === - does not register an offense for multibyte character method name - does not register an offense for << - works properly even if the argument not surrounded with braces - does not register an offense for arg named other - registers an offense and corrects when argument is referenced in method body - does not register an offense for non binary operators - does not register an offense for [] - does not register an offense for the match operator - -RuboCop::Cop::Naming::MemoizedInstanceVariableName - does not register an offense when or-assignment-based memoization is used outside a method definition - EnforcedStyleForLeadingUnderscores: required - when defined?-based memoization is used - registers an offense when it has leading `_` but names do not match - does not register an offense with a leading `_` for both names - registers an offense when names match but missing a leading _ - with dynamically defined methods - when a method is defined inside a module callback - when the method does not match - registers an offense - when the method matches - does not register an offense - when the variable name does not match the method name - registers an offense - when a singleton method is defined inside a module callback - when the method does not match - registers an offense - when the method matches - does not register an offense - when the variable name matches the method name - does not register an offense - when or-assignment-based memoization is used - registers an offense when names match but missing a leading _ - registers an offense when it has leading `_` but names do not match - does not register an offense with a leading `_` for both names - with dynamically defined methods - when the variable name does not match the method name - registers an offense - when the variable name matches the method name - does not register an offense - when a singleton method is defined inside a module callback - when the method does not match - registers an offense - when the method matches - does not register an offense - when a method is defined inside a module callback - when the method does not match - registers an offense - when the method matches - does not register an offense - with default EnforcedStyleForLeadingUnderscores => disallowed - when defined?-based memoization is used - does not register an offense when some code after assignment - registers an offense when memoized variable does not match method name - does not register an offense when some code before defined - registers an offense when memoized variable does not match class method name - does not register an offense when there is no assignment - with dynamically defined methods - when the variable name does not match the method name - registers an offense - when a method is defined inside a module callback - when the method does not match - registers an offense - when the method matches - does not register an offense - when the variable name matches the method name - does not register an offense - when a singleton method is defined inside a module callback - when the method does not match - registers an offense - when the method matches - does not register an offense - memoized variable matches method name - does not register an offense with a leading `_` for both names - does not register an offense - does not register an offense when memoized variable matches predicate method name - does not register an offense when method has leading `_` - does not register an offense when memoized variable matches bang method name - non-memoized variable does not match method name - does not register an offense - when or-assignment-based memoization is used - memoized variable does not match method name during assignment - registers an offense - memoized variable after other code does not match method name - registers an offense - registers an offense for a predicate method - registers an offense for a bang method - memoized variable does not match method name - registers an offense - memoized variable does not match class method name - registers an offense - memoized variable does not match method name for block - registers an offense - memoized variable matches method name - does not register an offense when method has leading `_` - does not register an offense - does not register an offense with a leading `_` for both names - memoized variable matches method name during assignment - does not register an offense - code follows memoized variable assignment - does not register an offense - instance variables in initialize methods - does not register an offense - memoized variable after other code - does not register an offense - non-memoized variable does not match method name - does not register an offense - memoized variable matches method name for block - does not register an offense - memoized variable matches predicate method name - does not register an offense - memoized variable matches bang method name - does not register an offense - with dynamically defined methods - when a method is defined inside a module callback - when the method does not match - registers an offense - when the method matches - does not register an offense - when the variable name does not match the method name - registers an offense - when a singleton method is defined inside a module callback - when the method does not match - registers an offense - when the method matches - does not register an offense - when the variable name matches the method name - does not register an offense - EnforcedStyleForLeadingUnderscores: optional - when or-assignment-based memoization is used - when defined?-based memoization is used - memoized variable matches method name - does not register an offense with a leading underscore - does not register an offense with a leading `_` for method name - does not register an offense with a leading `_` for both names - does not register an offense without a leading underscore - memoized variable matches method name - does not register an offense without a leading underscore - does not register an offense with a leading `_` for both names - does not register an offense with a leading underscore - does not register an offense with a leading `_` for method name - -RuboCop::Cop::Style::RescueModifier - handles modifier rescue in normal rescue - handles more complex expression with modifier rescue - handles modifier rescue in a method - does not register an offense for nested normal rescue - does not register an offense for normal rescue - handles parentheses around a rescue modifier - registers an offense for modifier rescue - does not register an offense for normal rescue with ensure - registers an offense for modifier rescue around parallel assignment - when an instance method has implicit begin - handles modifier rescue in body of implicit begin - accepts normal rescue - when a singleton method has implicit begin - accepts normal rescue - handles modifier rescue in body of implicit begin - autocorrect - corrects doubled rescue modifiers - corrects complex rescue modifier - excluded file - processes excluded files with issue - -RuboCop::Cop::Lint::ShadowedArgument - block argument shadowing - when a block local variable is assigned but no argument is shadowed - accepts - when multiple arguments are shadowed - and one of them shadowed within a lambda while another is shadowed outside - registers an offense - when a single argument is shadowed - registers an offense - and shadowed within a block - registers an offense without specifying where the reassignment took place - and was used before shadowing - accepts - and the argument was not shadowed outside the block - accepts - and the block occurs after the reassignment - registers an offense - and the block is nested within a block - registers an offense without specifying where the reassignment took place - and the argument was used before shadowing - accepts - and the block is nested within a conditional - registers an offense without specifying where the reassignment took place - and the argument was used before shadowing - accepts - and shadowed within a conditional - registers an offense without specifying where the reassignment took place - and the conditional occurs after the reassignment - registers an offense - and the conditional is nested within a conditional - registers an offense without specifying where the reassignment took place - and the argument was used before shadowing - accepts - and the argument was not shadowed outside the conditional - accepts - and was used before shadowing - accepts - and the conditional is nested within a lambda - registers an offense without specifying where the reassignment took place - and the argument was used before shadowing - accepts - when binding is used - registers an offense - when IgnoreImplicitReferences config option is set to true - accepts - and the argument is not used - accepts - when zsuper is used - accepts - method argument shadowing - when a single argument is shadowed - registers an offense - and shadowed within a block - registers an offense without specifying where the reassignment took place - and the argument was not shadowed outside the block - accepts - and the block is nested within a block - registers an offense without specifying where the reassignment took place - and the argument was used before shadowing - accepts - and the block occurs after the reassignment - registers an offense - and the block is nested within a conditional - registers an offense without specifying where the reassignment took place - and the argument was used before shadowing - accepts - and was used before shadowing - accepts - when argument was used in shorthand assignment - does not register an offense - when binding is used - registers an offense - when IgnoreImplicitReferences config option is set to true - accepts - when reassigning to splat variable - does not register an offense - and the argument is not used - accepts - and shadowed within a conditional - registers an offense without specifying where the reassignment took place - and was used before shadowing - accepts - and the conditional occurs after the reassignment - registers an offense - and the conditional is nested within a conditional - registers an offense without specifying where the reassignment took place - and the argument was used before shadowing - accepts - and the argument was not shadowed outside the conditional - accepts - and the conditional is nested within a lambda - registers an offense without specifying where the reassignment took place - and the argument was used before shadowing - accepts - when zsuper is used - registers an offense - when argument was shadowed by zsuper - registers an offense - when IgnoreImplicitReferences config option is set to true - accepts - when argument was shadowed by zsuper - does not register an offense - when a splat argument is shadowed - registers an offense - when multiple arguments are shadowed - and one of them shadowed within a lambda while another is shadowed outside - registers an offense - -RuboCop::Cop::Util - #line_range - returns line range of the expression - #same_line? - returns false if an argument is not a node or range - can use ranges - returns true when two nodes are on the same line - returns false when two nodes are not on the same line - #to_supported_styles - when EnforcedStyleInsidePipes - is expected to eq "SupportedStylesInsidePipes" - when EnforcedStyle - is expected to eq "SupportedStyles" - -RuboCop::Cop::Style::RescueStandardError - implicit - accepts rescue modifier - when rescuing in a begin block - accepts rescuing a single error class other than StandardError - accepts rescuing no error class - accepts rescuing StandardError with other errors - accepts rescuing StandardError with other errors, assigned to a variable - accepts rescuing ::StandardError with other errors - accepts rescuing a single error class other than StandardError, assigned to a variable - accepts rescuing no error class, assigned to a variable - when rescuing StandardError by itself - registers an offense - with ::StandardError - registers an offense - when the error is assigned to a variable - registers an offense - with ::StandardError - registers an offense - when rescuing in a method definition - accepts rescuing a single error other than StandardError - accepts rescuing StandardError with other errors - accepts rescuing no error class - accepts rescuing a single error other than StandardError, assigned to a variable - accepts rescuing StandardError with other errors, assigned to a variable - accepts rescuing no error class, assigned to a variable - when rescuing StandardError by itself - registers an offense - when the error is assigned to a variable - registers an offense - explicit - accepts rescue modifier - when rescuing in a method definition - accepts rescuing StandardError with other errors - accepts rescuing StandardError by itself - accepts rescuing a single error other than StandardError, assigned to a variable - accepts rescuing StandardError with other errors, assigned to a variable - accepts rescuing a single error other than StandardError - accepts rescuing StandardError by itself, assigned to a variable - when rescue is called without an error class - registers an offense - when the error is assigned to a variable - registers an offense - when rescuing in a begin block - accepts rescuing a single error other than StandardError - accepts rescuing StandardError with other errors - accepts rescuing StandardError with other errors, assigned to a variable - accepts rescuing StandardError by itself, assigned to a variable - accepts rescuing a single error other than StandardErrorassigned to a variable - accepts rescuing StandardError by itself - when calling rescue without an error class - registers an offense - when the error is assigned to a variable - registers an offense - -RuboCop::Cop::Style::RedundantStringEscape - does not register an offense for a regexp literal - does not register an offense for a __dir__ literal - does not register an offense for a x-str literal - does not register an offense for a __FILE__ literal - with an interpolation-disabled HEREDOC - behaves like a literal without interpolation - does not register an offense for meta control characters - does not register a bracket-escaped lvar interpolation - does not register an offense for control characters - does not register an offense for an escaped interpolation - does not register an offense for an escaped # followed { - does not register an offense for a hex escape - does not register an offense for a technically-unnecessary escape - does not register an offense without escapes - does not register an offense for a bracket-escaped interpolation - does not register an offense for an escaped cvar interpolation - does not register an offense for a $-escaped gvar interpolation - does not register an offense with escaped double quote - does not register an offense for a unicode escape - does not register an offense for a newline - does not register an offense with escaped single quote - does not register an offense for an escaped backslash - does not register an offense for a @-escaped cvar interpolation - does not register an offense for an ascii DEL - does not register an offense for an octal escape - does not register an offense for multiple unicode escapes - does not register an offense for a @-escaped ivar interpolation - does not register an offense for an escaped # with following { - does not register an offense for an escaped ivar interpolation - does not register an offense with escaped # at end-of-string - does not register an offense for an escaped gvar interpolation - does not register an offense for an escaped newline - does not register an offense for an allowed escape inside multi-line literal - does not register an offense with escaped # without following { - does not register an offense for a meta character - with an interpolation-enabled HEREDOC - does not register an offense for a meta character - does not register an offense for an escaped ivar interpolation - does not register an offense for a heredoc interpolating a string with an allowed escape - registers an offense and corrects an escaped single quote - does not register an offense for a unicode escape - does not register an offense without escapes - does not register an offense for a bracket-escaped interpolation - registers an offense and corrects an escaped # at end-of-string - does not register an offense for a newline - does not register an offense for multiple unicode escapes - does not register an offense for a @-escaped ivar interpolation - does not register an offense for a @-escaped cvar interpolation - does not register an offense for control characters - does not register an offense for an escaped backslash - does not register an offense for an octal escape - does not register an offense for a nested heredoc without interpolation - does not register an offense for an escaped interpolation - does not register an offense for an escaped gvar interpolation - does not register a bracket-escaped lvar interpolation - does not register an offense for a hex escape - registers an offense and corrects an escaped # before interpolation - does not register an offense for an escaped newline - does not register an offense for meta control characters - does not register an offense for an escaped # followed { - registers an offense and corrects an escaped # without following { - does not register an offense for a $-escaped gvar interpolation - does not register an offense for an ascii DEL - does not register an offense for an escaped cvar interpolation - does not register an offense for a technically-unnecessary escape - when using character literals - does not register an offense for `?\n` - does not register an offense for `?a` - with a %q(...) literal - behaves like a literal without interpolation - does not register an offense with escaped # at end-of-string - does not register an offense for a @-escaped cvar interpolation - does not register an offense for an escaped # with following { - does not register an offense for an escaped cvar interpolation - does not register an offense for meta control characters - does not register an offense for an escaped newline - does not register an offense for a $-escaped gvar interpolation - does not register an offense for a @-escaped ivar interpolation - does not register an offense without escapes - does not register an offense with escaped # without following { - does not register an offense with escaped double quote - does not register an offense with escaped single quote - does not register an offense for control characters - does not register a bracket-escaped lvar interpolation - does not register an offense for a meta character - does not register an offense for an octal escape - does not register an offense for an escaped backslash - does not register an offense for an escaped gvar interpolation - does not register an offense for a bracket-escaped interpolation - does not register an offense for an escaped delimiter before interpolation - does not register an offense for a newline - does not register an offense for a hex escape - does not register an offense for a unicode escape - does not register an offense for an escaped # followed { - does not register an offense for an allowed escape inside multi-line literal - does not register an offense for a technically-unnecessary escape - does not register an offense for an ascii DEL - does not register an offense for an escaped ivar interpolation - does not register an offense for an escaped interpolation - does not register an offense for an escaped delimiter - does not register an offense for multiple unicode escapes - with a %Q(...) literal - behaves like a literal with interpolation - does not register an offense for an escaped backslash - does not register an offense for an escaped gvar interpolation - does not register an offense for a unicode escape - registers an offense and corrects an escaped # before interpolation - does not register an offense without escapes - does not register an offense for an escaped interpolation - registers an offense and corrects an escaped double quote - registers an offense and corrects an escaped } when escaping both brackets to avoid interpolation - does not register an offense for an escaped # followed { - registers an offense and corrects a escaped nested delimiter in a double quoted string - does not register an offense for meta control characters - does not register an offense for an octal escape - does not register an offense for an escaped newline - does not register an offense for a hex escape - does not register an offense for an escaped cvar interpolation - does not register a bracket-escaped lvar interpolation - does not register an offense for an escaped delimiter before interpolation - registers an offense and corrects an escaped # at end-of-string - does not register an offense for a @-escaped ivar interpolation - does not register an offense for an ascii DEL - does not register an offense for a $-escaped gvar interpolation - does not register an offense for multiple unicode escapes - does not register an offense for an escaped ivar interpolation - registers an offense and corrects an escaped # without following { - does not register an offense for a meta character - does not register an offense for control characters - does not register an offense for a technically-unnecessary escape - does not register an offense for an escaped delimiter - does not register an offense for a @-escaped cvar interpolation - registers an offense and corrects an escaped single quote - does not register an offense for a bracket-escaped interpolation - does not register an offense for a newline - with a %(...) literal - behaves like a literal with interpolation - does not register an offense for a hex escape - does not register an offense for a technically-unnecessary escape - does not register an offense for an escaped gvar interpolation - does not register an offense for an escaped interpolation - does not register an offense for an escaped # followed { - registers an offense and corrects an escaped } when escaping both brackets to avoid interpolation - does not register an offense for a unicode escape - does not register an offense for an escaped ivar interpolation - does not register an offense for a newline - does not register an offense for an ascii DEL - does not register an offense for a @-escaped ivar interpolation - registers an offense and corrects an escaped single quote - registers an offense and corrects an escaped # without following { - does not register an offense for control characters - registers an offense and corrects a escaped nested delimiter in a double quoted string - does not register an offense for a meta character - does not register an offense for an escaped newline - does not register an offense for multiple unicode escapes - does not register an offense for a $-escaped gvar interpolation - does not register an offense for a bracket-escaped interpolation - does not register an offense without escapes - does not register an offense for a @-escaped cvar interpolation - registers an offense and corrects an escaped # at end-of-string - does not register an offense for an escaped delimiter - does not register an offense for meta control characters - does not register an offense for an escaped cvar interpolation - does not register an offense for an escaped backslash - does not register an offense for an octal escape - does not register an offense for an escaped delimiter before interpolation - does not register a bracket-escaped lvar interpolation - registers an offense and corrects an escaped # before interpolation - registers an offense and corrects an escaped double quote - with a %Q!...! literal - behaves like a literal with interpolation - does not register an offense for an escaped # followed { - does not register an offense for multiple unicode escapes - does not register an offense for a @-escaped cvar interpolation - does not register an offense for an escaped delimiter before interpolation - does not register an offense for an escaped newline - does not register an offense for an escaped cvar interpolation - does not register an offense without escapes - registers an offense and corrects an escaped single quote - does not register an offense for an escaped backslash - does not register an offense for a bracket-escaped interpolation - registers an offense and corrects an escaped double quote - does not register an offense for control characters - registers an offense and corrects an escaped # before interpolation - does not register an offense for a hex escape - does not register an offense for an ascii DEL - does not register an offense for an escaped ivar interpolation - registers an offense and corrects a escaped nested delimiter in a double quoted string - does not register an offense for a unicode escape - does not register an offense for an escaped gvar interpolation - does not register an offense for a newline - does not register an offense for a $-escaped gvar interpolation - does not register an offense for an octal escape - does not register an offense for an escaped interpolation - does not register an offense for meta control characters - registers an offense and corrects an escaped # without following { - registers an offense and corrects an escaped # at end-of-string - does not register a bracket-escaped lvar interpolation - does not register an offense for a technically-unnecessary escape - does not register an offense for a meta character - does not register an offense for a @-escaped ivar interpolation - does not register an offense for an escaped delimiter - registers an offense and corrects an escaped } when escaping both brackets to avoid interpolation - with a single quoted string - behaves like a literal without interpolation - does not register an offense with escaped # at end-of-string - does not register an offense for an escaped gvar interpolation - does not register an offense for an escaped delimiter - does not register an offense for an escaped ivar interpolation - does not register an offense for a technically-unnecessary escape - does not register an offense for a bracket-escaped interpolation - does not register an offense for a @-escaped ivar interpolation - does not register an offense for an escaped interpolation - does not register an offense for a $-escaped gvar interpolation - does not register an offense for a unicode escape - does not register an offense for a @-escaped cvar interpolation - does not register an offense for an escaped delimiter before interpolation - does not register an offense for an octal escape - does not register an offense with escaped double quote - does not register an offense for a meta character - does not register an offense for an escaped backslash - does not register an offense for an ascii DEL - does not register an offense for a hex escape - does not register an offense for an escaped newline - does not register an offense with escaped single quote - does not register an offense for an escaped # with following { - does not register an offense for multiple unicode escapes - does not register an offense for an escaped cvar interpolation - does not register an offense with escaped # without following { - does not register an offense for meta control characters - does not register a bracket-escaped lvar interpolation - does not register an offense for an allowed escape inside multi-line literal - does not register an offense for a newline - does not register an offense for control characters - does not register an offense without escapes - does not register an offense for an escaped # followed { - with a double quoted string - does not register an offense when escaping a quote in multi-line broken string - does not register an offense with escaped double quote - registers an offense and corrects an unnecessary escape in multi-line broken string - does not register an offense with multiple escaped backslashes - behaves like a literal with interpolation - does not register an offense for an escaped gvar interpolation - does not register an offense for a meta character - registers an offense and corrects an escaped # at end-of-string - does not register an offense for an escaped delimiter before interpolation - does not register an offense for an escaped # followed { - does not register an offense for a bracket-escaped interpolation - does not register an offense for an escaped newline - registers an offense and corrects an escaped # without following { - registers an offense and corrects an escaped single quote - does not register an offense for an escaped backslash - does not register an offense for meta control characters - does not register an offense for an escaped delimiter - does not register an offense for a unicode escape - does not register an offense for a hex escape - does not register an offense for an escaped ivar interpolation - registers an offense and corrects an escaped } when escaping both brackets to avoid interpolation - registers an offense and corrects an escaped # before interpolation - does not register an offense for control characters - does not register an offense for a technically-unnecessary escape - does not register an offense for multiple unicode escapes - does not register an offense for a @-escaped ivar interpolation - does not register an offense for an escaped cvar interpolation - does not register an offense for a newline - does not register a bracket-escaped lvar interpolation - does not register an offense for an ascii DEL - does not register an offense for an escaped interpolation - does not register an offense for a $-escaped gvar interpolation - does not register an offense for an octal escape - does not register an offense without escapes - does not register an offense for a @-escaped cvar interpolation - with a %W(...) literal - does not register an offense for escaped spaces - behaves like a literal with interpolation - does not register an offense for a bracket-escaped interpolation - does not register an offense for meta control characters - does not register an offense for a hex escape - does not register an offense for control characters - registers an offense and corrects an escaped # at end-of-string - does not register an offense for an escaped delimiter - does not register an offense for an escaped newline - does not register an offense for an escaped cvar interpolation - does not register an offense without escapes - registers an offense and corrects an escaped double quote - does not register an offense for an octal escape - does not register an offense for a unicode escape - does not register an offense for a technically-unnecessary escape - does not register an offense for an escaped gvar interpolation - does not register an offense for an escaped ivar interpolation - does not register a bracket-escaped lvar interpolation - registers an offense and corrects an escaped single quote - does not register an offense for a @-escaped ivar interpolation - registers an offense and corrects an escaped } when escaping both brackets to avoid interpolation - does not register an offense for a $-escaped gvar interpolation - does not register an offense for a @-escaped cvar interpolation - does not register an offense for an escaped interpolation - registers an offense and corrects an escaped # before interpolation - registers an offense and corrects an escaped # without following { - does not register an offense for an ascii DEL - does not register an offense for a newline - does not register an offense for an escaped delimiter before interpolation - does not register an offense for an escaped # followed { - does not register an offense for an escaped backslash - registers an offense and corrects a escaped nested delimiter in a double quoted string - does not register an offense for multiple unicode escapes - does not register an offense for a meta character - with a %w(...) literal - does not register an offense for escaped spaces - behaves like a literal without interpolation - does not register an offense with escaped # without following { - does not register an offense for an escaped backslash - does not register an offense for an allowed escape inside multi-line literal - does not register an offense for control characters - does not register an offense for a technically-unnecessary escape - does not register a bracket-escaped lvar interpolation - does not register an offense for a unicode escape - does not register an offense for an escaped newline - does not register an offense for an escaped delimiter before interpolation - does not register an offense for a newline - does not register an offense for an escaped delimiter - does not register an offense for multiple unicode escapes - does not register an offense for a @-escaped ivar interpolation - does not register an offense for meta control characters - does not register an offense for a $-escaped gvar interpolation - does not register an offense for an escaped gvar interpolation - does not register an offense with escaped # at end-of-string - does not register an offense without escapes - does not register an offense for a bracket-escaped interpolation - does not register an offense for an escaped # followed { - does not register an offense for an escaped # with following { - does not register an offense for a hex escape - does not register an offense for an ascii DEL - does not register an offense for an escaped interpolation - does not register an offense for an octal escape - does not register an offense for a @-escaped cvar interpolation - does not register an offense with escaped single quote - does not register an offense with escaped double quote - does not register an offense for an escaped cvar interpolation - does not register an offense for a meta character - does not register an offense for an escaped ivar interpolation - -RuboCop::Ext::RegexpNode - #each_capture - when called without argument - is expected to match [(be an instance of Regexp::Expression::Group::Capture), (be an instance of Regexp::Expression::Group::Named)] - when called with a `named: false` - is expected to match [(be an instance of Regexp::Expression::Group::Capture)] - when called with a `named: true` - is expected to match [(be an instance of Regexp::Expression::Group::Named)] - #parsed_tree - with a regexp containing interpolation - returns the expected blanked tree - with an extended mode regexp with comment - returns the expected tree - with a regexp containing a multi-line interpolation - returns the expected blanked tree - with a regexp with subexpressions - has location information - with a regexp not containing interpolation - returns the expected tree - -RuboCop::Cop::Layout::IndentationConsistency - with def/defs - accepts an empty def body - accepts an empty defs body - registers an offense and corrects bad indentation in a defs body - registers an offense and corrects bad indentation in a def body - with top-level code - registers and corrects an offense when using access modifier and indented method definition at the top level - accepts an empty expression string interpolation - accepts when using access modifier at the top level - with module - registers an offense and corrects bad indentation of private methods - accepts an empty module body - registers an offense and corrects bad indentation in a module body - even when there are no public methods - registers an offense and corrects bad indentation of private methods - with for - registers an offense and corrects bad indentation in a for body - accepts an empty for - with while/until - registers an offense and corrects bad indentation in a while body - accepts an empty while - registers an offense and corrects bad indentation in begin/end/while - registers an offense and corrects bad indentation in an until body - with block - registers an offense and correct bad indentation in a do/end body - does not autocorrect an offense within another offense - registers an offense and corrects bad indentation in a {} body - accepts a correctly indented block body - accepts an empty block body - with class - with normal style configured - accepts an empty class body - registers an offense and corrects bad indentation in a class body - accepts indented public, protected, and private - registers an offense and corrects bad indentation in def but not for outdented public, protected, and private - with indented_internal_methods style configured - accepts different indentation in different visibility sections - accepts different indentation in different visibility sections when using `Struct.new` - with if statement - accepts an if/else in assignment with end aligned with if - accepts if/then/else/end laid out as another table - accepts an if in assignment with end aligned with variable - registers an offense and corrects bad indentation in an else body - accepts a one line if statement - registers an offense and corrects bad indentation in an elsif body - accepts an if/else in assignment on next line with end aligned with if - accepts an if/else branches with rescue clauses - accepts if/elsif/else/end laid out as a table - accepts an if in assignment with end aligned with if - accepts a correctly aligned if/elsif/else/end - accepts if/elsif/else/end with fullwidth characters - accepts an if/else in assignment with end aligned with variable and chaining after the end - registers an offense and corrects bad indentation in an if body - accepts an empty if - accepts an if/else in assignment with end aligned with variable - accepts an if/else in assignment with end aligned with variable and chaining with a block after the end - with case - accepts correctly indented case/when/else - registers an offense and corrects bad indentation in a case/else body - accepts indented when/else plus indented body - accepts case/when/else with then beginning a line - registers an offense and corrects bad indentation in a case/when body - accepts case/when/else laid out as a table - with unless - accepts an empty unless - registers an offense and corrects bad indentation in an unless body + behaves like multiline literal brace layout trailing comma + same_line style + opening brace on same line as first element + last element has a trailing comma + autocorrects closing brace on different line as last element + symmetrical style + opening brace on same line as first element + last element has a trailing comma + autocorrects closing brace on different line from last element Pending: (Failures listed here are expected and do not affect your suite's status) - 1) RuboCop::Cop::Generator compliance with rubocop generates a spec file that has no offense - # Temporarily skipped with xit - # /build/reproducible-path/rubocop-1.39.0+dfsg/spec/rubocop/cop/generator_spec.rb:380 - - 2) RuboCop::Cop::Generator compliance with rubocop generates a cop file that has no offense - # Temporarily skipped with xit - # /build/reproducible-path/rubocop-1.39.0+dfsg/spec/rubocop/cop/generator_spec.rb:375 - - 3) RuboCop::Cop::Lint::UselessAssignment when a variable is reassigned in loop body but won't be referenced either next iteration or loop condition registers an offense + 1) RuboCop::Cop::Lint::UselessAssignment when a variable is reassigned in loop body but won't be referenced either next iteration or loop condition registers an offense # Requires an advanced logic that checks whether the return value of an operator assignment is used or not. Failure/Error: expect(actual_annotations).to eq(expected_annotations), '' @@ -30181,10 +30209,18 @@ # /build/reproducible-path/rubocop-1.39.0+dfsg/spec/rubocop/cop/lint/useless_assignment_spec.rb:341:in `block (3 levels) in ' # /usr/share/rubygems-integration/all/gems/webmock-3.18.1/lib/webmock/rspec.rb:37:in `block (2 levels) in ' -Finished in 5 minutes 20 seconds (files took 13.62 seconds to load) + 2) RuboCop::Cop::Generator compliance with rubocop generates a cop file that has no offense + # Temporarily skipped with xit + # /build/reproducible-path/rubocop-1.39.0+dfsg/spec/rubocop/cop/generator_spec.rb:375 + + 3) RuboCop::Cop::Generator compliance with rubocop generates a spec file that has no offense + # Temporarily skipped with xit + # /build/reproducible-path/rubocop-1.39.0+dfsg/spec/rubocop/cop/generator_spec.rb:380 + +Finished in 2 minutes 4.5 seconds (files took 5.34 seconds to load) 19138 examples, 0 failures, 3 pending -Randomized with seed 5000 +Randomized with seed 31202 ┌──────────────────────────────────────────────────────────────────────────────┐ @@ -30217,12 +30253,14 @@ dpkg-buildpackage: info: binary-only upload (no source included) dpkg-genchanges: info: including full source code in upload I: copying local configuration +I: user script /srv/workspace/pbuilder/32494/tmp/hooks/B01_cleanup starting +I: user script /srv/workspace/pbuilder/32494/tmp/hooks/B01_cleanup finished I: unmounting dev/ptmx filesystem I: unmounting dev/pts filesystem I: unmounting dev/shm filesystem I: unmounting proc filesystem I: unmounting sys filesystem I: cleaning the build env -I: removing directory /srv/workspace/pbuilder/27771 and its subdirectories -I: Current time: Wed Mar 27 14:59:46 -12 2024 -I: pbuilder-time-stamp: 1711594786 +I: removing directory /srv/workspace/pbuilder/32494 and its subdirectories +I: Current time: Wed Apr 30 23:25:38 +14 2025 +I: pbuilder-time-stamp: 1746005138