Module: Govuk::Lint::Diff
- Defined in:
- lib/govuk/lint/diff.rb
Defined Under Namespace
Modules: EnabledLines, TargetFinder
Class Method Summary
collapse
Class Method Details
.changed_lines ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/govuk/lint/diff.rb', line 24
def self.changed_lines
@changed_lines ||= begin
changes = changed_files.map do |file|
next unless File.exist?(file)
[file, `git difftool #{commit_options} \
-y \
-x 'diff \
--new-line-format="%dn " \
--unchanged-line-format="" \
--changed-group-format="%>"' \
#{file}`.split.map(&:to_i)]
end
Hash[changes.compact].tap { |h| h.default = [] }
end
end
|
.enable!(args) ⇒ Object
17
18
19
20
21
22
|
# File 'lib/govuk/lint/diff.rb', line 17
def self.enable!(args)
args.delete("--diff")
@cached = true if args.delete("--cached")
RuboCop::Cop::Cop.prepend EnabledLines
RuboCop::TargetFinder.prepend TargetFinder
end
|