Skip to content

Commit c974832

Browse files
committed
fix: fix Rubocop Style/IfUnlessModifier offense
1 parent e80c27d commit c974832

File tree

3 files changed

+4
-19
lines changed

3 files changed

+4
-19
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 4
10-
# This cop supports safe autocorrection (--autocorrect).
11-
Style/IfUnlessModifier:
12-
Exclude:
13-
- 'lib/git/base.rb'
14-
- 'lib/git/lib.rb'
15-
169
# Offense count: 2
1710
Style/MultilineBlockChain:
1811
Exclude:

lib/git/base.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -865,9 +865,7 @@ def diff_path_status(objectish = 'HEAD', obj2 = nil)
865865
File.expand_path(options[:repository] || '.git', options[:working_directory])
866866
end
867867

868-
if File.file?(repository)
869-
repository = File.expand_path(File.read(repository)[8..].strip, options[:working_directory])
870-
end
868+
repository = File.expand_path(File.read(repository)[8..].strip, options[:working_directory]) if File.file?(repository)
871869

872870
options[:repository] = repository
873871
end

lib/git/lib.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,9 +1300,7 @@ def tag(name, *opts)
13001300

13011301
opts = opts.last.instance_of?(Hash) ? opts.last : {}
13021302

1303-
if (opts[:a] || opts[:annotate]) && !(opts[:m] || opts[:message])
1304-
raise ArgumentError, 'Cannot create an annotated tag without a message.'
1305-
end
1303+
raise ArgumentError, 'Cannot create an annotated tag without a message.' if (opts[:a] || opts[:annotate]) && !(opts[:m] || opts[:message])
13061304

13071305
arr_opts = []
13081306

@@ -1520,9 +1518,7 @@ def self.warn_if_old_command(lib) # rubocop:disable Naming/PredicateMethod
15201518
return true if @version_checked
15211519

15221520
@version_checked = true
1523-
unless lib.meets_required_version?
1524-
warn "[WARNING] The git gem requires git #{lib.required_command_version.join('.')} or later, but only found #{lib.current_command_version.join('.')}. You should probably upgrade."
1525-
end
1521+
warn "[WARNING] The git gem requires git #{lib.required_command_version.join('.')} or later, but only found #{lib.current_command_version.join('.')}. You should probably upgrade." unless lib.meets_required_version?
15261522
true
15271523
end
15281524

@@ -1668,9 +1664,7 @@ def diff_as_hash(diff_command, opts = [])
16681664
def log_common_options(opts)
16691665
arr_opts = []
16701666

1671-
if opts[:count] && !opts[:count].is_a?(Integer)
1672-
raise ArgumentError, "The log count option must be an Integer but was #{opts[:count].inspect}"
1673-
end
1667+
raise ArgumentError, "The log count option must be an Integer but was #{opts[:count].inspect}" if opts[:count] && !opts[:count].is_a?(Integer)
16741668

16751669
arr_opts << "--max-count=#{opts[:count]}" if opts[:count]
16761670
arr_opts << '--all' if opts[:all]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy