Skip to content

Latest commit

 

History

History
3076 lines (2615 loc) · 290 KB

CHANGELOG.md

File metadata and controls

3076 lines (2615 loc) · 290 KB

Change log

master (unreleased)

New features

  • #5101: Allow to specify TargetRubyVersion 2.5. (@walf443)
  • #1575: Add new Layout/ClassStructure cop that checks whether definitions in a class are in the configured order. This cop is disabled by default. (@jonatas)
  • New cop Rails/InverseOf checks for association arguments that require setting the inverse_of option manually. (@bdewater)
  • #4811: Add new Layout/SpaceInsideReferenceBrackets cop. (@garettarrowood)
  • #4811: Add new Layout/SpaceInsideArrayLiteralBrackets cop. (@garettarrowood)
  • #4252: Add new Style/TrailingBodyOnMethodDefinition cop. (@garettarrowood)
  • Add new Style/TrailingMethodEndStatment cop. (@garettarrowood)
  • #5074: Add Layout/EmptyLinesAroundArguments cop. (@garettarrowood)
  • #4650: Add new Style/StringHashKeys cop. (@donjar)
  • #1583: Add a quiet formatter. (@drenmi)
  • Add new Style/RandomWithOffset cop. (@donjar)
  • #4892: Add new Lint/ShadowedArgument cop and remove argument shadowing detection from Lint/UnusedBlockArgument and Lint/UnusedMethodArgument. (@akhramov)
  • #4674: Add a new Lint/MissingCopEnableDirective cop. (@tdeo)
  • Add new Rails/EnvironmentComparison cop. (@tdeo)
  • Add AllowedChars option to Style/AsciiComments cop. (@hedgesky)
  • #5031: Add new Style/EmptyBlockParameter and Style/EmptyLambdaParameter cops. (@pocke)
  • #5057: Add new Gemspec/RequiredRubyVersion cop. (@koic)
  • #5087: Add new Gemspec/RedundantAssignment cop. (@koic)
  • Add unannotated option to Style/FormatStringToken cop. (@drenmi)
  • #5077: Add new Rails/CreateTableWithTimestamps cop. (@wata727)
  • Add new Style/ColonMethodDefinition cop. (@rrosenblum)
  • Add new Style/ExtendSelf cop. (@drenmi)
  • #5185: Add new Rails/RedundantReceiverInWithOptions cop. (@koic)
  • #5177: Add new Rails/LexicallyScopedActionFilter cop. (@wata727)
  • #5173: Add new Style/EvalWithLocation cop. (@pocke)
  • #5208: Add new Rails/Presence cop. (@wata727)

Bug fixes

  • #5096: Fix incorrect detection and autocorrection of multiple extend/include/prepend. (@marcandre)
  • #4662: Fix incorrect indent level detection when first line of heredoc is blank. (@sambostock)
  • #5016: Fix a false positive for Style/ConstantName with constant names using non-ASCII capital letters with accents. (@timrogers)
  • #4866: Prevent Layout/BlockEndNewline cop from introducing trailing whitespaces. (@bgeuken)
  • #3396: Concise error when config. file not found. (@jaredbeck)
  • #4881: Fix a false positive for Performance/HashEachMethods when unused argument(s) exists in other blocks. (@pocke)
  • #4883: Fix auto-correction for Performance/HashEachMethods. (@pocke)
  • #4896: Fix Style/DateTime wrongly triggered on classes ...::DateTime. (@dpostorivo)
  • #4938: Fix behavior of Lint/UnneededDisable, which was returning offenses even after being disabled in a comment. (@tdeo)
  • #4887: Add undeclared configuration option EnforcedStyleForEmptyBraces for Layout/SpaceBeforeBlockBraces cop. (@drenmi)
  • #4987: Skip permission check when using stdin option. (@mtsmfm)
  • #4909: Make Rails/HasManyOrHasOneDependent aware of multiple associations in with_options. (@koic)
  • #4794: Fix an error in Layout/MultilineOperationIndentation when an operation spans multiple lines and contains a ternary expression. (@rrosenblum)
  • #4885: Fix false offense detected by Style/MixinUsage cop. (@koic)
  • #3363: Fix Style/EmptyElse autocorrection removes comments from branches. (@dpostorivo)
  • #5025: Fix error with Layout/MultilineMethodCallIndentation cop and lambda.(...). (@dpostorivo)
  • #4781: Prevent Style/UnneededPercentQ from breaking on strings that are concated with backslash. (@pocke)
  • #4363: Fix Style/PercentLiteralDelimiters incorrectly automatically modifies escaped percent literal delimiter. (@koic)
  • #5053: Fix Naming/ConstantName false offense on assigning to a nonoffensive assignment. (@garettarrowood)
  • #5019: Fix auto-correct for Style/HashSyntax cop when hash is used as unspaced argument. (@drenmi)
  • #5052: Improve accuracy of Style/BracesAroundHashParameters auto-correction. (@garettarrowood)
  • #5059: Fix a false positive for Style/MixinUsage when include call is a method argument. (@koic)
  • #5071: Fix a false positive in Lint/UnneededSplatExpansion, when Array.new resides in an array literal. (@akhramov)
  • #4071: Prevent generating wrong code by Style/ColonMethodCall and Style/RedundantSelf. (@pocke)
  • #5089: Fix false positive for Style/SafeNavigation when safe guarding arithmetic operation or assignment. (@tiagotex)
  • #5099: Prevent Style/MinMax from breaking on implicit receivers. (@drenmi)
  • #5079: Fix false positive for Style/SafeNavigation when safe guarding comparisons. (@tiagotex)
  • #5075: Fix auto-correct for Style/RedundantParentheses cop when unspaced ternary is present. (@tiagotex)
  • #5155: Fix a false negative for Naming/ConstantName cop when using frozen object assignment. (@koic)
  • Fix a false positive in Style/SafeNavigation when the right hand side is negated. (@rrosenblum)
  • #5128: Fix Bundler/OrderedGems when gems are references from variables (ignores them in the sorting). (@tdeo)

Changes

  • #4848: Exclude lambdas and procs from Metrics/ParameterLists. (@reitermarkus)
  • #5120: Improve speed of RuboCop::PathUtil#smart_path. (@walf443)
  • #4888: Improve offense message of Style/StderrPuts. (@jaredbeck)
  • #4886: Fix false offense for Style/CommentedKeyword. (@michniewicz)
  • #4977: Make Lint/RedundantWithIndex cop aware of offset argument. (@koic)
  • #2679: Handle dependencies to Metrics/LineLength: Max when generating .rubocop_todo.yml. (@jonas054)
  • #4943: Make cop generator compliant with the repo's rubocop config. (@tdeo)
  • #5011: Remove SupportedStyles from "Configuration parameters" in .rubocop_todo.yml. (@pocke)
  • Lint/RescueWithoutErrorClass has been replaced by Style/RescueStandardError. (@rrosenblum)
  • #4811: Remove Layout/SpaceInsideBrackets in favor of two new configurable cops. (@garettarrowood)
  • #5042: Make offense locations of metrics cops to contain whole a method. (@pocke)
  • #5044: Add last_line and last_column into outputs of the JSON formatter. (@pocke)
  • #4633: Make metrics cops aware of define_method. (@pocke)
  • #5037: Make display cop names to enable by default. (@pocke)
  • #4449: Make Layout/IndentHeredoc aware of line length. (@pocke)
  • #5146: Make --show-cops option aware of --force-default-config. (@pocke)
  • #3001: Add configuration to Lint/MissingCopEnableDirective cop. (@tdeo)
  • #4932: Do not fail if configuration contains Lint/Syntax cop with the same settings as the default. (@tdeo)
  • #5175: Make Style/RedundantBegin aware of do-end block in Ruby 2.5. (@pocke)

0.51.0 (2017-10-18)

New features

Bug fixes

  • #3312: Make Rails/Date Correct false positive on #to_time for strings ending in UTC-"Z".(@erikdstock)
  • #4741: Make Style/SafeNavigation correctly exclude methods called without dot. (@drenmi)
  • #4740: Make Lint/RescueWithoutErrorClass aware of modifier form rescue. (@drenmi)
  • #4745: Make Style/SafeNavigation ignore negated continuations. (@drenmi)
  • #4732: Prevent Performance/HashEachMethods from registering an offense when #each follows #to_a. (@drenmi)
  • #4730: False positive on Lint/InterpolationCheck. (@koic)
  • #4751: Prevent Rails/HasManyOrHasOneDependent cop from registering offense if :through option was specified. (@smakagon)
  • #4737: Fix ReturnInVoidContext cop when return is in top scope. (@frodsan)
  • #4776: Non utf-8 magic encoding comments are now respected. (@deivid-rodriguez)
  • #4241: Prevent Rails/Blank and Rails/Present from breaking when there is no explicit receiver. (@rrosenblum)
  • #4814: Prevent Rails/Blank from breaking on send with an argument. (@pocke)
  • #4759: Make Naming/HeredocDelimiterNaming and Naming/HeredocDelimiterCase aware of more delimiter patterns. (@drenmi)
  • #4823: Make Lint/UnusedMethodArgument and Lint/UnusedBlockArgument aware of overriding assignments. (@akhramov)
  • #4830: Prevent Lint/BooleanSymbol from truncating symbol's value in the message when offense is located in the new syntax hash. (@akhramov)
  • #4747: Fix Rails/HasManyOrHasOneDependent cop incorrectly flags with_options blocks. (@koic)
  • #4836: Make Rails/OutputSafety aware of safe navigation operator. (@drenmi)
  • #4843: Make Lint/ShadowedException cop aware of same system error code. (@koic)
  • #4757: Make Style/TrailingUnderscoreVariable work for nested assignments. (@donjar)
  • #4597: Fix Style/StringLiterals cop not registering an offense on single quoted strings containing an escaped single quote when configured to use double quotes. (@promisedlandt)
  • #4850: Lint/UnusedMethodArgument respects IgnoreEmptyMethods setting by ignoring unused method arguments for singleton methods. (@jmks)
  • #2040: Document how to write a custom cop. (@jonatas)

Changes

  • #4746: The Lint/InvalidCharacterLiteral cop has been removed since it was never being actually triggered. (@deivid-rodriguez)
  • #4789: Analyzing code that needs to support MRI 1.9 is no longer supported. (@deivid-rodriguez)
  • #4582: Severity and other common parameters can be configured on department level. (@jonas054)
  • #4787: Analyzing code that needs to support MRI 2.0 is no longer supported. (@deivid-rodriguez)
  • #4787: RuboCop no longer installs on MRI 2.0. (@deivid-rodriguez)
  • #4266: Download the inherited config files of a remote file from the same remote. (@tdeo)
  • #4853: Make Lint/LiteralInCondition cop aware of ! and not. (@pocke)
  • #4864: Rename Lint/LiteralInCondition to Lint/LiteralAsCondition. (@pocke)

0.50.0 (2017-09-14)

New features

  • #4464: Add EnforcedStyleForEmptyBraces parameter to Layout/SpaceBeforeBlockBraces cop. (@palkan)
  • #4453: New cop Style/RedundantConditional checks for conditionals that return true/false. (@petehamilton)
  • #4448: Add new TapFormatter. (@cyberdelia)
  • #4467: Add new Style/HeredocDelimiters cop(Note: This cop was renamed to Naming/HeredocDelimiterNaming). (@drenmi)
  • #4153: New cop Lint/ReturnInVoidContext checks for the use of a return with a value in a context where it will be ignored. (@harold-s)
  • #4506: Add auto-correct support to Lint/ScriptPermission. (@rrosenblum)
  • #4514: Add configuration options to Style/YodaCondition to support checking all comparison operators or equality operators only. (@smakagon)
  • #4515: Add new Lint/BooleanSymbol cop. (@droptheplot)
  • #4535: Make Rails/PluralizationGrammar use singular methods for -1 / -1.0. (@promisedlandt)
  • #4541: Add new Rails/HasManyOrHasOneDependent cop. (@oboxodo)
  • #4552: Add new Style/Dir cop. (@drenmi)
  • #4548: Add new Style/HeredocDelimiterCase cop(Note: This cop is renamed to Naming/HeredocDelimiterCase). (@drenmi)
  • #2943: Add new Lint/RescueWithoutErrorClass cop. (@drenmi)
  • #4568: Fix autocorrection for Style/TrailingUnderscoreVariable. (@smakagon)
  • #4586: Add new Performance/UnfreezeString cop. (@pocke)
  • #2976: Add Whitelist configuration option to Style/NestedParenthesizedCalls cop. (@drenmi)
  • #3965: Add new Style/OrAssignment cop. (@donjar)
  • #4655: Make rake new_cop create parent directories if they do not already exist. (@highb)
  • #4368: Make Performance/HashEachMethod inspect send nodes with any receiver. (@gohdaniel15)
  • #4508: Add new Style/ReturnNil cop. (@donjar)
  • #4629: Add Metrics/MethodLength cop for define_method. (@jekuta)
  • #4702: Add new Lint/UriEscapeUnescape cop. (@koic)
  • #4696: Add new Performance/UriDefaultParser cop. (@koic)
  • #4694: Add new Lint/UriRegexp cop. (@koic)
  • #4711: Add new Style/MinMax cop. (@drenmi)
  • #4720: Add new Bundler/InsecureProtocolSource cop. (@koic)
  • #4708: Add new Lint/RedundantWithIndex cop. (@koic)
  • #4480: Add new Lint/InterpolationCheck cop. (@GauthamGoli)
  • #4628: Add new Lint/NestedPercentLiteral cop. (@asherkach)

Bug fixes

  • #4709: Use cached remote config on network failure. (@kristjan)
  • #4688: Accept yoda condition which isn't commutative. (@fujimura)
  • #4676: Make Style/RedundantConditional cop work with elsif. (@akhramov)
  • #4656: Modify Style/ConditionalAssignment autocorrection to work with unbracketed arrays. (@akhramov)
  • #4615: Don't consider <=> a comparison method. (@iGEL)
  • #4664: Fix typos in Rails/HttpPositionalArguments. (@JoeCohen)
  • #4618: Fix Lint/FormatParameterMismatch false positive if format string includes %%5B (CGI encoded left bracket). (@barthez)
  • #4604: Fix Style/LambdaCall to autocorrect obj.call to obj.. (@iGEL)
  • #4443: Prevent Style/YodaCondition from breaking not LITERAL. (@pocke)
  • #4434: Prevent bad auto-correct in Style/Alias for non-literal arguments. (@drenmi)
  • #4451: Make Style/AndOr cop aware of comparison methods. (@drenmi)
  • #4457: Fix false negative in Lint/Void with initialize and setter methods. (@pocke)
  • #4418: Register an offense in Style/ConditionalAssignment when the assignment line is the longest line, and it does not exceed the max line length. (@rrosenblum)
  • #4491: Prevent bad auto-correct in Style/EmptyElse for nested if. (@pocke)
  • #4485: Handle 304 status for remote config files. (@daniloisr)
  • #4529: Make Lint/UnreachableCode aware of if and case. (@pocke)
  • #4469: Include permissions in file cache. (@pocke)
  • #4270: Fix false positive in Performance/RegexpMatch for named captures. (@pocke)
  • #4525: Fix regexp for checking comment config of rubocop:disable all in Lint/UnneededDisable. (@meganemura)
  • #4555: Make Style/VariableName aware of optarg, kwarg and other arguments. (@pocke)
  • #4481: Prevent Style/WordArray and Style/SymbolArray from registering offenses where percent arrays don't work. (@drenmi)
  • #4447: Prevent Layout/EmptyLineBetweenDefs from removing too many lines. (@drenmi)
  • #3892: Make Style/NumericPredicate ignore numeric comparison of global variables. (@drenmi)
  • #4101: Skip auto-correct for literals with trailing comment and chained method call in Layout/Multiline*BraceLayout. (@jonas054)
  • #4518: Fix bug where Style/SafeNavigation does not register an offense when there are chained method calls. (@rrosenblum)
  • #3040: Ignore safe navigation in Rails/Delegate. (@cgriego)
  • #4587: Fix false negative for void unary operators in Lint/Void cop. (@pocke)
  • #4589: Fix false positive in Performance/RegexpMatch cop for =~ is in a class method. (@pocke)
  • #4578: Fix false positive in Lint/FormatParameterMismatch for format with "asterisk" (*) width and precision. (@smakagon)
  • #4285: Make Lint/DefEndAlignment aware of multiple modifiers. (@drenmi)
  • #4634: Handle heredoc that contains empty lines only in Layout/IndentHeredoc cop. (@pocke)
  • #4646: Make Lint/Debugger aware of Kernel and cbase. (@pocke)
  • #4643: Modify Style/InverseMethods to not register a separate offense for an inverse method nested inside of the block of an inverse method offense. (@rrosenblum)
  • #4593: Fix false positive in Rails/SaveBang when save/update_attribute is used with a case statement. (@theRealNG)
  • #4322: Fix Style/MultilineMemoization from autocorrecting to invalid ruby. (@dpostorivo)
  • #4722: Fix rake new_cop problem that doesn't add require line. (@koic)
  • #4723: Fix RaiseArgs auto-correction issue for raise with 3 arguments. (@smakagon)

Changes

  • #4470: Improve the error message for Lint/AssignmentInCondition. (@brandonweiss)
  • #4553: Add node_modules to default excludes. (@iainbeeston)
  • #4445: Make Style/Encoding cop enabled by default. (@deivid-rodriguez)
  • #4452: Add option to Rails/Delegate for enforcing the prefixed method name case. (@klesse413)
  • #4493: Make Lint/Void cop aware of Enumerable#each and for. (@pocke)
  • #4492: Make Lint/DuplicateMethods aware of alias and alias_method. (@pocke)
  • #4478: Fix confusing message of Performance/Caller cop. (@pocke)
  • #4543: Make Lint/DuplicateMethods aware of attr_* methods. (@pocke)
  • #4550: Mark RuboCop::CLI#run as a public API. (@yujinakayama)
  • #4551: Make Performance/Caller aware of caller_locations. (@pocke)
  • #4547: Rename Style/HeredocDelimiters to Style/HeredocDelimiterNaming. (@drenmi)
  • #4157: Enhance offense message for Style/RedudantReturn cop. (@gohdaniel15)
  • #4521: Move naming related cops into their own Naming department. (@drenmi)
  • #4600: Make Style/RedundantSelf aware of arguments of a block. (@Envek)
  • #4658: Disable auto-correction for Performance/TimesMap by default. (@Envek)

0.49.1 (2017-05-29)

Bug fixes

  • #4411: Handle properly safe navigation in Style/YodaCondition. (@bbatsov)
  • #4412: Handle properly literal comparisons in Style/YodaCondition. (@bbatsov)
  • Handle properly class variables and global variables in Style/YodaCondition. (@bbatsov)
  • #4392: Fix the auto-correct of Style/Next when the end is misaligned. (@rrosenblum)
  • #4407: Prevent Performance/RegexpMatch from blowing up on match without arguments. (@pocke)
  • #4414: Handle pseudo-assignments in for loops in Style/ConditionalAssignment. (@bbatsov)
  • #4419: Handle combination AllCops: DisabledByDefault: true and Rails: Enabled: true. (@jonas054)
  • #4422: Fix missing space in message for Style/MultipleComparison. (@timrogers)
  • #4420: Ensure Style/EmptyMethod honours indentation when auto-correcting. (@drenmi)
  • #4442: Prevent Style/WordArray from breaking on strings that aren't valid UTF-8. (@pocke)
  • #4441: Prevent Layout/SpaceAroundBlockParameters from breaking on lambda. (@pocke)

Changes

  • #4436: Display 'Running parallel inspection' only with --debug. (@pocke)

0.49.0 (2017-05-24)

New features

  • #117: Add --parallel option for running RuboCop in multiple processes or threads. (@jonas054)
  • Add auto-correct support to Style/MixinGrouping. (@rrosenblum)
  • #4236: Add new Rails/ApplicationJob and Rails/ApplicationRecord cops. (@tjwp)
  • #4078: Add new Performance/Caller cop. (@alpaca-tc)
  • #4314: Check slow hash accessing in Array#sort by Performance/CompareWithBlock. (@pocke)
  • #3438: Add new Style/FormatStringToken cop. (@backus)
  • #4342: Add new Lint/ScriptPermission cop. (@yhirano55)
  • #4145: Add new Style/YodaCondition cop. (@smakagon)
  • #4403: Add public API Cop.autocorrect_incompatible_with for specifying other cops that should not autocorrect together. (@backus)
  • #4354: Add autocorrect to Style/FormatString. (@hoshinotsuyoshi)
  • #4021: Add new Style/MultipleComparison cop. (@dabroz)
  • New Lint/RescueType cop. (@rrosenblum)
  • #4328: Add --ignore-parent-exclusion flag to ignore AllCops/Exclude inheritance. (@nelsonjr)

Changes

  • #4262: Add new MinSize configuration to Style/SymbolArray, consistent with the same configuration in Style/WordArray. (@scottmatthewman)
  • #3400: Remove auto-correct support from Lint/Debugger. (@ilansh)
  • #4278: Move all cops dealing with whitespace into a new department called Layout. (@jonas054)
  • #4320: Update Rails/OutputSafety to disallow wrapping raw or html_safe with safe_join. (@klesse413)
  • #4336: Store rubocop_cache in safer directories. (@jonas054)
  • #4361: Use relative path for offense message in Lint/DuplicateMethods. (@pocke)
  • #4385: Include .jb file by default. (@pocke)

Bug fixes

  • #4265: Require a space before first argument of a method call in Style/SpaceBeforeFirstArg cop. (@cjlarose)
  • #4237: Fix false positive in Lint/AmbiguousBlockAssociation cop for lambdas. (@smakagon)
  • #4242: Add Capfile to the list of known Ruby filenames. (@bbatsov)
  • #4240: Handle ||= in Rails/RelativeDateConstant. (@bbatsov)
  • #4241: Prevent Rails/Blank and Rails/Present from breaking when there is no explicit receiver. (@rrosenblum)
  • #4249: Handle multiple assignment in Rails/RelativeDateConstant. (@bbatsov)
  • #4250: Improve a bit the Ruby code detection config. (@bbatsov)
  • #4283: Fix Style/EmptyCaseCondition autocorrect bug - when first when branch includes comma-delimited alternatives. (@ilansh)
  • #4268: Handle end-of-line comments when autocorrecting Style/EmptyLinesAroundAccessModifier. (@vergenzt)
  • #4275: Prevent Style/MethodCallWithArgsParentheses from blowing up on yield. (@drenmi)
  • #3969: Handle multiline method call alignment for arguments to methods. (@jonas054)
  • #4304: Allow enabling whole departments when DisabledByDefault is true. (@jonas054)
  • #4264: Prevent Rails/SaveBang from blowing up when using the assigned variable in a hash. (@drenmi)
  • #4310: Treat paths containing invalid byte sequences as non-matches. (@mclark)
  • #4063: Fix Rails/ReversibleMigration misdetection. (@gprado)
  • #4339: Fix false positive in Security/Eval cop for multiline string lietral. (@pocke)
  • #4339: Fix false negative in Security/Eval cop for Binding#eval. (@pocke)
  • #4327: Prevent Layout/SpaceInsidePercentLiteralDelimiters from registering offenses on execute-strings. (@drenmi)
  • #4371: Prevent Style/MethodName from complaining about unary operator definitions. (@drenmi)
  • #4366: Prevent Performance/RedundantMerge from blowing up on double splat arguments. (@drenmi)
  • #4352: Fix the auto-correct of Style/AndOr when Enumerable accessors ([]) are used. (@rrosenblum)
  • #4393: Prevent Style/InverseMethods from registering an offense for methods that are double negated. (@rrosenblum)
  • #4394: Prevent some cops from breaking on safe navigation operator. (@drenmi)
  • #4260: Prevent Rails/SkipsModelValidations from registering an offense for FileUtils.touch. (@rrosenblum)

