quiet_quality 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3084fe3f419db403944af870a9ccc39cccfe046f9f01841f52872808cd38b186
4
- data.tar.gz: bc3b18bd54ec79e6adf72c9947142050cd0a14a329d665f58290fe40b3382b27
3
+ metadata.gz: f411385dc4547ecadf2e182ca8628a5f95973c43c7340314293b76489b5a5b5a
4
+ data.tar.gz: e414999cb5645c7d64fbcb8b52d02cae9b12be5ec8ea02ae640f2dbd434a5db2
5
5
  SHA512:
6
- metadata.gz: 761966c658f578970e2d420d194d8d81a71e2d8808f95c8862366656a88e2ee3bf10e1ec8907ac21f4b4e62d799cd923ea481c7bbbd856da8a9b5c8656c3cf1e
7
- data.tar.gz: 2a91a00a403943d7a6051dc788dae5d2a963740cfd6d543228d8dbc810a5efd2ac5bdc0d8fc9c5f6c799e97c0c81742fd17543a43b184b86e4be117365146a0c
6
+ metadata.gz: de6977b310cc518f46e81ca7404a3913419226c8723faa2554f52aa974759fbe572eab4486b29afe96880d8d5d80a4bc466b14ee85e8a51e2da52a46f2a335c1
7
+ data.tar.gz: 5bacf59ca7abd7004e2910f47e0cfc5fb5e4c8145faa6154b95d308ad73a0cc74a465b8a8a962b0471e4a417de09a486d11aea23f39972399633754c70be0bac
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ Gemfile.lock
4
4
  *.gem
5
5
  coverage/
