Skip to content

Latest commit

 

History

History
2325 lines (1943 loc) · 214 KB

CHANGELOG.md

File metadata and controls

2325 lines (1943 loc) · 214 KB

Change log

master (unreleased)

New features

  • #2968: Add new Style/DocumentationMethod cop. (@sooyang)
  • #3360: Add RequireForNonPublicMethods configuration option to Style/DocumentationMethod cop. (@drenmi)

Bug fixes

  • #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)

Changes

  • #3341: Exclude RSpec tests from inspection by Style/NumericPredicate cop. (@drenmi)

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)

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 Perfomance/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. (@stormbreakerbg)
  • #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 paramaters 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 preceeded 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 pased 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 inbetween. (@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.