1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2024-11-22 21:37:52 +00:00

feat: update rubocop to 0.50.0

This commit is contained in:
Adrien Waksberg 2017-09-24 12:38:14 +02:00
parent dd02776baa
commit ce02022ac7
27 changed files with 39 additions and 155 deletions

View file

@ -6,116 +6,33 @@ AllCops:
- Vagrantfile - Vagrantfile
TargetRubyVersion: 2.3 TargetRubyVersion: 2.3
Style/AccessorMethodName: Naming/AccessorMethodName:
Enabled: false Enabled: false
Style/NumericLiteralPrefix:
Enabled: false Lint/RescueWithoutErrorClass:
Style/TrailingCommaInArguments:
Enabled: false
Style/TrailingCommaInLiteral:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Metrics/ParameterLists:
Max: 5
CountKeywordArgs: false
Style/MutableConstant:
Enabled: false Enabled: false
Metrics/LineLength: Metrics/LineLength:
Max: 120 Max: 120
Metrics/AbcSize: Metrics/CyclomaticComplexity:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false Enabled: false
Metrics/MethodLength: Metrics/MethodLength:
Enabled: false Enabled: false
Metrics/BlockLength: Metrics/BlockLength:
Enabled: false Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
Metrics/ClassLength: Metrics/ClassLength:
Enabled: false Enabled: false
Style/SpaceInsideHashLiteralBraces: Metrics/AbcSize:
Enabled: false
Style/AsciiComments:
Enabled: true
Style/Documentation:
Enabled: false
Style/SignalException:
Enabled: false
Style/OptionHash:
Enabled: true
Style/SymbolArray:
Enabled: true
Performance/Casecmp:
Enabled: false
Style/DoubleNegation:
Enabled: false
Style/Alias:
EnforcedStyle: prefer_alias_method
Style/MultilineMethodCallIndentation:
EnforcedStyle: indented
Style/RaiseArgs:
EnforcedStyle: exploded
Style/SpaceInLambdaLiteral:
Enabled: false
Lint/UnneededSplatExpansion:
Enabled: false Enabled: false
Style/NumericLiteralPrefix:
# Generated configuration Enabled: false
Style/HashSyntax: Style/FrozenStringLiteralComment:
Enabled: true
EnforcedStyle: ruby19
UseHashRocketsWithSymbolValues: false
Style/MethodDefParentheses:
Enabled: true
EnforcedStyle: require_parentheses
Style/MultilineAssignmentLayout:
Enabled: true
EnforcedStyle: new_line
Style/IndentationConsistency:
Enabled: true
EnforcedStyle: normal
Style/AlignParameters:
Enabled: true
EnforcedStyle: with_fixed_indentation
Style/BlockDelimiters:
Enabled: true
EnforcedStyle: line_count_based
Style/AndOr:
Enabled: true
Style/DotPosition:
Enabled: true
EnforcedStyle: leading
Style/EmptyLinesAroundClassBody:
Enabled: true
EnforcedStyle: no_empty_lines
Style/EmptyLinesAroundModuleBody:
Enabled: true
EnforcedStyle: no_empty_lines
Style/NumericPredicate:
Enabled: true
EnforcedStyle: comparison
Style/EvenOdd:
Enabled: false Enabled: false
Style/CollectionMethods:
Enabled: true
PreferredMethods:
collect: map
collect!: map!
inject: reduce
detect: find
find_all: select
Style/EmptyLinesAroundAccessModifier:
Enabled: true
Style/CommandLiteral: Style/CommandLiteral:
Enabled: true Enabled: true
EnforcedStyle: percent_x EnforcedStyle: percent_x
Style/StringLiterals: Style/Documentation:
Enabled: true Enabled: false
EnforcedStyle: single_quotes
Style/SpaceInsideBlockBraces:
EnforcedStyle: space
Style/VariableNumber:
EnforcedStyle: snake_case

View file

@ -8,7 +8,7 @@ gem 'locale', '~> 2.1', '>= 2.1.2'
gem 'rotp', '~> 3.1', '>= 3.1.0' gem 'rotp', '~> 3.1', '>= 3.1.0'
group :development do group :development do
gem 'rubocop', '0.48.1' gem 'rubocop', '0.50.0'
gem 'test-unit' gem 'test-unit'
gem 'yard' gem 'yard'
end end

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #
@ -39,7 +38,7 @@ module MPW
@config.setup(options) @config.setup(options)
puts I18n.t('form.set_config.valid').to_s.green puts I18n.t('form.set_config.valid').to_s.green
rescue => e rescue e
puts "#{I18n.t('display.error')} #15: #{e}".red puts "#{I18n.t('display.error')} #15: #{e}".red
exit 2 exit 2
end end
@ -50,7 +49,7 @@ module MPW
@config.set_wallet_path(path, @wallet) @config.set_wallet_path(path, @wallet)
puts I18n.t('form.set_wallet_path.valid').to_s.green puts I18n.t('form.set_wallet_path.valid').to_s.green
rescue => e rescue e
puts "#{I18n.t('display.error')} #19: #{e}".red puts "#{I18n.t('display.error')} #19: #{e}".red
exit 2 exit 2
end end
@ -67,7 +66,7 @@ module MPW
load_config load_config
puts I18n.t('form.setup_config.valid').to_s.green puts I18n.t('form.setup_config.valid').to_s.green
rescue => e rescue e
puts "#{I18n.t('display.error')} #8: #{e}".red puts "#{I18n.t('display.error')} #8: #{e}".red
exit 2 exit 2
end end
@ -89,7 +88,7 @@ module MPW
@config.setup_gpg_key(@password, gpg_key) @config.setup_gpg_key(@password, gpg_key)
puts I18n.t('form.setup_gpg_key.valid').to_s.green puts I18n.t('form.setup_gpg_key.valid').to_s.green
rescue => e rescue e
puts "#{I18n.t('display.error')} #8: #{e}".red puts "#{I18n.t('display.error')} #8: #{e}".red
exit 2 exit 2
end end
@ -119,7 +118,7 @@ module MPW
# Load config # Load config
def load_config def load_config
@config.load_config @config.load_config
rescue => e rescue e
puts "#{I18n.t('display.error')} #10: #{e}".red puts "#{I18n.t('display.error')} #10: #{e}".red
exit 2 exit 2
end end
@ -140,7 +139,7 @@ module MPW
@mpw.read_data @mpw.read_data
end end
end end
rescue => e rescue e
puts "#{I18n.t('display.error')} #11: #{e}".red puts "#{I18n.t('display.error')} #11: #{e}".red
exit 2 exit 2
end end
@ -416,7 +415,7 @@ module MPW
@mpw.write_data @mpw.write_data
puts I18n.t('form.add_key.valid').to_s.green puts I18n.t('form.add_key.valid').to_s.green
rescue => e rescue e
puts "#{I18n.t('display.error')} #13: #{e}".red puts "#{I18n.t('display.error')} #13: #{e}".red
end end
@ -427,7 +426,7 @@ module MPW
@mpw.write_data @mpw.write_data
puts I18n.t('form.delete_key.valid').to_s.green puts I18n.t('form.delete_key.valid').to_s.green
rescue => e rescue e
puts "#{I18n.t('display.error')} #15: #{e}".red puts "#{I18n.t('display.error')} #15: #{e}".red
end end
@ -478,7 +477,7 @@ module MPW
@mpw.write_data @mpw.write_data
puts I18n.t('form.add_item.valid').to_s.green puts I18n.t('form.add_item.valid').to_s.green
rescue => e rescue e
puts "#{I18n.t('display.error')} #13: #{e}".red puts "#{I18n.t('display.error')} #13: #{e}".red
end end
@ -506,7 +505,7 @@ module MPW
puts I18n.t('form.update_item.valid').to_s.green puts I18n.t('form.update_item.valid').to_s.green
end end
rescue => e rescue e
puts "#{I18n.t('display.error')} #14: #{e}".red puts "#{I18n.t('display.error')} #14: #{e}".red
end end
@ -530,7 +529,7 @@ module MPW
puts I18n.t('form.delete_item.valid').to_s.green puts I18n.t('form.delete_item.valid').to_s.green
end end
rescue => e rescue e
puts "#{I18n.t('display.error')} #16: #{e}".red puts "#{I18n.t('display.error')} #16: #{e}".red
end end
@ -548,7 +547,7 @@ module MPW
item = get_item(items) item = get_item(items)
clipboard(item, clipboard) clipboard(item, clipboard)
end end
rescue => e rescue e
puts "#{I18n.t('display.error')} #14: #{e}".red puts "#{I18n.t('display.error')} #14: #{e}".red
end end
@ -578,7 +577,7 @@ module MPW
File.open(file, 'w') { |f| f << data.to_yaml } File.open(file, 'w') { |f| f << data.to_yaml }
puts I18n.t('form.export.valid', file: file).to_s.green puts I18n.t('form.export.valid', file: file).to_s.green
rescue => e rescue e
puts "#{I18n.t('display.error')} #17: #{e}".red puts "#{I18n.t('display.error')} #17: #{e}".red
end end
@ -613,7 +612,7 @@ module MPW
@mpw.write_data @mpw.write_data
puts I18n.t('form.import.valid').to_s.green puts I18n.t('form.import.valid').to_s.green
rescue => e rescue e
puts "#{I18n.t('display.error')} #18: #{e}".red puts "#{I18n.t('display.error')} #18: #{e}".red
end end
end end

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #
@ -39,9 +38,9 @@ module MPW
def initialize(config_file = nil) def initialize(config_file = nil)
@config_file = config_file @config_file = config_file
@config_dir = @config_dir =
if /darwin/ =~ RUBY_PLATFORM if RUBY_PLATFORM =~ /darwin/
"#{Dir.home}/Library/Preferences/mpw" "#{Dir.home}/Library/Preferences/mpw"
elsif /cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM elsif RUBY_PLATFORM =~ /cygwin|mswin|mingw|bccwin|wince|emx/
"#{Dir.home}/AppData/Local/mpw" "#{Dir.home}/AppData/Local/mpw"
else else
"#{Dir.home}/.config/mpw" "#{Dir.home}/.config/mpw"
@ -94,7 +93,7 @@ module MPW
File.open(@config_file, 'w') do |file| File.open(@config_file, 'w') do |file|
file << config.to_yaml file << config.to_yaml
end end
rescue => e rescue e
raise "#{I18n.t('error.config.write')}\n#{e}" raise "#{I18n.t('error.config.write')}\n#{e}"
end end
@ -122,7 +121,7 @@ module MPW
ctx = GPGME::Ctx.new ctx = GPGME::Ctx.new
ctx.genkey(param, nil, nil) ctx.genkey(param, nil, nil)
rescue => e rescue e
raise "#{I18n.t('error.config.genkey_gpg.exception')}\n#{e}" raise "#{I18n.t('error.config.genkey_gpg.exception')}\n#{e}"
end end
@ -141,7 +140,7 @@ module MPW
raise if @gpg_key.empty? || @wallet_dir.empty? raise if @gpg_key.empty? || @wallet_dir.empty?
I18n.locale = @lang.to_sym I18n.locale = @lang.to_sym
rescue => e rescue e
raise "#{I18n.t('error.config.load')}\n#{e}" raise "#{I18n.t('error.config.load')}\n#{e}"
end end

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #

View file

@ -1,4 +1,3 @@
#!/usr/bin/ruby
# MPW is a software to crypt and manage your passwords # MPW is a software to crypt and manage your passwords
# Copyright (C) 2017 Adrien Waksberg <mpw@yae.im> # Copyright (C) 2017 Adrien Waksberg <mpw@yae.im>
# #
@ -89,14 +88,14 @@ module MPW
otp: @otp_keys.key?(d['id']), otp: @otp_keys.key?(d['id']),
comment: d['comment'], comment: d['comment'],
last_edit: d['last_edit'], last_edit: d['last_edit'],
created: d['created'], created: d['created']
) )
) )
end end
end end
add_key(@key) unless @keys.key?(@key) add_key(@key) unless @keys.key?(@key)
rescue => e rescue e
raise "#{I18n.t('error.mpw_file.read_data')}\n#{e}" raise "#{I18n.t('error.mpw_file.read_data')}\n#{e}"
end end
@ -116,7 +115,7 @@ module MPW
'url' => item.url, 'url' => item.url,
'comment' => item.comment, 'comment' => item.comment,
'last_edit' => item.last_edit, 'last_edit' => item.last_edit,
'created' => item.created, 'created' => item.created
} }
) )
end end
@ -147,7 +146,7 @@ module MPW
end end
File.rename(tmp_file, @wallet_file) File.rename(tmp_file, @wallet_file)
rescue => e rescue e
File.unlink(tmp_file) if File.exist?(tmp_file) File.unlink(tmp_file) if File.exist?(tmp_file)
raise "#{I18n.t('error.mpw_file.write_data')}\n#{e}" raise "#{I18n.t('error.mpw_file.write_data')}\n#{e}"
@ -324,7 +323,7 @@ module MPW
crypto crypto
.decrypt(data, password) .decrypt(data, password)
.read.force_encoding('utf-8') .read.force_encoding('utf-8')
rescue => e rescue e
raise "#{I18n.t('error.gpg_file.decrypt')}\n#{e}" raise "#{I18n.t('error.gpg_file.decrypt')}\n#{e}"
end end
@ -342,7 +341,7 @@ module MPW
end end
crypto.encrypt(data, recipients: recipients).read crypto.encrypt(data, recipients: recipients).read
rescue => e rescue e
raise "#{I18n.t('error.gpg_file.encrypt')}\n#{e}" raise "#{I18n.t('error.gpg_file.encrypt')}\n#{e}"
end end
end end

View file

@ -1,5 +1,3 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__) lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

View file

@ -1,5 +1,3 @@
#!/usr/bin/ruby
require 'fileutils' require 'fileutils'
require 'gpgme' require 'gpgme'

View file

@ -1,5 +1,3 @@
#!/usr/bin/ruby
require 'i18n' require 'i18n'
require 'test/unit' require 'test/unit'

View file

@ -1,5 +1,3 @@
#!/usr/bin/ruby
require 'mpw/config' require 'mpw/config'
require 'test/unit' require 'test/unit'
require 'locale' require 'locale'

View file

@ -1,5 +1,3 @@
#!/usr/bin/ruby
require 'i18n' require 'i18n'
require 'test/unit' require 'test/unit'

View file

@ -1,5 +1,3 @@
#!/usr/bin/ruby
require 'mpw/item' require 'mpw/item'
require 'test/unit' require 'test/unit'
require 'yaml' require 'yaml'

View file

@ -1,5 +1,3 @@
#!/usr/bin/ruby
require 'mpw/mpw' require 'mpw/mpw'
require 'mpw/item' require 'mpw/item'
require 'test/unit' require 'test/unit'

View file

@ -1,5 +1,3 @@
#!/usr/bin/ruby
require 'yaml' require 'yaml'
require 'test/unit' require 'test/unit'