Skip to content

Commit a314835

Browse files
authored
Format code (no functional change) (#317)
1 parent 35303e1 commit a314835

File tree

6 files changed

+13
-18
lines changed

6 files changed

+13
-18
lines changed

src/commands/check.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ module Shards
5151
end
5252
end
5353

54-
#if commit = lock["commit"]?
54+
# if commit = lock["commit"]?
5555
# if resolver.responds_to?(:installed_commit)
5656
# return resolver.installed_commit == commit
5757
# else
5858
# return false
5959
# end
60-
#end
60+
# end
6161

6262
if Versions.resolve([spec.version], dependency.version).empty?
6363
Shards.logger.debug { "#{dependency.name}: version mismatch" }

src/config.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ module Shards
55
DEFAULT_COMMAND = "install"
66
DEFAULT_VERSION = "0"
77

8-
VERSION_REFERENCE = /^v?\d+[-.][-.a-zA-Z\d]+$/
9-
VERSION_TAG = /^v(\d+[-.][-.a-zA-Z\d]+)$/
8+
VERSION_REFERENCE = /^v?\d+[-.][-.a-zA-Z\d]+$/
9+
VERSION_TAG = /^v(\d+[-.][-.a-zA-Z\d]+)$/
1010
VERSION_AT_GIT_COMMIT = /\+git\.commit\.([0-9a-f]+)$/
1111

1212
def self.cache_path

src/resolvers/git.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module Shards
3535
refs = git_refs(version)
3636

3737
if file_exists?(refs, SPEC_FILENAME)
38-
capture("git show #{refs}:#{SPEC_FILENAME}")
38+
capture("git show #{refs}:#{SPEC_FILENAME}")
3939
else
4040
raise Error.new("Missing \"#{refs}:#{SPEC_FILENAME}\" for #{dependency.name.inspect}")
4141
end

src/solver.cr

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ module Shards
3939
if distance < @solution_distance
4040
# select better solution (less distance from ideal):
4141
consider(proposal, distance)
42-
4342
elsif distance == @solution_distance && proposal.size < @solution.not_nil!.size
4443
# select solution with fewer dependencies (same distance from ideal):
4544
consider(proposal, distance)
@@ -65,10 +64,10 @@ module Shards
6564
end
6665

6766
return unless packages.any? do |pkg|
68-
if dependency = pkg.spec.dependencies.find { |d| d.name == package.name }
69-
Versions.prerelease?(dependency.version)
70-
end
71-
end
67+
if dependency = pkg.spec.dependencies.find { |d| d.name == package.name }
68+
Versions.prerelease?(dependency.version)
69+
end
70+
end
7271
end
7372
end
7473

@@ -114,7 +113,6 @@ module Shards
114113

115114
yield "can't install '#{a_name}' versions #{a_version} and #{b_version} at the same time."
116115
interest << "#{a_name}:"
117-
118116
elsif interest.any? { |x| clause.any?(&.starts_with?(x)) }
119117
# dependency conflict:
120118
if clause[0] == negation

src/solver/sat.cr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ module Shards
99
alias Clause = Array(Literal)
1010

1111
enum Assignment : Int8
12-
NOT_SELECTED = 0
13-
SELECTED = 1
14-
UNDEFINED = -1
12+
NOT_SELECTED = 0
13+
SELECTED = 1
14+
UNDEFINED = -1
1515
end
1616

1717
def self.from_io(io : IO) : SAT

src/versions.cr

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Shards
22
module Versions
33
# :nodoc:
44
struct Segment
5-
NON_ALPHANUMERIC = /[^a-zA-Z0-9]/
5+
NON_ALPHANUMERIC = /[^a-zA-Z0-9]/
66
NATURAL_SORT_EXTRACT_NEXT_CHARS_AND_DIGITS = /^(\D*)(\d*)(.*)$/
77

88
protected getter! segment : String
@@ -121,23 +121,20 @@ module Shards
121121
if a_num && b_num
122122
# compare numbers (for natural 1, 2, ..., 10, 11 ordering):
123123
b_num <=> a_num
124-
125124
elsif a_num
126125
# b is preliminary version:
127126
a_segment.only_zeroes? do
128127
return b_segment <=> a_segment if a_segment.prerelease?
129128
return -1
130129
end
131130
return -1
132-
133131
elsif b_num
134132
# a is preliminary version:
135133
b_segment.only_zeroes? do
136134
return b_segment <=> a_segment if b_segment.prerelease?
137135
return 1
138136
end
139137
return 1
140-
141138
else
142139
# compare strings:
143140
b_segment <=> a_segment

0 commit comments

Comments
 (0)