0.48.1 (2017-04-03)

Changes

  • #4219: Add a link to style guide for Style/IndentationConsistency cop. (@pocke)
  • #4168: Removed -n option. (@sadovnik)
  • #4039: Change Style/PercentLiteralDelimiters default configuration to match Style Guide update. (@drenmi)
  • #4235: Improved copy of offense message in Lint/AmbiguousBlockAssociation cop. (@smakagon)

Bug fixes

  • #4171: Prevent Rails/Blank from breaking when RHS of or is a naked falsiness check. (@drenmi)
  • #4189: Make Lint/AmbiguousBlockAssociation aware of lambdas passed as arguments. (@drenmi)
  • #4179: Prevent Rails/Blank from breaking when LHS of or is a naked falsiness check. (@rrosenblum)
  • #4172: Fix false positives in Style/MixinGrouping cop. (@drenmi)
  • #4185: Make Lint/NestedMethodDefinition aware of #*_exec class of methods. (@drenmi)
  • #4197: Fix false positive in Style/RedundantSelf cop with parallel assignment. (@drenmi)
  • #4199: Fix incorrect auto correction in Style/SymbolArray and Style/WordArray cop. (@pocke)
  • #4218: Make Lint/NestedMethodDefinition aware of class shovel scope. (@drenmi)
  • #4198: Make Lint/AmbguousBlockAssociation aware of operator methods. (@drenmi)
  • #4152: Make Style/MethodCallWithArgsParentheses not require parens on setter methods. (@drenmi)
  • #4226: Show in --help output that --stdin takes a file name argument. (@jonas054)
  • #4217: Fix false positive in Rails/FilePath cop with non string argument. (@soutaro)
  • #4106: Make Style/TernaryParentheses unsafe autocorrect detector aware of literals and constants. (@drenmi)
  • #4228: Fix false positive in Lint/AmbiguousBlockAssociation cop. (@smakagon)
  • #4234: Fix false positive in Rails/RelativeDate for lambdas and procs. (@smakagon)

0.48.0 (2017-03-26)

New features

  • #4107: New TargetRailsVersion configuration parameter can be used to specify which version of Rails the inspected code is intended to run on. (@maxbeizer)
  • #4104: Add prefix and postfix styles to Style/NegatedIf. (@brandonweiss)
  • #4083: Add new configuration NumberOfEmptyLines for Style/EmptyLineBetweenDefs. (@dorian)
  • #4045: Add new configuration Strict for Style/NumericLiteral to make the change to this cop in 0.47.0 configurable. (@iGEL)
  • #4005: Add new AllCops/EnabledByDefault option. (@betesh)
  • #3893: Add a new configuration, IncludeActiveSupportAliases, to Performance/DoublStartEndWith. This configuration will check for ActiveSupport's starts_with? and ends_with?. (@rrosenblum)
  • #3889: Add new Style/EmptyLineAfterMagicComment cop. (@backus)
  • #3800: Make Style/EndOfLine configurable with lf, crlf, and native (default) styles. (@jonas054)
  • #3936: Add new Style/MixinGrouping cop. (@drenmi)
  • #4003: Add new Rails/RelativeDateConstant cop. (@sinsoku)
  • #3984: Add new Style/EmptyLinesAroundBeginBody cop. (@pocke)
  • #3995: Add new Style/EmptyLinesAroundExceptionHandlingKeywords cop. (@pocke)
  • #4019: Make configurable Style/MultilineMemoization cop. (@pocke)
  • #4018: Add autocorrect Lint/EmptyEnsure cop. (@pocke)
  • #4028: Add new Style/IndentHeredoc cop. (@pocke)
  • #3931: Add new Lint/AmbiguousBlockAssociation cop. (@smakagon)
  • Add new Style/InverseMethods cop. (@rrosenblum)
  • #4038: Allow default key in the Style/PercentLiteralDelimiters cop config to set all preferred delimiters. (@kddeisz)
  • Add IgnoreMacros option to Style/MethodCallWithArgsParentheses. (@drenmi)
  • #3937: Add new Rails/ActiveSupportAliases cop. (@tdeo)
  • Add new Rails/Blank cop. (@rrosenblum)
  • Add new Rails/Present cop. (@rrosenblum)
  • #4004: Allow not treating comment lines as group separators in Bundler/OrderedGems cop. (@konto-andrzeja)

Changes

  • #4100: Rails/SaveBang should flag update_attributes. (@andriymosin)
  • #4083: Style/EmptyLineBetweenDefs doesn't allow more than one empty line between method definitions by default (see NumberOfEmptyLines). (@dorian)
  • #3997: Include all ruby files by default and exclude non-ruby files. (@dorian)
  • #4012: Mark foo[:bar] as not complex in Style/TernaryParentheses cop with require_parentheses_when_complex style. (@onk)
  • #3915: Make configurable whitelist for Lint/SafeNavigationChain cop. (@pocke)
  • #3944: Allow keyword arguments in Style/RaiseArgs cop. (@mikegee)
  • Add auto-correct to Performance/DoubleStartEndWith. (@rrosenblum)
  • #3951: Make Rails/Date cop to register an offence for a string without timezone. (@sinsoku)
  • #4020: Fixed new_cop.rake suggested path. (@dabroz)
  • #4055: Add parameters count to offense message for Metrics/ParameterLists cop. (@pocke)
  • #4081: Allow Marshal.load if argument is a Marshal.dump in Security/MarshalLoad cop. (@droptheplot)
  • #4124: Make Style/SymbolArray cop to enable by default. (@pocke)
  • #3331: Change Style/MultilineMethodCallIndentation indented_relative_to_receiver to indent relative to the receiver and not relative to the caller. (@jfelchner)
  • #4137: Allow lines to be exempted from IndentationWidth by regex. (@jfelchner)

Bug fixes

  • #4007: Skip Rails/SkipsModelValidations for methods that don't accept arguments. (@dorian)
  • #3923: Allow asciibetical sorting in Bundler/OrderedGems. (@mikegee)
  • #3855: Make Lint/NonLocalExitFromIterator aware of method definitions. (@drenmi)
  • #2643: Allow uppercase and dashes in MagicComment. (@mikegee)
  • #3959: Don't wrap "percent arrays" with extra brackets when autocorrecting Style/MutableConstant. (@mikegee)
  • #3978: Fix false positive in Performance/RegexpMatch with English module. (@pocke)
  • #3242: Ignore Errno::ENOENT during cache cleanup from File.mtime too. (@mikegee)
  • #3958: Style/SpaceInsideHashLiteralBraces doesn't add and offence when checking an hash where a value is a left brace string (e.g. { k: '{' }). (@nodo)
  • #4006: Prevent Style/WhileUntilModifier from breaking on a multiline modifier. (@drenmi)
  • #3345: Allow Style/WordArray's WordRegex configuration value to be an instance of String. (@mikegee)
  • #4013: Follow redirects for RemoteConfig. (@buenaventure)
  • #3917: Rails/FilePath Match nodes in a method call only once. (@unmanbearpig)
  • #3673: Fix regression on Style/RedundantSelf when assigning to same local variable. (@bankair)
  • #4047: Allow find_zone and find_zone! methods in Rails/TimeZone. (@attilahorvath)
  • #3457: Clear a warning and prevent new warnings. (@mikegee)
  • #4066: Register an offense in Lint/ShadowedException when an exception is shadowed and there is an implicit begin. (@rrosenblum)
  • #4001: Lint/UnneededDisable of Metrics/LineLength that isn't unneeded. (@wkurniawan07)
  • #3960: Let Include/Exclude paths in all files beginning with .rubocop be relative to the configuration file's directory and not to the current directory. (@jonas054)
  • #4049: Bugfix for Style/EmptyLiteral cop. (@ota42y)
  • #4112: Fix false positives about double quotes in Style/StringLiterals, Style/UnneededCapitalW and Style/UnneededPercentQ cops. (@pocke)
  • #4109: Fix incorrect auto correction in Style/SelfAssignment cop. (@pocke)
  • #4110: Fix incorrect auto correction in Style/BracesAroundHashParameters cop. (@musialik)
  • #4084: Fix incorrect auto correction in Style/TernaryParentheses cop. (@musialik)
  • #4102: Fix Security/JSONLoad, Security/MarshalLoad and Security/YAMLLoad cops patterns not matching ::Const. (@musialik)
  • #3580: Handle combinations of # rubocop:disable all and # rubocop:disable SomeCop. (@jonas054)
  • #4124: Fix auto correction bugs in Style/SymbolArray cop. (@pocke)
  • #4128: Prevent Style/CaseIndentation cop from registering offenses on single-line case statements. (@drenmi)
  • #4143: Prevent Style/IdenticalConditionalBranches from registering offenses when a case statement has an empty when. (@dpostorivo)
  • #4160: Fix a regression where UselessAssignment cop may not properly detect useless assignments when there's only a single conditional expression in the top level scope. (@yujinakayama)
  • #4162: Fix a false negative in UselessAssignment cop with nested conditionals. (@yujinakayama)

0.47.1 (2017-01-18)

Bug fixes

  • #3911: Prevent a crash in Performance/RegexpMatch cop with module definition. (@pocke)
  • #3908: Prevent Style/AlignHash from breaking on a keyword splat when using enforced table style. (@drenmi)
  • #3918: Prevent Rails/EnumUniqueness from breaking on a non-literal hash value. (@drenmi)
  • #3914: Fix department resolution for third party cops required through configuration. (@backus)
  • #3846: NodePattern works for hyphenated node types. (@alexdowad)
  • #3922: Prevent Style/NegatedIf from breaking on negated ternary. (@drenmi)
  • #3915: Fix a false positive in Lint/SafeNavigationChain cop with try method. (@pocke)

0.47.0 (2017-01-16)

New features

  • #3822: Add Rails/FilePath cop. (@iguchi1124)
  • #3821: Add Security/YAMLLoad cop. (@cyberdelia)
  • #3816: Add Security/MarshalLoad cop. (@cyberdelia)
  • #3757: Add Auto-Correct for Bundler/OrderedGems cop. (@pocke)
  • Style/FrozenStringLiteralComment now supports the style never that will remove the frozen_string_literal comment. (@rrosenblum)
  • #3795: Add Lint/MultipleCompare cop. (@pocke)
  • #3772: Allow exclusion of certain methods for Metrics/BlockLength. (@NobodysNightmare)
  • #3804: Add new Lint/SafeNavigationChain cop. (@pocke)
  • #3670: Add CountBlocks boolean option to Metrics/BlockNesting. It allows blocks to be counted towards the nesting limit. (@georgyangelov)
  • #2992: Add a configuration to Style/ConditionalAssignment to toggle offenses for ternary expressions. (@rrosenblum)
  • #3824: Add new Performance/RegexpMatch cop. (@pocke)
  • #3825: Add new Rails/SkipsModelValidations cop. (@rahulcs)
  • #3737: Add new Style/MethodCallWithArgsParentheses cop. (@dominh)
  • Renamed MethodCallParentheses to MethodCallWithoutArgsParentheses. (@dominh)
  • #3854: Add new Rails/ReversibleMigration cop. (@sue445)
  • #3872: Detect String#% with hash literal. (@backus)
  • #2731: Allow configuration of method calls that create methods for Lint/UselessAccessModifier. (@pat)

Changes

  • #3820: Rename Lint/Eval to Security/Eval. (@cyberdelia)
  • #3725: Disable Style/SingleLineBlockParams by default. (@tejasbubane)
  • #3765: Add a validation for supported styles other than EnforcedStyle. AlignWith, IndentWhenRelativeTo and EnforcedMode configurations are renamed. (@pocke)
  • #3782: Add check for add_reference method by Rails/NotNullColumn cop. (@pocke)
  • #3761: Update Style/RedundantFreeze message from Freezing immutable objects is pointless. to Do not freeze immutable objects, as freezing them has no effect.. (@lucasuyezu)
  • #3753: Change error message of Bundler/OrderedGems to mention Alphabetize Gems. (@tejasbubane)
  • #3802: Ignore case when checking Gemfile order. (@breckenedge)
  • Add missing examples in Lint cops documentation. (@enriikke)
  • Make Style/EmptyMethod cop aware of class methods. (@drenmi)
  • #3871: Add check for void defined? and self by Lint/Void cop. (@pocke)
  • Allow ignoring methods in Style/BlockDelimiters when using any style. (@twe4ked)

Bug fixes

  • #3751: Avoid crash in Rails/EnumUniqueness cop. (@pocke)
  • #3766: Avoid crash in Style/ConditionalAssignment cop with masgn. (@pocke)
  • #3770: Style/RedundantParentheses Don't flag raised to a power negative numeric literals, since removing the parentheses would change the meaning of the expressions. (@amogil)
  • #3750: Register an offense in Style/ConditionalAssignment when the assignment spans multiple lines. (@rrosenblum)
  • #3775: Avoid crash in Style/HashSyntax cop with an empty hash. (@pocke)
  • #3783: Maintain parentheses in Rails/HttpPositionalArguments when methods are defined with them. (@kevindew)
  • #3786: Avoid crash Style/ConditionalAssignment cop with mass assign method. (@pocke)
  • #3749: Detect corner case of Style/NumericLitterals. (@kamaradclimber)
  • #3788: Prevent bad auto-correct in Style/Next when block has nested conditionals. (@drenmi)
  • #3807: Prevent Style/Documentation and Style/DocumentationMethod from mistaking RuboCop directives for class documentation. (@drenmi)
  • #3815: Fix false positive in Style/IdenticalConditionalBranches cop when branches have same line at leading. (@pocke)
  • Fix false negative in Rails/HttpPositionalArguments where offense would go undetected if one of the request parameter names matched one of the special keyword arguments. (@deivid-rodriguez)
  • Fix false negative in Rails/HttpPositionalArguments where offense would go undetected if the :format keyword was used with other non-special keywords. (@deivid-rodriguez)
  • #3406: Enable cops if Enabled is not explicitly set to false. (@metcalf)
  • Fix Lint/FormatParameterMismatch for splatted last argument. (@zverok)
  • #3853: Fix false positive in RedundantParentheses cop with multiple expression. (@pocke)
  • #3870: Avoid crash in Rails/HttpPositionalArguments. (@pocke)
  • #3869: Prevent Lint/FormatParameterMismatch from breaking when #% is passed an empty array. (@drenmi)
  • #3879: Properly handle Emacs and Vim magic comments for FrozenStringLiteralComment. (@backus)
  • #3736: Fix to remove accumulator return value by auto-correction in Style/EachWithObject. (@pocke)

0.46.0 (2016-11-30)

New features

  • #3600: Add new Bundler/DuplicatedGem cop. (@jmks)
  • #3624: Add new configuration option empty_lines_special to Style/EmptyLinesAroundClassBody and Style/EmptyLinesAroundModuleBody. (@legendetm)
  • Add new Style/EmptyMethod cop. (@drenmi)
  • Style/EmptyLiteral will now auto-correct Hash.new when it is the first argument being passed to a method. The arguments will be wrapped with parenthesis. (@rrosenblum)
  • #3713: Respect DisabledByDefault in parent configs. (@aroben)
  • New cop Rails/EnumUniqueness checks for duplicate values defined in enum config. (@olliebennett)
  • New cop Rails/EnumUniqueness checks for duplicate values defined in enum config hash. (@olliebennett)
  • #3451: Add new require_parentheses_when_complex style to Style/TernaryParentheses cop. (@swcraig)
  • #3600: Add new Bundler/OrderedGems cop. (@tdeo)
  • #3479: Add new configuration option IgnoredPatterns to Metrics/LineLength. (@jonas054)

Changes

  • The offense range for Performance/FlatMap now includes any parameters that are passed to flatten. (@rrosenblum)
  • #1747: Update Style/SpecialGlobalVars messages with a reminder to require 'English'. (@ivanovaleksey)
  • Checks binding.irb call by Lint/Debugger cop. (@pocke)
  • #3742: Checks min and max call by Performance/CompareWithBlock cop. (@pocke)

Bug fixes

  • #3662: Fix the auto-correction of Lint/UnneededSplatExpansion when the splat expansion is inside of another array. (@rrosenblum)
  • #3699: Fix false positive in Style/VariableNumber on variable names ending with an underscore. (@bquorning)
  • #3687: Fix the fact that Style/TernaryParentheses cop claims to correct uncorrected offenses. (@Ana06)
  • #3568: Fix --auto-gen-config behavior for Style/VariableNumber. (@jonas054)
  • Add format as an acceptable keyword argument for Rails/HttpPositionalArguments. (@aesthetikx)
  • #3598: In Style/NumericPredicate, don't report x != 0 or x.nonzero? as the expressions have different values. (@jonas054)
  • #3690: Do not register an offense for multiline braces with content in Style/SpaceInsideBlockBraces. (@rrosenblum)
  • #3746: Lint/NonLocalExitFromIterator does not warn about return in a block which is passed to Object#define_singleton_method. (@AlexWayfer)

0.45.0 (2016-10-31)

New features

  • #3615: Add autocorrection for Lint/EmptyInterpolation. (@pocke)
  • Make PercentLiteralDelimiters enforce delimiters around %I() too. (@bronson)
  • #3408: Add check for repeated values in case conditionals. (@swcraig)
  • #3646: Add new Lint/EmptyWhen cop. (@drenmi)
  • #3246: Add list of all cops to the manual (generated automatically from a rake task). (@sihu)
  • #3647: Add --force-default-config option. (@jawshooah)
  • #3570: Add new MultilineIfModifier cop to avoid usage of if/unless-modifiers on multiline statements. (@tessi)
  • #3631: Add new Style/SpaceInLambdaLiteral cop to check for spaces in lambda literals. (@swcraig)
  • Add new Lint/EmptyExpression cop. (@drenmi)

Bug fixes

  • #3553: Make Style/RedundantSelf cop to not register an offence for self.(). (@iGEL)
  • #3474: Make the Rails/TimeZone only analyze functions which have "Time" in the receiver. (@b-t-g)
  • #3607: Fix Style/RedundantReturn cop for empty if body. (@pocke)
  • #3291: Improve detection of raw and html_safe methods in Rails/OutputSafety. (@lumeet)
  • Redundant return style now properly handles empty when blocks. (@albus522)
  • #3622: Fix false positive for Metrics/MethodLength and Metrics/BlockLength. (@meganemura)
  • #3625: Fix some cops errors when condition is empty brace. (@pocke)
  • #3468: Fix bug regarding alignment inside begin..end block in Style/MultilineMethodCallIndentation. (@jonas054)
  • #3644: Fix generation incorrect documentation. (@pocke)
  • #3637: Fix Style/NonNilCheck crashing for ternary condition. (@tejasbubane)
  • #3654: Add missing keywords for Rails/HttpPositionalArguments. (@eitoball)
  • #3652: Avoid crash Rails/HttpPositionalArguments for lvar params when auto-correct. (@pocke)
  • Fix bug in Style/SafeNavigation where there is a check for an object in an elsif statement with a method call on that object in the branch. (@rrosenblum)
  • #3660: Fix false positive for Rails/SafeNavigation when without receiver. (@pocke)
  • #3650: Fix Style/VariableNumber registering an offense for variables with double digit numbers. (@rrosenblum)
  • #3494: Check rails style indentation also inside blocks in Style/IndentationWidth. (@jonas054)
  • #3676: Ignore raw and html_safe invocations when wrapped inside a safe_join. (@b-t-g)

Changes

  • #3601: Change default args for Style/SingleLineBlockParams. This cop checks that reduce and inject use the variable names a and e for block arguments. These defaults are uncommunicative variable names and thus conflict with the "Uncommunicative Variable Name" check in Reek. Default args changed to acc and elem.(@jessieay)
  • #3645: Fix bug with empty case when nodes in Style/RedundantReturn. (@tiagocasanovapt)
  • #3263: Fix auto-correct of if statements inside of unless else statements in Style/ConditionalAssignment. (@rrosenblum)
  • Bump default Ruby version to 2.1. (@drenmi)

0.44.1 (2016-10-13)

Bug fixes

0.44.0 (2016-10-13)

New features

  • #3560: Add a configuration option empty_lines_except_namespace to Style/EmptyLinesAroundClassBody and Style/EmptyLinesAroundModuleBody. (@legendetm)
  • #3370: Add new Rails/HttpPositionalArguments cop to check your Rails 5 test code for existence of positional args usage. (@logicminds)
  • #3510: Add a configuration option, ConvertCodeThatCanStartToReturnNil, to Style/SafeNavigation to check for code that could start returning nil if safe navigation is used. (@rrosenblum)
  • Add a new AllCops/StyleGuideBaseURL setting that allows the use of relative paths and/or fragments within each cop's StyleGuide setting, to make forking of custom style guides easier. (@scottmatthewman)
  • #3566: Add new Metric/BlockLength cop to ensure blocks don't get too long. (@savef)
  • #3428: Add support for configuring Style/PreferredHashMethods with either short or verbose style method names. (@abrom)
  • #3455: Add new Rails/DynamicFindBy cop. (@pocke)
  • #3542: Add a configuration option, IgnoreCopDirectives, to Metrics/LineLength to stop cop directives (# rubocop:disable Metrics/AbcSize) from being counted when considering line length. (@jmks)
  • Add new Rails/DelegateAllowBlank cop. (@connorjacobsen)
  • Add new Style/MultilineMemoization cop. (@drenmi)

