From 112bf1eb1e5c1db4fb0ff9337850e2dd809b6c5c Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Wed, 16 Mar 2022 20:59:23 -0500 Subject: [PATCH 01/22] Update foo_bar.rb --- foo_bar.rb | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/foo_bar.rb b/foo_bar.rb index bc32445..168d669 100644 --- a/foo_bar.rb +++ b/foo_bar.rb @@ -1 +1,22 @@ -# TODO: Add FooBar content +class FooBar + def run(items = gets.chomp.to_i) + if items > 0 + list = [] + (1..items).each do |n| + if n % 3 == 0 && n % 5 == 0 + list << "FOOBAR" + elsif n % 3 == 0 + list << "FOO" + elsif n % 5 == 0 + list << "BAR" + else + list << n + end + end + else + puts "Please enter a positive number" + end + + list + end +end From c49807377455ec1f36523d6e120c2b16ab4c38d1 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Wed, 16 Mar 2022 21:01:49 -0500 Subject: [PATCH 02/22] Update foo_bar_spec.rb add some tests --- spec/foo_bar_spec.rb | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/spec/foo_bar_spec.rb b/spec/foo_bar_spec.rb index 7689240..587fb09 100644 --- a/spec/foo_bar_spec.rb +++ b/spec/foo_bar_spec.rb @@ -1,4 +1,30 @@ require "spec_helper" require_relative "../foo_bar" -# TODO: Add FooBar specs +require "spec_helper" +require_relative "../foo_bar" + +describe "FooBar" do + it "returns correct list of items" do + result = FooBar.new.run(15) + + expect(result.length).to eq(15) + expect(result).to eq([ + 1, + 2, + "FOO", + 4, + "BAR", + "FOO", + 7, + 8, + "FOO", + "BAR", + 11, + "FOO", + 13, + 14, + "FOOBAR", + ]) + end +end From bca7d6305a7dfd481d41da3140e9e7c479ea7c54 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Wed, 16 Mar 2022 21:05:20 -0500 Subject: [PATCH 03/22] Update duplication_2.rb add some duplication --- duplication_2.rb | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/duplication_2.rb b/duplication_2.rb index debf01d..fb0f995 100644 --- a/duplication_2.rb +++ b/duplication_2.rb @@ -1 +1,30 @@ -# TODO: Add duplication_2.rb content +require "securerandom" + +module DuplicationExample + def identical(message, header: true) + body = [] + body << "-- HEADER --" if header + body << "-- MESSAGE --" + body << message + body << "-- FOOTER --" + message = body.join("\n") + + if message.length > 100 + message[0, 100] + else + message + end + end + + def similar + hex = SecureRandom.hex(20) + hex.reverse + hex += "-suffix" + + if hex.start_with?("z") + hex += "something-else" + end + + hex + end +end From fdeac6bc7c7d9977e5a2c74bf199db924fd6de96 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Wed, 16 Mar 2022 21:10:08 -0500 Subject: [PATCH 04/22] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 20ce1f1..ad99b84 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ Example files: https://gist.github.com/dblandin/589e70345774298e1622850349c31876 ## Setup + 1. Install the Code Climate [browser extension](https://codeclimate.com/browser-extension) 1. [Fork](https://github.com/codeclimate-demo/example-foobar#fork-destination-box) this project From 2176dbcfd70a6ca6b200f2d5aaeac46665a32eea Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Tue, 26 Apr 2022 18:27:45 -0500 Subject: [PATCH 05/22] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ad99b84..33b8a68 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Code Climate Lunch & Learn Example Example files: https://gist.github.com/dblandin/589e70345774298e1622850349c31876 -## Setup +## Setup 1. Install the Code Climate [browser extension](https://codeclimate.com/browser-extension) From 95c647a153f4d920a76046b1cce5683c7aeb0be3 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Mon, 2 May 2022 16:45:47 -0500 Subject: [PATCH 06/22] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 33b8a68..0e800de 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Code Climate Lunch & Learn Example Example files: https://gist.github.com/dblandin/589e70345774298e1622850349c31876 - + ## Setup From 095e79f86f1d8b2c761d2ec69de16b7c78cf0e40 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Mon, 2 May 2022 16:49:02 -0500 Subject: [PATCH 07/22] Update foo_bar_spec.rb --- spec/foo_bar_spec.rb | 54 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/spec/foo_bar_spec.rb b/spec/foo_bar_spec.rb index 587fb09..a863550 100644 --- a/spec/foo_bar_spec.rb +++ b/spec/foo_bar_spec.rb @@ -1,30 +1,30 @@ -require "spec_helper" -require_relative "../foo_bar" +# require "spec_helper" +# require_relative "../foo_bar" -require "spec_helper" -require_relative "../foo_bar" +# require "spec_helper" +# require_relative "../foo_bar" -describe "FooBar" do - it "returns correct list of items" do - result = FooBar.new.run(15) +# describe "FooBar" do +# it "returns correct list of items" do +# result = FooBar.new.run(15) - expect(result.length).to eq(15) - expect(result).to eq([ - 1, - 2, - "FOO", - 4, - "BAR", - "FOO", - 7, - 8, - "FOO", - "BAR", - 11, - "FOO", - 13, - 14, - "FOOBAR", - ]) - end -end +# expect(result.length).to eq(15) +# expect(result).to eq([ +# 1, +# 2, +# "FOO", +# 4, +# "BAR", +# "FOO", +# 7, +# 8, +# "FOO", +# "BAR", +# 11, +# "FOO", +# 13, +# 14, +# "FOOBAR", +# ]) +# end +# end From 2b81202dabb9baad571816c4d33b9ad1a5797d43 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Mon, 2 May 2022 16:53:32 -0500 Subject: [PATCH 08/22] Update foo_bar.rb --- foo_bar.rb | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/foo_bar.rb b/foo_bar.rb index 168d669..edea9e9 100644 --- a/foo_bar.rb +++ b/foo_bar.rb @@ -1,22 +1,22 @@ -class FooBar - def run(items = gets.chomp.to_i) - if items > 0 - list = [] - (1..items).each do |n| - if n % 3 == 0 && n % 5 == 0 - list << "FOOBAR" - elsif n % 3 == 0 - list << "FOO" - elsif n % 5 == 0 - list << "BAR" - else - list << n - end - end - else - puts "Please enter a positive number" - end +# class FooBar +# def run(items = gets.chomp.to_i) +# if items > 0 +# list = [] +# (1..items).each do |n| +# if n % 3 == 0 && n % 5 == 0 +# list << "FOOBAR" +# elsif n % 3 == 0 +# list << "FOO" +# elsif n % 5 == 0 +# list << "BAR" +# else +# list << n +# end +# end +# else +# puts "Please enter a positive number" +# end - list - end -end +# list +# end +# end From 6924b584685747a93fdc919dd1abc8c1cc591213 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Mon, 2 May 2022 16:55:57 -0500 Subject: [PATCH 09/22] Update Gemfile --- Gemfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 80af9d8..6aabbf5 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ -# frozen_string_literal: true -source "https://rubygems.org" +# # frozen_string_literal: true +# source "https://rubygems.org" -gem "codeclimate-test-reporter" -gem "rspec" -gem "simplecov" +# gem "codeclimate-test-reporter" +# gem "rspec" +# gem "simplecov" From d9e6f75125116dcde6ec10db19302005b37c0ccc Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Tue, 10 May 2022 13:38:08 -0500 Subject: [PATCH 10/22] Update Gemfile --- Gemfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 6aabbf5..9671472 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ -# # frozen_string_literal: true -# source "https://rubygems.org" +frozen_string_literal: true +source "https://rubygems.org" -# gem "codeclimate-test-reporter" -# gem "rspec" -# gem "simplecov" +gem "codeclimate-test-reporter" +gem "rspec" +gem "simplecov" From 2b1a2e59ba05b7af6245c02e466ca127d06fe954 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Tue, 10 May 2022 13:38:33 -0500 Subject: [PATCH 11/22] Update foo_bar_spec.rb --- spec/foo_bar_spec.rb | 54 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/spec/foo_bar_spec.rb b/spec/foo_bar_spec.rb index a863550..587fb09 100644 --- a/spec/foo_bar_spec.rb +++ b/spec/foo_bar_spec.rb @@ -1,30 +1,30 @@ -# require "spec_helper" -# require_relative "../foo_bar" +require "spec_helper" +require_relative "../foo_bar" -# require "spec_helper" -# require_relative "../foo_bar" +require "spec_helper" +require_relative "../foo_bar" -# describe "FooBar" do -# it "returns correct list of items" do -# result = FooBar.new.run(15) +describe "FooBar" do + it "returns correct list of items" do + result = FooBar.new.run(15) -# expect(result.length).to eq(15) -# expect(result).to eq([ -# 1, -# 2, -# "FOO", -# 4, -# "BAR", -# "FOO", -# 7, -# 8, -# "FOO", -# "BAR", -# 11, -# "FOO", -# 13, -# 14, -# "FOOBAR", -# ]) -# end -# end + expect(result.length).to eq(15) + expect(result).to eq([ + 1, + 2, + "FOO", + 4, + "BAR", + "FOO", + 7, + 8, + "FOO", + "BAR", + 11, + "FOO", + 13, + 14, + "FOOBAR", + ]) + end +end From d4efa712928fecf1f54a0879eaae5d1ebf47dfad Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Tue, 10 May 2022 13:41:11 -0500 Subject: [PATCH 12/22] Update foo_bar.rb --- foo_bar.rb | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/foo_bar.rb b/foo_bar.rb index edea9e9..168d669 100644 --- a/foo_bar.rb +++ b/foo_bar.rb @@ -1,22 +1,22 @@ -# class FooBar -# def run(items = gets.chomp.to_i) -# if items > 0 -# list = [] -# (1..items).each do |n| -# if n % 3 == 0 && n % 5 == 0 -# list << "FOOBAR" -# elsif n % 3 == 0 -# list << "FOO" -# elsif n % 5 == 0 -# list << "BAR" -# else -# list << n -# end -# end -# else -# puts "Please enter a positive number" -# end +class FooBar + def run(items = gets.chomp.to_i) + if items > 0 + list = [] + (1..items).each do |n| + if n % 3 == 0 && n % 5 == 0 + list << "FOOBAR" + elsif n % 3 == 0 + list << "FOO" + elsif n % 5 == 0 + list << "BAR" + else + list << n + end + end + else + puts "Please enter a positive number" + end -# list -# end -# end + list + end +end From ddcb332ed0bbd0e7523ddcadec4a9355395e5b63 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Tue, 10 May 2022 13:44:23 -0500 Subject: [PATCH 13/22] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0e800de..cc681f2 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Example files: https://gist.github.com/dblandin/589e70345774298e1622850349c31876 -## Introduce some complexity +## Introduce some complexity 1. Modify `foo_bar.rb` with [this content](https://gist.github.com/dblandin/589e70345774298e1622850349c31876#file-foo_bar-rb) from gist 1. Push to fork and open PR against master From b5327429f6a2b0d075ced91491ea1dbfb4f90224 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Tue, 10 May 2022 13:45:51 -0500 Subject: [PATCH 14/22] Update foo_bar_spec.rb --- spec/foo_bar_spec.rb | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/spec/foo_bar_spec.rb b/spec/foo_bar_spec.rb index 587fb09..880ab02 100644 --- a/spec/foo_bar_spec.rb +++ b/spec/foo_bar_spec.rb @@ -4,27 +4,27 @@ require "spec_helper" require_relative "../foo_bar" -describe "FooBar" do - it "returns correct list of items" do - result = FooBar.new.run(15) +# describe "FooBar" do +# it "returns correct list of items" do +# result = FooBar.new.run(15) - expect(result.length).to eq(15) - expect(result).to eq([ - 1, - 2, - "FOO", - 4, - "BAR", - "FOO", - 7, - 8, - "FOO", - "BAR", - 11, - "FOO", - 13, - 14, - "FOOBAR", - ]) - end -end +# expect(result.length).to eq(15) +# expect(result).to eq([ +# 1, +# 2, +# "FOO", +# 4, +# "BAR", +# "FOO", +# 7, +# 8, +# "FOO", +# "BAR", +# 11, +# "FOO", +# 13, +# 14, +# "FOOBAR", +# ]) +# end +# end From dfa4d94974f8291781090ec35fd17792b8b4440b Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Tue, 10 May 2022 13:52:17 -0500 Subject: [PATCH 15/22] Update foo_bar_spec.rb --- spec/foo_bar_spec.rb | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/spec/foo_bar_spec.rb b/spec/foo_bar_spec.rb index 880ab02..587fb09 100644 --- a/spec/foo_bar_spec.rb +++ b/spec/foo_bar_spec.rb @@ -4,27 +4,27 @@ require "spec_helper" require_relative "../foo_bar" -# describe "FooBar" do -# it "returns correct list of items" do -# result = FooBar.new.run(15) +describe "FooBar" do + it "returns correct list of items" do + result = FooBar.new.run(15) -# expect(result.length).to eq(15) -# expect(result).to eq([ -# 1, -# 2, -# "FOO", -# 4, -# "BAR", -# "FOO", -# 7, -# 8, -# "FOO", -# "BAR", -# 11, -# "FOO", -# 13, -# 14, -# "FOOBAR", -# ]) -# end -# end + expect(result.length).to eq(15) + expect(result).to eq([ + 1, + 2, + "FOO", + 4, + "BAR", + "FOO", + 7, + 8, + "FOO", + "BAR", + 11, + "FOO", + 13, + 14, + "FOOBAR", + ]) + end +end From 6cc6cd5d601bc1af600f23d82fc3f283ce7faaa3 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Tue, 10 May 2022 13:57:16 -0500 Subject: [PATCH 16/22] Update Gemfile --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 9671472..101fc26 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,4 @@ -frozen_string_literal: true +#frozen_string_literal: true source "https://rubygems.org" gem "codeclimate-test-reporter" From f1e71663e740cff596216fe72ace3d90665672bc Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Tue, 2 Aug 2022 16:29:20 -0500 Subject: [PATCH 17/22] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cc681f2..234c233 100644 --- a/README.md +++ b/README.md @@ -63,3 +63,5 @@ You should now see green annotations which mean those lines are now covered by You should now see duplication issues reported by Code Climate. + + From 572d9a3496c0644c05d16e7937bf3cf9d7c96d70 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Tue, 2 Aug 2022 17:45:48 -0500 Subject: [PATCH 18/22] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 234c233..831c928 100644 --- a/README.md +++ b/README.md @@ -63,5 +63,5 @@ You should now see green annotations which mean those lines are now covered by You should now see duplication issues reported by Code Climate. - + From 3be4693bd27ad47d8cdf3927c8343b2cd88d5cb3 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Fri, 2 Sep 2022 12:04:38 -0500 Subject: [PATCH 19/22] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 831c928..99b34aa 100644 --- a/README.md +++ b/README.md @@ -63,5 +63,5 @@ You should now see green annotations which mean those lines are now covered by You should now see duplication issues reported by Code Climate. - + From c6a06195f2cea0a848d9ae2c90f8069a1a1597b9 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Thu, 6 Oct 2022 09:44:07 -0500 Subject: [PATCH 20/22] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 99b34aa..cd9c54a 100644 --- a/README.md +++ b/README.md @@ -63,5 +63,5 @@ You should now see green annotations which mean those lines are now covered by You should now see duplication issues reported by Code Climate. - + From 9eb2f76259032484f78c451ee95d43e681d26732 Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Tue, 29 Nov 2022 13:21:00 -0600 Subject: [PATCH 21/22] Update example.rb --- nestfolder1/nestfolder2/example.rb | 127 +++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/nestfolder1/nestfolder2/example.rb b/nestfolder1/nestfolder2/example.rb index 31bd03f..6e47d1a 100644 --- a/nestfolder1/nestfolder2/example.rb +++ b/nestfolder1/nestfolder2/example.rb @@ -145,4 +145,131 @@ test test test +testtest +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test test +test +test +test +test +test +test +test + +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +test +testtest +test +test +test +test +test +test +test +testtest +test +test +test +test +test +test +test +testtest +test +test +test +test +test +test +test +testtest +test +test + + From 009eea7cf61a8d9159113367543889f47504366b Mon Sep 17 00:00:00 2001 From: Dave Henton Date: Tue, 10 Jan 2023 14:05:56 -0600 Subject: [PATCH 22/22] Update foo_bar.rb --- foo_bar.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foo_bar.rb b/foo_bar.rb index 168d669..44c0eb1 100644 --- a/foo_bar.rb +++ b/foo_bar.rb @@ -14,7 +14,7 @@ def run(items = gets.chomp.to_i) end end else - puts "Please enter a positive number" + puts "Please enter a positive number " end list