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 +4 -4
- data/.travis.yml +2 -0
- data/Gemfile.lock +1 -1
- data/README.md +5 -2
- data/lib/alfonsox/cli.rb +6 -1
- data/lib/alfonsox/spellchecker/main.rb +15 -1
- data/lib/alfonsox/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46aba9cc362ba13a198ed04c55a31f0c7ea8a8305f1ae89f8b89a7e39e6a3c97
|
4
|
+
data.tar.gz: a4bd31552791e901798ceab360ddc4ad71f8fb342cd285009a1025750d9ccc59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dccb7d3ff2ac28df3273762787d5c32a7646c5395c1aa46caa9399c3a7b0c0c3b0c2e446d2a0fc72028c4def6786124fe42096576c1b2261cce99701a1fdf3d
|
7
|
+
data.tar.gz: c74839001cc6b6f18d56d0393ad39676fb43f9af7c8b66eac070d74d8a3701cee1327602373b19df01656c2a69c4ed325da60e5ea38c40a3a4dc634980924f72
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
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 =
|
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
|
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.
|
data/lib/alfonsox/version.rb
CHANGED