Bug fixes

  • #3103: Make Style/ExtraSpacing cop register an offense for extra spaces present in single-line hash literals. (@tcdowney)
  • #3513: Fix false positive in Style/TernaryParentheses for a ternary with ranges. (@dreyks)
  • #3520: Fix regression causing Lint/AssignmentInCondition false positive. (@savef)
  • #3514: Make Style/VariableNumber cop not register an offense when valid normal case variable names have an integer after the first _. (@b-t-g)
  • #3516: Make Style/VariableNumber cop not register an offense when valid normal case variable names have an integer in the middle. (@b-t-g)
  • #3436: Make Rails/SaveBang cop not register an offense when return value of a non-bang method is returned by the parent method. (@coorasse)
  • #3540: Fix Style/GuardClause to register offense for instance and singleton methods. (@tejasbubane)
  • #3311: Detect incompatibilities with the external encoding to prevent bad autocorrections in Style/StringLiterals. (@deivid-rodriguez)
  • #3499: Ensure Lint/UnusedBlockArgument doesn't make recommendations that would change arity for methods defined using #define_method. (@drenmi)
  • #3430: Fix exception in Performance/RedundantMerge when inspecting a #merge! with implicit receiver. (@drenmi)
  • #3411: Avoid auto-correction crash for single when in Performance/CaseWhenSplat. (@jonas054)
  • #3286: Allow self.a, self.b = b, a in Style/ParallelAssignment. (@jonas054)
  • #3419: Report offense for unless x.nil? in Style/NonNilCheck if IncludeSemanticChanges is true. (@jonas054)
  • #3382: Avoid auto-correction crash for multiple elsifs in Style/EmptyElse. (@lumeet)
  • #3334: Do not register an offense for a literal space (\s) in Style/UnneededCapitalW. (@rrosenblum)
  • #3390: Fix SaveBang cop for multiple conditional. (@tejasbubane)
  • #3577: Fix Style/RaiseArgs not allowing compact raise with splatted args. (@savef)
  • #3578: Fix safe navigation method call counting in Metrics/AbcSize. (@savef)
  • #3592: Fix Style/RedundantParentheses for indexing with literals. (@thegedge)
  • #3597: Fix the autocorrect of Performance/CaseWhenSplat when trying to rearange splat expanded variables to the end of a when condition. (@rrosenblum)

Changes

  • #3512: Change error message of Lint/UnneededSplatExpansion for array in method parameters. (@tejasbubane)
  • #3510: Fix some issues with Style/SafeNavigation. Fix auto-correct of multiline if expressions, and do not register an offense for scenarios using || and ternary expression. (@rrosenblum)
  • #3503: Change misleading message of Style/EmptyLinesAroundAccessModifier. (@bquorning)
  • #3407: Turn off autocorrect for unsafe rules by default. (@ptarjan)
  • #3521: Turn off autocorrect for Security/JSONLoad by default. (@savef)
  • #2903: Style/RedundantReturn looks for redundant return inside conditional branches. (@lumeet)

0.43.0 (2016-09-19)

New features

  • #3379: Add table of contents at the beginning of HTML formatted output. (@hedgesky)
  • #2968: Add new Style/DocumentationMethod cop. (@sooyang)
  • #3360: Add RequireForNonPublicMethods configuration option to Style/DocumentationMethod cop. (@drenmi)
  • Add new Rails/SafeNavigation cop to convert try! to &.. (@rrosenblum)
  • #3415: Add new Rails/NotNullColumn cop. (@pocke)
  • #3167: Add new Style/VariableNumber cop. (@sooyang)
  • Add new style no_mixed_keys to Style/HashSyntax to only check for hashes with mixed keys. (@daviddavis)
  • Allow including multiple configuration files from a single gem. (@tjwallace)
  • Add check for persisted? method call when using a create method in Rails/SaveBang. (@QuinnHarris)
  • Add new Style/SafeNavigation cop to convert method calls safeguarded by a non nil check for the object to &.. (@rrosenblum)
  • Add new Performance/SortWithBlock cop to use sort_by(&:foo) instead of sort { |a, b| a.foo <=> b.foo }. (@koic)
  • #3492: Add new UnifiedInteger cop. (@pocke)

Bug fixes

  • #3383: Fix the local variable reset issue with Style/RedundantSelf cop. (@bankair)
  • #3445: Fix bad autocorrect for Style/AndOr cop. (@mikezter)
  • #3349: Fix bad autocorrect for Style/Lambda cop. (@metcalf)
  • #3351: Fix bad auto-correct for Performance/RedundantMatch cop. (@annaswims)
  • #3347: Prevent infinite loop in Style/TernaryParentheses cop when used together with Style/RedundantParentheses. (@drenmi)
  • #3209: Remove faulty line length check from Style/GuardClause cop. (@drenmi)
  • #3366: Make Style/MutableConstant cop aware of splat assignments. (@drenmi)
  • #3372: Fix RuboCop crash with empty brackets in Style/Next cop. (@pocke)
  • #3358: Make Style/MethodMissing cop aware of class scope. (@drenmi)
  • #3342: Fix error in Lint/ShadowedException cop if last rescue does not have parameter. (@soutaro)
  • #3380: Fix false positive in Style/TrailingUnderscoreVariable cop. (@drenmi)
  • #3388: Fix bug where Lint/ShadowedException would register an offense when rescuing different numbers of custom exceptions in multiple rescue groups. (@rrosenblum)
  • #3386: Make VariableForce understand an empty RegExp literal as LHS to =~. (@drenmi)
  • #3421: Fix clobbering inherit_from additions when not using Namespaces in the configs. (@nicklamuro)
  • #3425: Fix bug for invalid bytes in UTF-8 in Lint/PercentStringArray cop. (@pocke)
  • #3374: Make SpaceInsideBlockBraces and SpaceBeforeBlockBraces not depend on BlockDelimiters configuration. (@jonas054)
  • Fix error in Lint/ShadowedException cop for higher number of rescue groups. (@groddeck)
  • #3456: Don't crash on a multiline empty brace in Style/MultilineMethodCallBraceLayout. (@pocke)
  • #3423: Checks if .rubocop is a file before parsing. (@joejuzl)
  • #3439: Fix variable assignment check not working properly when a block is used in Rails/SaveBang. (@QuinnHarris)
  • #3401: Read file contents in binary mode so Style/EndOfLine works on Windows. (@jonas054)
  • #3450: Prevent Style/TernaryParentheses cop from making unsafe corrections. (@drenmi)
  • #3460: Fix false positives in Style/InlineComment cop. (@drenmi)
  • #3485: Make OneLineConditional cop not register offense for empty else. (@tejasbubane)
  • #3508: Fix false negatives in Rails/NotNullColumn. (@pocke)
  • #3462: Don't create MultilineMethodCallBraceLayout offenses for single-line method calls when receiver spans multiple lines. (@maxjacobson)

Changes

  • #3341: Exclude RSpec tests from inspection by Style/NumericPredicate cop. (@drenmi)
  • Rename Lint/UselessArraySplat to Lint/UnneededSplatExpansion, and add functionality to check for unnecessary expansion of other literals. (@rrosenblum)
  • No longer register an offense for splat expansion of an array literal in Performance/CaseWhenSplat. Lint/UnneededSplatExpansion now handles this behavior. (@rrosenblum)
  • Lint/InheritException restricts inheriting from standard library subclasses of Exception. (@metcalf)
  • No longer register an offense if the first line of code starts with #\ in Style/LeadingCommentSpace. config.ru files consider such lines as options. (@scottohara)
  • #3292: Remove Performance/PushSplat as it can produce code that is slower or even cause failure. (@jonas054)

0.42.0 (2016-07-25)

New features

  • #3306: Add autocorrection for Style/EachWithObject. (@owst)
  • Add new Style/TernaryParentheses cop. (@drenmi)
  • #3136: Add config for UselessAccessModifier so it can be made aware of ActiveSupport's concerning and class_methods methods. (@maxjacobson)
  • #3128: Add new Rails/SaveBang cop. (@QuinnHarris)
  • Add new Style/NumericPredicate cop. (@drenmi)

Bug fixes

  • #3271: Fix bad auto-correct for Style/EachForSimpleLoop cop. (@drenmi)
  • #3288: Fix auto-correct of word and symbol arrays in Style/ParallelAssignment cop. (@jonas054)
  • #3307: Fix exception when inspecting an operator assignment with Style/MethodCallParentheses cop. (@drenmi)
  • #3316: Fix error for blocks without arguments in Style/SingleLineBlockParams cop. (@owst)
  • #3320: Make Style/OpMethod aware of the backtick method. (@drenmi)
  • Do not register an offense in Lint/ShadowedException when rescuing an exception built into Ruby before a custom exception. (@rrosenblum)

Changes

  • #2645: Style/EmptyLiteral no longer generates an offense for String.new when using frozen string literals. (@drenmi)
  • #3308: Make Lint/NextWithoutAccumulator aware of nested enumeration. (@drenmi)
  • Extend Style/MethodMissing cop to check for the conditions in the style guide. (@drenmi)
  • #3325: Drop support for MRI 1.9.3. (@drenmi)
  • Add support for MRI 2.4. (@dvandersluis)
  • #3256: Highlight the closing brace in Style/Multiline...BraceLayout cops. (@jonas054)
  • Always register an offense when rescuing Exception before or along with any other exception in Lint/ShadowedException. (@rrosenblum)

0.41.2 (2016-07-07)

Bug fixes

  • #3248: Support 'ruby-' prefix in .ruby-version. (@tjwp)
  • #3250: Make regexp for cop names less restrictive in CommentConfig lines. (@tjwp)
  • #3261: Prefer TargetRubyVersion to .ruby-version. (@tjwp)
  • #3249: Account for rescue nil in Style/ShadowedException. (@rrosenblum)
  • Modify the highlighting in Style/ShadowedException to be more useful. Highlight just rescue area. (@rrosenblum)
  • #3129: Fix Style/MethodCallParentheses to work with multiple assignments. (@tejasbubane)
  • #3247: Ensure whitespace after beginning of block in Style/BlockDelimiters. (@tjwp)
  • #2941: Make sure Lint/UnneededDisable can do auto-correction. (@jonas054)
  • #3269: Fix Lint/ShadowedException to block arbitrary code execution. (@pocke)
  • #3266: Handle empty parentheses in Performance/RedundantBlockCall auto-correct. (@jonas054)
  • #3272: Add escape character missing to LITERAL_REGEX. (@pocke)
  • #3255: Fix auto-correct for Style/RaiseArgs when constructing exception without arguments. (@drenmi)
  • #3294: Allow to use Time.zone_default. (@Tei)
  • #3300: Do not replace %q()s containing escaped non-backslashes. (@owst)

Changes

  • #3230: Improve highlighting for Style/AsciiComments cop. (@drenmi)
  • Improve highlighting for Style/AsciiIdentifiers cop. (@drenmi)
  • #3265: Include --no-offense-counts in .rubocop_todo.yml. (@vergenzt)

0.41.1 (2016-06-26)

Bug fixes

  • #3245: Fix UniqBeforePluck cop by solving difference of config name. (@pocke)

0.41.0 (2016-06-25)

New features

  • #2956: Prefer .ruby-version to TargetRubyVersion. (@pclalv)
  • #3095: Add IndentationWidth configuration parameter for Style/AlignParameters cop. (@alexdowad)
  • #3066: Add new Style/ImplicitRuntimeError cop which advises the use of an explicit exception class when raising an error. (@alexdowad)
  • #3018: Add new Style/EachForSimpleLoop cop which advises the use of Integer#times for simple loops which iterate a fixed number of times. (@alexdowad)
  • #2595: New compact style for Style/SpaceInsideLiteralHashBraces. (@alexdowad)
  • #2927: Add autocorrect for Rails/Validation cop. (@neodelf)
  • #3135: Add new Rails/OutputSafety cop. (@josh)
  • #3164: Add Fastlane's Fastfile to the default Includes. (@jules2689)
  • #3173: Make Style/ModuleFunction configurable with module_function and extend_self styles. (@tjwp)
  • #3105: Add new Rails/RequestReferer cop. (@giannileggio)
  • #3200: Add autocorrect for Style/EachForSimpleLoop cop. (@tejasbubane)
  • #3058: Add new Style/SpaceInsideArrayPercentLiteral cop. (@owst)
  • #3058: Add new Style/SpaceInsidePercentLiteralDelimiters cop. (@owst)
  • #3179: Expose files to support testings Cops using RSpec. (@tjwp)
  • #3191: Allow arbitrary comments after cop names in CommentConfig lines (e.g. rubocop:enable). (@owst)
  • #3165: Add new Lint/PercentStringArray cop. (@owst)
  • #3165: Add new Lint/PercentSymbolArray cop. (@owst)
  • #3177: Add new Style/NumericLiteralPrefix cop. (@tejasbubane)
  • #1646: Add configuration style indented_relative_to_receiver for Style/MultilineMethodCallIndentation. (@jonas054)
  • New cop Lint/ShadowedException checks for the order which exceptions are rescued to avoid rescueing a less specific exception before a more specific exception. (@rrosenblum)
  • #3127: New cop Lint/InheritException checks for error classes inheriting from Exception, and instead suggests RuntimeError or StandardError. (@drenmi)
  • Add new Performance/PushSplat cop. (@segiddins)
  • #3089: Add new Rails/Exit cop. (@sgringwe)
  • #3104: Add new Style/MethodMissing cop. (@haziqhafizuddin)

Bug fixes

  • #3005: Symlink protection prevents use of caching in CI context. (@urbanautomaton)
  • #3037: Style/StringLiterals understands that a bare '#', not '#@variable' or '#{interpolation}', does not require double quotes. (@alexdowad)
  • #2722: Style/ExtraSpacing does not attempt to align an equals sign in an argument list with one in an assignment statement. (@alexdowad)
  • #3133: Style/MultilineMethodCallBraceLayout does not register offenses for single-line calls. (@alexdowad)
  • #3170: Style/MutableConstant does not infinite-loop when correcting an array with no brackets. (@alexdowad)
  • #3150: Fix auto-correct for Style/MultilineArrayBraceLayout. (@jspanjers)
  • #3192: Fix Lint/UnusedBlockArgument's IgnoreEmptyBlocks parameter from being removed from configuration. (@jfelchner)
  • #3114: Fix alignment end when auto-correcting Style/EmptyElse. (@rrosenblum)
  • #3120: Fix Lint/UselessAccessModifier reporting useless access modifiers inside {Class,Module,Struct}.new blocks. (@owst)
  • #3125: Fix Rails/UniqBeforePluck to ignore uniq with block. (@tejasbubane)
  • #3116: Style/SpaceAroundKeyword allows &. method calls after super and yield. (@segiddins)
  • #3131: Fix Style/ZeroLengthPredicate to ignore size and length variables. (@tejasbubane)
  • #3146: Fix NegatedIf and NegatedWhile to ignore double negations. (@natalzia-paperless)
  • #3140: Style/FrozenStringLiteralComment works with file doesn't have any tokens. (@pocke)
  • #3154: Fix handling of () in Style/RedundantParentheses. (@lumeet)
  • #3155: Fix Style/SpaceAfterNot reporting on the not keyword. (@NobodysNightmare)
  • #3160: Style/Lambda fix whitespacing when auto-correcting unparenthesized arguments. (@palkan)
  • #2944: Don't crash on strings that span multiple lines but only have one pair of delimiters in Style/StringLiterals. (@jonas054)
  • #3157: Don't let LineEndConcatenation and UnneededInterpolation make changes to the same string during auto-correct. (@jonas054)
  • #3187: Let Style/BlockDelimiters ignore blocks in all method arguments. (@jonas054)
  • Modify Style/ParallelAssignment to use implicit begins when parallel assignment uses a rescue modifier and is the only thing in the method. (@rrosenblum)
  • #3217: Fix output of ellipses for multi-line offense ranges in HTML formatter. (@jonas054)
  • #3207: Auto-correct modifier while/until and begin..end + while/until in Style/InfiniteLoop. (@jonas054)
  • #3202: Fix Style/EmptyElse registering wrong offenses and thus making RuboCop crash. (@deivid-rodriguez)
  • #3183: Ensure Style/SpaceInsideBlockBraces reports offenses for multi-line blocks. (@owst)
  • #3017: Fix Style/StringLiterals to register offenses on non-ascii strings. (@deivid-rodriguez)
  • #3056: Fix Style/StringLiterals to register offenses on non-ascii strings. (@deivid-rodriguez)
  • #2986: Fix RedundantBlockCall to not report calls that pass block arguments, or where the block has been overridden. (@owst)
  • #3223: Return can take many arguments. (@ptarjan)
  • #3239: Fix bug with --auto-gen-config and a file that does not exist. (@meganemura)
  • #3138: Fix RuboCop crashing when config file contains utf-8 characters and external encoding is not utf-8. (@deivid-rodriguez)
  • #3175: Generate 'Exclude' list for the cops with configurable enforced style to .rubocop_todo.yml if different styles are used. (@flexoid)
  • #3231: Make Rails/UniqBeforePluck more conservative. (@tjwp)

Changes

  • #3149: Make Style/HashSyntax configurable to not report hash rocket syntax for symbols ending with ? or ! when using ruby19 style. (@owst)
  • #1758: Let Style/ClosingParenthesisIndentation follow Style/AlignParameters configuration for method calls. (@jonas054)
  • #3224: Rename Style/DeprecatedHashMethods to Style/PreferredHashMethods. (@tejasbubane)

0.40.0 (2016-05-09)

New features

  • #2997: Performance/CaseWhenSplat can now identify multiple offenses in the same branch and offenses that do not occur as the first argument. (@rrosenblum)
  • #2928: Style/NestedParenthesizedCalls cop can auto-correct. (@drenmi)
  • Style/RaiseArgs cop can auto-correct. (@drenmi)
  • #2993: Style/SpaceAfterColon now checks optional keyword arguments. (@owst)
  • #3003: Read command line options from .rubocop file and RUBOCOP_OPTS environment variable. (@bolshakov)
  • #2857: Style/MultilineArrayBraceLayout enforced style is configurable and supports symmetrical and new_line options. (@panthomakos)
  • #2857: Style/MultilineHashBraceLayout enforced style is configurable and supports symmetrical and new_line options. (@panthomakos)
  • #2857: Style/MultilineMethodCallBraceLayout enforced style is configurable and supports symmetrical and new_line options. (@panthomakos)
  • #2857: Style/MultilineMethodDefinitionBraceLayout enforced style is configurable and supports symmetrical and new_line options. (@panthomakos)
  • #3052: Style/MultilineArrayBraceLayout enforced style supports same_line option. (@panthomakos)
  • #3052: Style/MultilineHashBraceLayout enforced style supports same_line option. (@panthomakos)
  • #3052: Style/MultilineMethodCallBraceLayout enforced style supports same_line option. (@panthomakos)
  • #3052: Style/MultilineMethodDefinitionBraceLayout enforced style supports same_line option. (@panthomakos)
  • #3019: Add new Style/EmptyCaseCondition cop. (@owst, @rrosenblum)
  • #3072: Add new Lint/UselessArraySplat cop. (@owst)
  • #3022: Style/Lambda enforced style supports literal option. (@drenmi)
  • #2909: Style/Lambda enforced style supports lambda option. (@drenmi)
  • #3092: Allow Style/Encoding to enforce using no encoding comments. (@NobodysNightmare)
  • New cop Rails/UniqBeforePluck checks that uniq is used before pluck. (@tjwp)

Bug fixes

  • #3112: Fix Style/ClassAndModuleChildren for nested classes with explicit superclass. (@jspanjers)
  • #3032: Fix autocorrecting parentheses for predicate methods without space before args. (@graemeboy)
  • #3000: Fix encoding crash on HTML output. (@gerrywastaken)
  • #2983: Style/AlignParameters message was clarified for with_fixed_indentation style. (@dylanahsmith)
  • #2314: Ignore UnusedBlockArgument for keyword arguments. (@volkert)
  • #2975: Make comment indentation before ) consistent with comment indentation before } or ]. (@jonas054)
  • #3010: Fix double reporting/correction of spaces after ternary operator colons (now only reported by Style/SpaceAroundOperators, and not Style/SpaceAfterColon too). (@owst)
  • #3006: Register an offense for calling merge! on a method on a variable inside each_with_object in Performance/RedundantMerge. (@lumeet, @rrosenblum)
  • #2886: Custom cop changes now bust the cache. (@ptarjan)
  • #3043: Style/SpaceAfterNot will now register an offense for a receiver that is wrapped in parentheses. (@rrosenblum)
  • #3039: Accept match without a receiver in Performance/EndWith. (@lumeet)
  • #3039: Accept match without a receiver in Performance/StartWith. (@lumeet)
  • #3048: Lint/NestedMethodDefinition shouldn't flag methods defined on Structs. (@owst)
  • #2912: Check whether a line is aligned with the following line if the preceding line is not an assignment. (@akihiro17)
  • #3036: Don't let Lint/UnneededDisable inspect files that are excluded for the cop. (@jonas054)
  • #2874: Fix bug when the closing parenthesis is preceded by a newline in array and hash literals in Style/RedundantParentheses. (@lumeet)
  • #3049: Make Lint/UselessAccessModifier detect conditionally defined methods and correctly handle dynamically defined methods and singleton class methods. (@owst)
  • #3004: Don't add Style/Alias offenses for use of alias in instance_eval blocks, since object instances don't respond to alias_method. (@magni-)
  • #3061: Custom cops now show up in --show-cops. (@ptarjan)
  • #3088: Ignore offenses that involve conflicting HEREDOCs in the Style/Multiline*BraceLayout cops. (@panthomakos)
  • #3083: Do not register an offense for splat block args in Style/SymbolProc. (@rrosenblum)
  • #3063: Don't auto-correct a + \ into a + \\ in Style/LineEndConcatenation. (@jonas054)
  • #3034: Report offenses for RuntimeError.new(msg) in Style/RedundantException. (@jonas054)
  • #3016: Style/SpaceAfterComma now uses Style/SpaceInsideHashLiteralBraces's setting. (@ptarjan)

Changes

  • #2995: Removed deprecated path matching syntax. (@gerrywastaken)
  • #3025: Removed deprecation warnings for rubocop-todo.yml. (@ptarjan)
  • #3028: Add define_method to the default list of IgnoredMethods of Style/SymbolProc. (@jastkand)
  • #3064: Style/SpaceAfterNot highlights the entire expression instead of just the exlamation mark. (@rrosenblum)
  • #3085: Enable Style/MultilineArrayBraceLayout and Style/MultilineHashBraceLayout with the symmetrical style by default. (@panthomakos)
  • #3091: Enable Style/MultilineMethodCallBraceLayout and Style/MultilineMethodDefinitionBraceLayout with the symmetrical style by default. (@panthomakos)
  • #1830: Style/PredicateName now ignores the spec/ directory, since there is a strong convention for using have_* and be_* helper methods in RSpec. (@gylaz)

0.39.0 (2016-03-27)

New features

  • Performance/TimesMap cop can auto-correct. (@lumeet)
  • Style/ZeroLengthPredicate cop can auto-correct. (@lumeet)
  • #2828: Style/ConditionalAssignment is now configurable to enforce assignment inside of conditions or to enforce assignment to conditions. (@rrosenblum)
  • #2862: Performance/Detect and Performance/Count have a new configuration SafeMode that is defaulted to true. These cops have known issues with Rails and other ORM frameworks. With this default configuration, these cops will not run if the Rails cops are enabled. (@rrosenblum)
  • Style/IfUnlessModifierOfIfUnless cop added. (@amuino)

Bug fixes

  • #2948: Style/SpaceAroundKeyword should allow yield[n] and super[n]. (@laurelfan)
  • #2950: Fix auto-correcting cases in which precedence has changed in Style/OneLineConditional. (@lumeet)
  • #2947: Fix auto-correcting if-then in Style/Next. (@lumeet)
  • #2904: Style/RedundantParentheses doesn't flag -(1.method) or +(1.method), since removing the parentheses would change the meaning of these expressions. (@alexdowad)
  • #2958: Style/MultilineMethodCallIndentation doesn't fail when inspecting unary ops which span multiple lines. (@alexdowad)
  • #2959: Lint/LiteralInInterpolation doesn't report offenses for iranges and eranges with non-literal endpoints. (@alexdowad)
  • #2960: Lint/AssignmentInCondition catches method assignments (like obj.attr = val) in a condition. (@alexdowad)
  • #2871: Second solution for possible encoding incompatibility when outputting an HTML report. (@jonas054)
  • #2967: Fix auto-correcting of ===, <=, and >= in Style/ConditionalAssignment. (@rrosenblum)
  • #2977: Fix auto-correcting of "#{$!}" in Style/SpecialGlobalVars. (@lumeet)
  • #2935: Make configuration loading work if SafeYAML.load is private. (@jonas054)

