Skip to content

Releases: rubocop/rubocop

RuboCop 0.24.1

03 Jul 11:43
Compare
Choose a tag to compare

RuboCop 0.24.1 is a bugfix-only release. Below is a list of the bugs we've fixed since 0.24.0:

Bugs fixed

  • #1174: Fix --auto-correct crash in AlignParameters. (@jonas054)
  • #1176: Fix --auto-correct crash in IndentationWidth. (@jonas054)
  • #1177: Avoid suggesting underscore-prefixed name for unused keyword arguments and auto-correcting in that way. (@yujinakayama)
  • #1157: Validate --only arguments later when all cop names are known. (@jonas054)
  • #1188, #1190: Fix crash in LineLength cop when AllowURI option is enabled. (@yujinakayama)
  • #1191: Fix crash on empty body branches in a loop in Next cop. (@yujinakayama)

RuboCop 0.24.0

25 Jun 06:51
Compare
Choose a tag to compare

This release is mostly about fixing bugs, but it also features a few new cops.

Below is the list of all the gory details. Enjoy!

New features

  • #639: Support square bracket setters in UselessSetterCall. (@yujinakayama)
  • #835: UnneededCapitalW cop does auto-correction. (@sfeldon)
  • #1092: New cop DefEndAlignment takes over responsibility for checkng alignment of method definition ends from EndAlignment, and is configurable. (@jonas054)
  • #1145: New cop ClassCheck enforces consistent use of is_a? or kind_of?. (@bbatsov)
  • #1161: New cop SpaceBeforeComma detects spaces before a comma. (@agrimm)
  • #1161: New cop SpaceBeforeSemicolon detects spaces before a semicolon. (@agrimm)
  • #835: New cop UnneededPercentQ checks for usage of the %q/%Q syntax when '' or "" would do. (@jonas054)
  • #977: Add AllowURI option (enabled by default) to LineLength cop. (@yujinakayama)

Changes

  • Unused block local variables (obj.each { |arg; this| }) are now handled by UnusedBlockArgument cop instead of UselessAssignment cop. (@yujinakayama)
  • #1141: Clarify in the message from TrailingComma that a trailing comma is never allowed for lists where some items share a line. (@jonas054)

Bugs fixed

  • #1133: Handle reduce/inject with no arguments in EachWithObject. (@bbatsov)
  • #1152: Handle while/until with no body in Next. (@tamird)
  • Fix a false positive in UselessSetterCall for setter call on a local variable that contains a non-local object. (@yujinakayama)
  • #1158: Fix auto-correction of floating-point numbers. (@bbatsov)
  • #1159: Fix checking of begin..end structures, blocks, and parenthesized expressions in IndentationWidth. (@jonas054)
  • #1159: More rigid conditions for when attr is considered an offense. (@jonas054)
  • #1167: Fix handling of parameters spanning multiple lines in TrailingComma. (@jonas054)
  • #1169: Fix handling of ternary op conditions in ParenthesesAroundCondition. (@bbatsov)
  • #1147: WordArray checks arrays with special characters. (@camilleldn)
  • Fix a false positive against return in a loop in Next cop. (@yujinakayama)
  • #1165: Support rescue/else/ensure bodies in IndentationWidth. (@jonas054)
  • Fix false positive for aligned list of values after when in IndentationWidth. (@jonas054)

RuboCop 0.23.0

02 Jun 12:22
Compare
Choose a tag to compare

This release is mostly about fixing bugs, but it also features a few prominent changes:

  • Cops are now namespace aware, which would it make it simpler to write RuboCop extensions without
    worrying about name collisions (e.g. you can now have Style/Filename and RSpec/Filename cops).
  • There's now logic which prevents auto-corrections from generated invalid Ruby code.
  • The Rubocop module was renamed to RuboCop, which will affect packages relying on RuboCop's public API.

Below is the list of all the gory details. Enjoy!

