yalphabetize 0.6.2 → 0.7.0

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: 6988242d325c39c0c114fce1300814c74456806bed554987a30b5ad5f2d6ca9b
4
- data.tar.gz: 7db44e443592581729084a86b16a58248223e324f935be63af5786624edfe4da
3
+ metadata.gz: 8adda25f8bd79c06f784d72b46e8391e236f858133a3251369203aef16a661b2
4
+ data.tar.gz: a25104aa54b0d51451c1964b6cccb9600d5619514830dd19c49a48a18d4fee38
5
5
  SHA512:
6
- metadata.gz: de2c63f96b4d3b182f79c0c57256a94f0f9f357cc49378b76b37c2dac21156256c8193d7dd45f8471992a3e9e83847db324dd0c216668da492ed72206606ed9a
7
- data.tar.gz: acf1e2c0c0ae38053c6b5e705768c06dc4ea15e52746d6361133ccbe7b2f6be475777e0ab7af92c92d867f28fd3ffc2ce3501c2908b279906ed2213116e8ae76
6
+ metadata.gz: 02a9cba0a46e97afbf79b5e6b8f9876c9380c526466d39b55d0032d239ec4214c08580df492cf076e7f8a72c23bf358571877328014befd6ffb13bad14ae14eb
7
+ data.tar.gz: d7e4741b3edd5934352750560041f9c03ea3ecc4b7ff8e4867474dc7e66539c51533f8d2efd295e64eea27467e233b2ab7f507a0dd212c52db55f1a2a385d505
@@ -14,12 +14,10 @@ module Yalphabetize
14
14
  end
15
15
 
16
16
  def call
17
- if offences?
18
- logger.log_offence(file_path)
19
- autocorrect_file if autocorrect
20
- else
21
- logger.log_no_offence
22
- end
17
+ return logger.log_no_offence unless offences?
18
+
19
+ logger.log_offence(file_path)
20
+ autocorrect_file if autocorrect
23
21
  end
24
22
 
25
23
  private
@@ -15,13 +15,13 @@ module Yalphabetize
15
15
  end
16
16
 
17
17
  def log_offence(file_path)
18
- @inspected_count += 1
18
+ self.inspected_count += 1
19
19
  offences[file_path] = :detected
20
20
  output.print red 'O'
21
21
  end
22
22
 
23
23
  def log_no_offence
24
- @inspected_count += 1
24
+ self.inspected_count += 1
25
25
  output.print green '.'
26
26
  end
27
27
 
@@ -30,6 +30,9 @@ module Yalphabetize
30
30
  output.puts send(list_offences_color, "Offences: #{offences.size}")
31
31
 
32
32
  offences.each { |file_path, status| puts_offence(file_path, status) }
33
+ return unless offences?
34
+
35
+ output.puts 'Offences can be automatically fixed with `-a` or `--autocorrect`'
33
36
  end
34
37
 
35
38
  def offences?
@@ -42,7 +45,8 @@ module Yalphabetize
42
45
 
43
46
  private
44
47
 
45
- attr_reader :offences, :inspected_count, :output
48
+ attr_reader :offences, :output
49
+ attr_accessor :inspected_count
46
50
 
47
51
  def puts_offence(file_path, status)
48
52
  case status
@@ -54,11 +58,7 @@ module Yalphabetize
54
58
  end
55
59
 
56
60
  def list_offences_color
57
- if offences?
58
- :red
59
- else
60
- :green
61
- end
61
+ offences? ? :red : :green
62
62
  end
63
63
 
64
64
  def red(string)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yalphabetize
4
4
  class Version
5
- STRING = '0.6.2'
5
+ STRING = '0.7.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yalphabetize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Jenkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-10 00:00:00.000000000 Z
11
+ date: 2022-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: factory_bot
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubygems_version: 3.0.3.1
160
+ rubygems_version: 3.1.6
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: Alphabetize your YAML files