Changes

  • require: only does relative includes when it starts with a .. (@ptarjan)
  • Style/IfUnlessModifier does not trigger if the body is another conditional. (@amuino)
  • #2963: Performance/RedundantMerge will now register an offense inside of each_with_object. (@rrosenblum)

0.38.0 (2016-03-09)

New features

  • Style/UnlessElse cop can auto-correct. (@lumeet)
  • #2629: Add a new public API method, highlighted_area to offense. This method returns the range of the highlighted portion of an offense. (@rrosenblum)
  • Style/OneLineConditional cop can auto-correct. (@lumeet)
  • #2905: Style/ZeroLengthPredicate flags code like array.length < 1, 1 > array.length, and so on. (@alexdowad)
  • #2892: Lint/BlockAlignment cop can be configured to be stricter. (@ptarjan)
  • Style/Not is able to autocorrect in cases where parentheses must be added to preserve the meaning of an expression. (@alexdowad)
  • Style/Not auto-corrects comparison expressions by removing not and using the opposite comparison. (@alexdowad)

Bug fixes

  • Add require 'time' to remote_config.rb to avoid "undefined method `rfc2822'". (@necojackarc)
  • Replace Rake::TaskManager#last_comment with Rake::TaskManager#last_description for Rake 11 compatibility. (@tbrisker)
  • Fix false positive in Style/TrailingCommaInArguments & Style/TrailingCommaInLiteral cops with consistent_comma style. (@meganemura)
  • #2861: Fix false positive in Style/SpaceAroundKeyword for rescue(.... (@rrosenblum)
  • #2832: Style/MultilineOperationIndentation treats operations inside blocks inside other operations correctly. (@jonas054)
  • #2865: Change require: in config to be relative to the .rubocop.yml file itself. (@ptarjan)
  • #2845: Handle heredocs in Style/MultilineLiteralBraceLayout auto-correct. (@jonas054)
  • #2848: Handle comments inside arrays in Style/MultilineArrayBraceLayout auto-correct. (@jonas054)
  • Style/TrivialAccessors allows predicate methods by default. (@alexdowad)
  • #2869: Offenses which occur in the body of a when clause with multiple arguments will not be missed. (@alexdowad)
  • Lint/UselessAccessModifier recognizes method defs inside a begin block. (@alexdowad)
  • #2870: Lint/UselessAccessModifier recognizes method definitions which are passed as an argument to a method call. (@alexdowad)
  • #2859: Style/RedundantParentheses doesn't consider the parentheses in (!receiver.method arg) to be redundant, since they might change the meaning of an expression, depending on precedence. (@alexdowad)
  • #2852: Performance/Casecmp doesn't flag uses of downcase/upcase which are not redundant. (@alexdowad)
  • #2850: Style/FileName doesn't choke on empty files with spaces in their names. (@alexdowad)
  • #2834: When configured as ConsistentQuotesInMultiline: true, Style/StringLiterals doesn't error out when inspecting a heredoc with differing indentation across multiple lines. (@alexdowad)
  • #2876: Style/ConditionalAssignment behaves correctly when assignment statement uses a character which has a special meaning in a regex. (@alexdowad)
  • #2877: Style/SpaceAroundKeyword doesn't flag !super.method, !yield.method, and so on. (@alexdowad)
  • #2631: Style/Encoding can remove unneeded encoding comment when autocorrecting with when_needed style. (@alexdowad)
  • #2860: Fix false positive in Rails/Date when to_time is chained with safe method. (@palkan)
  • #2898: Lint/NestedMethodDefinition allows methods defined inside Class.new(S) blocks. (@segiddins)
  • #2894: Fix auto-correct an unless with a comparison operator. (@jweir)
  • #2911: Style/ClassAndModuleChildren doesn't flag nested class definitions, where the outer class has an explicit superclass (because such definitions can't be converted to compact style). (@alexdowad)
  • #2871: Don't crash when offense messages are read back from cache with ASCII-8BIT encoding and output as HTML or JSON. (@jonas054)
  • #2901: Don't crash when ENV['HOME'] is undefined. (@mikegee)
  • #2627: Style/BlockDelimiters does not flag blocks delimited by {} when a block call is the final value in a hash with implicit braces (one which is the last argument to an outer method call). (@alexdowad)

Changes

  • Update Rake to version 11. (@tbrisker)
  • #2629: Change the offense range for metrics cops to default to expression instead of keyword (the offense now spans the entire method, class, or module). (@rrosenblum)
  • #2891: Change the caching of remote configs to live alongside the parent file. (@Fryguy)
  • #2662: When setting options for Rake task, nested arrays can be used in the options, formatters, and requires arrays. (@alexdowad)
  • #2925: Bump unicode-display_width dependency to >= 1.0.1. (@jspanjers)
  • #2875: Style/SignalException does not flag calls to fail if a custom method named fail is defined in the same file. (@alexdowad)
  • #2923: Style/FileName considers file names which contain a ? or ! character to still be "snake case". (@alexdowad)
  • #2879: When autocorrecting, Lint/UnusedMethodArgument removes unused block arguments rather than simply prefixing them with an underscore. (@alexdowad)

0.37.2 (2016-02-11)

Bug fixes

  • Fix auto-correction of array and hash literals in Lint/LiteralInInterpolation. (@lumeet)
  • #2815: Fix missing assets for html formatter. (@prsimp)
  • Style/RedundantParentheses catches offenses involving the 2nd argument to a method call without parentheses, if the 2nd argument is a hash. (@alexdowad)
  • Style/RedundantParentheses catches offenses inside an array literal. (@alexdowad)
  • Style/RedundantParentheses doesn't flag method (:arg) {}, since removing the parentheses would change the meaning of the expression. (@alexdowad)
  • Performance/Detect doesn't flag code where first or last takes an argument, as it cannot be transformed to equivalent code using detect. (@alexdowad)
  • Style/SpaceAroundOperators ignores aref assignments. (@alexdowad)
  • Style/RescueModifier indents code correctly when auto-correcting. (@alexdowad)
  • Style/RedundantMerge indents code correctly when auto-correcting, even if the corrected hash had multiple keys, and even if the corrected code was indented to start with. (@alexdowad)
  • #2831: Performance/RedundantMerge doesn't break code by autocorrecting a #merge! call which occurs at tail position in a block. (@alexdowad)

Changes

  • Handle auto-correction of nested interpolations in Lint/LiteralInInterpolation. (@lumeet)
  • RuboCop results cache uses different directory names when there are many (or long) CLI options, to avoid a very long path which could cause failures on some filesystems. (@alexdowad)

0.37.1 (2016-02-09)

New features

  • #2798: Rails/FindEach cop works with where.not. (@pocke)
  • Style/MultilineBlockLayout can correct offenses which involve argument destructuring. (@alexdowad)
  • Style/SpaceAroundKeyword checks super nodes with no args. (@alexdowad)
  • Style/SpaceAroundKeyword checks defined? nodes. (@alexdowad)
  • #2719: Style/ConditionalAssignment handles correcting the alignment of end. (@rrosenblum)

Bug fixes

  • Fix auto-correction of not with parentheses in Style/Not. (@lumeet)
  • #2784: RuboCop can inspect super { ... } and super(arg) { ... }. (@alexdowad)
  • #2781: Performance/RedundantMerge doesn't flag calls to #update, since many classes have methods by this name (not only Hash). (@alexdowad)
  • #2780: Lint/DuplicateMethods does not flag method definitions inside dynamic Class.new blocks. (@alexdowad)
  • #2775: Style/SpaceAroundKeyword doesn't flag yield.method. (@alexdowad)
  • #2774: Style/SpaceAroundOperators doesn't flag calls to #[]. (@alexdowad)
  • #2772: RuboCop doesn't crash when AllCops section in configuration file is empty (rather, it displays a warning as intended). (@alexdowad)
  • #2737: Style/GuardClause handles elsif clauses correctly. (@alexdowad)
  • #2735: Style/MultilineBlockLayout doesn't cause an infinite loop by moving end onto the same line as the block args. (@alexdowad)
  • #2715: Performance/RedundantMatch doesn't flag calls to #match which take a block. (@alexdowad)
  • #2704: Lint/NestedMethodDefinition doesn't flag singleton defs which define a method on the value of a local variable. (@alexdowad)
  • #2660: Style/TrailingUnderscoreVariable shows recommended code in its offense message. (@alexdowad)
  • #2671: Style/WordArray doesn't attempt to inspect strings with invalid encoding, to avoid failing with an encoding error. (@alexdowad)

Changes

  • #2739: Change the configuration option when_needed in Style/FrozenStringLiteralComment to add a frozen_string_literal comment to all files when the TargetRubyVersion is set to 2.3+. (@rrosenblum)

0.37.0 (2016-02-04)

New features

  • #2620: New cop Style/ZeroLengthPredicate checks for object.size == 0 and variants, and suggests replacing them with an appropriate empty? predicate. (@drenmi)
  • #2657: Floating headers in HTML output. (@mattparlane)
  • Add new Style/SpaceAroundKeyword cop. (@lumeet)
  • #2745: New cop Style/MultilineHashBraceLayout checks that the closing brace in a hash literal is symmetrical with respect to the opening brace and the hash elements. (@panthomakos)
  • #2761: New cop Style/MultilineMethodDefinitionBraceLayout checks that the closing brace in a method definition is symmetrical with respect to the opening brace and the method parameters. (@panthomakos)
  • #2699: Performance/Casecmp can register offenses when str.downcase or str.upcase are passed to an equality method. (@rrosenblum)
  • #2766: New cop Style/MultilineMethodCallBraceLayout checks that the closing brace in a method call is symmetrical with respect to the opening brace and the method arguments. (@panthomakos)
  • Style/Semicolon can autocorrect useless semicolons at the beginning of a line. (@alexdowad)

Bug fixes

  • #2723: Fix NoMethodError in Style/GuardClause. (@drenmi)
  • #2674: Also check for Hash#update alias in Performance/RedundantMerge. (@drenmi)
  • #2630: Take frozen string literals into account in Style/MutableConstant. (@segiddins)
  • #2642: Support assignment via ||= in Style/MutableConstant. (@segiddins)
  • #2646: Fix auto-correcting assignment to a constant in Style/ConditionalAssignment. (@segiddins)
  • #2614: Check for zero return value from casecmp in Performance/casecmp. (@segiddins)
  • #2647: Allow xstr interpolations in Lint/LiteralInInterpolation. (@segiddins)
  • Report a violation when freeze is called on a frozen string literal in Style/RedundantFreeze. (@segiddins)
  • #2641: Fix crashing on empty methods with block args in Performance/RedundantBlockCall. (@segiddins)
  • Lint/DuplicateMethods doesn't crash when class_eval is used with an implicit receiver. (@lumeet)
  • #2654: Fix handling of unary operations in Style/RedundantParentheses. (@lumeet)
  • #2661: Style/Next doesn't crash when auto-correcting modifier if/unless. (@lumeet)
  • #2665: Make specs pass when running on Windows. (@jonas054)
  • #2691: Do not register an offense in Performance/TimesMap for calling map or collect on a variable named times. (@rrosenblum)
  • #2689: Change Performance/RedundantBlockCall to respect parentheses usage. (@rrosenblum)
  • #2694: Fix caching when using a different JSON gem such as Oj. (@georgyangelov)
  • #2707: Change Lint/NestedMethodDefinition to respect Class.new and Module.new. (@owst)
  • #2701: Do not consider assignments to the same variable as useless if later assignments are within a loop. (@owst)
  • #2696: Style/NestedModifier adds parentheses around a condition when needed. (@lumeet)
  • #2666: Fix bug when auto-correcting symbol literals in Lint/LiteralInInterpolation. (@lumeet)
  • #2664: Performance/Casecmp can auto-correct case comparison to variables and method calls without error. (@rrosenblum)
  • #2729: Fix handling of hash literal as the first argument in Style/RedundantParentheses. (@lumeet)
  • #2703: Handle byte order mark in Style/IndentationWidth, Style/ElseAlignment, Lint/EndAlignment, and Lint/DefEndAlignment. (@jonas054)
  • #2710: Fix handling of fullwidth characters in some cops. (@seikichi)
  • #2690: Fix alignment of operands that are part of an assignment in Style/MultilineOperationIndentation. (@jonas054)
  • #2228: Use the config of a related cop whether it's enabled or not. (@madwort)
  • #2721: Do not register an offense for constants wrapped in parentheses passed to rescue in Style/RedundantParentheses. (@rrosenblum)
  • #2742: Fix Style/TrailingCommaInArguments & Style/TrailingCommaInLiteral for inline single element arrays. (@annih)
  • #2768: Allow parentheses after keyword not in Style/MethodCallParentheses. (@lumeet)
  • #2758: Allow leading underscores in camel case variable names.(@mmcguinn)

Changes

  • Remove Style/SpaceAfterControlKeyword and Style/SpaceBeforeModifierKeyword as the more generic Style/SpaceAroundKeyword handles the same cases. (@lumeet)
  • Handle comparisons with != in Performance/casecmp. (@segiddins)
  • #2684: Do not base Style/FrozenStringLiteralComment on the version of Ruby that is running. (@rrosenblum)
  • #2732: Change the default style of Style/SignalException to only_raise. (@bbatsov)

0.36.0 (2016-01-14)

New features

  • #2598: New cop Lint/RandOne checks for rand(1), Kernel.rand(1.0) and similar calls. Such call are most likely a mistake because they always return 0. (@DNNX)
  • #2590: New cop Performance/DoubleStartEndWith checks for two start_with? (or end_with?) calls joined by || with the same receiver, like str.start_with?('x') || str.start_with?('y') and suggests using one call instead: str.start_with?('x', 'y'). (@DNNX)
  • #2583: New cop Performance/TimesMap checks for x.times.map{} and suggests replacing them with Array.new(x){}. (@DNNX)
  • #2581: New cop Lint/NextWithoutAccumulator finds bare next in reduce/inject blocks which assigns nil to the accumulator. (@mvidner)
  • #2529: Add EnforcedStyle config parameter to IndentArray. (@jawshooah)
  • #2479: Add option AllowHeredoc to Metrics/LineLength. (@fphilipe)
  • #2416: New cop Style/ConditionalAssignment checks for assignment of the same variable in all branches of conditionals and replaces them with a single assignment to the return of the conditional. (@rrosenblum)
  • #2410: New cop Style/IndentAssignment checks the indentation of the first line of the right-hand-side of a multi-line assignment. (@panthomakos)
  • #2431: Add IgnoreExecutableScripts option to Style/FileName. (@sometimesfood)
  • #2460: New cop Style/UnneededInterpolation checks for strings that are just an interpolated expression. (@cgriego)
  • #2361: Style/MultilineAssignmentLayout cop checks for a newline after the assignment operator in a multi-line assignment. (@panthomakos)
  • #2462: Lint/UselessAccessModifier can catch more types of useless access modifiers. (@alexdowad)
  • #1677: Add new Performance/Casecmp cop. (@alexdowad)
  • #1677: Add new Performance/RangeInclude cop. (@alexdowad)
  • #1677: Add new Performance/RedundantSortBy cop. (@alexdowad)
  • #1677: Add new Performance/LstripRstrip cop. (@alexdowad)
  • #1677: Add new Performance/StartWith cop. (@alexdowad)
  • #1677: Add new Performance/EndWith cop. (@alexdowad)
  • #1677: Add new Performance/RedundantMerge cop. (@alexdowad)
  • Lint/Debugger cop can now auto-correct offenses. (@alexdowad)
  • #1677: Add new Performance/RedundantMatch cop. (@alexdowad)
  • #1677: Add new Performance/RedundantBlockCall cop. (@alexdowad)
  • #1954: Lint/UnneededDisable can now autocorrect. (@alexdowad)
  • #2501: Add new Lint/ImplicitStringConcatenation cop. (@alexdowad)
  • Add new Style/RedundantParentheses cop. (@lumeet)
  • #1346: Style/SpecialGlobalVars can be configured to use either use_english_names or use_perl_names styles. (@alexdowad)
  • #2426: New Style/NestedParenthesizedCalls cop checks for non-parenthesized method calls nested inside a parenthesized call, like method1(method2 arg). (@alexdowad)
  • #2502: The --stdin and --auto-correct CLI options can be combined, and if you do so, corrected code is printed to stdout. (@alexdowad)
  • Style/ConditionalAssignment works on conditionals with a common aref assignment (like array[index] = val) or attribute assignment (like self.attribute = val). (@alexdowad)
  • #2476: Style/GuardClause catches if..else nodes with one branch which terminates the execution of the current scope. (@alexdowad)
  • New Style/IdenticalConditionalBranches flags if..else and case..when..else constructs with an identical line at the end of each branch. (@alexdowad)
  • #207: Add new Lint/FloatOutOfRange cop which catches floating-point literals which are too large or too small for Ruby to represent. (@alexdowad)
  • Style/GuardClause doesn't report offenses in places where correction would make a line too long. (@alexdowad)
  • Lint/DuplicateMethods can find duplicate method definitions in many more circumstances, even across multiple files; however, it ignores definitions inside if or something which could be a DSL method. (@alexdowad)
  • A warning is printed if an invalid EnforcedStyle is configured. (@alexdowad)
  • #1367: New Lint/IneffectiveAccessModifier checks for access modifiers which are erroneously applied to a singleton method, where they have no effect. (@alexdowad)
  • #1614: Lint/BlockAlignment aligns block end with splat operator when applied to a splatted method call. (@alexdowad)
  • #2263: Warn if task.options = %w(--format ...) is used when configuring RuboCop::RakeTask; this should be task.formatters = ... instead. (@alexdowad)
  • #2511: --no-offense-counts CLI option suppresses the inclusion of offense count lines in auto-generated config. (@alexdowad)
  • #2504: New AllowForAlignment config parameter for Style/SingleSpaceBeforeFirstArg allows the insertion of extra spaces before the first argument if it aligns it with something on the preceding or following line. (@alexdowad)
  • #2478: Style/ExtraSpacing has new ForceEqualSignAlignment config parameter which forces = signs on consecutive lines to be aligned, and it can auto-correct. (@alexdowad)
  • Lint/BlockAlignment aligns block end with unary operators like ~, -, or ! when such operators are applied to the method call taking the block. (@alexdowad)
  • #1460: Style/Alias supports both prefer_alias and prefer_alias_method styles. (@alexdowad)
  • #1569: New ExpectMatchingDefinition config parameter for Style/FileName makes it check for a class or module definition in each file which corresponds to the file name and path. (@alexdowad)
  • #2480: Add a configuration to Style/ConditionalAssignment to check and correct conditionals that contain multiple assignments. (@rrosenblum)
  • #2480: Allow Style/ConditionalAssignment to correct assignment in ternary operations. (@rrosenblum)
  • #2480: Allow Style/ConditionalAssignment to correct comparable methods. (@rrosenblum)
  • #1633: New cop Style/MultilineMethodCallIndentation takes over the responsibility for checking alignment of methods from the Style/MultilineOperationIndentation cop. (@jonas054)
  • #2472: New cop Style/MultilineArrayBraceLayout checks that the closing brace in an array literal is symmetrical with respect to the opening brace and the array elements. (@panthomakos)
  • #1543: Style/WordArray has both percent and brackets (which enforces the use of bracketed arrays for strings) styles. (@alexdowad)
  • Style/SpaceAroundOperators has AllowForAlignment config parameter which allows extra spaces on the left if they serve to align the operator with another. (@alexdowad)
  • Style/SymbolArray has both percent and brackets (which enforces the user of bracketed arrays for symbols) styles. (@alexdowad)
  • #2343: Entire cop types (or "departments") can be disabled using in .rubocop.yml using config like Style: Enabled: false. (@alexdowad)
  • #2399: New start_of_line style for Lint/EndAlignment aligns a closing end keyword with the start of the line where the opening keyword appears. (@alexdowad)
  • #1545: New Regex config parameter for Style/FileName allows user to provide their own regex for validating file names. (@alexdowad)
  • #2253: New DefaultFormatter config parameter can be used to set formatter from within .rubocop.yml. (@alexdowad)
  • #2481: New WorstOffendersFormatter prints a list of files with offenses (and offense counts), showing the files with the most offenses first. (@alexdowad)
  • New IfInsideElse cop catches if..end nodes which can be converted into an elsif instead, reducing the nesting level. (@alexdowad)
  • #1725: --color CLI option forces color output, even when not printing to a TTY. (@alexdowad)
  • #2549: New ConsistentQuotesInMultiline config param for Style/StringLiterals forces all literals which are concatenated using \ to use the same quote style. (@alexdowad)
  • #2560: Style/AccessModifierIndentation, Style/CaseIndentation, Style/FirstParameterIndentation, Style/IndentArray, Style/IndentAssignment, Style/IndentHash, Style/MultilineMethodCallIndentation, and Style/MultilineOperationIndentation all have a new IndentationWidth parameter which can be used to override the indentation width from Style/IndentationWidth. (@alexdowad)
  • Add new Performance/HashEachMethods cop. (@ojab)
  • New cop Style/FrozenStringLiteralComment will check for and add the comment # frozen_string_literal: true to the top of files. This will help with upgrading to Ruby 3.0. (@rrosenblum)