New features

  • #1117: BlockComments cop does auto-correction. (@jonas054)
  • #1124: TrivialAccessors cop auto-corrects class-level accessors. (@ggilder)
  • #1062: New cop InlineComment checks for inline comments. (@salbertson)
  • #1118: Add checking and auto-correction of right brackets in IndentArray and IndentHash. (@jonas054)

Changes

  • #1097: Add optional namespace prefix to cop names: Style/LineLength instead of LineLength in config files, --only argument, --show-cops output, and # rubocop:disable. (@jonas054)
  • #1075: More strict limits on when to require trailing comma. (@jonas054)
  • Renamed Rubocop module to RuboCop. (@bbatsov)

Bugs fixed

  • #1126: Fix --auto-gen-config bug with RegexpLiteral where only the last file's results would be used. (@ggilder)
  • #1104: Fix EachWithObject with modifier if as body. (@geniou)
  • #1106: Fix EachWithObject with single method call as body. (@geniou)
  • Avoid the warning about ignoring syck YAML engine from JRuby. (@jonas054)
  • #1111: Fix problem in EndOfLine with reading non-UTF-8 encoded files. (@jonas054)
  • #1115: Fix Next to ignore super nodes. (@geniou)
  • #1117: Don't auto-correct indentation in scopes that contain block comments (=begin..=end). (@jonas054)
  • #1123: Support setter calls in safe assignment in ParenthesesAroundCondition. (@jonas054)
  • #1090: Correct handling of documentation vs annotation comment. (@jonas054)
  • #1118: Never write invalid ruby to a file in auto-correct. (@jonas054)
  • #1120: Don't change indentation of heredoc strings in auto-correct. (@jonas054)
  • #1109: Handle conditions with modifier ops in them in ParenthesesAroundCondition. (@bbatsov)

RuboCop 0.22.0

20 May 14:38
Compare
Choose a tag to compare

This release brings a few new cops, extended auto-correction support and plenty of bug fixes.

Below is the list of all the gory details. Enjoy!

New features

  • #974: New cop CommentIndentation checks indentation of comments. (@jonas054)
  • Add new cop EachWithObject to prefer each_with_object over inject or reduce. (@geniou)
  • #1010: New Cop Next check for conditions at the end of an interation and propose to use next instead. (@geniou)
  • The GuardClause cop now also looks for unless and it is configurable how many lines the body of an if / unless needs to have to not be ignored. (@geniou)
  • #835: New cop UnneededPercentX checks for %x when backquotes would do. (@jonas054)
  • Add auto-correct to UnusedBlockArgument and UnusedMethodArgument cops. (@hannestyden)
  • #1074: New cop SpaceBeforeComment checks for missing space between code and a comment on the same line. (@jonas054)
  • #1089: New option -F/--fail-fast inspects files in modification time order and stop after the first file with offenses. (@jonas054)

Changes

  • NonNilCheck offense reporting and autocorrect are configurable to include semantic changes. (@hannestyden)
  • The parameters AllCops/Excludes and AllCops/Includes with final s only give a warning and don't halt rubocop execution. (@jonas054)
  • The GuardClause cop is no longer irgnoring a one-line body by default - see configuration. (@geniou)
  • #1050: Rename rubocop-todo.yml file to .rubocop_todo.yml. (@geniou)
  • #1064: Adjust default max line length to 80. (@bbatsov)

Bugs fixed

  • Allow assignment in AlignParameters cop. (@tommeier)
  • Fix Void and SpaceAroundOperators for short call syntax lambda.(). (@biinari)
  • Fix Delegate for delegation with assignment or constant. (@geniou)
  • #1032: Avoid duplicate reporting when code moves around due to --auto-correct. (@jonas054)
  • #1036: Handle strings like __FILE__ in LineEndConcatenation. (@bbatsov)
  • #1006: Fix LineEndConcatenation to handle chained concatenations. (@barunio)
  • #1066: Fix auto-correct for NegatedIf when the condition has parentheses around it. (@jonas054)
  • Fix AlignParameters with_fixed_indentation for multi-line method calls. (@molawson)
  • Fix problem that appears in some installations when reading empty YAML files. (@jonas054)
  • #1022: A Cop will no longer auto-correct a file that's excluded through an Exclude setting in the cop's configuration. (@jonas054)
  • Fix paths in Exclude config section not being recognized on Windows. (@wndhydrnt)
  • #1094: Fix ClassAndModuleChildren for classes with a single method. (@geniou)

