talira

rubocop-require_tools

RuboCop extension that flags missing require statements

open sourceMITfree

rubocop-require_tools is an extension for RuboCop with tools for working with Ruby code's require statements. Its one cop, MissingRequireStatement, reports possibly missing requires, which leave implicit dependencies between files that are error prone and hard to maintain. It's added to a project's Gemfile and loaded from .rubocop.yml.

Problems it solves

  • my Ruby gem works in tests but crashes when loaded alone because a file forgot a require
  • find implicit dependencies between files in a Ruby project before they break
  • lint a Ruby codebase for missing require statements in CI

Features

  • MissingRequireStatement cop for missing requires
  • loads as a RuboCop extension from .rubocop.yml

Limitations

  • Only checks for missing requires; it has no other cops.1

Alternatives

The same job

These do what rubocop-require_tools does.

  1. ESLint Find and fix problems in your JavaScript code.
  2. RuboCop Rails RuboCop extension with cops for Rails best practices and conventions
  3. Reek Code smell detector for Ruby
  4. RuboCop A Ruby static code analyzer and formatter, based on the community Ruby style guide.
  5. RuboCop RSpec RuboCop extension with cops for RSpec test files
  6. Standard Ruby Unconfigurable Ruby linter and formatter built on RuboCop

Compare rubocop-require_tools with the top 3