Bug Fixes

  • #2594: Style/EmptyLiteral autocorrector respects Style/StringLiterals:EnforcedStyle config. (@DNNX)
  • #2411: Make local inherited configuration override configuration loaded from gems. (@jonas054)
  • #2413: Allow %Q for dynamic strings with double quotes inside them. (@jonas054)
  • #2404: Style/Next does not remove comments when auto-correcting. (@lumeet)
  • Style/Next handles auto-correction of nested offenses. (@lumeet)
  • Style/VariableInterpolation now detects non-numeric regex back references. (@cgriego)
  • ProgressFormatter fully respects the --no-color switch. (@savef)
  • Replace Time.zone.current with Time.current on Rails::TimeZone cop message. (@volmer)
  • #2451: Style/StabbyLambdaParentheses does not treat method calls named lambda as lambdas. (@domcleal)
  • #2463: Allow comments before an access modifier. (@codebeige)
  • #2471: Style/MethodName doesn't choke on methods which are defined inside methods. (@alexdowad)
  • #2449: Style/StabbyLambdaParentheses only checks lambdas in the arrow form. (@lumeet)
  • #2456: Lint/NestedMethodDefinition doesn't register offenses for method definitions inside an eval block (either instance_eval, class_eval, or module_eval). (@alexdowad)
  • #2464: Style/ParallelAssignment understands aref and attribute assignments, and doesn't warn if they can't be correctly rearranged into a series of single assignments. (@alexdowad)
  • #2482: Style/AndOr doesn't raise an exception when trying to autocorrect !variable or .... (@alexdowad)
  • #2446: Style/Tab doesn't register errors for leading tabs which occur inside a string literal (including heredoc). (@alexdowad)
  • #2452: Style/TrailingComma incorrectly categorizes single-line hashes in methods calls. (@panthomakos)
  • #2441: Style/AlignParameters doesn't crash if it finds nested offenses. (@alexdowad)
  • #2436: Style/SpaceInsideHashLiteralBraces doesn't mangle a hash literal which is not surrounded by curly braces, but has another hash literal which does as its first key. (@alexdowad)
  • #2483: Style/Attr differentiate between attr_accessor and attr_reader. (@weh)
  • Style/ConditionalAssignment doesn't crash if it finds a case with an empty branch. (@lumeet)
  • #2506: Lint/FormatParameterMismatch understands %{} and %<> interpolations. (@alexdowad)
  • #2145: Lint/ParenthesesAsGroupedExpression ignores calls with multiple arguments, since they are not ambiguous. (@alexdowad)
  • #2484: Remove two vulnerabilities in cache handling. (@jonas054)
  • #2517: Lint/UselessAccessModifier doesn't think that an access modifier applied to attr_writer is useless. (@alexdowad)
  • #2518: Style/ConditionalAssignment doesn't think that branches using << and []= should be combined. (@alexdowad)
  • CharacterLiteral auto-corrector now properly corrects ?'. (@bfontaine)
  • #2313: Rails/FindEach doesn't break code which uses order(...).each, limit(...).each, and so on. (@alexdowad)
  • #1938: Rails/FindBy doesn't autocorrect where(...).first to find_by, since the returned record is often different. (@alexdowad)
  • #1801: EmacsFormatter strips newlines out of error messages, if there are any. (@alexdowad)
  • #2534: Style/RescueEnsureAlignment works on rescue nested inside a class or module block. (@alexdowad)
  • Lint/BlockAlignment does not refer to a block terminator as end when it is actually }. (@alexdowad)
  • #2540: Lint/FormatParameterMismatch understands format specifiers with multiple flags. (@alexdowad)
  • #2538: Style/SpaceAroundOperators doesn't eat newlines. (@alexdowad)
  • #2531: Style/AndOr autocorrects in cases where parentheses must be added, even inside a nested begin node. (@alexdowad)
  • #2450: Style/Next adjusts indentation when auto-correcting, to avoid introducing new offenses. (@alexdowad)
  • #2066: Style/TrivialAccessors doesn't flag what appear to be trivial accessor method definitions, if they are nested inside a call to instance_eval. (@alexdowad)
  • Style/SymbolArray doesn't flag arrays of symbols if a symbol contains a space character. (@alexdowad)
  • Style/SymbolArray can auto-correct offenses. (@alexdowad)
  • #2546: Report when two rubocop:disable comments (not the single line kind) for a given cop apppear in a file with no rubocop:enable in between. (@jonas054)
  • #2552: Style/Encoding can auto-correct files with a blank first line. (@alexdowad)
  • #2556: Style/SpecialGlobalVariables generates auto-config correctly. (@alexdowad)
  • #2565: Let Style/SpaceAroundOperators leave spacing around => to Style/AlignHash. (@jonas054)
  • #2569: Style/MethodCallParentheses doesn't register warnings for object.() syntax, since it is handled by Style/LambdaCall. (@alexdowad)
  • #2570: Performance/RedundantMerge doesn't break code with a modifier if when autocorrecting. (@alexdowad)
  • Performance/RedundantMerge doesn't break code with a modifier while or until when autocorrecting. (@alexdowad)
  • #2574: variable style for Lint/EndAlignment is working again. (@alexdowad)
  • Lint/EndAlignment can autocorrect offenses on the RHS of an assignment to an instance variable, class variable, constant, and so on; previously, it only worked if the LHS was a local variable. (@alexdowad)
  • #2580: Style/StringReplacement doesn't break code when autocorrection involves a regex with embedded escapes (like /\n/). (@alexdowad)
  • #2582: Style/AlignHash doesn't move a key so far left that it goes onto the previous line (in an attempt to align). (@alexdowad)
  • #2588: Style/SymbolProc doesn't break code when autocorrecting a method call with a trailing comma in the argument list. (@alexdowad)
  • #2448: Style/TrailingCommaInArguments and Style/TrailingCommaInLiteral don't special-case single-item lists in a way which contradicts the documentation. (@alexdowad)
  • Fix for remote config files to only load from on http and https URLs. (@ptrippett)
  • #2604: Style/FileName doesn't fail on empty files when ExpectMatchingDefinition is true. (@alexdowad)
  • Style/RedundantFreeze registers offences for frozen dynamic symbols. (@segiddins)
  • #2609: All cops which rely on the AutocorrectUnlessChangingAST module can now autocorrect files which contain __FILE__. (@alexdowad)
  • #2608: Style/ConditionalAssignment can autocorrect =~ within a ternary expression. (@alexdowad)

Changes

  • #2427: Allow non-snake-case file names (e.g. some-random-script) for Ruby scripts that have a shebang. (@sometimesfood)
  • #2430: Lint/UnneededDisable now adds "unknown cop" to messages if cop names in rubocop:disable comments are unrecognized, or "did you mean ..." if they are misspelled names of existing cops. (@jonas054)
  • #947: Style/Documentation considers classes and modules which only define constants to be "namespaces", and doesn't flag them for lack of a documentation comment. (@alexdowad)
  • #2467: Explicitly inheriting configuration from the rubocop gem in .rubocop.yml is not allowed. (@alexdowad)
  • #2322: Output of --auto-gen-config shows content of default config parameters which are Arrays; this is especially useful for SupportedStyles. (@alexdowad)
  • #1566: When autocorrecting on Windows, line endings are not converted to "\r\n" in untouched portions of the source files; corrected portions may use "\n" rather than "\r\n". (@alexdowad)
  • New rake repl task can be used for experimentation when working on RuboCop. (@alexdowad)
  • Lint/SpaceBeforeFirstArg cop has been removed, since it just duplicates Style/SingleSpaceBeforeFirstArg. (@alexdowad)
  • Style/SingleSpaceBeforeFirstArg cop has been renamed to Style/SpaceBeforeFirstArg, which more accurately reflects what it now does. (@alexdowad)
  • Style/UnneededPercentQ reports %q() strings with what only appears to be an escape, but is not really (there are no escapes in %q() strings). (@alexdowad)
  • Performance/StringReplacement, Performance\StartWith, and Performance\EndWith more accurately identify code which can be improved. (@alexdowad)
  • The MultiSpaceAllowedForOperators config parameter for Style/SpaceAroundOperators has been removed, as it is made redundant by AllowForAlignment. If someone attempts to use it, config validation will fail with a helpful message. (@alexdowad)
  • The RunRailsCops config parameter in .rubocop.yml is now obsolete. If someone attempts to use it, config validation will fail with a helpful message. (@alexdowad)
  • If .rubocop.yml contains configuration for a custom cop, no warning regarding "unknown cop" will be printed. The custom cop must inherit from RuboCop::Cop::Cop, and must be loaded into memory for this to work. (@alexdowad)
  • #2102: If .rubocop.yml exists in the working directory when running --auto-gen-config, any Exclude config parameters in .rubocop.yml will be merged into the generated .rubocop_todo.yml. (@alexdowad)
  • #1895: Remove Rails/DefaultScope cop. (@alexdowad)
  • #2550: New TargetRubyVersion configuration parameter can be used to specify which version of the Ruby interpreter the inspected code is intended to run on. (@alexdowad)
  • #2557: Style/GuardClause does not warn about if nodes whose condition spans multiple lines. (@alexdowad)
  • Style/EmptyLinesAroundClassBody, Style/EmptyLinesAroundModuleBody, and Style/EmptyLinesAroundBlockBody accept an empty body with no blank line, even if configured to empty_lines style. This is because the empty lines only serve to provide a break between the header, body, and footer, and are redundant if there is no body. (@alexdowad)
  • #2554: Style/FirstMethodArgumentLineBreak handles implicit hash arguments without braces; Style/FirstHashElementLineBreak still handles those with braces. (@alexdowad)
  • Style/TrailingComma has been split into Style/TrailingCommaInArguments and Style/TrailingCommaInLiteral. (@alexdowad)
  • RuboCop returns process exit code 2 if it fails due to bad configuration, bad CLI options, or an internal error. If it runs successfully but finds one or more offenses, it still exits with code 1, as was previously the case. This is helpful when invoking RuboCop programmatically, perhaps from a script. (@alexdowad)

0.35.1 (2015-11-10)

Bug Fixes

  • #2407: Use Process.uid rather than Etc.getlogin for simplicity and compatibility. (@jujugrrr)

0.35.0 (2015-11-07)

New features

  • #2028: New config ExtraDetails supports addition of Details param to all cops to allow extra details on offense to be displayed. (@tansaku)
  • #2036: New cop Style/StabbyLambdaParentheses will find and correct cases where a stabby lambda's parameters are not wrapped in parentheses. (@hmadison)
  • #2246: Style/TrailingUnderscoreVariable will now register an offense for *_. (@rrosenblum)
  • #2246: Style/TrailingUnderscoreVariable now has a configuration to remove named underscore variables (Defaulted to false). (@rrosenblum)
  • #2276: New cop Performance/FixedSize will register an offense when calling length, size, or count on statically sized objected (strings, symbols, arrays, and hashes). (@rrosenblum)
  • New cop Style/NestedModifier checks for nested if, unless, while and until modifier statements. (@lumeet)
  • #2270: Add a new inherit_gem configuration to inherit a config file from an installed gem (originally requested in #290). (@jhansche)
  • Allow StyleGuide parameters in local configuration for all cops, so users can add references to custom style guide documents. (@cornelius)
  • UnusedMethodArgument cop allows configuration to skip keyword arguments. (@apiology)
  • #2318: Lint/Debugger cop now checks for Pry.rescue. (@rrosenblum)
  • #2277: New cop Style/FirstArrayElementLineBreak checks for a line break before the first element in a multi-line array. (@panthomakos)
  • #2277: New cop Style/FirstHashElementLineBreak checks for a line break before the first element in a multi-line hash. (@panthomakos)
  • #2277: New cop Style/FirstMethodArgumentLineBreak checks for a line break before the first argument in a multi-line method call. (@panthomakos)
  • #2277: New cop Style/FirstMethodParameterLineBreak checks for a line break before the first parameter in a multi-line method parameter definition. (@panthomakos)
  • Add Rails/PluralizationGrammar cop, checks for incorrect grammar when using methods like 3.day.ago, when you should write 3.days.ago. (@maxjacobson)
  • #2347: Lint/Eval cop does not warn about "security risk" when eval argument is a string literal without interpolations. (@alexdowad)
  • #2335: Style/VariableName cop checks naming style of method parameters. (@alexdowad)
  • #2329: New style braces_for_chaining for Style/BlockDelimiters cop enforces braces on a multi-line block if its return value is being chained with another method. (@panthomakos)
  • Lint/LiteralInCondition warns if a symbol or dynamic symbol is used as a condition. (@alexdowad)
  • #2369: Style/TrailingComma doesn't add a trailing comma to a multiline method chain which is the only arg to a method call. (@alexdowad)
  • CircularArgumentReference cop updated to lint for ordinal circular argument references on top of optional keyword arguments. (@maxjacobson)
  • Added ability to download shared rubocop config files from remote urls. (@ptrippett)
  • #1601: Add IgnoreEmptyMethods config parameter for Lint/UnusedMethodArgument and IgnoreEmptyBlocks config parameter for Lint/UnusedBlockArgument cops. (@alexdowad)
  • #1729: Style/MethodDefParentheses supports new 'require_no_parentheses_except_multiline' style. (@alexdowad)
  • #2173: Style/AlignParameters also checks parameter alignment for method definitions. (@alexdowad)
  • #1825: New NameWhitelist configuration parameter for Style/PredicateName can be used to suppress errors on known-good predicate names. (@alexdowad)
  • Style/Documentation recognizes 'Constant = Class.new' as a class definition. (@alexdowad)
  • #1608: Add new 'align_braces' style for Style/IndentHash. (@alexdowad)
  • Style/Next can autocorrect. (@alexdowad)

Bug Fixes

  • #2265: Handle unary + in ExtraSpacing cop. (@jonas054)
  • #2275: Copy default Exclude into Exclude lists in .rubocop_todo.yml. (@jonas054)
  • Style/IfUnlessModifier accepts blocks followed by a chained call. (@lumeet)
  • #2261: Make relative Exclude paths in $HOME/.rubocop_todo.yml be relative to current directory. (@jonas054)
  • #2286: Handle auto-correction of empty method when AllowIfMethodIsEmpty is false in Style/SingleLineMethods. (@jonas054)
  • #2246: Do not register an offense for Style/TrailingUnderscoreVariable when the underscore variable is preceded by a splat variable. (@rrosenblum)
  • #2292: Results should not be stored in the cache if affected by errors (crashes). (@jonas054)
  • #2280: Avoid reporting space between hash literal keys and values in Style/ExtraSpacing. (@jonas054)
  • #2284: Fix result cache being shared between ruby versions. (@miquella)
  • #2285: Fix ConfigurableNaming#class_emitter_method? error when handling singleton class methods. (@palkan)
  • #2295: Fix Performance/Detect autocorrect to handle rogue newlines. (@palkan)
  • #2294: Do not register an offense in Performance/StringReplacement for regex with options. (@rrosenblum)
  • Fix Style/UnneededPercentQ condition for single-quoted literal containing interpolation-like string. (@eagletmt)
  • #2324: Handle --only Lint/Syntax and --except Lint/Syntax correctly. (@jonas054)
  • #2317: Handle case as an argument correctly in Lint/EndAlignment. (@lumeet)
  • #2287: Fix auto-correct of lines with only whitespace in Style/IndentationWidth. (@lumeet)
  • #2331: Do not register an offense in Performance/Size for count with an argument. (@rrosenblum)
  • Handle a backslash at the end of a line in Style/SpaceAroundOperators. (@lumeet)
  • Don't warn about lack of "leading space" in a =begin/=end comment. (@alexdowad)
  • #2307: In Lint/FormatParameterMismatch, don't register an offense if either argument to % is not a literal. (@alexdowad)
  • #2356: Style/Encoding will now place the encoding comment on the second line if the first line is a shebang. (@rrosenblum)
  • Style/InitialIndentation cop doesn't error out when a line begins with an integer literal. (@alexdowad)
  • #2296: In Style/DotPosition, don't "correct" (and break) a method call which has a line comment (or blank line) between the dot and the selector. (@alexdowad)
  • #2272: Lint/NonLocalExitFromIterator does not warn about return in a block which is passed to Module#define_method. (@alexdowad)
  • #2262: Replace Rainbow reference with Colorizable#yellow. (@minustehbare)
  • #2068: Display warning if Style/Copyright is misconfigured. (@alexdowad)
  • #2321: In Style/EachWithObject, don't replace reduce with each_with_object if the accumulator parameter is assigned to in the block. (@alexdowad)
  • #1981: Lint/UselessAssignment doesn't erroneously identify assignments in identical if branches as useless. (@alexdowad)
  • #2323: Style/IfUnlessModifier cop parenthesizes autocorrected code when necessary due to operator precedence, to avoid changing its meaning. (@alexdowad)
  • #2003: Make Lint/UnneededDisable work with --auto-correct. (@jonas054)
  • Default RuboCop cache dir moved to per-user folders. (@br3nda)
  • #2393: Style/MethodCallParentheses doesn't fail on obj.method ||= func(). (@alexdowad)
  • #2344: When autocorrecting, Style/ParallelAssignment reorders assignment statements, if necessary, to avoid breaking code. (@alexdowad)
  • Style/MultilineOperationAlignment does not try to align the receiver and selector of a method call if both are on the LHS of an assignment. (@alexdowad)

Changes

  • #2194: Allow any options with --auto-gen-config. (@agrimm)

0.34.2 (2015-09-21)

Bug Fixes

  • #2232: Fix false positive in Lint/FormatParameterMismatch for argument with splat operator. (@dreyks)
  • #2237: Allow Lint/FormatParameterMismatch to be called using Kernel.format and Kernel.sprintf. (@rrosenblum)
  • #2234: Do not register an offense for Lint/FormatParameterMismatch when the format string is a variable. (@rrosenblum)
  • #2240: Lint/UnneededDisable should not report non-Lint rubocop:disable comments when running rubocop --lint. (@jonas054)
  • #2121: Allow space before values in hash literals in Style/ExtraSpacing to avoid correction conflict. (@jonas054)
  • #2241: Read cache in binary format. (@jonas054)
  • #2247: Fix auto-correct of Performance/CaseWhenSplat for percent arrays (%w, %W, %i, and %I). (@rrosenblum)
  • #2244: Disregard annotation keywords in Style/CommentAnnotation if they don't start a comment. (@jonas054)
  • #2257: Fix bug where Style/RescueEnsureAlignment will register an offense for rescue and ensure on the same line. (@rrosenblum)
  • #2255: Refine the offense highlighting for Style/SymbolProc. (@bbatsov)
  • #2260: Make Exclude in .rubocop_todo.yml work when running from a subdirectory. (@jonas054)

Changes

  • #2248: Allow block-pass in Style/AutoResourceCleanup. (@lumeet)
  • #2258: Style/Documentation will exclude test directories by default. (@rrosenblum)
  • #2260: Disable Style/StringMethods by default. (@bbatsov)

0.34.1 (2015-09-09)

Bug Fixes

  • #2212: Handle methods without parentheses in auto-correct. (@karreiro)
  • #2214: Fix File name too long error when STDIN option is provided. (@mrfoto)
  • #2217: Allow block arguments in Style/SymbolProc. (@lumeet)
  • #2213: Write to cache with binary encoding to avoid transcoding exceptions in some locales. (@jonas054)
  • #2218: Fix loading config error when safe yaml is only partially loaded. (@maxjacobson)
  • #2161: Allow an explicit receiver (except Kernel) in Style/SignalException. (@lumeet)

0.34.0 (2015-09-05)

New features

  • #2143: New cop Performance/CaseWhenSplat will identify and rearange case when statements that contain a when condition with a splat. (@rrosenblum)
  • New cop Lint/DuplicatedKey checks for duplicated keys in hashes, which Ruby 2.2 warns against. (@sliuu)
  • #2106: Add SuspiciousParamNames option to Style/OptionHash. (@wli)
  • #2193: Style/Next supports more Enumerable methods. (@rrosenblum)
  • #2179: Add --list-target-files option to CLI, which prints the files which will be inspected. (@maxjacobson)
  • New cop Style/MutableConstant checks for assignment of mutable objects to constants. (@bbatsov)
  • New cop Style/RedudantFreeze checks for usages of Object#freeze on immutable objects. (@bbatsov)
  • #1924: New option --cache and configuration parameter AllCops: UseCache turn result caching on (default) or off. (@jonas054)
  • #2204: New cop Style/StringMethods will check for preferred method to_sym over intern. (@imtayadeway)

Changes

  • #1351: Allow class emitter methods in Style/MethodName. (@jonas054)
  • #2126: Style/RescueModifier can now auto-correct. (@rrosenblum)
  • #2109: Allow alignment with a token on the nearest line with same indentation in Style/ExtraSpacing. (@jonas054)
  • Lint/EndAlignment handles the case keyword. (@lumeet)
  • #2146: Add STDIN support. (@caseywebdev)
  • #2175: Files that are excluded from a cop (e.g. using the Exclude: config option) are no longer being processed by that cop. (@bquorning)
  • Rails/ActionFilter now handles complete list of methods found in the Rails 4.2 release notes. (@MGerrior)
  • *2138: Change the offense in Style/Next to highlight the condition instead of the iteration. (@rrosenblum)
  • Style/EmptyLineBetweenDefs now handles class methods as well. (@unmanbearpig)
  • Improve handling of super in Style/SymbolProc. (@lumeet)
  • Style/SymbolProc is applied to methods receiving arguments. (@lumeet)
  • #1839: Remove Rainbow monkey patching of String which conflicts with other gems like colorize. (@daviddavis)
  • Style/HashSyntax is now a bit faster when checking Ruby 1.9 syntax hash keys. (@bquorning)
  • Lint/DeprecatedClassMethods is now a whole lot faster. (@bquorning)
  • Lint/BlockAlignment, Style/IndentationWidth, and Style/MultilineOperationIndentation are now quite a bit faster. (@bquorning)

Bug Fixes

  • #2123: Fix handing of dynamic widths Lint/FormatParameterMismatch. (@edmz)
  • #2116: Fix named params (using hash) Lint/FormatParameterMismatch. (@edmz)
  • #2135: Ignore super and zsuper nodes in Style/SymbolProc. (@bbatsov)
  • #2165: Fix a NPE in Style/Alias. (@bbatsov)
  • #2168: Fix a NPE in Rails/TimeZone. (@bbatsov)
  • #2169: Fix a NPE in Rails/Date. (@bbatsov)
  • #2105: Fix a warning that was thrown when enabling Style/OptionHash. (@wli)
  • #2107: Fix auto-correct of Style/ParallelAssignment for nested expressions. (@rrosenblum)
  • #2111: Deal with byte order mark in Style/InitialIndentation. (@jonas054)
  • #2113: Handle non-string tokens in Style/ExtraSpacing. (@jonas054)
  • #2129: Handle empty interpolations in Style/SpaceInsideStringInterpolation. (@lumeet)
  • #2119: Do not raise an error in Style/RescueEnsureAlignment and Style/RescueModifier when processing an excluded file. (@rrosenblum)
  • #2149: Do not register an offense in Rails/Date when Date#to_time is called with a time zone argument. (@maxjacobson)
  • Do not register a Rails/TimeZone offense when using Time.new safely. (@maxjacobson)
  • #2124: Fix bug in Style/EmptyLineBetweenDefs when there are only comments between method definitions. (@lumeet)
  • #2154: Performance/StringReplacement can auto-correct replacements with backslash in them. (@rrosenblum)
  • #2009: Fix bug in RuboCop::ConfigLoader.load_file when safe_yaml is required. (@eitoball)
  • #2155: Configuration EndAlignment: AlignWith: variable only applies when the operands of = are on the same line. (@jonas054)
  • Fix bug in Style/IndentationWidth when rescue or ensure is preceded by an empty body. (@lumeet)
  • #2183: Fix bug in Style/BlockDelimiters when auto-correcting adjacent braces. (@lumeet)
  • #2199: Make rubocop exit with error when there are only Lint/UnneededDisable offenses. (@jonas054)
  • Fix handling of empty parentheses when auto-correcting in Style/SymbolProc. (@lumeet)

0.33.0 (2015-08-05)