RuboCop 0.21.0

24 Apr 09:50
Compare
Choose a tag to compare

This release brings a few new cops and extended auto-correction support. The most significant
change is that we've changed the syntax for excluding/including to be closer to that of shell globbing.

Below is the list of all the gory details. Enjoy!

New features

  • #835: New cop UnneededCapitalW checks for %W when interpolation not necessary and %w would do. (@sfeldon)
  • #934: New cop UnderscorePrefixedVariableName checks for _-prefixed variables that are actually used. (@yujinakayama)
  • #934: New cop UnusedMethodArgument checks for unused method arguments. (@yujinakayama)
  • #934: New cop UnusedBlockArgument checks for unused block arguments. (@yujinakayama)
  • #964: RedundantBegin cop does auto-correction. (@tamird)
  • #966: RescueException cop does auto-correction. (@tamird)
  • #967: TrivialAccessors cop does auto-correction. (@tamird)
  • #963: Add AllowDSLWriters options to TrivialAccessors. (@tamird)
  • #969: Let the Debugger cop check for forgotten calls to byebug. (@bquorning)
  • #971: Configuration format deprecation warnings include the path to the problematic config file. (@bcobb)
  • #490: Add EnforcedStyle config option to TrailingBlankLines. (@jonas054)
  • Add auto_correct task to Rake integration. (@irrationalfab)
  • #986: The --only option can take a comma-separated list of cops. (@jonas054)
  • New Rails cop Delegate that checks for delegations that could be replaced by the delegate method. (@geniou)
  • Add configuration to Encoding cop to only enforce encoding comment if there are non ASCII characters. (@geniou)

Changes

  • Removed FinalNewline cop as its check is now performed by TrailingBlankLines. (@jonas054)
  • #1011: Pattern matching with Dir#[] for config parameters added. (@jonas054)

Bugs fixed

  • Update description on LineEndConcatenation cop. (@mockdeep)
  • #978: Fix regression in IndentationWidth handling method calls. (@tamird)
  • #976: Fix EndAlignment not handling element assignment correctly. (@tamird)
  • #976: Fix IndentationWidth not handling element assignment correctly. (@tamird)
  • #800: Do not report [Corrected] in --auto-correct mode if correction wasn't done. (@jonas054)
  • #968: Fix bug when running Rubocop with -c .rubocop.yml. (@bquorning)
  • #975: Fix infinite correction in IndentationWidth. (@jonas054)
  • #986: When --lint is used together with --only, all lint cops are run in addition to the given cops. (@jonas054)
  • #997: Fix handling of file paths for matching against Exclude property when rubocop . is called. (@jonas054)
  • #1000: Support modifier (e.g., private) and def on the same line (Ruby >= 2.1) in IndentationWidth. (@jonas054)
  • #1001: Fix --auto-gen-config logic for RegexpLiteral. (@jonas054)
  • #993: Do not report any offenses for the contents of an empty file. (@jonas054)
  • #1016: Fix a false positive in ConditionPosition regarding statement modifiers. (@bbatsov)
  • #1014: Fix handling of strings nested in dstr nodes. (@bbatsov)

RuboCop 0.20.1

05 Apr 12:17
Compare
Choose a tag to compare

RuboCop 0.20.1 is a bugfix-only release. Below is a list of the bugs we've fixed since 0.20.0:

0.20.1 (05/04/2014)

