-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodeclimate_diff
More file actions
executable file
·29 lines (22 loc) · 935 Bytes
/
codeclimate_diff
File metadata and controls
executable file
·29 lines (22 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env ruby
# frozen_string_literal: true
$LOAD_PATH.unshift("#{__dir__}/../lib")
require "optparse"
require "codeclimate_diff/runner"
require "codeclimate_diff"
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: codeclimate_diff [options]"
opts.on("-b", "--baseline", "Means it will regenerate the baseline.")
opts.on("-n", "--new-only",
"It will only show what you have changed and not existing issues in files you have touched.")
opts.on("-pPATTERN", "--pattern=PATTERN",
"Grep pattern to filter files. If provided, will filter the files changed on your branch further.")
end.parse!(into: options)
if options[:baseline]
CodeclimateDiff::Runner.generate_baseline
elsif options[:"new-only"]
CodeclimateDiff::Runner.run_diff_on_branch(options[:pattern], show_preexisting: false)
else
CodeclimateDiff::Runner.run_diff_on_branch(options[:pattern], show_preexisting: true)
end