New features

  • #2081: New cop Style/Send checks for the use of send and instead encourages changing it to BasicObject#__send__ or Object#public_send (disabled by default). (@syndbg)
  • #2057: New cop Lint/FormatParameterMismatch checks for a mismatch between the number of fields expected in format/sprintf/% and what was passed to it. (@edmz)
  • #2010: Add space style for SpaceInsideStringInterpolation. (@gotrevor)
  • #2007: Allow any modifier before def, not only visibility modifiers. (@fphilipe)
  • #1980: --auto-gen-config now outputs an excluded files list for failed cops (up to a maxiumum of 15 files). (@bmorrall)
  • #2004: Introduced --exclude-limit COUNT to configure how many files --auto-gen-config will exclude. (@awwaiid, @jonas054)
  • #1918: New configuration parameter AllCops:DisabledByDefault when set to true makes only cops found in user configuration enabled, which makes cop selection opt-in. (@jonas054)
  • New cop Performance/StringReplacement checks for usages of gsub that can be replaced with tr or delete. (@rrosenblum)
  • #2001: New cop Style/InitialIndentation checks for indentation of the first non-blank non-comment line in a file. (@jonas054)
  • #2060: New cop Style/RescueEnsureAlignment checks for bad alignment of rescue and ensure keywords. (@lumeet)
  • New cop Style/OptionalArguments checks for optional arguments that do not appear at the end of an argument list. (@rrosenblum)
  • New cop Lint/CircularArgumentReference checks for "circular argument references" in keyword arguments, which Ruby 2.2 warns against. (@maxjacobson, @sliuu)
  • #2030: New cop Style/OptionHash checks for option hashes and encourages changing them to keyword arguments (disabled by default). (@maxjacobson)

Changes

  • #2052: Style/RescueModifier uses token stream to identify offenses. (@urbanautomaton)
  • Rename Rails/Date and Rails/TimeZone style names to "strict" and "flexible" and make "flexible" to be default. (@palkan)
  • #2035: Style/ExtraSpacing is now enabled by default and has a configuration parameter AllowForAlignment that is true by default, making it allow extra spacing if it's used for alignment purposes. (@jonas054)

Bugs fixed

  • #2014: Fix Style/TrivialAccessors to support AllowPredicates: false. (@gotrevor)
  • #1988: Fix bug in Style/ParallelAssignment when assigning from Module::CONSTANT. (@rrosenblum)
  • #1995: Improve message for Rails/TimeZone. (@palkan)
  • #1977: Fix bugs in Rails/Date and Rails/TimeZone when using namespaced Time/Date. (@palkan)
  • #1973: Do not register an offense in Performance/Detect when select is called on Enumerable::Lazy. (@palkan)
  • #2015: Fix bug occurring for auto-correction of a misaligned end in a file with only one method. (@jonas054)
  • Allow string interpolation segments inside single quoted string literals when double quotes are preferred. (@segiddins)
  • #2026: Allow Time.current when style is "acceptable".(@palkan)
  • #2029: Fix bug where Style/RedundantReturn auto-corrects returning implicit hashes to invalid syntax. (@rrosenblum)
  • #2021: Fix bug in Style/BlockDelimiters when a semantic expression is used in an array or a range. (@lumeet)
  • #1992: Allow parentheses in assignment to a variable with the same name as the method's in Style/MethodCallParentheses. (@lumeet)
  • #2045: Fix crash in Style/IndentationWidth when using private_class_method def self.foo syntax. (@unmanbearpig)
  • #2006: Fix crash in Style/FirstParameterIndentation in case of nested offenses. (@unmanbearpig)
  • #2059: Don't check for trivial accessors in modules. (@bbatsov)
  • Add proper punctuation to the end of offense messages, where it is missing. (@lumeet)
  • #2071: Keep line breaks in place on WordArray autocorrect.(@unmanbearpig)
  • #2075: Properly correct Style/PercentLiteralDelimiters with escape characters in them. (@rrosenblum)
  • #2023: Avoid auto-correction corruption in IndentationWidth. (@jonas054)
  • #2080: Properly parse code in Performance/Count when calling select..count in a class that extends an enumerable. (@rrosenblum)
  • #2093: Fix bug in Style/OneLineConditional which should not raise an offense with an 'if/then/end' statement. (@sliuu)

0.32.1 (2015-06-24)

New features

  • Debugger cop now checks catches methods called with arguments. (@crazydog115)

Bugs fixed

  • Make it possible to disable Lint/UnneededDisable. (@jonas054)
  • #1958: Show name of Lint/UnneededDisable when -D/--display-cop-names is given. (@jonas054)
  • Do not show Style/NonNilCheck offenses as corrected when the source code is not modified. (@rrosenblum)
  • Fix auto-correct in Style/RedundantReturn when return has no arguments. (@lumeet)
  • #1955: Fix false positive for Style/TrailingComma cop. (@mattjmcnaughton)
  • #1928: Avoid auto-correcting two alignment offenses in the same area at the same time. (@jonas054)
  • #1964: Fix RedundantBegin auto-correct issue with comments by doing a smaller correction. (@jonas054)
  • #1978: Don't count disabled offences if fail-level is autocorrect. (@sch1zo)
  • #1986: Fix Date false positives on variables. (@palkan)

Changes

0.32.0 (2015-06-06)

New features

  • Adjust behavior of TrailingComma cop to account for multi-line hashes nested within method calls. (@panthomakos)
  • #1719: Display an error and abort the program if input file can't be found. (@matugm)
  • New cop SpaceInsideStringInterpolation checks for spaces within string interpolations. (@glasnt)
  • New cop NestedMethodDefinition checks for method definitions inside other methods. (@ojab)
  • LiteralInInterpolation cop does auto-correction. (@tmr08c)
  • #1865: New cop Lint/UnneededDisable checks for rubocop:disable comments that can be removed. (@jonas054)
  • EmptyElse cop does auto-correction. (@lumeet)
  • Show reference links when displaying style guide links. (@rrosenblum)
  • Debugger cop now checks for the Capybara debug method save_screenshot. (@crazydog115)
  • #1282: CaseIndentation cop does auto-correction. (@lumeet)
  • #1928: Do auto-correction one offense at a time (rather than one cop at a time) if there are tabs in the code. (@jonas054)

Changes

  • Prefer SpaceInsideBlockBraces to SpaceBeforeSemicolon and SpaceAfterSemicolon to avoid an infinite loop when auto-correcting. (@lumeet)
  • #1873: Move ParallelAssignment cop from Performance to Style. (@rrosenblum)
  • Add getlocal to acceptable methods of Rails/TimeZone. (@ojab)
  • #1851, #1948: Change offense message for ClassLength and ModuleLength to match that of MethodLength. (@bquorning)

Bugs fixed

  • Don't count required keyword args when specifying CountKeywordArgs: false for ParameterLists. (@sumeet)
  • #1879: Avoid auto-correcting hash with trailing comma into invalid code in BracesAroundHashParameters. (@jonas054)
  • #1868: Do not register an offense in Performance/Count when select is called with symbols or strings as the parameters. (@rrosenblum)
  • Sample rewritten to properly handle shuffle randomness source, first/last params and non-literal ranges. (@chastell)
  • #1873: Modify ParallelAssignment to properly autocorrect when the assignment is protected by a modifier statement. (@rrosenblum)
  • Configure ParallelAssignment to work with non-standard IndentationWidths. (@rrosenblum)
  • #1899: Be careful about comments when auto-correcting in BracesAroundHashParameters. (@jonas054)
  • #1897: Don't report that semicolon separated statements can be converted to modifier form in IfUnlessModifier (and don't auto-correct them). (@jonas054)
  • #1644: Don't search the entire file system when a folder is named , (fix for jruby and rbx). (@rrosenblum)
  • #1803: Don't warn for return from lambda block in NonLocalExitFromIterator. (@ypresto)
  • #1905: Ignore sparse and trailing comments in Style/Documentation. (@RGBD)
  • #1923: Handle properly for without body in Style/Next. (@bbatsov)
  • #1901: Do not auto correct comments that are missing a note. (@rrosenblum)
  • #1926: Fix crash in Style/AlignHash when correcting a hash with a splat in it. (@rrosenblum)
  • #1935: Allow Symbol#to_proc blocks in Performance/Size. (@m1foley)

0.31.0 (2015-05-05)

New features

  • Rails/TimeZone emits acceptable methods on a violation when EnforcedStyle is :acceptable. (@l8nite)
  • Recognize rackup file (config.ru) out of the box. (@carhartl)
  • #1788: New cop ModuleLength checks for overly long module definitions. (@sdeframond)
  • New cop Performance/Count to convert Enumerable#select...size, Enumerable#reject...size, Enumerable#select...count, Enumerable#reject...count Enumerable#select...length, and Enumerable#reject...length to Enumerable#count. (@rrosenblum)
  • CommentAnnotation cop does auto-correction. (@dylandavidson)
  • New cop Style/TrailingUnderscoreVariable to remove trailing underscore variables from mass assignment. (@rrosenblum)
  • #1136: New cop Performance/ParallelAssignment to avoid usages of unnessary parallel assignment. (@rrosenblum)
  • #1278: DefEndAlignment and EndAlignment cops do auto-correction. (@lumeet)
  • IndentationWidth cop follows the AlignWith option of the DefEndAlignment cop. (@lumeet)
  • #1837: New cop EachWithObjectArgument checks that each_with_object isn't called with an immutable object as argument. (@jonas054)
  • ArrayJoin cop does auto-correction. (@tmr08c)

Bugs fixed

  • #1816: Fix bug in Sample when calling #shuffle with something other than an element selector. (@rrosenblum)
  • #1768: DefEndAlignment recognizes preceding private_class_method or public_class_method before def. (@til)
  • #1820: Correct the logic in AlignHash for when to ignore a key because it's not on its own line. (@jonas054)
  • #1829: Fix bug in Sample and FlatMap that would cause them to report having been auto-corrected when they were not. (@rrosenblum)
  • #1832: Fix bug in UnusedMethodArgument that would cause them to report having been auto-corrected when they were not. (@jonas054)
  • #1834: Support only boolean values for AutoCorrect configuration parameter, and remove warning for unknown parameter. (@jonas054)
  • #1843: Fix crash in TrailingBlankLines when a file ends with a block comment without final newline. (@jonas054)
  • #1849: Fix bug where you can not have nested arrays in the Rake task configuration. (@rrosenblum)
  • Fix bug in MultilineTernaryOperator where it will not register an offense when only the false branch is on a separate line. (@rrosenblum)
  • Fix crash in MultilineBlockLayout when using new lambda literal syntax without parentheses. (@hbd225)
  • #1859: Fix bugs in IfUnlessModifier concerning comments and empty lines. (@jonas054)
  • Fix handling of trailing comma in SpaceAroundBlockParameters and SpaceAfterComma. (@lumeet)

0.30.1 (2015-04-21)

Bugs fixed

  • #1691: For assignments with line break after =, use keyword alignment in EndAlignment regardless of configured style. (@jonas054)
  • #1769: Fix bug where LiteralInInterpolation registers an offense for interpolation of __LINE__. (@rrosenblum)
  • #1773: Fix typo ('strptime' -> 'strftime') in Rails/TimeZone. (@palkan)
  • #1777: Fix offense message from Rails/TimeZone. (@mzp)
  • #1784: Add an explicit error message when config contains an empty section. (@bankair)
  • #1791: Fix autocorrection of PercentLiteralDelimiters with no content. (@cshaffer)
  • Fix handling of while and until with assignment in IndentationWidth. (@lumeet)
  • #1793: Fix bug in TrailingComma that caused , in comment to count as a trailing comma. (@jonas054)
  • #1765: Update 1.9 hash to stop triggering when the symbol is not valid in the 1.9 hash syntax. (@crimsonknave)
  • #1806: Require a newer version of parser and use its corrected solution for comment association in Style/Documentation. (@jonas054)
  • #1792: Fix bugs in Sample that did not account for array selectors with a range and passing random to shuffle. (@rrosenblum)
  • #1770: Add more acceptable methods to Rails/TimeZone (utc, localtime, to_i, iso8601 etc). (@palkan)
  • #1767: Do not register offenses on non-enumerable select/find_all by Performance/Detect. (@palkan)
  • #1795: Fix bug in TrailingBlankLines that caused a crash for files containing only newlines. (@renuo)

0.30.0 (2015-04-06)

New features

  • #1600: Add line_count_based and semantic styles to the BlockDelimiters (formerly Blocks) cop. (@clowder, @mudge)
  • #1712: Set Offense#corrected? to true, false, or nil when it was, wasn't, or can't be auto-corrected, respectively. (@vassilevsky)
  • #1669: Add command-line switch --display-style-guide. (@marxarelli)
  • #1405: Add Rails TimeZone and Date cops. (@palkan)
  • #1641: Add ruby19_no_mixed_keys style to HashStyle cop. (@iainbeeston)
  • #1604: Add IgnoreClassMethods option to TrivialAccessors cop. (@bbatsov)
  • #1651: The Style/SpaceAroundOperators cop now also detects extra spaces around operators. A list of operators that may be surrounded by multiple spaces is configurable. (@bquorning)
  • Add auto-correct to Encoding cop. (@rrosenblum)
  • #1621: TrailingComma has a new style consistent_comma. (@tamird)
  • #1611: Add empty, nil, and both SupportedStyles to EmptyElse cop. Default is both. (@rrosenblum)
  • #1611: Add new MissingElse cop. Default is to have this cop be disabled. (@rrosenblum)
  • #1602: Add support for # :nodoc in Documentation. (@lumeet)
  • #1437: Modify HashSyntax cop to allow the use of hash rockets for hashes that have symbol values when using ruby19 syntax. (@rrosenblum)
  • New cop Style/SymbolLiteral makes sure you're not using the string within symbol syntax unless it's needed. (@bbatsov)
  • #1657: Autocorrect can be turned off on a specific cop via the configuration. (@jdoconnor)
  • New cop Style/AutoResourceCleanup suggests the use of block taking versions of methods that do resource cleanup. (@bbatsov)
  • #1275: WhileUntilModifier cop does auto-correction. (@lumeet)
  • New cop Performance/ReverseEach to convert reverse.each to reverse_each. (@rrosenblum)
  • #1281: IfUnlessModifier cop does auto-correction. (@lumeet)
  • New cop Performance/Detect to detect usage of select.first, select.last, find_all.first, and find_all.last and convert them to use detect instead. (@palkan, @rrosenblum)
  • #1728: New cop NonLocalExitFromIterator checks for misused return in block. (@ypresto)
  • New cop Performance/Size to convert calls to count on Array and Hash to size. (@rrosenblum)
  • New cop Performance/Sample to convert usages of shuffle.first, shuffle.last, and shuffle[Fixnum] to sample. (@rrosenblum)
  • New cop Performance/FlatMap to convert Enumerable#map...Array#flatten and Enumerable#collect...Array#flatten to Enumerable#flat_map. (@rrosenblum)
  • #1144: New cop ClosingParenthesisIndentation checks the indentation of hanging closing parentheses. (@jonas054)
  • New Rails cop FindBy identifies usages of where.first and where.take. (@bbatsov)
  • New Rails cop FindEach identifies usages of all.each. (@bbatsov)
  • #1342: IndentationConsistency is now configurable with the styles normal and rails. (@jonas054)

Bugs fixed

  • #1705: Fix crash when reporting offenses of MissingElse cop. (@gerry3)
  • #1659: Fix stack overflow with JRuby and Windows 8, during initial config validation. (@pimterry)
  • #1694: Ignore methods with a blockarg in TrivialAccessors. (@bbatsov)
  • #1617: Always read the html output template using utf-8. (@bbatsov)
  • #1684: Ignore symbol keys like :"string" in HashSyntax. (@bbatsov)
  • Handle explicit begin blocks in Lint/Void. (@bbatsov)
  • Handle symbols in Lint/Void. (@bbatsov)
  • #1695: Fix bug with --auto-gen-config and SpaceInsideBlockBraces. (@meganemura)
  • Correct issues with whitespace around multi-line lambda arguments. (@zvkemp)
  • #1579: Fix handling of similar-looking blocks in BlockAlignment. (@lumeet)
  • #1676: Fix auto-correct in Lambda when a new multi-line lambda is used as an argument. (@lumeet)
  • #1656: Fix bug that would include hidden directories implicitly. (@jonas054)
  • #1728: Fix bug in LiteralInInterpolation and AssignmentInCondition. (@ypresto)
  • #1735: Handle trailing space in LineEndConcatenation autocorrect. (@jonas054)
  • #1750: Escape offending code lines output by the HTML formatter in case they contain markup. (@jonas054)
  • #1541: No inspection of text that follows __END__. (@jonas054)
  • Fix comment detection in Style/Documentation. (@lumeet)
  • #1637: Fix handling of binding calls in UnusedBlockArgument and UnusedMethodArgument. (@lumeet)

Changes

  • #1397: UnneededPercentX renamed to CommandLiteral. The cop can be configured to enforce using either %x or backticks around command literals, or using %x around multi-line commands and backticks around single-line commands. The cop ignores heredoc commands. (@bquorning)
  • #1020: Removed the MaxSlashes configuration option for RegexpLiteral. Instead, the cop can be configured to enforce using either %r or slashes around regular expressions, or using %r around multi-line regexes and slashes around single-line regexes. (@bquorning)
  • #1734: The default exclusion of hidden directories has been optimized for speed. (@jonas054)
  • #1673: Style/TrivialAccessors now requires matching names by default. (@bbatsov)

0.29.1 (2015-02-13)

Bugs fixed

  • #1638: Use Parser functionality rather than regular expressions for matching comments in FirstParameterIndentation. (@jonas054)
  • #1642: Raise the correct exception if the configuration file is malformed. (@bquorning)
  • #1647: Skip SpaceAroundBlockParameters when lambda has no argument. (@eitoball)
  • #1649: Handle exception assignments in UselessSetterCall. (@bbatsov)
  • #1644: Don't search the entire file system when a folder is named ,. (@bquorning)

0.29.0 (2015-02-05)

New features

  • #1430: Add --except option for disabling cops on the command line. (@jonas054)
  • #1506: Add auto-correct from EvenOdd cop. (@blainesch)
  • #1507: Debugger cop now checks for the Capybara debug methods save_and_open_page and save_and_open_screenshot. (@rrosenblum)
  • #1539: Implement autocorrection for Rails/ReadWriteAttribute cop. (@huerlisi)
  • #1324: Add AllCops/DisplayCopNames configuration option for showing cop names in reports, like --display-cop-names. (@jonas054)
  • #1271: Lambda cop does auto-correction. (@lumeet)
  • #1284: Support namespaces, e.g. Lint, in the arguments to --only and --except. (@jonas054)
  • #1276: SelfAssignment cop does auto-correction. (@lumeet)
  • Add autocorrect to RedundantException. (@mattjmcnaughton)
  • #1571: New cop StructInheritance checks for inheritance from Struct.new. (@mmozuras)
  • #1575: New cop DuplicateMethods points out duplicate method name in class and module. (@d4rk5eed)
  • #1144: New cop FirstParameterIndentation checks the indentation of the first parameter in a method call. (@jonas054)
  • #1627: New cop SpaceAroundBlockParameters checks the spacing inside and after block parameters pipes. (@jonas054)

Changes

  • #1492: Abort when auto-correct causes an infinite loop. (@dblock)
  • Options -e/--emacs and -s/--silent are no longer recognized. Using them will now raise an error. (@bquorning)
  • #1565: Let --fail-level A cause exit with error if all offenses are auto-corrected. (@jonas054)
  • #1309: Add argument handling to MultilineBlockLayout. (@lumeet)

Bugs fixed

  • #1634: Fix PerlBackrefs Cop Autocorrections to Not Raise. (@cshaffer)
  • #1553: Fix bug where Style/EmptyLinesAroundAccessModifier interfered with Style/EmptyLinesAroundBlockBody when there is and access modifier at the beginning of a block. (@volkert)
  • Handle element assignment in Lint/AssignmentInCondition. (@jonas054)
  • #1484: Fix EmptyLinesAroundAccessModifier incorrectly finding a violation inside method calls with names identical to an access modifier. (@dblock)
  • Fix bug concerning Exclude properties inherited from a higher directory level. (@jonas054)
  • #1500: Fix crashing --auto-correct --only IndentationWidth. (@jonas054)
  • #1512: Fix false negative for typical string formatting examples. (@kakutani, @jonas054)
  • #1504: Fail with a meaningful error if the configuration file is malformed. (@bquorning)
  • Fix bug where auto_correct Rake tasks does not take in the options specified in its parent task. (@rrosenblum)
  • #1054: Handle comments within concatenated strings in LineEndConcatenation. (@yujinakayama, @jonas054)
  • #1527: Make autocorrect BracesAroundHashParameter leave the correct number of spaces. (@mattjmcnaughton)
  • #1547: Don't print [Corrected] when auto-correction was avoided in Style/Semicolon. (@jonas054)
  • #1573: Fix assignment-related auto-correction for BlockAlignment. (@lumeet)
  • #1587: Exit with exit code 1 if there were errors ("crashing" cops). (@jonas054)
  • #1574: Avoid auto-correcting Hash.new to {} when braces would be interpreted as a block. (@jonas054)
  • #1591: Don't check parameters inside [] in MultilineOperationIndentation. (@jonas054)
  • #1509: Ignore class methods in Rails/Delegate. (@bbatsov)
  • #1594: Fix @example warnings in Yard Doc documentation generation. (@mattjmcnaughton)
  • #1598: Fix bug in file inclusion when running from another directory. (@jonas054)
  • #1580: Don't print [Corrected] when auto-correction was avoided in TrivialAccessors. (@lumeet)
  • #1612: Allow expand_path on inherit_from in .rubocop.yml. (@mattjmcnaughton)
  • #1610: Check that class method names actually match the name of the containing class/module in Style/ClassMethods. (@bbatsov)

0.28.0 (2014-12-10)

New features

  • #1450: New cop ExtraSpacing points out unnecessary spacing in files. (@blainesch)
  • New cop EmptyLinesAroundBlockBody provides same functionality as the EmptyLinesAround(Class|Method|Module)Body but for blocks. (@jcarbo)
  • New cop Style/EmptyElse checks for empty else-clauses. (@Koronen)
  • #1454: New --only-guide-cops and AllCops/StyleGuideCopsOnly options that will only enforce cops that link to a style guide. (@marxarelli)

Changes

  • #801: New style context_dependent for Style/BracesAroundHashParameters looks at preceding parameter to determine if braces should be used for final parameter. (@jonas054)
  • #1427: Excluding directories on the top level is now done earlier, so that these file trees are not searched, thus saving time when inspecting projects with many excluded files. (@jonas054)
  • #1325: When running with --auto-correct, only offenses that can not be corrected will result in a non-zero exit code. (@jonas054)
  • #1445: Allow sprockets directive comments (starting with #=) in Style/LeadingCommentSpace. (@bbatsov)

