alfonsox 0.2.6 → 0.2.7

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: 55888345dcf01140ee8a7603eaaeb1c0976cc8066a5cbd61015324f486686914
4
- data.tar.gz: 78640ce9cc851ce6b3e0b154f2840b5c6aa5678518f2ac6ce55e1fe160a2394e
3
+ metadata.gz: 46aba9cc362ba13a198ed04c55a31f0c7ea8a8305f1ae89f8b89a7e39e6a3c97
4
+ data.tar.gz: a4bd31552791e901798ceab360ddc4ad71f8fb342cd285009a1025750d9ccc59
5
5
  SHA512:
6
- metadata.gz: 63de29a23988e785e53ff235ed99bda02cdd1b35408f7939c969febc538b4dc70a607fdae95cfba3258980156e690f4491c235dffc81c0245d1e6bb421ec6095
7
- data.tar.gz: 02e19169097964499735b933e8dd41fe9417e435387574db6bea4968cb2ebe2a7a44ae3ca19c3d67484f27a60144c26fc131e2938fae384c0323738aa1b844a1
6
+ metadata.gz: 2dccb7d3ff2ac28df3273762787d5c32a7646c5395c1aa46caa9399c3a7b0c0c3b0c2e446d2a0fc72028c4def6786124fe42096576c1b2261cce99701a1fdf3d
7
+ data.tar.gz: c74839001cc6b6f18d56d0393ad39676fb43f9af7c8b66eac070d74d8a3701cee1327602373b19df01656c2a69c4ed325da60e5ea38c40a3a4dc634980924f72
data/.travis.yml CHANGED
@@ -1,6 +1,8 @@
1
1
  before_install:
2
2
  - sudo apt-get update
3
3
  - sudo apt-get install -y hunspell libhunspell-dev build-essential
4
+ - gem update --system
5
+ - bundle install
4
6
  env:
5
7
  global:
6
8
  - CC_TEST_REPORTER_ID=c6f6f48c884645f1b5cf6adaccd1c837b19989c5b88e430e5c217ca93cbe07dd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- alfonsox (0.2.6)
4
+ alfonsox (0.2.7)
5
5
  hunspell (~> 1.1, >= 1.1.0)
6
6
  nokogiri (~> 1.8, >= 1.8.5)
7
7
 
data/README.md CHANGED
@@ -110,6 +110,9 @@ Dictionaries:
110
110
 
111
111
  Just call **bundle exec alfonsox** and it should work fine, informing of any orthographic error in your code files.
112
112
 
113
+ The arguments must be the full paths of the file to be checked. If no arguments are passed to this tool, all files
114
+ that fulfill the paths defined in the configuration file will be checked.
115
+
113
116
  ##### Output
114
117
 
115
118
  ###### Successful Output
@@ -117,7 +120,7 @@ Just call **bundle exec alfonsox** and it should work fine, informing of any ort
117
120
  Note the output is written in standard output (STDOUT).
118
121
 
119
122
  ```bash
120
- $ bundle exec alfonsox
123
+ $ bundle exec alfonsox file1 file2 #...
121
124
  ✔ Code is spell-checked correctly
122
125
  ```
123
126
 
@@ -133,7 +136,7 @@ $ echo $?
133
136
  Note the output is written in error standard output (STDERR).
134
137
 
135
138
  ```bash
136
- $ bundle exec alfonsox
139
+ $ bundle exec alfonsox file1 file2 #...
137
140
  /Users/diegoj/proyectos/blobik/app/models/post.rb:2 incorrektword
138
141
  ✗ Errors in code spellchecking
139
142
  ```
data/lib/alfonsox/cli.rb CHANGED
@@ -20,7 +20,12 @@ module AlfonsoX
20
20
  # Run spell-check on files specified by config file
21
21
  def run
22
22
  spellchecker = AlfonsoX::SpellChecker::Main.from_config(@config_file_path)
23
- spellchecker_errors_by_file = spellchecker.check
23
+ spellchecker_errors_by_file = if ARGV&.length&.positive?
24
+ spellchecker.check(ARGV)
25
+ else
26
+ spellchecker.check_all
27
+ end
28
+
24
29
  exit_status = SUCCESS_EXIT_STATUS
25
30
  spellchecker_errors_by_file.each do |file_path, spellchecker_errors|
26
31
  spellchecker_errors.each do |spellchecker_error_i|
@@ -50,7 +50,7 @@ module AlfonsoX
50
50
 
51
51
  # Spellcheck all the paths.
52
52
  # @return [Array<AlfonsoX::SpellChecker::Word>] array of the incorrect words by file.
53
- def check
53
+ def check_all
54
54
  incorrect_words_by_file = {}
55
55
  @paths.each do |path|
56
56
  rb_file_paths = Dir.glob(path).map { |expanded_path| ::File.realpath(expanded_path) }
@@ -63,6 +63,20 @@ module AlfonsoX
63
63
  incorrect_words_by_file
64
64
  end
65
65
 
66
+ # Spellcheck some files.
67
+ # @param [Array<String>] applicable_files List of full file paths that will be spell-checked. Optional.
68
+ # @return [Array<AlfonsoX::SpellChecker::Word>] array of the incorrect words by file.
69
+ def check(applicable_files = nil)
70
+ return check_all unless applicable_files
71
+ incorrect_words_by_file = {}
72
+ applicable_files.each do |applicable_file_i|
73
+ file_incorrect_words = check_file(applicable_file_i)
74
+ next unless file_incorrect_words.length.positive?
75
+ incorrect_words_by_file[applicable_file_i] = file_incorrect_words
76
+ end
77
+ incorrect_words_by_file
78
+ end
79
+
66
80
  private
67
81
 
68
82
  # Spellcheck a file given its file_path.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AlfonsoX
4
- VERSION = '0.2.6'
4
+ VERSION = '0.2.7'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alfonsox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego J. Romero López