Bugs fixed

  • #940: Fixed UselessAccessModifier not handling attr_* correctly. (@fshowalter)
  • NegatedIf properly handles negated unless condition. (@bbatsov)
  • NegatedWhile properly handles negated until condition. (@bbatsov)
  • #925: Do not disable the Syntax cop in output from --auto-gen-config. (@jonas054)
  • #943: Fix auto-correction interference problem between SpaceAfterComma and other cops. (@jonas054)
  • #954: Fix auto-correction bug in NilComparison. (@bbatsov)
  • #953: Fix auto-correction bug in NonNilCheck. (@bbatsov)
  • #952: Handle implicit receiver in StringConversionInInterpolation. (@bbatsov)
  • #956: Apply ClassMethods check only on class/module bodies. (@bbatsov)
  • #945: Fix SpaceBeforeFirstArg cop for multiline argument and exclude assignments. (@cschramm)
  • #948: Blocks cop avoids auto-correction if it would introduce a semantic change. (@jonas054)
  • #946: Allow non-nil checks that are the final expressions of predicate method definitions in NonNilCheck. (@bbatsov)
  • #957: Allow space + comment inside parentheses, braces, and square brackets. (@jonas054)

RuboCop 0.20.0

02 Apr 14:05
Compare
Choose a tag to compare

There aren't many exciting new features this time around - our focus in 0.20 has been fixing most of the problems we introduced in 0.19. Apart from that we've added a few new cops and implemented auto-correct for a bunch of the existing cops.

You'll also notice that the messages produced by most formatters a bit more colorful (and hopefully more readable as well).

You should also note that AllCops/Includes and AllCops/Excludes have been renamed, so you'll have to update your config files accordingly.

Below is the list of all the gory details. Enjoy!

New features

  • New cop GuardClause checks for conditionals that can be replaced by guard clauses. (@bbatsov)
  • New cop EmptyInterpolation checks for empty interpolation in double-quoted strings. (@bbatsov)
  • #899: Make LineEndConcatenation cop << aware. (@mockdeep)
  • #896: New option --fail-level changes minimum severity for exit with error code. (@hiroponz)
  • #893: New option --force-exclusion forces excluding files specified in the configuration Exclude even if they are explicitly passed as arguments. (@yujinakayama)
  • VariableInterpolation cop does auto-correction. (@bbatsov)
  • Not cop does auto-correction. (@bbatsov)
  • ClassMethods cop does auto-correction. (@bbatsov)
  • StringConversionInInterpolation cop does auto-correction. (@bbatsov)
  • NilComparison cop does auto-correction. (@bbatsov)
  • NonNilComparison cop does auto-correction. (@bbatsov)
  • NegatedIf cop does auto-correction. (@bbatsov)
  • NegatedWhile cop does auto-correction. (@bbatsov)
  • New lint cop SpaceBeforeFirstArg checks for space between the method name and the first argument in method calls without parentheses. (@jonas054)
  • New style cop SingleSpaceBeforeFirstArg checks that no more than one space is used between the method name and the first argument in method calls without parentheses. (@jonas054)
  • New formatter disabled_lines displays cops and line ranges disabled by inline comments. (@fshowalter)
  • New cop UselessAccessModifiers checks for access modifiers that have no effect. (@fshowalter)

Changes

  • #913: FileName accepts multiple extensions. (@tamird)
  • AllCops/Excludes and AllCops/Includes were renamed to AllCops/Exclude and AllCops/Include for consistency with standard cop params. (@bbatsov)
  • Extract NonNilCheck cop from NilComparison. (@bbatsov)
  • Renamed FavorJoin to ArrayJoin. (@bbatsov)
  • Renamed FavorUnlessOverNegatedIf to NegatedIf. (@bbatsov)
  • Renamed FavorUntilOverNegatedWhileto NegatedWhile. (@bbatsov)
  • Renamed HashMethods to DeprecatedHashMethods. (@bbatsov)
  • Renamed ReadAttribute to ReadWriteAttribute and extended it to check for uses of write_attribute. (@bbatsov)
  • Add experimental support for Ruby 2.2 (development version) by falling back to Ruby 2.1 parser. (@yujinakayama)