Bugs fixed

  • Fix %W[] auto corrected to %w(]. (@toy)
  • Fix Style/ElseAlignment Cop to find the right parent on def/rescue/else/ensure/end. (@oneamtu)
  • #1181: (fix again) Style/StringLiterals cop stays away from strings inside interpolated expressions. (@jonas054)
  • #1441: Correct the logic used by Style/Blocks and other cops to determine if an auto-correction would alter the meaning of the code. (@jonas054)
  • #1449: Handle the case in MultilineOperationIndentation where instances of both correct style and unrecognized (plain wrong) style are detected during an --auto-gen-config run. (@jonas054)
  • #1456: Fix autocorrect in SymbolProc when there are multiple offenses on the same line. (@jcarbo)
  • #1459: Handle parenthesis around the condition in --auto-correct for NegatedWhile. (@jonas054)
  • #1465: Fix autocorrect of code like #$1 in PerlBackrefs. (@bbatsov)
  • Fix autocorrect of code like #$: in SpecialGlobalVars. (@bbatsov)
  • #1466: Allow leading underscore for unused parameters in SingleLineBlockParams. (@jonas054)
  • #1470: Handle elsif + else in ElseAlignment. (@jonas054)
  • #1474: Multiline string with both << and \ caught by Style/LineEndConcatenation cop. (@katieschilling)
  • #1485: Ignore procs in SymbolProc. (@bbatsov)
  • #1473: Style/MultilineOperationIndentation doesn't recognize assignment to array/hash element. (@jonas054)

0.27.1 (2014-11-08)

Changes

  • #1343: Remove auto-correct from RescueException cop. (@bbatsov)
  • #1425: AllCops/Include configuration parameters are only taken from the project .rubocop.yml and files it inherits from, not from .rubocop.yml files in subdirectories. (@jonas054)

Bugs fixed

  • #1411: Handle lambda calls without a selector in MultilineOperationIndentation. (@bbatsov)
  • #1401: Files in hidden directories, i.e. ones beginning with dot, can now be selected through configuration, but are still not included by default. (@jonas054)
  • #1415: String literals concatenated with backslashes are now handled correctly by StringLiteralsInInterpolation. (@jonas054)
  • #1416: Fix handling of begin/rescue/else/end in ElseAlignment. (@jonas054)
  • #1413: Support empty elsif branches in MultilineIfThen. (@janraasch, @jonas054)
  • #1406: Allow a newline in SpaceInsideRangeLiteral. (@bbatsov)

0.27.0 (2014-10-30)

New features

  • #1348: New cop ElseAlignment checks alignment of else and elsif keywords. (@jonas054)
  • #1321: New cop MultilineOperationIndentation checks indentation/alignment of binary operations if they span more than one line. (@jonas054)
  • #1077: New cop Metrics/AbcSize checks the ABC metric, based on assignments, branches, and conditions. (@jonas054, @jfelchner)
  • #1352: WordArray is now configurable with the WordRegex option. (@bquorning)
  • #1181: New cop Style/StringLiteralsInInterpolation checks quotes inside interpolated expressions in strings. (@jonas054)
  • #872: Style/IndentationWidth is now configurable with the Width option. (@jonas054)
  • #1396: Include .opal files by default. (@bbatsov)
  • #771: Three new Style cops, EmptyLinesAroundMethodBody , EmptyLinesAroundClassBody , and EmptyLinesAroundModuleBody replace the EmptyLinesAroundBody cop. (@jonas054)

Changes

Bugs fixed

  • AlignHash no longer skips multiline hashes that contain some elements on the same line. (@mvz)
  • #1349: BracesAroundHashParameters no longer cleans up whitespace in autocorrect, as these extra corrections are likely to interfere with other cops' corrections. (@jonas054)
  • #1350: Guard against Blocks cop introducing syntax errors in auto-correct. (@jonas054)
  • #1374: To eliminate interference, auto-correction is now done by one cop at a time, with saving and re-parsing in between. (@jonas054)
  • #1388: Fix a false positive in FormatString. (@bbatsov)
  • #1389: Make --out to create parent directories. (@yous)
  • Refine HTML formatter. (@yujinakayama)
  • #1410: Handle specially Java primitive type references in ColonMethodCall. (@bbatsov)

0.26.1 (2014-09-18)

Bugs fixed

  • #1326: Fix problem in SpaceInsideParens with detecting space inside parentheses used for grouping expressions. (@jonas054)
  • #1335: Restrict URI schemes permitted by LineLength when AllowURI is enabled. (@smangelsdorf)
  • #1339: Handle eql? and equal? in OpMethod. (@bbatsov)
  • #1340: Fix crash in Style/SymbolProc cop when the block calls a method with no explicit receiver. (@smangelsdorf)

0.26.0 (2014-09-03)

New features

  • New formatter HTMLFormatter generates a html file with a list of files with offences in them. (@SkuliOskarsson)
  • New cop SpaceInsideRangeLiteral checks for spaces around .. and ... in range literals. (@bbatsov)
  • New cop InfiniteLoop checks for places where Kernel#loop should have been used. (@bbatsov)
  • New cop SymbolProc checks for places where a symbol can be used as proc instead of a block. (@bbatsov)
  • UselessAssignment cop now suggests a variable name for possible typos if there's a variable-ish identifier similar to the unused variable name in the same scope. (@yujinakayama)
  • PredicateName cop now has separate configurations for prefices that denote predicate method names and predicate prefices that should be removed. (@bbatsov)
  • #1272: Tab cop does auto-correction. (@yous)
  • #1274: MultilineIfThen cop does auto-correction. (@bbatsov)
  • #1279: DotPosition cop does auto-correction. (@yous)
  • #1277: SpaceBeforeFirstArg cop does auto-correction. (@yous)
  • #1310: Handle module_function in Style/AccessModifierIndentation and Style/EmptyLinesAroundAccessModifier. (@bbatsov)

Changes

  • #1289: Use utf-8 as default encoding for inspected files. (@jonas054)
  • #1304: Style/Encoding is no longer a no-op on Ruby 2.x. It's also disabled by default, as projects not supporting 1.9 don't need to run it. (@bbatsov)

Bugs fixed

  • #1263: Do not report %W literals with special escaped characters in UnneededCapitalW. (@jonas054)
  • #1286: Fix a false positive in VariableName. (@bbatsov)
  • #1211: Fix false negative in UselessAssignment when there's a reference for the variable in an exclusive branch. (@yujinakayama)
  • #1307: Fix auto-correction of RedundantBegin cop deletes new line. (@yous)
  • #1283: Fix auto-correction of indented expressions in PercentLiteralDelimiters. (@jonas054)
  • #1315: BracesAroundHashParameters auto-correction removes whitespace around content inside braces. (@jspanjers)
  • #1313: Fix a false positive in AndOr when enforced style is conditionals. (@bbatsov)
  • Handle post-conditional while and until in AndOr when enforced style is conditionals. (@yujinakayama)
  • #1319: Fix a false positive in FormatString. (@bbatsov)
  • #1287: Allow missing blank line for EmptyLinesAroundAccessModifier if next line closes a block. (@sch1zo)

0.25.0 (2014-08-15)

New features

  • #1259: Allow AndOr cop to autocorrect by adding method call parenthesis. (@vrthra)
  • #1232: Add EnforcedStyle option to cop AndOr to restrict it to conditionals. (@vrthra)
  • #835: New cop PercentQLiterals checks if use of %Q and %q matches configuration. (@jonas054)
  • #835: New cop BarePercentLiterals checks if usage of %() or %Q() matches configuration. (@jonas054)
  • #1079: New cop MultilineBlockLayout checks if a multiline block has an expression on the same line as the start of the block. (@barunio)
  • #1217: Style::EmptyLinesAroundAccessModifier cop does auto-correction. (@tamird)
  • #1220: New cop PerceivedComplexity is similar to CyclomaticComplexity, but reports when methods have a high complexity for a human reader. (@jonas054)
  • Debugger cop now checks for binding.pry_remote. (@yous)
  • #1238: Add MinBodyLength option to Next cop. (@bbatsov)
  • #1241: TrailingComma cop does auto-correction. (@yous)
  • #1078: New cop BlockEndNewline checks if the end statement of a multiline block is on its own line. (@barunio)
  • #1078: BlockAlignment cop does auto-correction. (@barunio)

Changes

Bugs fixed

  • #1251: Fix PercentLiteralDelimiters auto-correct indentation error. (@hannestyden)
  • #1197: Fix false positive for new lambda syntax in SpaceInsideBlockBraces. (@jonas054)
  • #1201: Fix error at anonymous keyword splat arguments in some variable cops. (@yujinakayama)
  • Fix false positive in UnneededPercentQ for /%Q(something)/. (@jonas054)
  • Fix SpacesInsideBrackets for Hash#[] calls with spaces after left bracket. (@mcls)
  • #1210: Fix false positive in UnneededPercentQ for %Q(\t"). (@jonas054)
  • Fix false positive in UnneededPercentQ for heredoc strings with %q/%Q. (@jonas054)
  • #1214: Don't destroy code in AlignHash autocorrect. (@jonas054)
  • #1219: Don't report bad alignment for end or } in BlockAlignment if it doesn't begin its line. (@jonas054)
  • #1227: Don't permanently change yamler as it can affect other apps. (@jonas054)
  • #1184: Fix a false positive in Output cop. (@bbatsov)
  • #1256: Ignore block-pass in TrailingComma. (@tamird)
  • #1255: Compare without context in AutocorrectUnlessChangingAST. (@jonas054)
  • #1262: Handle regexp and backtick literals in VariableInterpolation. (@bbatsov)

0.24.1 (2014-07-03)

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)

0.24.0 (2014-06-25)

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 checking 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)

0.23.0 (2014-06-02)

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)

0.22.0 (2014-05-20)

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 iteration 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)
  • Add optional require directive to .rubocop.yml to load custom ruby files. (@geniou)

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 ignoring 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)

0.21.0 (2014-04-24)

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)

0.20.1 (2014-04-05)

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)

0.20.0 (2014-04-02)

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)

0.19.1 (2014-03-17)

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)

0.19.0 (2014-03-13)

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)
  • #877: Fix bug in PercentLiteralDelimiters concerning auto-correct of regular expressions with interpolation. (@hannestyden)

0.18.1 (2014-02-02)

Bugs fixed

  • Remove double reporting in EmptyLinesAroundBody of empty line inside otherwise empty class/module/method that caused crash in autocorrect. (@jonas054)
  • #779: Fix a false positive in LineEndConcatenation. (@bbatsov)
  • #751: Fix Documentation cop so that a comment followed by an empty line and then a class definition is not considered to be class documentation. (@jonas054)
  • #783: Fix a false positive in ParenthesesAroundCondition when the parentheses are actually required. (@bbatsov)
  • #781: Fix problem with back-and-forth auto-correction in AccessModifierIndentation. (@jonas054)
  • #785: Fix false positive on %w arrays in TrailingComma. (@jonas054)
  • #782: Fix false positive in AlignHash for single line hashes. (@jonas054)

0.18.0 (2014-01-30)

New features

  • #714: New cop RequireParentheses checks for method calls without parentheses together with a boolean operator indicating that a mistake about precedence may have been made. (@jonas054)
  • #743: WordArray cop does auto-correction. (@jonas054)
  • #743: Proc cop does auto-correction. (@bbatsov)
  • #743: AccessModifierIndentation cop does auto-correction. (@jonas054)
  • #768: Rake task now supports requires and options. (@nevir)
  • #759: New cop EndLineConcatenation checks for string literal concatenation with + at line end. (@bbatsov)

Changes

Bugs fixed

0.17.0 (2014-01-25)

New features

  • New cop ConditionPosition checks for misplaced conditions in expressions like if/unless/when/until. (@bbatsov)
  • New cop ElseLayout checks for odd arrangement of code in the else branch of a conditional expression. (@bbatsov)
  • #694: Support Ruby 1.9.2 until June 2014. (@yujinakayama)
  • #702: Improve rubocop-todo.yml with comments about offence count, configuration parameters, and auto-correction support. (@jonas054)
  • Add new command-line flag -D/--display-cop-names to trigger the display of cop names in offence messages. (@bbatsov)
  • #733: NumericLiterals cop does auto-correction. (@dblock)
  • #713: New cop TrailingComma checks for comma after the last item in a hash, array, or method call parameter list. (@jonas054)

Changes

  • #581: Extracted a new cop AmbiguousOperator from Syntax cop. It checks for ambiguous operators in the first argument of a method invocation without parentheses. (@yujinakayama)
  • Extracted a new cop AmbiguousRegexpLiteral from Syntax cop. It checks for ambiguous regexp literals in the first argument of a method invocation without parentheses. (@yujinakayama)
  • Extracted a new cop UselessElseWithoutRescue from Syntax cop. It checks for useless else in begin..end without rescue. (@yujinakayama)
  • Extracted a new cop InvalidCharacterLiteral from Syntax cop. It checks for invalid character literals with a non-escaped whitespace character (e.g. ? ). (@yujinakayama)
  • Removed Syntax cop from the configuration. It no longer can be disabled and it reports only invalid syntax offences. (@yujinakayama)
  • #688: Output from rubocop --show-cops now looks like a YAML configuration file. The --show-cops option takes a comma separated list of cops as optional argument. (@jonas054)
  • New cop IndentationConsistency extracted from IndentationWidth, which has checked two kinds of offences until now. (@jonas054)

Bugs fixed

  • #698: Support Windows paths on command-line. (@rifraf)
  • #498: Disable terminal ANSI escape sequences when a formatter's output is not a TTY. (@yujinakayama)
  • #703: BracesAroundHashParameters auto-correction broken with trailing comma. (@jonas054)
  • #709: When EndAlignment has configuration AlignWith: variable, it now handles @@a = if ... and a, b = if .... (@jonas054)
  • SpaceAroundOperators now reports an offence for @@a=0. (@jonas054)
  • #707: Fix error on operator assignments in top level scope in UselessAssignment. (@yujinakayama)
  • Fix a bug where some offences were discarded when any cop that has specific target file path (by Include or Exclude under each cop configuration) had run. (@yujinakayama)
  • #724: Accept colons denoting required keyword argument (a new feature in Ruby 2.1) without trailing space in SpaceAfterColon. (@jonas054)
  • The --no-color option works again. (@jonas054)
  • #716: Fixed a regression in the auto-correction logic of MethodDefParentheses. (@bbatsov)
  • Inspected projects that lack a .rubocop.yml file, and therefore get their configuration from RuboCop's config/default.yml, no longer get configuration from RuboCop's .rubocop.yml and rubocop-todo.yml. (@jonas054)
  • #730: EndAlignment now handles for example private def some_method, which is allowed in Ruby 2.1. It requires end to be aligned with private, not def, in such cases. (@jonas054)
  • #744: Any new offences created by --auto-correct are now handled immediately and corrected when possible, so running --auto-correct once is enough. (@jonas054)
  • #748: Auto-correction conflict between EmptyLinesAroundBody and TrailingWhitespace resolved. (@jonas054)
  • ParenthesesAroundCondition no longer crashes on parentheses around the condition in a ternary if. (@jonas054)
  • #738: Fix a false positive in StringLiterals. (@bbatsov)

0.16.0 (2013-12-25)

New features

  • #612: BracesAroundHashParameters cop does auto-correction. (@dblock)
  • #614: ParenthesesAroundCondition cop does auto-correction. (@dblock)
  • #624: EmptyLines cop does auto-correction. (@dblock)
  • New Rails cop DefaultScope ensures default_scope is called properly with a block argument. (@bbatsov)
  • All cops now support the Include param, which specifies the files on which they should operate. (@bbatsov)
  • All cops now support the Exclude param, which specifies the files on which they should not operate. (@bbatsov)
  • #631: IndentationWidth cop now detects inconsistent indentation between lines that should have the same indentation. (@jonas054)
  • #649: EmptyLinesAroundBody cop does auto-correction. (@dblock)
  • #657: Alias cop does auto-correction. (@dblock)
  • Rake task now support setting formatters. (@pmenglund)
  • #653: CaseIndentation cop is now configurable with parameters IndentWhenRelativeTo and IndentOneStep. (@jonas054)
  • #654: For cop is now configurable to enforce either each (default) or for. (@jonas054)
  • #661: EndAlignment cop is now configurable for alignment with keyword (default) or variable. (@jonas054)
  • Allow to overwrite the severity of a cop with the new Severity param. (@codez)
  • New cop FlipFlop checks for flip flops. (@agrimm)
  • #577: Introduced MethodDefParentheses to allow for for requiring either parentheses or no parentheses in method definitions. Replaces DefWithoutParentheses. (@skanev)
  • #693: Generation of parameter values (i.e., not only Enabled: false) in rubocop-todo.yml by the --auto-gen-config option is now supported for some cops. (@jonas054)
  • New cop AccessorMethodName checks accessor method names for non-idiomatic names like get_attribute and set_attribute. (@bbatsov)
  • New cop PredicateName checks the names of predicate methods for non-idiomatic names like is_something, has_something, etc. (@bbatsov)
  • Support Ruby 2.1 with Parser 2.1. (@yujinakayama)

Changes

  • Removed SymbolNames as it was generating way too many false positives. (@bbatsov)
  • Renamed ReduceArguments to SingleLineBlockParams and made it configurable. (@bbatsov)

Bugs fixed

  • Handle properly heredocs in StringLiterals cop. (@bbatsov)
  • Fix SpaceAroundOperators to not report missing space around operator for def self.method *args. (@jonas054)
  • Properly handle ['AllCops']['Includes'] and ['AllCops']['Excludes'] when passing config via -c. (@fancyremarker, @codez)
  • #611: Fix crash when loading an empty config file. (@sinisterchipmunk)
  • Fix DotPosition cop with trailing style for method calls on same line. (@vonTronje)
  • #627: Fix counting of slashes in complicated regexps in RegexpLiteral cop. (@jonas054)
  • #638: Fix bug in auto-correct that changes each{ |x| to each d o |x|. (@jonas054)
  • #418: Stop searching for configuration files above the work directory of the isolated environment when running specs. (@jonas054)
  • Fix error on implicit match conditionals (e.g. if /pattern/; end) in MultilineIfThen. (@agrimm)
  • #651: Handle properly method arguments in RedundantSelf. (@bbatsov)
  • #628: Allow self.Foo in RedundantSelf cop. (@chulkilee)
  • #668: Fix crash in EndOfLine that occurs when default encoding is US_ASCII and an inspected file has non-ascii characters. (@jonas054)
  • #664: Accept oneline while when condition has local variable assignment. (@emou)
  • Fix auto-correct for MethodDefParentheses when parentheses are required. (@skanev)

0.15.0 (2013-11-06)

New features

  • New cop Output checks for calls to print, puts, etc. in Rails. (@daviddavis)
  • New cop EmptyLinesAroundBody checks for empty lines around the bodies of class, method and module definitions. (@bbatsov)
  • LeadingCommentSpace cop does auto-correction. (@jonas054)
  • SpaceAfterControlKeyword cop does auto-correction. (@jonas054)
  • SpaceAfterColon cop does auto-correction. (@jonas054)
  • SpaceAfterComma cop does auto-correction. (@jonas054)
  • SpaceAfterSemicolon cop does auto-correction. (@jonas054)
  • SpaceAfterMethodName cop does auto-correction. (@jonas054)
  • SpaceAroundBlockBraces cop does auto-correction. (@jonas054)
  • SpaceAroundEqualsInParameterDefault cop does auto-correction. (@jonas054)
  • SpaceAroundOperators cop does auto-correction. (@jonas054)
  • SpaceBeforeModifierKeyword cop does auto-correction. (@jonas054)
  • SpaceInsideHashLiteralBraces cop does auto-correction. (@jonas054)
  • SpaceInsideBrackets cop does auto-correction. (@jonas054)
  • SpaceInsideParens cop does auto-correction. (@jonas054)
  • TrailingWhitespace cop does auto-correction. (@jonas054)
  • TrailingBlankLines cop does auto-correction. (@jonas054)
  • FinalNewline cop does auto-correction. (@jonas054)
  • New cop CyclomaticComplexity checks the cyclomatic complexity of methods against a configurable max value. (@jonas054)
  • #594: New parameter EnforcedStyleForEmptyBraces with values space and no_space (default) added to SpaceAroundBlockBraces. (@jonas054)
  • #603: New parameter MinSize added to WordArray to allow small string arrays, retaining the default (0). (@claco)

Changes

  • #557: Configuration files for excluded files are no longer loaded. (@jonas054)
  • #571: The default rake task now runs RuboCop over itself! (@nevir)
  • Encoding errors are reported as fatal offences rather than printed with red text. (@jonas054)
  • AccessControl cop is now configurable with the EnforcedStyle option. (@sds)
  • Split AccessControl cop to AccessModifierIndentation and EmptyLinesAroundAccessModifier. (@bbatsov)
  • #594: Add configuration parameter EnforcedStyleForEmptyBraces to SpaceInsideHashLiteralBraces cop, and change EnforcedStyleIsWithSpaces (values true, false) to EnforcedStyle (values space, no_space). (@jonas054)
  • Coverage builds linked from the README page are enabled again. (@jonas054)

Bugs fixed

  • #561: Handle properly negative literals in NumericLiterals cop. (@bbatsov)
  • #567: Register an offence when the last hash parameter has braces in BracesAroundHashParameters cop. (@dblock)
  • StringLiterals cop no longer reports errors for character literals such as ?/. That should be done only by the CharacterLiterals cop. (@jonas054)
  • Made auto-correct much less likely to crash due to conflicting corrections ("clobbering"). (@jonas054)
  • #565: $GLOBAL_VAR from English library should no longer be inserted when autocorrecting short-form global variables like $!. (@nevir)
  • #566: Methods that just assign a splat to an ivar are no longer considered trivial writers. (@nevir)
  • #585: MethodCallParentheses should allow methods starting with uppercase letter. (@bbatsov)
  • #574: Fix error on multiple-assignment with non-array right hand side in UselessSetterCall. (@yujinakayama)
  • #576: Output config validation warning to STDERR so that it won't be mixed up with formatter's output. (@yujinakayama)
  • #599: EndOfLine cop is operational again. (@jonas054)
  • #604: Fix error on implicit match conditionals (e.g. if /pattern/; end) in FavorModifier. (@yujinakayama)
  • #600: Don't require an empty line for access modifiers at the beginning of class/module body. (@bbatsov)
  • #608: RescueException no longer crashes when the namespace of a rescued class is in a local variable. (@jonas054)
  • #173: Allow the use of alias in the body of an instance_exec. (@bbatsov)
  • #554: Handle properly multi-line arrays with comments in them in WordArray. (@bbatsov)

0.14.1 (2013-10-10)

New features

  • #551: New cop BracesAroundHashParameters checks for braces in function calls with hash parameters. (@dblock)
  • New cop SpaceAfterNot tracks redundant space after the ! operator. (@bbatsov)

Bugs fixed

  • Fix bug concerning table and separator alignment of multi-line hash with multiple keys on the same line. (@jonas054)
  • #550: Fix a bug where ClassLength counted lines of inner classes/modules. (@yujinakayama)
  • #550: Fix a false positive for namespace class in Documentation. (@yujinakayama)
  • #556: Fix "Parser::Source::Range spans more than one line" bug in clang formatter. (@yujinakayama)
  • #552: RaiseArgs allows exception constructor calls with more than one 1 argument. (@bbatsov)

0.14.0 (2013-10-07)

