Skip to content

Releases: rubocop/rubocop

RuboCop 0.47

16 Jan 01:39
Compare
Choose a tag to compare

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 Perfomance/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)

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)

RuboCop 0.46

30 Nov 06:57
Compare
Choose a tag to compare

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 Perfomance/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)

RuboCop 0.45 (The Halloween Release)

31 Oct 09:32
Compare
Choose a tag to compare

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)

RuboCop 0.44 (The Birthday Release)

13 Oct 14:06
Compare
Choose a tag to compare

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)

RuboCop 0.43

19 Sep 08:03
Compare
Choose a tag to compare

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_by { |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)

RuboCop 0.42.0

25 Jul 09:17
Compare
Choose a tag to compare

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)

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)

RuboCop 0.41.2

07 Jul 12:31
Compare
Choose a tag to compare

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)

Changes

  • #3230: Improve highlighting for Style/AsciiComments cop. (@drenmi)
  • Improve highlighting for Style/AsciiIdentifiers cop. (@drenmi)

RuboCop 0.41

25 Jun 17:51
Compare
Choose a tag to compare

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)

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

Read more

RuboCop 0.40

09 May 17:53
Compare
Choose a tag to compare

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)

RuboCop 0.39

27 Mar 11:15
Compare
Choose a tag to compare

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)