diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..cc32da4 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1 @@ +inherit_from: .rubocop_todo.yml diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..37882fb --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,309 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2019-10-03 01:19:12 -0300 using RuboCop version 0.75.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: TreatCommentsAsGroupSeparators, Include. +# Include: **/*.gemfile, **/Gemfile, **/gems.rb +Bundler/OrderedGems: + Exclude: + - 'Gemfile' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleAlignWith. +# SupportedStylesAlignWith: either, start_of_block, start_of_line +Layout/BlockAlignment: + Exclude: + - 'spec/monkeypatch/array_spec.rb' + - 'spec/monkeypatch/hash_spec.rb' + - 'spec/monkeypatch/object_spec.rb' + - 'spec/monkeypatch/set_spec.rb' + - 'spec/monkeypatch/single_value_spec.rb' + - 'spec/safe/class_method_spec.rb' + - 'spec/safe/extend_spec.rb' + - 'spec/safe/stats_spec.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Layout/EmptyLineAfterGuardClause: + Exclude: + - 'lib/descriptive_statistics/percentile.rb' + - 'lib/descriptive_statistics/support/convert.rb' + +# Offense count: 48 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, no_empty_lines +Layout/EmptyLinesAroundBlockBody: + Exclude: + - 'lib/descriptive_statistics/refinement.rb' + - 'spec/monkeypatch/array_spec.rb' + - 'spec/monkeypatch/empty_collection_spec.rb' + - 'spec/monkeypatch/enumerable_spec.rb' + - 'spec/monkeypatch/hash_spec.rb' + - 'spec/monkeypatch/object_spec.rb' + - 'spec/monkeypatch/set_spec.rb' + - 'spec/monkeypatch/single_value_spec.rb' + - 'spec/refinement/refinement_spec.rb' + - 'spec/safe/class_method_spec.rb' + - 'spec/safe/extend_spec.rb' + - 'spec/safe/stats_spec.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only +Layout/EmptyLinesAroundClassBody: + Exclude: + - 'lib/descriptive_statistics/class_methods.rb' + - 'test/test.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/EmptyLinesAroundExceptionHandlingKeywords: + Exclude: + - 'Rakefile' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/EmptyLinesAroundMethodBody: + Exclude: + - 'lib/descriptive_statistics/refinement.rb' + +# Offense count: 13 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines +Layout/EmptyLinesAroundModuleBody: + Exclude: + - 'lib/descriptive_statistics/class_methods.rb' + - 'lib/descriptive_statistics/enumerable_extension.rb' + - 'lib/descriptive_statistics/refinement.rb' + - 'lib/descriptive_statistics/stats.rb' + - 'lib/descriptive_statistics/support/convert.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: Width, IgnoredPatterns. +Layout/IndentationWidth: + Exclude: + - 'spec/monkeypatch/array_spec.rb' + - 'spec/monkeypatch/hash_spec.rb' + - 'spec/monkeypatch/object_spec.rb' + - 'spec/monkeypatch/set_spec.rb' + - 'spec/monkeypatch/single_value_spec.rb' + - 'spec/safe/class_method_spec.rb' + - 'spec/safe/extend_spec.rb' + - 'spec/safe/stats_spec.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +Layout/SpaceAfterColon: + Exclude: + - 'spec/refinement/refinement_spec.rb' + +# Offense count: 125 +# Cop supports --auto-correct. +Layout/SpaceAfterComma: + Exclude: + - 'lib/descriptive_statistics/percentile.rb' + - 'spec/monkeypatch/array_spec.rb' + - 'spec/monkeypatch/hash_spec.rb' + - 'spec/monkeypatch/set_spec.rb' + - 'spec/refinement/refinement_spec.rb' + - 'spec/safe/class_method_spec.rb' + - 'spec/safe/extend_spec.rb' + - 'spec/safe/stats_spec.rb' + - 'test/test.rb' + +# Offense count: 12 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment. +Layout/SpaceAroundOperators: + Exclude: + - 'lib/descriptive_statistics/variance.rb' + - 'spec/monkeypatch/hash_spec.rb' + +# Offense count: 16 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceBeforeBlockBraces: + Exclude: + - 'spec/monkeypatch/object_spec.rb' + - 'spec/refinement/refinement_spec.rb' + +# Offense count: 32 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideBlockBraces: + Exclude: + - 'spec/monkeypatch/object_spec.rb' + - 'spec/refinement/refinement_spec.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + Exclude: + - 'spec/monkeypatch/hash_spec.rb' + - 'spec/refinement/refinement_spec.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/SpaceInsideParens: + Exclude: + - 'spec/monkeypatch/object_spec.rb' + +# Offense count: 18 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: final_newline, final_blank_line +Layout/TrailingBlankLines: + Enabled: false + +# Offense count: 4 +Lint/IneffectiveAccessModifier: + Exclude: + - 'lib/descriptive_statistics/support/convert.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods. +Lint/UnusedMethodArgument: + Exclude: + - 'lib/descriptive_statistics/support/convert.rb' + +# Offense count: 1 +# Configuration parameters: ContextCreatingMethods, MethodCreatingMethods. +Lint/UselessAccessModifier: + Exclude: + - 'lib/descriptive_statistics/support/convert.rb' + +# Offense count: 3 +Metrics/AbcSize: + Max: 67 + +# Offense count: 24 +# Configuration parameters: CountComments, ExcludedMethods. +# ExcludedMethods: refine +Metrics/BlockLength: + Max: 167 + +# Offense count: 4 +# Configuration parameters: CountComments, ExcludedMethods. +Metrics/MethodLength: + Max: 15 + +# Offense count: 2 +# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. +# AllowedNames: io, id, to, by, on, in, at, ip, db +Naming/UncommunicativeMethodParamName: + Exclude: + - 'lib/descriptive_statistics/percentile.rb' + - 'lib/descriptive_statistics/percentile_rank.rb' + +# Offense count: 2 +# Configuration parameters: EnforcedStyle. +# SupportedStyles: inline, group +Style/AccessModifierDeclarations: + Exclude: + - 'lib/descriptive_statistics/class_methods.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners. +# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces +# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object +# FunctionalMethods: let, let!, subject, watch +# IgnoredMethods: lambda, proc, it +Style/BlockDelimiters: + Exclude: + - 'spec/monkeypatch/object_spec.rb' + +# Offense count: 10 +# Cop supports --auto-correct. +Style/ColonMethodCall: + Exclude: + - 'lib/descriptive_statistics/mean.rb' + - 'lib/descriptive_statistics/median.rb' + - 'lib/descriptive_statistics/mode.rb' + - 'lib/descriptive_statistics/number.rb' + - 'lib/descriptive_statistics/percentile.rb' + - 'lib/descriptive_statistics/percentile_rank.rb' + - 'lib/descriptive_statistics/range.rb' + - 'lib/descriptive_statistics/standard_deviation.rb' + - 'lib/descriptive_statistics/sum.rb' + - 'lib/descriptive_statistics/variance.rb' + +# Offense count: 16 +Style/Documentation: + Enabled: false + +# Offense count: 36 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, never +Style/FrozenStringLiteralComment: + Enabled: false + +# Offense count: 29 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +Style/HashSyntax: + Exclude: + - 'Gemfile' + - 'lib/descriptive_statistics/descriptive_statistics.rb' + - 'spec/monkeypatch/hash_spec.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: AllowMultipleReturnValues. +Style/RedundantReturn: + Exclude: + - 'lib/descriptive_statistics/descriptive_statistics.rb' + - 'lib/descriptive_statistics/percentile_rank.rb' + - 'lib/descriptive_statistics/refinement.rb' + - 'lib/descriptive_statistics/sum.rb' + +# Offense count: 13 +# Cop supports --auto-correct. +Style/RedundantSelf: + Exclude: + - 'lib/descriptive_statistics/descriptive_statistics.rb' + +# Offense count: 200 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Enabled: false + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, Whitelist. +# Whitelist: to_ary, to_a, to_c, to_enum, to_h, to_hash, to_i, to_int, to_io, to_open, to_path, to_proc, to_r, to_regexp, to_str, to_s, to_sym +Style/TrivialAccessors: + Exclude: + - 'lib/descriptive_statistics/class_methods.rb' + +# Offense count: 32 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Metrics/LineLength: + Max: 125 diff --git a/Gemfile b/Gemfile index 6c22f71..1a9449d 100644 --- a/Gemfile +++ b/Gemfile @@ -3,4 +3,8 @@ source "https://rubygems.org" gem "rake", :group => :development gem "rspec", :group => :test gem "simplecov", :require => false, :group => :test -gem "minitest", :group => :test \ No newline at end of file +gem "minitest", :group => :test + +group :development, :test do + gem "rubocop" +end diff --git a/Gemfile.lock b/Gemfile.lock index cfa5ba9..4b2d5a9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,10 +1,16 @@ GEM remote: https://rubygems.org/ specs: + ast (2.4.0) diff-lcs (1.2.5) docile (1.1.5) + jaro_winkler (1.5.3) minitest (5.8.4) multi_json (1.10.1) + parallel (1.17.0) + parser (2.6.5.0) + ast (~> 2.4.0) + rainbow (3.0.0) rake (10.4.2) rspec (3.1.0) rspec-core (~> 3.1.0) @@ -18,11 +24,20 @@ GEM rspec-mocks (3.1.3) rspec-support (~> 3.1.0) rspec-support (3.1.2) + rubocop (0.75.0) + jaro_winkler (~> 1.5.1) + parallel (~> 1.10) + parser (>= 2.6) + rainbow (>= 2.2.2, < 4.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 1.7) + ruby-progressbar (1.10.1) simplecov (0.9.1) docile (~> 1.1.0) multi_json (~> 1.0) simplecov-html (~> 0.8.0) simplecov-html (0.8.0) + unicode-display_width (1.6.0) PLATFORMS ruby @@ -31,4 +46,8 @@ DEPENDENCIES minitest rake rspec + rubocop simplecov + +BUNDLED WITH + 2.0.1