New features

  • #491: New cop MethodCalledOnDoEndBlock keeps track of methods called on do...end blocks.
  • #456: New configuration parameter AllCops/RunRailsCops can be set to true for a project, removing the need to give the -R/--rails option with every invocation of rubocop.
  • #501: simple/clang/progress/emacs formatters now print [Corrected] along with offence message when the offence is automatically corrected.
  • #501: simple/clang/progress formatters now print count of auto-corrected offences in the final summary.
  • #501: json formatter now outputs corrected key with boolean value in offence objects whether the offence is automatically corrected.
  • New cop ClassLength checks for overly long class definitions.
  • New cop Debugger checks for forgotten calls to debugger or pry.
  • New cop RedundantException checks for code like raise RuntimeError, message.
  • #526: New cop RaiseArgs checks the args passed to raise/fail.

Changes

  • Cop MethodAndVariableSnakeCase replaced by MethodName and VariableName, both having the configuration parameter EnforcedStyle with values snake_case (default) and camelCase.
  • #519: HashSyntax cop is now configurable and can enforce the use of the classic hash rockets syntax.
  • #520: StringLiterals cop is now configurable and can enforce either single-quoted or double-quoted strings.
  • #528: Added a config option to RedundantReturn to allow a return with multiple values.
  • #524: Added a config option to Semicolon to allow the use of ; as an expression separator.
  • #525: SignalException cop is now configurable and can enforce the semantic rule or an exclusive use of raise or fail.
  • LambdaCall is now configurable and enforce either Proc#call or Proc#().
  • #529: Added config option EnforcedStyle to SpaceAroundBraces.
  • #529: Changed config option NoSpaceBeforeBlockParameters to SpaceBeforeBlockParameters.
  • Support Parser 2.0.0 (non-beta).

Bugs fixed

  • #514: Fix alignment of the hash containing different key lengths in one line.
  • #496: Fix corner case crash in AlignHash cop: single key/value pair when configuration is table for '=>' and separator for :.
  • #502: Don't check non-decimal literals with NumericLiterals.
  • #448: Fix auto-correction of parameters spanning more than one line in AlignParameters cop.
  • #493: Support disabling Syntax offences with warning severity.
  • Fix bug appearing when there were different values for the AllCops/RunRailsCops configuration parameter in different directories.
  • #512: Fix bug causing crash in AndOr auto-correction.
  • #515: Fix bug causing AlignParameters and AlignArray auto-correction to destroy code.
  • #516: Fix bug causing RedundantReturn auto-correction to produce invalid code.
  • #527: Handle != expressions in EvenOdd cop.
  • SignalException cop now finds raise calls anywhere, not only in begin sections.
  • #538: Fix bug causing Blocks auto-correction to produce invalid code.

0.13.1 (2013-09-19)

New features

  • HashSyntax cop does auto-correction.
  • #484: Allow calls to self to fix name clash with argument.
  • Renamed SpaceAroundBraces to SpaceAroundBlockBraces.
  • SpaceAroundBlockBraces now has a NoSpaceBeforeBlockParameters config option to enforce a style for blocks with parameters like {|foo| puts }.
  • New cop LambdaCall tracks uses of the obscure lambda.(...) syntax.

Bugs fixed

  • Fix crash on empty input file in FinalNewline.
  • #485: Fix crash on multiple-assignment and op-assignment in UselessSetterCall.
  • #497: Fix crash in UselessComparison and NilComparison.

0.13.0 (2013-09-13)

New features

  • New configuration parameter AllowAdjacentOneLineDefs for EmptyLineBetweenDefs.
  • New cop MultilineBlockChain keeps track of chained blocks spanning multiple lines.
  • RedundantSelf cop does auto-correction.
  • AvoidPerlBackrefs cop does auto-correction.
  • AvoidPerlisms cop does auto-correction.
  • RedundantReturn cop does auto-correction.
  • Blocks cop does auto-correction.
  • New cop TrailingBlankLines keeps track of extra blanks lines at the end of source file.
  • New cop AlignHash keeps track of bad alignment in multi-line hash literals.
  • New cop AlignArray keeps track of bad alignment in multi-line array literals.
  • New cop SpaceBeforeModifierKeyword keeps track of missing space before a modifier keyword (if, unless, while, until).
  • New cop FinalNewline keeps tracks of the required final newline in a source file.
  • Highlightling corrected in SpaceInsideHashLiteralBraces and SpaceAroundBraces cops.

Changes

  • #447: BlockAlignment cop now allows end to be aligned with the start of the line containing do.
  • SymbolName now has an AllowDots config option to allow symbols like :'whatever.submit_button'.
  • #469: Extracted useless setter call tracking part of UselessAssignment cop to UselessSetterCall.
  • #469: Merged UnusedLocalVariable cop into UselessAssignment.
  • #458: The merged UselessAssignment cop now has advanced logic that tracks not only assignment at the end of the method but also every assignment in every scope.
  • #466: Allow built-in JRuby global vars in AvoidGlobalVars.
  • Added a config option AllowedVariables to AvoidGlobalVars to allow users to whitelist certain global variables.
  • Renamed AvoidGlobalVars to GlobalVars.
  • Renamed AvoidPerlisms to SpecialGlobalVars.
  • Renamed AvoidFor to For.
  • Renamed AvoidClassVars to ClassVars.
  • Renamed AvoidPerlBackrefs to PerlBackrefs.
  • NumericLiterals now accepts a config param MinDigits - the minimal number of digits in the integer portion of number for the cop to check it.

Bugs fixed

  • #449: Remove whitespaces between condition and do with WhileUntilDo auto-correction.
  • Continue with file inspection after parser warnings. Give up only on syntax errors.
  • Don't trigger the HashSyntax cop on digit-starting keys.
  • Fix crashes while inspecting class definition subclassing another class stored in a local variable in UselessAssignment (formerly of UnusedLocalVariable) and ShadowingOuterLocalVariable (like clazz = Array; class SomeClass < clazz; end).
  • #463: Do not warn if using destructuring in second reduce argument (ReduceArguments).

0.12.0 (2013-08-23)

New features

  • #439: Added formatter 'OffenceCount' which outputs a summary list of cops and their offence count.
  • #395: Added --show-cops option to show available cops.
  • New cop NilComparison keeps track of comparisons like == nil.
  • New cop EvenOdd keeps track of occasions where Fixnum#even? or Fixnum#odd? should have been used (like x % 2 == 0).
  • New cop IndentationWidth checks for files using indentation that is not two spaces.
  • New cop SpaceAfterMethodName keeps track of method definitions with a space between the method name and the opening parenthesis.
  • New cop ParenthesesAsGroupedExpression keeps track of method calls with a space before the opening parenthesis.
  • New cop HashMethods keeps track of uses of deprecated Hash methods.
  • New Rails cop HasAndBelongsToMany checks for uses of has_and_belongs_to_many.
  • New Rails cop ReadAttribute tracks uses of read_attribute.
  • Attr cop does auto-correction.
  • CollectionMethods cop does auto-correction.
  • SignalException cop does auto-correction.
  • EmptyLiteral cop does auto-correction.
  • MethodCallParentheses cop does auto-correction.
  • DefWithParentheses cop does auto-correction.
  • DefWithoutParentheses cop does auto-correction.

Changes

  • Dropped -s/--silent option. Now progress/simple/clang formatters always report summary and emacs/files formatters no longer report.
  • Dropped the LineContinuation cop.

Bugs fixed

  • #432: Fix false positive for constant assignments when rhs is a method call with block in ConstantName.
  • #434: Support classes and modules defined with Class.new/Module.new in AccessControl.
  • Fix which ranges are highlighted in reports from IfUnlessModifier, WhileUntilModifier, and MethodAndVariableSnakeCase cop.
  • #438: Accept setting attribute on method argument in UselessAssignment.

0.11.1 (2013-08-12)

Changes

  • #425: ColonMethodCalls now allows constructor methods (like Nokogiri::HTML() to be called with double colon.

Bugs fixed

  • #427: FavorUnlessOverNegatedIf triggered when using elsifs.
  • #429: Fix LeadingCommentSpace offence reporting.
  • Fixed AsciiComments offence reporting.
  • Fixed BlockComments offence reporting.

0.11.0 (2013-08-09)

New features

  • #421: TrivialAccessors now ignores methods on user-configurable whitelist (such as to_s and to_hash).
  • #369: New option --auto-gen-config outputs RuboCop configuration that disables all cops that detect any offences.
  • The list of annotation keywords recognized by the CommentAnnotation cop is now configurable.
  • Configuration file names are printed as they are loaded in --debug mode.
  • Auto-correct support added in AlignParameters cop.
  • New cop UselessComparison checks for comparisons of the same arguments.
  • New cop UselessAssignment checks for useless assignments to local variables.
  • New cop SignalException checks for proper usage of fail and raise.
  • New cop ModuleFunction checks for usage of extend self in modules.

Bugs fixed

  • #374: Fixed error at post condition loop (begin-end-while, begin-end-until) in UnusedLocalVariable and ShadowingOuterLocalVariable.
  • #373 and #376: Allow braces around multi-line blocks if do-end would change the meaning of the code.
  • RedundantSelf now allows self. followed by any ruby keyword.
  • #391: Fix bug in counting slashes in a regexp.
  • #394: DotPosition cop handles correctly code like l.(1).
  • #390: CommentAnnotation cop allows keywords (e.g. Review, Optimize) if they just begin a sentence.
  • #400: Fix bug concerning nested defs in EmptyLineBetweenDefs cop.
  • #399: Allow assignment inside blocks in AssignmentInCondition cop.
  • Fix bug in favor_modifier.rb regarding missed offences after else etc.
  • #393: Retract support for multiline chaining of blocks (which fixed #346), thus rejecting issue 346.
  • #389: Ignore symbols that are arguments to Module#private_constant in SymbolName cop.
  • #387: Do autocorrect in AndOr cop only if it does not change the meaning of the code.
  • #398: Don't display blank lines in the output of the clang formatter.
  • #283: Refine StringLiterals string content check.

0.10.0 (2013-07-17)

New features

  • New cop RedundantReturn tracks redundant returns in method bodies.
  • New cop RedundantBegin tracks redundant begin blocks in method definitions.
  • New cop RedundantSelf tracks redundant uses of self.
  • New cop EmptyEnsure tracks empty ensure blocks.
  • New cop CommentAnnotation tracks formatting of annotation comments such as TODO.
  • Added custom rake task.
  • New formatter FileListFormatter outputs just a list of files with offences in them (related to #357).

Changes

  • TrivialAccessors now has an ExactNameMatch config option (related to #308).
  • TrivialAccessors now has an ExcludePredicates config option (related to #326).
  • Cops don't inherit from Parser::AST::Rewriter anymore. All 3rd party Cops should remove the call to super in their callbacks. If you implement your own processing you need to define the #investigate method instead of #inspect. Refer to the documentation of Cop::Commissioner and Cop::Cop classes for more information.
  • EndAlignment cop split into EndAlignment and BlockAlignment cops.

Bugs fixed

  • #288: Work with absolute Excludes paths internally (2nd fix for this issue).
  • TrivialAccessors now detects class attributes as well as instance attributes.
  • #338: Fix end alignment of blocks in chained assignments.
  • #345: Add $SAFE to the list of built-in global variables.
  • #340: Override config parameters rather than merging them.
  • #349: Fix false positive for CharacterLiteral (%w(?)).
  • #346: Support method chains for block end alignment checks.
  • #350: Support line breaks between variables on left hand side for block end alignment checks.
  • #356: Allow safe assignment in ParenthesesAroundCondition.

Misc

  • Improved performance on Ruby 1.9 by about 20%.
  • Improved overall performance by about 35%.

0.9.1 (2013-07-05)

New features

  • Added -l/--lint option to allow doing only linting with no style checks (similar to running ruby -wc).

Changes

  • Removed the BlockAlignSchema configuration option from EndAlignment. We now support only the default alignment schema - StartOfAssignment.
  • Made the preferred collection methods in CollectionMethods configurable.
  • Made the DotPosition cop configurable - now both leading and trailing styles are supported.

Bugs fixed

  • #318: Correct some special cases of block end alignment.
  • #317: Fix a false positive in LiteralInCondition.
  • #321: Ignore variables whose name start with _ in ShadowingOuterLocalVariable.
  • #322: Fix exception of UnusedLocalVariable and ShadowingOuterLocalVariable when inspecting keyword splat argument.
  • #316: Correct nested postfix unless in MultilineIfThen.
  • #327: Fix false offences for block expression that span on two lines in EndAlignment.
  • #332: Fix exception of UnusedLocalVariable and ShadowingOuterLocalVariable when inspecting named captures.
  • #333: Fix a case that EnsureReturn throws an exception when ensure has no body.

0.9.0 (2013-07-01)

New features

  • Introduced formatter feature, enables custom formatted output and multiple outputs.
  • Added progress formatter and now it's the default. (--format progress).
  • Added JSON formatter. (--format json).
  • Added clang style formatter showing the offending source. code. (--format clang). The clang formatter marks a whole range rather than just the starting position, to indicate more clearly where the problem is.
  • Added -f/--format option to specify formatter.
  • Added -o/--out option to specify output file for each formatter.
  • Added -r/--require option to inject external Ruby code into RuboCop.
  • Added -V/--verbose-version option that displays Parser version and Ruby version as well.
  • Added -R/--rails option that enables extra Rails-specific cops.
  • Added support for auto-correction of some offences with -a/--auto-correct.
  • New cop CaseEquality checks for explicit use of ===.
  • New cop AssignmentInCondition checks for assignment in conditions.
  • New cop EndAlignment tracks misaligned end keywords.
  • New cop Void tracks uses of literals/variables/operators in possibly void context.
  • New cop Documentation checks for top level class/module doc comments.
  • New cop UnreachableCode tracks unreachable code segments.
  • New cop MethodCallParentheses tracks unwanted braces in method calls.
  • New cop UnusedLocalVariable tracks unused local variables for each scope.
  • New cop ShadowingOuterLocalVariable tracks use of the same name as outer local variables for block arguments or block local variables.
  • New cop WhileUntilDo tracks uses of do with multi-line while/until.
  • New cop CharacterLiteral tracks uses of character literals (?x).
  • New cop EndInMethod tracks uses of END in method definitions.
  • New cop LiteralInCondition tracks uses of literals in the conditions of if/while/until.
  • New cop BeginBlock tracks uses of BEGIN blocks.
  • New cop EndBlock tracks uses of END blocks.
  • New cop DotPosition tracks the dot position in multi-line method calls.
  • New cop Attr tracks uses of Module#attr.
  • Add support for auto-correction of some offences with -a/--auto-correct.

Changes

  • Deprecated -e/--emacs option. (Use --format emacs instead).
  • Made progress formatter the default.
  • Most formatters (progress, simple and clang) now print relative file paths if the paths are under the current working directory.
  • Migrate all cops to new namespaces. Rubocop::Cop::Lint is for cops that emit warnings. Rubocop::Cop::Style is for cops that do not belong in other namespaces.
  • Merge FavorPercentR and PercentR into one cop called RegexpLiteral, and add configuration parameter MaxSlashes.
  • Add CountKeywordArgs configuration option to ParameterLists cop.

Bugs fixed

  • #239: Fixed double quotes false positives.
  • #233: Report syntax cop offences.
  • Fix off-by-one error in favor_modifier.
  • #229: Recognize a line with CR+LF as a blank line in AccessControl cop.
  • #235: Handle multiple constant assignment in ConstantName cop.
  • #246: Correct handling of unicode escapes within double quotes.
  • Fix crashes in Blocks, CaseEquality, CaseIndentation, ClassAndModuleCamelCase, ClassMethods, CollectionMethods, and ColonMethodCall.
  • #263: Do not check for space around operators called with method syntax.
  • #271: Always allow line breaks inside hash literal braces.
  • #270: Fixed a false positive in ParenthesesAroundCondition.
  • #288: Get config parameter AllCops/Excludes from highest config file in path.
  • #276: Let columns start at 1 instead of 0 in all output of column numbers.
  • #292: Don't check non-regular files (like sockets, etc).
  • Fix crashes in WordArray on arrays of character literals such as [?\r, ?\n].
  • Fix crashes in Documentation on empty modules.

0.8.3 (2013-06-18)

Bug fixes

  • Lock Parser dependency to version 2.0.0.beta5.

0.8.2 (2013-06-05)

New features

  • New cop BlockNesting checks for excessive block nesting.

Bug fixes

  • Correct calculation of whether a modifier version of a conditional statement will fit.
  • Fix an error in MultilineIfThen cop that occurred in some special cases.
  • #231: Fix a false positive for modifier if.

0.8.1 (2013-05-30)

New features

  • New cop Proc tracks uses of Proc.new.

Changes

  • Renamed NewLambdaLiteral to Lambda.
  • Aligned the Lambda cop more closely to the style guide - it now allows the use of lambda for multi-line blocks.

Bugs fixed

  • #210: Fix a false positive for double quotes in regexp literals.
  • #211: Fix a false positive for initialize method looking like a trivial writer.
  • #215: Fixed a lot of modifier if/unless/while/until issues.
  • #213: Make sure even disabled cops get their configuration set.
  • #214: Fix SpaceInsideHashLiteralBraces to handle string interpolation right.

0.8.0 (2013-05-28)

Changes

  • Folded ArrayLiteral and HashLiteral into EmptyLiteral cop.
  • The maximum number of params ParameterLists accepts in now configurable.
  • Reworked SymbolSnakeCase into SymbolName, which has an option AllowCamelCase enabled by default.
  • Migrated from Ripper to the portable Parser.

New features

  • New cop ConstantName checks for constant which are not using SCREAMING_SNAKE_CASE.
  • New cop AccessControl checks private/protected indentation and surrounding blank lines.
  • New cop Loop checks for begin/end/while(until) and suggests the use of Kernel#loop.

0.7.2 (2013-05-13)

Bugs fixed

  • #155: 'Do not use semicolons to terminate expressions.' is not implemented correctly.
  • OpMethod now handles definition of unary operators without crashing.
  • SymbolSnakeCase now handles aliasing of operators without crashing.
  • RescueException now handles the splat operator * in a rescue clause without crashing.
  • #159: AvoidFor cop misses many violations.

0.7.1 (2013-05-11)

Bugs fixed

  • Added missing files to the gemspec.

0.7.0 (2013-05-11)

New features

  • Added ability to include or exclude files/directories through .rubocop.yml.
  • Added option --only for running a single cop.
  • Relax semicolon rule for one line methods, classes and modules.
  • Configuration files, such as .rubocop.yml, can now include configuration from other files through the inherit_from directive. All configuration files implicitly inherit from config/default.yml.
  • New cop ClassMethods checks for uses for class/module names in definitions of class/module methods.
  • New cop SingleLineMethods checks for methods implemented on a single line.
  • New cop FavorJoin checks for usages of Array#* with a string argument.
  • New cop BlockComments tracks uses of block comments(=begin/=end comments).
  • New cop EmptyLines tracks consecutive blank lines.
  • New cop WordArray tracks arrays of words.
  • #108: New cop SpaceInsideHashLiteralBraces checks for spaces inside hash literal braces - style is configurable.
  • New cop LineContinuation tracks uses of the line continuation character (\).
  • New cop SymbolArray tracks arrays of symbols.
  • Print warnings for unrecognized names in configuration files.
  • New cop TrivialAccessors tracks method definitions that could be automatically generated with attr_* methods.
  • New cop LeadingCommentSpace checks for missing space after # in comments.
  • New cop ColonMethodCall tracks uses of :: for method calls.
  • New cop AvoidGlobalVars tracks uses of non built-in global variables.
  • New cop SpaceAfterControlKeyword tracks missing spaces after if/elsif/case/when/until/unless/while.
  • New cop Not tracks uses of the not keyword.
  • New cop Eval tracks uses of the eval function.

Bugs fixed

  • #101: SpaceAroundEqualsInParameterDefault doesn't work properly with empty string.
  • Fix BraceAfterPercent for %W, %i and %I and added more tests.
  • Fix a false positive in the Alias cop. :alias is no longer treated as keyword.
  • ArrayLiteral now properly detects Array.new.
  • HashLiteral now properly detects Hash.new.
  • VariableInterpolation now detects regexp back references and doesn't crash.
  • Don't generate pathnames like some/project//some.rb.
  • #151: Don't print the unrecognized cop warning several times for the same .rubocop.yml.

Misc

  • Renamed Indentation cop to CaseIndentation to avoid confusion.
  • Renamed EmptyLines cop to EmptyLineBetweenDefs to avoid confusion.

0.6.1 (2013-04-28)

New features

  • Split AsciiIdentifiersAndComments cop in two separate cops.

Bugs fixed

  • #90: Two cops crash when scanning code using super.
  • #93: Issue with whitespace?': undefined method.
  • #97: Build fails.
  • #100: OpMethod cop doesn't work if method arg is not in braces.
  • SymbolSnakeCase now tracks Ruby 1.9 hash labels as well as regular symbols.

Misc

  • #88: Abort gracefully when interrupted with Ctrl-C.
  • No longer crashes on bugs within cops. Now problematic checks are skipped and a message is displayed.
  • Replaced Term::ANSIColor with Rainbow.
  • Add an option to disable colors in the output.
  • Cop names are now displayed alongside messages when -d/--debug is passed.

0.6.0 (2013-04-23)

New features

  • New cop ReduceArguments tracks argument names in reduce calls.
  • New cop MethodLength tracks number of LOC (lines of code) in methods.
  • New cop RescueModifier tracks uses of rescue in modifier form.
  • New cop PercentLiterals tracks uses of %q, %Q, %s and %x.
  • New cop BraceAfterPercent tracks uses of % literals with delimiters other than ().
  • Support for disabling cops locally in a file with rubocop:disable comments.
  • New cop EnsureReturn tracks usages of return in ensure blocks.
  • New cop HandleExceptions tracks suppressed exceptions.
  • New cop AsciiIdentifiersAndComments tracks uses of non-ascii characters in identifiers and comments.
  • New cop RescueException tracks uses of rescuing the Exception class.
  • New cop ArrayLiteral tracks uses of Array.new.
  • New cop HashLiteral tracks uses of Hash.new.
  • New cop OpMethod tracks the argument name in operator methods.
  • New cop PercentR tracks uses of %r literals with zero or one slash in the regexp.
  • New cop FavorPercentR tracks uses of // literals with more than one slash in the regexp.

Bugs fixed

  • #62: Config files in ancestor directories are ignored if another exists in home directory.
  • #65: Suggests to convert symbols :==, :<=> and the like to snake_case.
  • #66: Does not crash on unreadable or unparseable files.
  • #70: Support alias with bareword arguments.
  • #64: Performance issue with Bundler.
  • #75: Make it clear that some global variables require the use of the English library.
  • #79: Ternary operator missing whitespace detection.

Misc

  • Dropped Jeweler for gem release management since it's no longer actively maintained.
  • Handle pluralization properly in the final summary.

0.5.0 (2013-04-17)

New features

  • New cop FavorSprintf that checks for usages of String#%.
  • New cop Semicolon that checks for usages of ; as expression separator.
  • New cop VariableInterpolation that checks for variable interpolation in double quoted strings.
  • New cop Alias that checks for uses of the keyword alias.
  • Automatically detect extensionless Ruby files with shebangs when search for Ruby source files in a directory.

Bugs fixed

  • #59: Interpolated variables not enclosed in braces are not noticed.
  • #42: Received malformed format string ArgumentError from rubocop.