clausewitz-spelling 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52ed7c87ef8be8154db1f560deaa9c6f3e42df3f
4
- data.tar.gz: 40c988ca4b304606158e6fb7547b0063f4994514
3
+ metadata.gz: adb9e6a92780070203cbdebb8c4ed53de713acc5
4
+ data.tar.gz: 478dfd5e51b6a7d55b4011beabde495b51aa95dc
5
5
  SHA512:
6
- metadata.gz: 59e7f30426c3bebfced3c563e1720254dbda0109537158f1ceca1b0945ce0e92f277647065e1e0620312f46e662d2b211504320b82ec1042603fa581cdddaec9
7
- data.tar.gz: e647a12581ec7346509ffc1492ffca0d8f23df37031480b5e1c50edcf7d8a8eae115d016afd8641bdb44c0b2eb1d00539852a8a6dcd4ae7ca1880ad46fc9dfbb
6
+ metadata.gz: d23c534633cdc1de14d40c0ce87832b35138b8fc014ba647be056a310ddd134fac6b19d10106d0d1dec69e0fe3be38b6c4607b7e6fa2f72ef6cd6e652392ea44
7
+ data.tar.gz: c1329c0a425fb5f0aaa83d0a43ba43403b14d965184f3f403cc9d20e164db1ef28b0f9b22ca518298009f908ba90805e9579d3635f7193c09f4f457d681192f3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clausewitz-spelling (0.1.5)
4
+ clausewitz-spelling (0.1.6)
5
5
  colorize
6
6
  damerau-levenshtein
7
7
  ffi-aspell
@@ -35,11 +35,14 @@ module Clausewitz; module Spelling
35
35
  @custom_words_filepath = generate_word_list
36
36
  @en_speller.set('extra-dicts', @custom_words_filepath)
37
37
  @en_speller.set('ignore-accents', true)
38
+ else
39
+ @dict_words = Set.new([])
40
+ @en_speller.set('ignore-accents', true)
38
41
  end
39
42
  end
40
43
 
41
44
  def check_file(file_path)
42
- $stderr.outs "Checking #{file_path}..."
45
+ $stderr.puts "Checking #{file_path}..."
43
46
  loc = load_file(file_path)
44
47
  # Poorly formatted YAML files often lack proper indentation; you can
45
48
  # easily discover this by checking to make sure all top level keys are
@@ -61,18 +64,19 @@ module Clausewitz; module Spelling
61
64
 
62
65
  def check_files(file_paths)
63
66
  results = Array(file_paths).map do |file_path|
64
- check_file(file_path)
67
+ check_file(file_path) unless File.directory?(file_path)
65
68
  end
66
- OverallResults.new(results)
69
+ OverallResults.new(results.compact)
67
70
  end
68
71
 
69
72
  def check_entries(lang, entries)
70
73
  misspellings = []
71
- entries.each do |key, text|
72
- result = check_entry(key, text)
73
- misspellings << result unless result.check_results.empty?
74
+ if entries && !entries.empty?
75
+ entries.each do |key, text|
76
+ result = check_entry(key, text)
77
+ misspellings << result unless result.check_results.empty?
78
+ end
74
79
  end
75
- misspellings
76
80
  LangResults.new(lang, misspellings)
77
81
  end
78
82
 
@@ -119,7 +123,7 @@ module Clausewitz; module Spelling
119
123
  private
120
124
 
121
125
  def bad_lang_key(key)
122
- key !~ /l_.+/
126
+ key !~ /^l_.+/
123
127
  end
124
128
 
125
129
  def is_ordinal?(word)
@@ -21,8 +21,17 @@ module Clausewitz; module Spelling
21
21
  end
22
22
 
23
23
  def render
24
- puts " #{@file_path} has #{@lang_results.size.to_s.red} langs with errors:"
25
- @lang_results.each(&:render)
24
+ successful, failed = @lang_results.partition do |lang|
25
+ lang.key_results.empty?
26
+ end
27
+ successful.each do |lang|
28
+ puts " #{@file_path}:#{lang.lang} passed".green
29
+ end
30
+ failed.each do |lang|
31
+ failed_count = lang.key_results.size.to_s.red
32
+ puts " #{@file_path}:#{lang.lang} has #{failed_count} langs with errors:"
33
+ lang.key_results.each(&:render)
34
+ end
26
35
  end
27
36
  end
28
37
 
@@ -46,8 +55,7 @@ module Clausewitz; module Spelling
46
55
  end
47
56
 
48
57
  def render
49
- langs = @bad_langs.join(', ')
50
- puts " #{@file_path} has unknown languages #{langs}!".red
58
+ puts " #{@file_path} has unknown language keys!".red
51
59
  puts " Make sure that each loc key has *two* leading *spaces*.".yellow
52
60
  end
53
61
  end
@@ -1,5 +1,5 @@
1
1
  module Clausewitz
2
2
  module Spelling
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clausewitz-spelling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Chappell