Skip to content

Code and documentation for the RubyConf 2021 workshop "All comments must be haiku! Custom linting with RuboCop"

Notifications You must be signed in to change notification settings

scottcmoore/rubyconf_2021_customizing_rubocop

Repository files navigation

README

This repository contains code and documentation for a RubyConf 2021 workshop called "All Comments Must Be Haiku! Custom linting with RuboCop". In this workshop, we will:

  • Discuss RuboCop, what it does, its benefits and drawbacks.
  • Experiment a little with parser and learn about the underlying data structure RuboCop uses to parse code.
  • Write a custom cop (linting rule) that will enforce a rule that comments must be in haiku format.
  • Extend that cop in order to get more practice with RuboCop's Node Pattern DSL

If time permits we will:

Prerequisites

This workshop assumes that you have some experience writing Ruby. This workshop does not assume that you have any experience with RuboCop.

Getting Ready

You'll need Ruby installed. This code has been tested with Ruby 2.5, 2.6, and 3.0.

Set up the workshop app

  1. Clone the repo
  2. Run bundle install

Learning objectives

This workshop will hopefully teach you:

  1. What abstract syntax trees are and what they are useful for
  2. How RuboCop uses ASTs to understand Ruby code
  3. How to use RuboCop to enforce custom linting rules
  4. Drawbacks to RuboCop
  5. What is possible with RuboCop, and what isn't

Resources

These are some links to useful reading about some of the topics we've touched on.

About

Code and documentation for the RubyConf 2021 workshop "All comments must be haiku! Custom linting with RuboCop"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published