diff --git a/.travis.yml b/.travis.yml index 9fb557809..35f40530e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,7 @@ before_script: script: - bundle exec rake clobber compile test sign_hooks overcommit + - bundle exec codeclimate-test-reporter rvm: - 2.1.10 diff --git a/Gemfile b/Gemfile index f478b0b7e..2363f6e04 100644 --- a/Gemfile +++ b/Gemfile @@ -4,11 +4,11 @@ gemspec gem 'rake', '~> 11.1' gem 'rake-compiler', '~> 1.0' -gem 'rubocop', '0.43.0' +gem 'rubocop', '0.45.0' gem 'minitest', '~> 5.7' gem 'simplecov', '0.12.0' -gem 'codeclimate-test-reporter', '0.6.0' -gem 'overcommit', '0.36.0' +gem 'codeclimate-test-reporter', '~> 1.0' +gem 'overcommit', '0.37.0' gem 'mdl', '0.4.0' gem 'pry', git: 'https://github.com/pry/pry' gem 'travis', '~> 1.8' diff --git a/Gemfile.lock b/Gemfile.lock index 350231bac..8462b9007 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/pry/pry - revision: ce8c4b5137d0f14f2aa1c7a83b4706c5c798cead + revision: 285374b15a09f14b89687c5ee4c227249390ddc5 specs: pry (0.10.4) coderay (~> 1.1.0) @@ -22,11 +22,11 @@ GEM octokit (>= 2.2.0) childprocess (0.5.9) ffi (~> 1.0, >= 1.0.11) - codeclimate-test-reporter (0.6.0) - simplecov (>= 0.7.1, < 1.0.0) + codeclimate-test-reporter (1.0.0) coderay (1.1.1) + connection_pool (2.2.0) docile (1.1.5) - ethon (0.9.0) + ethon (0.9.1) ffi (>= 1.3.0) faraday (0.9.2) multipart-post (>= 1.2, < 3) @@ -56,12 +56,13 @@ GEM mixlib-config (2.2.4) multi_json (1.12.1) multipart-post (2.0.0) - net-http-persistent (2.9.4) + net-http-persistent (3.0.0) + connection_pool (~> 2.2) net-http-pipeline (1.0.1) netrc (0.11.0) octokit (4.3.0) sawyer (~> 0.7.0, >= 0.5.3) - overcommit (0.36.0) + overcommit (0.37.0) childprocess (~> 0.5.8) iniparse (~> 1.4) parser (2.3.1.4) @@ -74,7 +75,7 @@ GEM rake (11.3.0) rake-compiler (1.0.1) rake - rubocop (0.43.0) + rubocop (0.45.0) parser (>= 2.3.1.1, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) @@ -111,17 +112,17 @@ DEPENDENCIES bundler (~> 1.7) byebug! chandler (= 0.3.1) - codeclimate-test-reporter (= 0.6.0) + codeclimate-test-reporter (~> 1.0) mdl (= 0.4.0) minitest (~> 5.7) - overcommit (= 0.36.0) + overcommit (= 0.37.0) pry! rake (~> 11.1) rake-compiler (~> 1.0) - rubocop (= 0.43.0) + rubocop (= 0.45.0) simplecov (= 0.12.0) travis (~> 1.8) yard (= 0.9.5) BUNDLED WITH - 1.13.5 + 1.13.6 diff --git a/lib/byebug/helpers/file.rb b/lib/byebug/helpers/file.rb index d6b60dc97..3a090f8cf 100644 --- a/lib/byebug/helpers/file.rb +++ b/lib/byebug/helpers/file.rb @@ -8,7 +8,7 @@ module FileHelper # Reads lines of source file +filename+ into an array # def get_lines(filename) - File.foreach(filename).reduce([]) { |a, e| a << e.chomp } + File.foreach(filename).reduce([]) { |acc, elem| acc << elem.chomp } end # @@ -26,7 +26,7 @@ def get_line(filename, lineno) # one-line-at-a-time way. # def n_lines(filename) - File.foreach(filename).reduce(0) { |a, _e| a + 1 } + File.foreach(filename).reduce(0) { |acc, _elem| acc + 1 } end # diff --git a/test/commands/history_test.rb b/test/commands/history_test.rb index c605274a8..e57d91e0a 100644 --- a/test/commands/history_test.rb +++ b/test/commands/history_test.rb @@ -1,73 +1,79 @@ require 'test_helper' -module Byebug - # - # Tests Byebug's command line history. - # - class HistoryTest < TestCase - def program - strip_line_numbers <<-EOC - 1: module Byebug - 2: byebug - 3: - 4: a = 2 - 5: a + 3 - 6: end - EOC - end +unless ENV['LIBEDIT'] + module Byebug + # + # Tests Byebug's command line history. + # + class HistoryTest < TestCase + def program + strip_line_numbers <<-EOC + 1: module Byebug + 2: byebug + 3: + 4: a = 2 + 5: a + 3 + 6: end + EOC + end - def test_history_displays_latest_records_from_readline_history - enter 'show', 'history' - debug_code(program) + def test_history_displays_latest_records_from_readline_history + enter 'show', 'history' + debug_code(program) - check_output_includes(/\d+ show$/, /\d+ history$/) - end + check_output_includes(/\d+ show$/, /\d+ history$/) + end - def test_history_n_displays_whole_history_if_n_is_bigger_than_history_size - enter 'show', 'history 3' - debug_code(program) + def test_history_n_displays_whole_history_if_n_is_bigger_than_history_size + enter 'show', 'history 3' + debug_code(program) - check_output_includes(/\d+ show$/, /\d+ history 3$/) - end + check_output_includes(/\d+ show$/, /\d+ history 3$/) + end - def test_history_n_displays_lastest_n_records_from_readline_history - enter 'show width', 'show autolist', 'history 2' - debug_code(program) + def test_history_n_displays_lastest_n_records_from_readline_history + enter 'show width', 'show autolist', 'history 2' + debug_code(program) - check_output_includes(/\d+ show autolist$/, /\d+ history 2$/) - end + check_output_includes(/\d+ show autolist$/, /\d+ history 2$/) + end - def test_history_does_not_save_empty_commands - enter 'show', 'show width', '', 'history 3' - debug_code(program) + def test_history_does_not_save_empty_commands + enter 'show', 'show width', '', 'history 3' + debug_code(program) - check_output_includes(/\d+ show$/, /\d+ show width$/, /\d+ history 3$/) - end + check_output_includes( + /\d+ show$/, /\d+ show width$/, /\d+ history 3$/ + ) + end - def test_history_does_not_save_duplicated_consecutive_commands - enter 'show', 'show width', 'show width', 'history 3' - debug_code(program) + def test_history_does_not_save_duplicated_consecutive_commands + enter 'show', 'show width', 'show width', 'history 3' + debug_code(program) - check_output_includes(/\d+ show$/, /\d+ show width$/, /\d+ history 3$/) - end + check_output_includes( + /\d+ show$/, /\d+ show width$/, /\d+ history 3$/ + ) + end - def test_cmds_from_previous_repls_are_remembered_if_autosave_enabled - with_setting :autosave, true do - enter 'next', 'history 2' - debug_code(program) + def test_cmds_from_previous_repls_are_remembered_if_autosave_enabled + with_setting :autosave, true do + enter 'next', 'history 2' + debug_code(program) - check_output_includes(/\d+ next$/, /\d+ history 2$/) + check_output_includes(/\d+ next$/, /\d+ history 2$/) + end end - end - def test_cmds_from_previous_repls_are_not_remembered_if_autosave_disabled - with_setting :autosave, false do - enter 'next', 'history' - debug_code(program) + def test_cmds_from_previous_repls_are_not_remembered_if_autosave_disabled + with_setting :autosave, false do + enter 'next', 'history' + debug_code(program) - check_output_includes(/\d+ history$/) - check_output_doesnt_include(/\d+ next$/) + check_output_includes(/\d+ history$/) + check_output_doesnt_include(/\d+ next$/) + end end end - end unless ENV['LIBEDIT'] + end end diff --git a/test/commands/where_test.rb b/test/commands/where_test.rb index 7eecb4e61..61cf1d312 100644 --- a/test/commands/where_test.rb +++ b/test/commands/where_test.rb @@ -91,23 +91,25 @@ def test_where_displays_backtraces_using_short_callstyle # @note We skip this tests in Windows since the paths in this CI environment # are usually very deeply nested. # - class WhereWithNotDeeplyNestedPathsTest < WhereStandardTest - def test_where_displays_current_backtrace_w_shorpaths_if_fullpath_disabled - enter 'set nofullpath', 'where', 'set fullpath' - debug_code(program) - - expected_output = prepare_for_regexp <<-TXT - --> #0 #{example_full_class}.to_int(str#String) at #{example_path}:16 - #1 #{example_full_class}.encode(str#String) at #{example_path}:11 - #2 #{example_full_class}.initialize(l#String) at #{example_path}:7 - ͱ-- #3 Class.new(*args) at #{example_path}:20 - #4 at #{example_path}:20 - #5 at #{example_path}:1 - TXT - - check_output_includes(*expected_output) + unless /cygwin|mswin|mingw/ =~ RUBY_PLATFORM + class WhereWithNotDeeplyNestedPathsTest < WhereStandardTest + def test_where_displays_current_backtrace_w_shorpaths_if_fullpath_disabled + enter 'set nofullpath', 'where', 'set fullpath' + debug_code(program) + + expected_output = prepare_for_regexp <<-TXT + --> #0 #{example_full_class}.to_int(str#String) at #{example_path}:16 + #1 #{example_full_class}.encode(str#String) at #{example_path}:11 + #2 #{example_full_class}.initialize(l#String) at #{example_path}:7 + ͱ-- #3 Class.new(*args) at #{example_path}:20 + #4 at #{example_path}:20 + #5 at #{example_path}:1 + TXT + + check_output_includes(*expected_output) + end end - end unless /cygwin|mswin|mingw/ =~ RUBY_PLATFORM + end # # Tests dealing with backtraces when the path being debugged is deeply nested. diff --git a/test/support/coverage.rb b/test/support/coverage.rb index 09302fe47..5abf84ddd 100644 --- a/test/support/coverage.rb +++ b/test/support/coverage.rb @@ -5,13 +5,7 @@ def start_coverage_tracking require 'simplecov' SimpleCov.add_filter 'test' - - if ENV['CI'] - require 'codeclimate-test-reporter' - CodeClimate::TestReporter.start - else - SimpleCov.start - end + SimpleCov.start end start_coverage_tracking if ENV['NOCOV'].nil?