yalphabetize 0.6.1 → 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: 4e19b4e6cc39bf8354bab85e0238605f9d45b0ae4fb8c01436cf73a5ed1ab4c8
4
- data.tar.gz: 8e960a7474e6f6cd0a5510bd9414b2518277c874f9c2d68f436b80d1a1d0b123
3
+ metadata.gz: 8adda25f8bd79c06f784d72b46e8391e236f858133a3251369203aef16a661b2
4
+ data.tar.gz: a25104aa54b0d51451c1964b6cccb9600d5619514830dd19c49a48a18d4fee38
5
5
  SHA512:
6
- metadata.gz: eeb6ea0a70e67277733cb2c7c75a404506e784a32c93802129b72c64d8370231c2caed23f91a149f515d536cc0b0f63f2e10df02b0e5c3c58c6ed0d9844c14a7
7
- data.tar.gz: 8adaab2c141d5f6d74d41836678b8797d20a70bb39fa55f2bd0875f6361291a927e92e1df503edf8f2fe60f26a2c86df1d08b2a3444c563bfc01f982b95b07b3
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.1'
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.1
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