Sha256: 39aafb1c3e7089e6ba60c6d5a36eee3b272dd50595ee0b7ecbadd6f45fedb246
Contents?: true
Size: 811 Bytes
Versions: 1
Compression:
Stored size: 811 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop module Sorbet # This cop makes sure that RBI files are always located under sorbet/rbi/. # # @example # # bad # lib/some_file.rbi # other_file.rbi # # # good # sorbet/rbi/some_file.rbi # sorbet/rbi/any/path/for/file.rbi class ForbidRBIOutsideOfSorbetDir < RuboCop::Cop::Cop include RangeHelp PATH_REGEXP = %r{sorbet/rbi} def investigate(processed_source) add_offense( nil, location: source_range(processed_source.buffer, 1, 0), message: "RBI files are only accepted in the sorbet/rbi/ directory." ) unless processed_source.file_path =~ PATH_REGEXP end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rubocop-sorbet-0.6.2 | lib/rubocop/cop/sorbet/rbi/forbid_rbi_outside_of_sorbet_dir.rb |