6
6
  tmp/*
7
+ .DS_Store
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## Release 1.5.2
4
+
5
+ * Support command/exec-command overrides (yaml-only) (#127)
6
+ * Support ruby-git 2.x (#130 resolves #129)
7
+
3
8
  ## Release 1.5.1
4
9
 
5
10
  * Refactor ConfigParser to just parse the config into ParsedOptions, separating
@@ -129,13 +129,15 @@ module QuietQuality
129
129
  options.tools.each do |tool_options|
130
130
  update_tool_option(tool_options, :limit_targets)
131
131
  update_tool_option(tool_options, :filter_messages)
132
+ update_tool_option(tool_options, :command, global: false)
133
+ update_tool_option(tool_options, :exec_command, global: false)
132
134
  set_unless_nil(tool_options, :file_filter, build_file_filter(tool_options.tool_name))
133
135
  end
134
136
  end
135
137
 
136
- def update_tool_option(tool_options, option_name)
138
+ def update_tool_option(tool_options, option_name, global: true)
137
139
  tool_name = tool_options.tool_name
138
- set_unless_nil(tool_options, option_name, apply.global_option(option_name))
140
+ set_unless_nil(tool_options, option_name, apply.global_option(option_name)) if global
139
141
  set_unless_nil(tool_options, option_name, apply.tool_option(tool_name, option_name))
140
142
  end
141
143
 
@@ -22,7 +22,9 @@ module QuietQuality
22
22
  :limit_targets,
23
23
  :filter_messages,
24
24
  :file_filter,
25
- :excludes
25
+ :excludes,
26
+ :command,
27
+ :exec_command
26
28
  ].to_set
27
29
 
28
30
  def initialize
@@ -67,6 +67,8 @@ module QuietQuality
67
67
  read_tool_option(opts, tool_name, :all_files, :limit_targets, as: :reversed_boolean)
68
68
  read_tool_option(opts, tool_name, :file_filter, :file_filter, as: :string)
69
69
  read_tool_option(opts, tool_name, :excludes, :excludes, as: :strings)
70
+ read_tool_option(opts, tool_name, :command, :command, as: :strings)
71
+ read_tool_option(opts, tool_name, :exec_command, :exec_command, as: :strings)
70
72
  end
71
73
 
72
74
  def invalid!(message)
@@ -1,14 +1,16 @@
1
1
  module QuietQuality
2
2
  module Config
3
3
  class ToolOptions
4
- def initialize(tool, limit_targets: true, filter_messages: true, file_filter: nil)
4
+ def initialize(tool, **options)
5
5
  @tool_name = tool.to_sym
6
- @limit_targets = limit_targets
7
- @filter_messages = filter_messages
8
- @file_filter = file_filter
6
+ @limit_targets = options.fetch(:limit_targets, true)
7
+ @filter_messages = options.fetch(:filter_messages, true)
8
+ @file_filter = options.fetch(:file_filter, nil)
9
+ @command = options.fetch(:command, nil)
10
+ @exec_command = options.fetch(:exec_command, nil)
9
11
  end
10
12
 
11
- attr_accessor :file_filter
13
+ attr_accessor :file_filter, :command, :exec_command
12
14
  attr_reader :tool_name
13
15
  attr_writer :limit_targets, :filter_messages
14
16
 
@@ -38,6 +40,8 @@ module QuietQuality
38
40
  limit_targets: limit_targets?,
39
41
  filter_messages: filter_messages?,
40
42
  file_filter: file_filter&.regex&.to_s,
43
+ command: command,
44
+ exec_command: exec_command,
41
45
  excludes: file_filter&.excludes&.map(&:to_s)
42
46
  }
43
47
  end
@@ -32,7 +32,9 @@ module QuietQuality
32
32
  def runner
33
33
  @_runner ||= tool_options.runner_class.new(
34
34
  changed_files: limit_targets? ? changed_files : nil,
35
- file_filter: tool_options.file_filter
35
+ file_filter: tool_options.file_filter,
36
+ command_override: tool_options.command,
37
+ exec_override: tool_options.exec_command
36
38
  ).tap { |r| log_runner(r) }
37
39
  end
38
40
 
@@ -49,7 +49,9 @@ module QuietQuality
49
49
  def runner
50
50
  @_runner ||= tool_options.runner_class.new(
51
51
  changed_files: limit_targets? ? changed_files : nil,
52
- file_filter: tool_options.file_filter
52
+ file_filter: tool_options.file_filter,
53
+ command_override: tool_options.command,
54
+ exec_override: tool_options.exec_command
53
55
  ).tap { |r| log_runner(r) }
54
56
  end
55
57
 
@@ -6,9 +6,11 @@ module QuietQuality
6
6
  # In general, we don't want to supply a huge number of arguments to a command-line tool.
7
7
  MAX_FILES = 100
8
8
 
9
- def initialize(changed_files: nil, file_filter: nil)
9
+ def initialize(changed_files: nil, file_filter: nil, command_override: nil, exec_override: nil)
10
10
  @changed_files = changed_files
11
11
  @file_filter = file_filter
12
+ @command_override = command_override
13
+ @exec_override = exec_override
12
14
  end
13
15
 
14
16
  def invoke!
@@ -38,7 +40,7 @@ module QuietQuality
38
40
 
39
41
  private
40
42
 
41
- attr_reader :changed_files, :file_filter
43
+ attr_reader :changed_files, :file_filter, :command_override, :exec_override
42
44
 
43
45
  def performed_outcome
44
46
  out, err, stat = Open3.capture3(*command)
@@ -7,11 +7,11 @@ module QuietQuality
7
7
  end
8
8
 
9
9
  def command
10
- ["brakeman", "-f", "json"]
10
+ command_override || ["brakeman", "-f", "json"]
11
11
  end
12
12
 
13
13
  def exec_command
14
- ["brakeman"]
14
+ exec_override || ["brakeman"]
15
15
  end
16
16
 
17
17
  # These are specified in constants at the top of brakeman.rb:
@@ -12,22 +12,27 @@ module QuietQuality
12
12
 
13
13
  def command(json: true)
14
14
  return nil if skip_execution?
15
- base_command = ["mdl"]
16
- base_command << "--json" if json
17
- if target_files.any?
18
- base_command + target_files.sort
19
- else
20
- base_command + ["."]
21
- end
15
+ (command_override || ["mdl", "--json"]) + command_targets
22
16
  end
23
17
 
24
18
  def exec_command
25
- command(json: false)
19
+ return nil if skip_execution?
20
+ (exec_override || ["mdl"]) + command_targets
26
21
  end
27
22
 
28
23
  def relevant_path?(path)
29
24
  path.end_with?(".md")
30
25
  end
26
+
27
+ private
28
+
29
+ def command_targets
30
+ if target_files.any?
31
+ target_files.sort
32
+ else
33
+ ["."]
34
+ end
35
+ end
31
36
  end
32
37
  end
33
38
  end
@@ -13,12 +13,12 @@ module QuietQuality
13
13
 
14
14
  def command
15
15
  return nil if skip_execution?
16
- base_command + target_files.sort
16
+ (command_override || base_command) + target_files.sort
17
17
  end
18
18
 
19
19
  def exec_command
20
20
  return nil if skip_execution?
21
- base_exec_command + target_files.sort
21
+ (exec_override || base_exec_command) + target_files.sort
22
22
  end
23
23
 
24
24
  def relevant_path?(path)
@@ -1,3 +1,3 @@
1
1
  module QuietQuality
2
- VERSION = "1.5.1"
2
+ VERSION = "1.5.2"
3
3
  end
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  .map { |path| path.sub(/^bin\//, "") }
32
32
  end
33
33
 
34
- spec.add_dependency "git", "~> 1.18"
34
+ spec.add_dependency "git", ">= 1.18"
35
35
  spec.add_dependency "git_diff_parser", "~> 4"
36
36
 
37
37
  spec.add_development_dependency "rspec", "~> 3.13"
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quiet_quality
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Mueller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-07 00:00:00.000000000 Z
11
+ date: 2024-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.18'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.18'
27
27
  - !ruby/object:Gem::Dependency