Bugs fixed

  • #926: Fixed BlockNesting not auto-generating correctly. (@tmorris-fiksu)
  • #904: Fixed a NPE in LiteralInInterpolation. (@bbatsov)
  • #904: Fixed a NPE in StringConversionInInterpolation. (@bbatsov)
  • #892: Make sure Include and Exclude paths in a .rubocop.yml are interpreted as relative to the directory of that file. (@jonas054)
  • #906: Fixed a false positive in LiteralInInterpolation. (@bbatsov)
  • #909: Handle properly multiple rescue clauses in SignalException. (@bbatsov)
  • #876: Do a deep merge of hashes when overriding default configuration in a .rubocop.yml file. (@jonas054)
  • #912: Fix a false positive in LineEndConcatenation for % string literals. (@bbatsov)
  • #912: Handle top-level constant resolution in DeprecatedClassMethods (e.g. ::File.exists?). (@bbatsov)
  • #914: Fixed rdoc error during gem installation. (@bbatsov)
  • The --only option now enables the given cop in case it is disabled in configuration. (@jonas054)
  • Fix path resolution so that the default exclusion of vendor directories works. (@jonas054)
  • #908: Fixed hanging while auto correct for SpaceAfterComma and SpaceInsideBrackets. (@hiroponz)
  • #919: Don't avoid auto-correction in HashSyntax when there is missing space around operator. (@jonas054)
  • Fixed handling of floats in NumericLiterals. (@bbatsov)
  • #927: Let --auto-gen-config overwrite an existing rubocop-todo.yml file instead of asking the user to remove it. (@jonas054)
  • #936: Allow _other as well as other in OpMethod. (@bbatsov)

RuboCop 0.19.1

18 Mar 07:27
Compare
Choose a tag to compare

RuboCop 0.19.1 is a bugfix-only release. Below is a list of the bugs we've fixed since 0.19.0:

Bugs fixed

  • #884: Fix --auto-gen-config for NumericLiterals so MinDigits is correct. (@tmorris-fiksu)
  • #879: Fix --auto-gen-config for RegexpLiteral so we don't generate illegal values for MaxSlashes. (@jonas054)
  • Fix the name of the Include param in the default config of the Rails cops. (@bbatsov)
  • #878: Blacklist Rakefile, Gemfile and Capfile by default in the FileName cop. (@bbatsov)
  • #875: Handle separator style hashes in IndentHash. (@jonas054)
  • Fix a bug where multiple cli options that result in exit can be specified at once (e.g. -vV, -v --show-cops). (@jkogara)
  • #889: Fix a false positive for LiteralInCondition when the condition is non-primitive array. (@bbatsov)

RuboCop 0.19.0

13 Mar 16:34
Compare
Choose a tag to compare

This is the biggest RuboCop release we've done in a while. The highlights include
about a dozen new cops, more cop configuration options, improved auto-correct and so many bugfixes.

You'll might note that we changed the use of offence with offense. This was done to keep the spelling
in our code consistent. Hopefully this won't cause anyone problems, but we're obliged to mention it as
the Offence class itself got renamed.

Below is the list of all the gory details. Enjoy!

RuboCop 0.19.0

New features

  • New cop FileName makes sure that source files have snake_case names. (@bbatsov)
  • New cop DeprecatedClassMethods checks for deprecated class methods. (@bbatsov)
  • New cop StringConversionInInterpolation checks for redundant Object#to_s in string interpolation. (@bbatsov)
  • New cop LiteralInInterpolation checks for interpolated string literals. (@bbatsov)
  • New cop SelfAssignment checks for places where the self-assignment shorthand should have been used. (@bbatsov)
  • New cop DoubleNegation checks for uses of !!. (@bbatsov)
  • New cop PercentLiteralDelimiters enforces consistent usage of %-literal delimiters. (@hannestyden)
  • New Rails cop ActionFilter enforces the use of _filter or _action action filter methods. (@bbatsov)
  • New Rails cop ScopeArgs makes sure you invoke the scope method properly. (@bbatsov)
  • Add with_fixed_indentation style to AlignParameters cop. (@hannestyden)
  • Add IgnoreLastArgumentHash option to AlignHash cop. (@hannestyden)
  • #743: SingleLineMethods cop does auto-correction. (@jonas054)
  • #743: Semicolon cop does auto-correction. (@jonas054)
  • #743: EmptyLineBetweenDefs cop does auto-correction. (@jonas054)
  • #743: IndentationWidth cop does auto-correction. (@jonas054)
  • #743: IndentationConsistency cop does auto-correction. (@jonas054)
  • #809: New formatter fuubar displays a progress bar and shows details of offenses as soon as they are detected. (@yujinakayama)
  • #797: New cop IndentHash checks the indentation of the first key in multi-line hash literals. (@jonas054)
  • #797: New cop IndentArray checks the indentation of the first element in multi-line array literals. (@jonas054)
  • #806: Now excludes files in vendor/** by default. (@jeremyolliver)
  • #795: IfUnlessModifier and WhileUntilModifier supports MaxLineLength, which is independent of LineLength parameter Max. (@agrimm)
  • #868: New cop ClassAndModuleChildren checks the style of children definitions at classes and modules: nested / compact. (@geniou)

