Skip to content

Commit

Permalink
Fix rubocop styles
Browse files Browse the repository at this point in the history
  • Loading branch information
eagletmt committed Mar 3, 2018
1 parent 52a030d commit b908b63
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 15 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ inherit_from: .rubocop_todo.yml

AllCops:
DisplayCopNames: true
TargetRubyVersion: 2.2

Style/Documentation:
Exclude:
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ end

RSpec::Core::RakeTask.new(:spec)

task :default => [:clobber, :compile, :docker, :spec]
task :default => %i[clobber compile docker spec]

desc 'Build docker image for integration test'
task :docker do
Expand Down
5 changes: 1 addition & 4 deletions example/local_forward.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/usr/bin/env ruby
require 'libssh'
require 'socket'
require 'thread'

GC.stress = true

ssh_host = 'rossmann'
Expand Down Expand Up @@ -37,8 +35,7 @@
loop do
channel.write(socket.readpartial(bufsiz))
end
# rubocop:disable Lint/HandleExceptions
rescue EOFError
rescue EOFError # rubocop:disable Lint/HandleExceptions
end
channel.send_eof
end
Expand Down
4 changes: 2 additions & 2 deletions example/sshkit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
SSHKit.config.output = SSHKit::Formatter::Pretty.new($stdout)
SSHKit.config.output_verbosity = :debug

include SSHKit::DSL
include SSHKit::DSL # rubocop:disable Style/MixinUsage

on %w[barkhorn rossmann], in: :parallel do |host|
date = capture(:date)
Expand All @@ -24,7 +24,7 @@

on %w[barkhorn rossmann], in: :parallel do
execute :ruby, '-e', Shellwords.escape('puts "stdout"; $stderr.puts "stderr"')
execute :false, raise_on_non_zero_exit: false
execute :false, raise_on_non_zero_exit: false # rubocop:disable Lint/BooleanSymbol
end

on %w[barkhorn rossmann], in: :parallel do |host|
Expand Down
3 changes: 2 additions & 1 deletion lib/libssh/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

module LibSSH
# The version of libssh gem.
VERSION = '0.4.0'
VERSION = '0.4.0'.freeze
end
7 changes: 3 additions & 4 deletions lib/sshkit/backends/libssh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ def upload!(local, remote, _options = {})
loop do
scp.write(io.readpartial(BUFSIZ))
end
# rubocop:disable Lint/HandleExceptions
rescue EOFError
rescue EOFError # rubocop:disable Lint/HandleExceptions
end
end
end
Expand Down Expand Up @@ -143,7 +142,7 @@ def execute_command(cmd)
def wrap_local_reader(local)
if local.respond_to?(:read)
# local is IO-like object
yield(local, 0644)
yield(local, 0o644)
else
File.open(local, 'rb') do |f|
yield(f, File.stat(local).mode & 0xfff)
Expand Down Expand Up @@ -217,7 +216,7 @@ def configure_session(session, ssh_options)
when true
# Load from default ssh_config
session.parse_config
when false, nil
when false, nil # rubocop:disable Lint/EmptyWhen
# Don't load from ssh_config
else
# Load from specified path
Expand Down
2 changes: 1 addition & 1 deletion libssh.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# coding: utf-8

lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'libssh/version'
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/session_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
end

it 'returns available methods' do
expect(session.userauth_list).to match_array([:publickey, :password])
expect(session.userauth_list).to match_array(%i[publickey password])
end
end
end
Expand Down
3 changes: 2 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'English'
require 'fileutils'
require 'json'
Expand All @@ -22,7 +23,7 @@ def start

def stop
unless system('docker', 'stop', '-t', '0', @container_id, out: File::NULL)
$stderr.puts "[WARN] Cannot stop Docker container #{@container_id}"
warn "Cannot stop Docker container #{@container_id}"
end
end

Expand Down

0 comments on commit b908b63

Please sign in to comment.