Skip to content

Commit 9cd98bb

Browse files
committed
(FACT-3428) Style/SoleNestedConditional
Combine conditional logic
1 parent a20fc6b commit 9cd98bb

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,6 @@ Style/RedundantParentheses:
266266
Exclude:
267267
- 'lib/facter/custom_facts/core/execution/posix.rb'
268268

269-
# Offense count: 3
270-
# This cop supports safe autocorrection (--autocorrect).
271-
# Configuration parameters: AllowModifier.
272-
Style/SoleNestedConditional:
273-
Exclude:
274-
- 'lib/facter/framework/core/options/config_file_options.rb'
275-
- 'scripts/generate_changelog.rb'
276-
277269
# Offense count: 8
278270
# This cop supports safe autocorrection (--autocorrect).
279271
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.

lib/facter/framework/core/options/config_file_options.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ def augment_cli(file_cli_conf)
6060
def augment_custom(file_global_conf)
6161
return unless file_global_conf
6262

63-
if Options.cli?
64-
unless file_global_conf['no-custom-facts'].nil?
65-
@options[:no_custom_facts] = file_global_conf['no-custom-facts']
66-
end
63+
if Options.cli? && !file_global_conf['no-custom-facts'].nil?
64+
@options[:no_custom_facts] = file_global_conf['no-custom-facts']
6765
end
6866

6967
@options[:custom_dir] = file_global_conf['custom-dir'] unless file_global_conf['custom-dir'].nil?
@@ -73,8 +71,8 @@ def augment_custom(file_global_conf)
7371
def augment_external(global_conf)
7472
return unless global_conf
7573

76-
if Options.cli?
77-
@options[:no_external_facts] = global_conf['no-external-facts'] unless global_conf['no-external-facts'].nil?
74+
if Options.cli? && !global_conf['no-external-facts'].nil?
75+
@options[:no_external_facts] = global_conf['no-external-facts']
7876
end
7977

8078
@options[:external_dir] = [global_conf['external-dir']].flatten unless global_conf['external-dir'].nil?

scripts/generate_changelog.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ def parse_commit(commit)
7979
prs.each do |pr|
8080
next if pr[:state] != 'closed' && pr[:merged_at].nil?
8181

82-
if pr[:labels].nil? || pr[:labels].empty?
83-
unlabeled_prs << pr[:html_url] unless unlabeled_prs.include?(pr[:html_url])
82+
if (pr[:labels].nil? || pr[:labels].empty?) && !unlabeled_prs.include?(pr[:html_url])
83+
unlabeled_prs << pr[:html_url]
8484
end
8585

8686
pr[:labels].each do |label|

0 commit comments

Comments
 (0)