Changes

  • #793: Add printing total count when rubocop --format offences. (@ma2gedev)
  • Remove Ignore param from the Rails Output cop. The standard Exclude/Include should be used instead. (@bbatsov)
  • Renamed FavorSprintf to FormatString and made it configurable. (@bbatsov)
  • Renamed Offence to Offense. (@bbatsov)
  • Use offense in all messages instead of offence. (@bbatsov)
  • For indentation of if/unless/while/until bodies when the result is assigned to a variable, instead of supporting two styles simultaneously, IndentationWidth now supports one style of indentation at a time, specified by EndAlignment/AlignWith. (@jonas054)
  • Renamed Style param of DotPosition cop to EnforcedStyle. (@bbatsov)
  • Add length value to locations of offense in JSON formatter. (@yujinakayama)
  • SpaceAroundBlockBraces cop replaced by SpaceBeforeBlockBraces and SpaceInsideBlockBraces. (@jonas054)
  • SpaceAroundEqualsInParameterDefault cop is now configurable with the EnforcedStyle option. (@jonas054)

Bugs fixed

  • #790: Fix auto-correction interference problem between MethodDefParentheses and other cops. (@jonas054)
  • #794: Fix handling of modifier keywords with required parentheses in ParenthesesAroundCondition. (@bbatsov)
  • #804: Fix a false positive with operator assignments in a loop (including begin..rescue..end with retry) in UselessAssignment. (@yujinakayama)
  • #815: Fix a false positive for heredocs with blank lines in them in EmptyLines. (@bbatsov)
  • Auto-correction is now more robust and less likely to die because of RangeError or "clobbering". (@jonas054)
  • Offenses always reported in order of position in file, also during --auto-correct runs. (@jonas054)
  • Fix problem with [Corrected] tag sometimes missing in output from --auto-correct runs. (@jonas054)
  • Fix message from EndAlignment cop when AlignWith is keyword. (@jonas054)
  • Handle case conditions in LiteralInCondition. (@bbatsov)
  • #822: Fix a false positive in DotPosition when enforced style is set to trailing. (@bbatsov)
  • Handle properly dynamic strings in LineEndConcatenation. (@bbatsov)
  • #832: Fix auto-correction interference problem between BracesAroundHashParameters and SpaceInsideHashLiteralBraces. (@jonas054)
  • Fix bug in auto-correction of alignment so that only space can be removed. (@jonas054)
  • Fix bug in IndentationWidth auto-correction so it doesn't correct things that IndentationConsistency should correct. (@jonas054)
  • #847: Fix bug in RegexpLiteral concerning --auto-gen-config. (@jonas054)
  • #848: Fix bug in --show-cops that made it print the default configuration rather than the current configuration. (@jonas054)
  • #862: Fix a bug where single line rubocop:disable comments with indentations were treated as multiline cop disabling comments. (@yujinakayama)
  • Fix a bug where rubocop:disable comments with a cop name including all (e.g. MethodCallParentheses) were disabling all cops. (@yujinakayama)
  • Fix a bug where string and regexp literals including # rubocop:disable were confused with real comments. (@yujinakayama)