Slide 1

Slide 1 text

Lessons Learned from Open Source Ernesto Tagwerker (@etagwerker) OmbuLabs, June 10th, 2021

Slide 2

Slide 2 text

🇦🇷 Hi, I’m from Argentina 🦅 I live in Philadelphia 👨💻 I ❤ Open Source

Slide 3

Slide 3 text

Lessons Learned & What You Can Learn About All Of Our Open Source Projects

Slide 4

Slide 4 text

Open Source Contributor & Maintainer Since 2009

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Lesson #1: Some people will implement your solution in a better way.

Slide 8

Slide 8 text

Open by Default When starting a project, we should ask ourselves: “Is there any reason to make this a closed source project?” There must be a solid reason to start a new closed source project. Otherwise, our projects should be open by default.

Slide 9

Slide 9 text

database_cleaner

Slide 10

Slide 10 text

How can we make sure that our database is clean between test runs?

Slide 11

Slide 11 text

1 RSpec.configure do |config| 2 3 config.before(:suite) do 4 DatabaseCleaner.strategy = :transaction 5 DatabaseCleaner.clean_with(:truncation) 6 end 7 8 config.around(:each) do |example| 9 DatabaseCleaner.cleaning do 10 example.run 11 end 12 end 13 14 end

Slide 12

Slide 12 text

email_spec

Slide 13

Slide 13 text

How can we test email behavior in our test suite?

Slide 14

Slide 14 text

1 describe "Signup Email" do 2 include EmailSpec::Helpers 3 include EmailSpec::Matchers 4 5 before do 6 @email = UserMailer.create_signup("[email protected]", "Jojo Binks") 7 end 8 9 it "should be set to be delivered to the email passed in" do 10 expect(@email).to deliver_to("[email protected]") 11 end 12 13 it "should contain the user's message in the mail body" do 14 expect(@email).to have_body_text(/Jojo Binks/) 15 end 16 end

Slide 15

Slide 15 text

Lesson #2: Even simple libraries can get complicated with different ORMs, testing frameworks, and multiple databases.

Slide 16

Slide 16 text

Both database_cleaner and email_spec were inherited by me.

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

Lesson #3: Volunteer to maintain a project even if you are not the best person for the job.

Slide 19

Slide 19 text

ombushop styleguide

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

ombulabs styleguide

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

fastruby.io styleguide

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

Lesson #4: You can organize your CSS code in a way that is easy to maintain.

Slide 26

Slide 26 text

Atomic Design by Brad Frost

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

OCA-epak

Slide 29

Slide 29 text

How can we communicate with the OCA API?

Slide 30

Slide 30 text

MercadoPago

Slide 31

Slide 31 text

How can we communicate with the MercadoPago API?

Slide 32

Slide 32 text

Lesson #5: You should stub your API requests in your test suite.

Slide 33

Slide 33 text

Lesson #6: You can detect a security hole if you don’t stub your API requests.

Slide 34

Slide 34 text

rails_stats

Slide 35

Slide 35 text

How can we measure the size of a Rails app without having to install its Rails environment?

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

Lesson #7: Proactively reaching out to maintainers of abandoned projects could make you a maintainer.

Slide 38

Slide 38 text

rails_upgrader

Slide 39

Slide 39 text

How can we build gems to automatically transform code? (e.g. strong params)

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

Lesson #8: Writing code transformations is not as easy as it sounds.

Slide 42

Slide 42 text

points

Slide 43

Slide 43 text

How can we keep track of our blind estimation process?

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

Lesson #9: We could add planning poker feature to make it easier to (not blindly) estimate.

Slide 49

Slide 49 text

dash

Slide 50

Slide 50 text

How can we see all the things we need to do in Pivotal Tracker _and_ GitHub?

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

harvesting

Slide 55

Slide 55 text

Is there a Ruby gem to communicate with the Harvest API?

Slide 56

Slide 56 text

Lesson #10: Building API wrappers is quite easy to do if you have built a few.

Slide 57

Slide 57 text

skunk

Slide 58

Slide 58 text

What if we could combine complexity and code coverage metrics?

Slide 59

Slide 59 text

Maintainability 1. Code Coverage (SimpleCov) 2. Code Quality (RubyCritic)

Slide 60

Slide 60 text

Signal #1 Code Coverage

Slide 61

Slide 61 text

Signal #2 Complexity

Slide 62

Slide 62 text

Signal #3 SkunkScore

Slide 63

Slide 63 text

SkunkScore = f(code_quality, code_coverage)

Slide 64

Slide 64 text

Complex files which lack tests should be our top priority

Slide 65

Slide 65 text

Maintainability 1. Code Coverage (SimpleCov) 2. Code Quality (RubyCritic) 3. SkunkScore (Skunk)

Slide 66

Slide 66 text

You are here:

Slide 67

Slide 67 text

Skunk Score Your compass to get out of the tar pit

Slide 68

Slide 68 text

Time SkunkScore Average 100 (days) 0 1 100

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

Lesson #11: Churn vs Complexity is not enough to see the whole picture of tech debt.

Slide 71

Slide 71 text

benchmark.fyi

Slide 72

Slide 72 text

What if we could share benchmark-ips reports easily?

Slide 73

Slide 73 text

skunk.fyi

Slide 74

Slide 74 text

How can we share our skunk score information with colleagues?

Slide 75

Slide 75 text

SHARE=true skunk

Slide 76

Slide 76 text

next_rails

Slide 77

Slide 77 text

How can we set up dual booting and keep track of deprecation warnings?

Slide 78

Slide 78 text

metric_fu

Slide 79

Slide 79 text

How can we run a bunch of static code analysis tools in our codebase?

Slide 80

Slide 80 text

No content

Slide 81

Slide 81 text

rubycritic

Slide 82

Slide 82 text

How can we visualize the churn vs. complexity graph of a Ruby app?

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

No content

Slide 85

Slide 85 text

bundler-leak

Slide 86

Slide 86 text

How can we know if one of our dependencies is known to have a memory leak?

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

What project do you feel more passionate about?

Slide 90

Slide 90 text

What project do you find more challenging?

Slide 91

Slide 91 text

Lesson #12: Pick a project that intrigues you, challenges you, interests you, and/or you feel passionate about.

Slide 92

Slide 92 text

Thank you! @etagwerker 92 Thank you!

Slide 93

Slide 93 text

Resources 1. https://github.com/whitesmith/rubycritic 2.https://github.com/colszowka/simplecov 3.https://github.com/metricfu/metric_fu 4.https://www.fastruby.io/blog/ruby/quality/code-quality-ruby-gems.html 5.https://www.reddit.com/r/ruby/comments/2bq092/rubycritic/ 6.http://jakescruggs.blogspot.com/2008/08/whats-good-flog-score.html 7.http://ruby.sadi.st/Flog.html 8.http://ruby.sadi.st/Flay.html 9.https://www.fastruby.io/blog/code-quality/intruducing-skunk-stink-score- calculator.html 10.https://www.ombulabs.com/blog/security/mercado-pago-security-vulnerability.html 11.https://www.fastruby.io/blog/bundler/memory-leaks/introducing-bundler-leak.html