From 9a7c20babb051953e7757ac3d44a1fc50e6a31e5 Mon Sep 17 00:00:00 2001 From: cn Date: Fri, 23 Feb 2018 11:13:28 +0100 Subject: [PATCH] gem: add rubocop --- .rubocop.yml | 13 ++ .rubocop_todo.yml | 308 ++++++++++++++++++++++++++++++++++++++++++++++ Rakefile | 4 +- dyndnsd.gemspec | 1 + 4 files changed, 325 insertions(+), 1 deletion(-) create mode 100644 .rubocop.yml create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..b7dc82c --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,13 @@ +inherit_from: .rubocop_todo.yml + +AllCops: + TargetRubyVersion: '2.3' + +Gemspec/OrderedDependencies: + Enabled: false + +Metrics/LineLength: + Max: 200 + +Style/Documentation: + Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..f097309 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,308 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2018-02-23 11:13:02 +0100 using RuboCop version 0.52.1. +# 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: AllowForAlignment, ForceEqualSignAlignment. +Layout/ExtraSpacing: + Exclude: + - 'dyndnsd.gemspec' + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/SpaceAfterComma: + Exclude: + - 'lib/dyndnsd/generator/bind.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: AllowForAlignment. +Layout/SpaceAroundOperators: + Exclude: + - 'dyndnsd.gemspec' + +# Offense count: 38 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + Exclude: + - 'lib/dyndnsd.rb' + - 'lib/dyndnsd/responder/dyndns_style.rb' + - 'lib/dyndnsd/responder/rest_style.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: final_newline, final_blank_line +Layout/TrailingBlankLines: + Exclude: + - 'spec/support/dummy_database.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +Layout/TrailingWhitespace: + Exclude: + - 'lib/dyndnsd/database.rb' + - 'lib/dyndnsd/updater/command_with_bind_zone.rb' + - 'spec/support/dummy_database.rb' + +# Offense count: 4 +Lint/IneffectiveAccessModifier: + Exclude: + - 'lib/dyndnsd.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Lint/ScriptPermission: + Exclude: + - 'lib/dyndnsd.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods. +Lint/UnusedMethodArgument: + Exclude: + - 'lib/dyndnsd.rb' + - 'lib/dyndnsd/responder/dyndns_style.rb' + - 'lib/dyndnsd/responder/rest_style.rb' + +# Offense count: 1 +Lint/UselessAssignment: + Exclude: + - 'spec/daemon_spec.rb' + +# Offense count: 5 +Metrics/AbcSize: + Max: 31 + +# Offense count: 1 +# Configuration parameters: CountComments, ExcludedMethods. +Metrics/BlockLength: + Max: 159 + +# Offense count: 1 +# Configuration parameters: CountComments. +Metrics/ClassLength: + Max: 149 + +# Offense count: 6 +# Configuration parameters: CountComments. +Metrics/MethodLength: + Max: 19 + +# Offense count: 2 +Naming/AccessorMethodName: + Exclude: + - 'lib/dyndnsd/responder/dyndns_style.rb' + - 'lib/dyndnsd/responder/rest_style.rb' + +# Offense count: 3 +# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist, MethodDefinitionMacros. +# NamePrefix: is_, has_, have_ +# NamePrefixBlacklist: is_, has_, have_ +# NameWhitelist: is_a? +# MethodDefinitionMacros: define_method, define_singleton_method +Naming/PredicateName: + Exclude: + - 'spec/**/*' + - 'lib/dyndnsd.rb' + - 'lib/dyndnsd/helper.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AutoCorrect. +Security/JSONLoad: + Exclude: + - 'lib/dyndnsd/database.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Security/YAMLLoad: + Exclude: + - 'lib/dyndnsd.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, conditionals +Style/AndOr: + Exclude: + - 'lib/dyndnsd.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/ColonMethodCall: + Exclude: + - 'lib/dyndnsd.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. +# SupportedStyles: assign_to_condition, assign_inside_condition +Style/ConditionalAssignment: + Exclude: + - 'lib/dyndnsd.rb' + - 'lib/dyndnsd/database.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/DefWithParentheses: + Exclude: + - 'lib/dyndnsd.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: format, sprintf, percent +Style/FormatString: + Exclude: + - 'lib/dyndnsd.rb' + +# Offense count: 3 +# Configuration parameters: . +# SupportedStyles: annotated, template, unannotated +Style/FormatStringToken: + EnforcedStyle: unannotated + +# Offense count: 15 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: when_needed, always, never +Style/FrozenStringLiteralComment: + Exclude: + - 'Gemfile' + - 'Rakefile' + - 'dyndnsd.gemspec' + - 'lib/dyndnsd.rb' + - 'lib/dyndnsd/database.rb' + - 'lib/dyndnsd/generator/bind.rb' + - 'lib/dyndnsd/helper.rb' + - 'lib/dyndnsd/responder/dyndns_style.rb' + - 'lib/dyndnsd/responder/rest_style.rb' + - 'lib/dyndnsd/updater/command_with_bind_zone.rb' + - 'lib/dyndnsd/version.rb' + - 'spec/daemon_spec.rb' + - 'spec/spec_helper.rb' + - 'spec/support/dummy_database.rb' + - 'spec/support/dummy_updater.rb' + +# Offense count: 2 +# Configuration parameters: MinBodyLength. +Style/GuardClause: + Exclude: + - 'lib/dyndnsd/responder/dyndns_style.rb' + - 'lib/dyndnsd/responder/rest_style.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +Style/HashSyntax: + EnforcedStyle: hash_rockets + +# Offense count: 2 +Style/IdenticalConditionalBranches: + Exclude: + - 'lib/dyndnsd.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: InverseMethods, InverseBlocks. +Style/InverseMethods: + Exclude: + - 'lib/dyndnsd.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/MethodCallWithoutArgsParentheses: + Exclude: + - 'lib/dyndnsd.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/MutableConstant: + Exclude: + - 'lib/dyndnsd/version.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: both, prefix, postfix +Style/NegatedIf: + Exclude: + - 'lib/dyndnsd.rb' + - 'lib/dyndnsd/helper.rb' + +# Offense count: 8 +# Cop supports --auto-correct. +Style/Not: + Exclude: + - 'lib/dyndnsd.rb' + - 'lib/dyndnsd/helper.rb' + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: short, verbose +Style/PreferredHashMethods: + Exclude: + - 'lib/dyndnsd.rb' + - 'lib/dyndnsd/responder/dyndns_style.rb' + - 'lib/dyndnsd/responder/rest_style.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantBegin: + Exclude: + - 'lib/dyndnsd/helper.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowAsExpressionSeparator. +Style/Semicolon: + Exclude: + - 'lib/dyndnsd.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: . +# SupportedStyles: use_perl_names, use_english_names +Style/SpecialGlobalVars: + EnforcedStyle: use_perl_names + +# Offense count: 80 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Exclude: + - 'dyndnsd.gemspec' + - 'lib/dyndnsd.rb' + - 'lib/dyndnsd/generator/bind.rb' + - 'lib/dyndnsd/responder/dyndns_style.rb' + - 'lib/dyndnsd/responder/rest_style.rb' + - 'lib/dyndnsd/version.rb' + - 'spec/daemon_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: MinSize. +# SupportedStyles: percent, brackets +Style/SymbolArray: + EnforcedStyle: brackets + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: IgnoredMethods. +# IgnoredMethods: respond_to, define_method +Style/SymbolProc: + Exclude: + - 'lib/dyndnsd.rb' + - 'lib/dyndnsd/database.rb' diff --git a/Rakefile b/Rakefile index 93cb943..ff8bf7c 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,8 @@ require 'bundler/gem_tasks' require 'rspec/core/rake_task' +require 'rubocop/rake_task' RSpec::Core::RakeTask.new(:spec) +RuboCop::RakeTask.new -task :default => :spec +task :default => [:rubocop, :spec] diff --git a/dyndnsd.gemspec b/dyndnsd.gemspec index 2bfed0e..376d0ae 100644 --- a/dyndnsd.gemspec +++ b/dyndnsd.gemspec @@ -28,4 +28,5 @@ Gem::Specification.new do |s| s.add_development_dependency 'rake' s.add_development_dependency 'rspec' s.add_development_dependency 'rack-test' + s.add_development_dependency 'rubocop', '~> 0.52.1' end