class BoxtRubyStyleGuide::GitDiff

Returns a list of files that have changed, as detected by `git-diff`

TODO: Write tests for this to ensure we're pulling the desired diff files see: github.com/ruby-git/ruby-git

Constants

TEST_STATUSES

List of Git statuses we should test See: git-scm.com/docs/git-status#_short_format

Attributes

base[R]

Public Class Methods

new(base:) click to toggle source
# File lib/boxt_ruby_style_guide/git_diff.rb, line 18
def initialize(base:)
  @base = base
end

Public Instance Methods

all() click to toggle source

A list of the local file paths of Ruby files with committed changes.

Returns Array

# File lib/boxt_ruby_style_guide/git_diff.rb, line 26
def all
  @all ||= git.diff(base).name_status.select { |_, stat| TEST_STATUSES.include?(stat) }.keys
end

Private Instance Methods

git() click to toggle source
# File lib/boxt_ruby_style_guide/git_diff.rb, line 32
def git
  @git ||= Git.open(".")
end