Sha256: 8f60f9b67c8fe2bdbdb4c050d84e85f3bd3f54ddb54fd0ba4c00f0b8848a5e30

Contents?: true

Size: 487 Bytes

Versions: 3

Compression:

Stored size: 487 Bytes

Contents

# frozen_string_literal: true

module NoComments
  module CommentDetector
    MAGIC_COMMENT_REGEX = /\A#.*\b(?:frozen_string_literal|encoding|coding|warn_indent|fileencoding)\b.*\z/
    TOOL_COMMENT_REGEX = /\A#\s*(?:rubocop|reek|simplecov|coveralls|pry|byebug|noinspection|sorbet|type)\b/
    def magic_comment?(stripped_line)
      stripped_line.match?(MAGIC_COMMENT_REGEX)
    end

    def tool_comment?(stripped_line)
      stripped_line.match?(TOOL_COMMENT_REGEX)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
no_comments-0.1.9 lib/no_comments/comment_detector.rb
no_comments-0.1.8 lib/no_comments/comment_detector.rb
no_comments-0.1.7 lib/no_comments/comment_detector.rb