spellr 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +15 -3
- data/lib/spellr/cli_options.rb +7 -0
- data/lib/spellr/column_location.rb +2 -2
- data/lib/spellr/config.rb +5 -4
- data/lib/spellr/file_list.rb +10 -2
- data/lib/spellr/interactive.rb +1 -1
- data/lib/spellr/key_tuner/naive_bayes.rb +1 -4
- data/lib/spellr/language.rb +1 -2
- data/lib/spellr/line_location.rb +1 -4
- data/lib/spellr/line_tokenizer.rb +2 -2
- data/lib/spellr/output_stubbed.rb +1 -1
- data/lib/spellr/version.rb +1 -1
- data/spellr.gemspec +6 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31be9d119f5909486cfd46089d224e0bf1a47b815951766fc138bf1a6637dec3
|
4
|
+
data.tar.gz: b621fac32ca57cd912b0167cd02f0fb998c2366b8160247324f2f9e190638704
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a701cb79672ac340ac8d688b1b859189647ed4e1cb0d7c0b869cf55517287330cbf3144283a25a151c36ac00ee7aa1c2da0ee322be3c2e8aabd409b0f104ec8
|
7
|
+
data.tar.gz: 88a37834530501ddfe3bd5e63c667b97a8b0b282fc71b40ab9040e06725bc235798c86d28f1f817ec332f7018bdfcef69f951ad854d93e02b797efdd62b7ef04
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Spellr
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.com/robotdana/spellr.svg?branch=main)](https://travis-ci.com/robotdana/spellr)
|
3
4
|
[![Gem Version](https://badge.fury.io/rb/spellr.svg)](https://rubygems.org/gems/spellr)
|
4
|
-
[![Build Status](https://travis-ci.org/robotdana/spellr.svg?branch=master)](https://travis-ci.org/robotdana/spellr)
|
5
5
|
|
6
6
|
Spell check your source code for fun and occasionally finding bugs
|
7
7
|
|
@@ -195,7 +195,7 @@ If your language supports inline comments you can also surround with `spellr:dis
|
|
195
195
|
```
|
196
196
|
## Configuration
|
197
197
|
|
198
|
-
Spellr's configuration is a `.spellr.yml` file in your project root. This is combined with the gem defaults defined [here](https://github.com/robotdana/spellr/blob/
|
198
|
+
Spellr's configuration is a `.spellr.yml` file in your project root. This is combined with the gem defaults defined [here](https://github.com/robotdana/spellr/blob/main/lib/.spellr.yml).
|
199
199
|
There are top-level keys and per-language keys.
|
200
200
|
```yml
|
201
201
|
word_minimum_length: 3 # any words shorter than this will be ignored
|
@@ -304,6 +304,18 @@ Spellr::RakeTask.generate_task(:spellr, **spellr_arguments)
|
|
304
304
|
task default: :spellr
|
305
305
|
```
|
306
306
|
|
307
|
+
## Ignoring the configured patterns
|
308
|
+
|
309
|
+
Sometimes you'll want to spell check something that would usually be ignored,
|
310
|
+
e.g. `.git/COMMIT_EDITMSG` even though `spellr` ignores the `.git` directory.
|
311
|
+
|
312
|
+
For this you can use the `--suppress-file-rules` command line argument.
|
313
|
+
```bash
|
314
|
+
$ spellr --suppress-file-rules .git/COMMIT_EDITMSG
|
315
|
+
```
|
316
|
+
|
317
|
+
**Note: This still ignores files outside of the current directory**
|
318
|
+
|
307
319
|
## Development
|
308
320
|
|
309
321
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
|
@@ -317,4 +329,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/robotd
|
|
317
329
|
## License
|
318
330
|
|
319
331
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
320
|
-
Wordlists packaged with this gem have their own licenses, see them in https://github.com/robotdana/spellr/tree/
|
332
|
+
Wordlists packaged with this gem have their own licenses, see them in https://github.com/robotdana/spellr/tree/main/wordlists
|
data/lib/spellr/cli_options.rb
CHANGED
@@ -28,6 +28,9 @@ module Spellr
|
|
28
28
|
opts.separator('')
|
29
29
|
opts.on('--[no-]parallel', 'Run in parallel or not, default --parallel', &method(:parallel_option))
|
30
30
|
opts.on('-d', '--dry-run', 'List files to be checked', &method(:dry_run_option))
|
31
|
+
opts.on('-f', '--suppress-file-rules', <<~HELP, &method(:suppress_file_rules))
|
32
|
+
Suppress all configured, default, and gitignore include and exclude patterns
|
33
|
+
HELP
|
31
34
|
opts.separator('')
|
32
35
|
opts.on('-c', '--config FILENAME', String, <<~HELP, &method(:config_option))
|
33
36
|
Path to the config file (default ./.spellr.yml)
|
@@ -56,6 +59,10 @@ module Spellr
|
|
56
59
|
Spellr.config.checker = Spellr::CheckInteractive unless @parallel_option
|
57
60
|
end
|
58
61
|
|
62
|
+
def suppress_file_rules(_)
|
63
|
+
Spellr.config.suppress_file_rules = true
|
64
|
+
end
|
65
|
+
|
59
66
|
def config_option(file)
|
60
67
|
file = Spellr.pwd.join(file).expand_path
|
61
68
|
|
@@ -4,8 +4,8 @@ require_relative 'line_location'
|
|
4
4
|
|
5
5
|
module Spellr
|
6
6
|
class ColumnLocation
|
7
|
-
attr_reader :char_offset
|
8
|
-
|
7
|
+
attr_reader :char_offset, :byte_offset
|
8
|
+
|
9
9
|
attr_accessor :line_location
|
10
10
|
|
11
11
|
def initialize(char_offset: 0, byte_offset: 0, line_location: LineLocation.new)
|
data/lib/spellr/config.rb
CHANGED
@@ -10,10 +10,11 @@ require 'pathname'
|
|
10
10
|
|
11
11
|
module Spellr
|
12
12
|
class Config
|
13
|
-
attr_writer :reporter
|
14
|
-
|
13
|
+
attr_writer :reporter, :checker
|
14
|
+
|
15
|
+
attr_accessor :suppress_file_rules, :dry_run
|
16
|
+
|
15
17
|
attr_reader :config_file
|
16
|
-
attr_accessor :dry_run
|
17
18
|
alias_method :dry_run?, :dry_run
|
18
19
|
|
19
20
|
def initialize
|
@@ -77,7 +78,7 @@ module Spellr
|
|
77
78
|
Spellr::ConfigValidator.new.valid?
|
78
79
|
end
|
79
80
|
|
80
|
-
def reset! # rubocop:disable Metrics/MethodLength
|
81
|
+
def reset! # rubocop:disable Metrics/MethodLength
|
81
82
|
@config = ConfigLoader.new
|
82
83
|
remove_instance_variable(:@languages) if defined?(@languages)
|
83
84
|
remove_instance_variable(:@excludes) if defined?(@excludes)
|
data/lib/spellr/file_list.rb
CHANGED
@@ -26,10 +26,18 @@ module Spellr
|
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
+
def configured_rules
|
30
|
+
return { gitignore: false } if Spellr.config.suppress_file_rules
|
31
|
+
|
32
|
+
{
|
33
|
+
ignore_rules: Spellr.config.excludes,
|
34
|
+
include_rules: Spellr.config.includes
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
29
38
|
def fast_ignore # rubocop:disable Metrics/MethodLength
|
30
39
|
FastIgnore.new(
|
31
|
-
|
32
|
-
include_rules: Spellr.config.includes,
|
40
|
+
**configured_rules,
|
33
41
|
argv_rules: @patterns,
|
34
42
|
follow_symlinks: true,
|
35
43
|
root: Spellr.pwd_s
|
data/lib/spellr/interactive.rb
CHANGED
@@ -58,7 +58,7 @@ module Spellr
|
|
58
58
|
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
59
59
|
end
|
60
60
|
|
61
|
-
def stdin_getch(legal_chars) # rubocop:disable Metrics/MethodLength
|
61
|
+
def stdin_getch(legal_chars) # rubocop:disable Metrics/MethodLength
|
62
62
|
choice = output.stdin.getch
|
63
63
|
|
64
64
|
if legal_chars.include?(choice)
|
@@ -13,10 +13,7 @@ class NaiveBayes
|
|
13
13
|
|
14
14
|
YAML_PATH = File.join(__dir__, 'data.yml')
|
15
15
|
|
16
|
-
attr_reader :feature_set
|
17
|
-
attr_reader :num_classes
|
18
|
-
attr_reader :classes
|
19
|
-
attr_reader :features
|
16
|
+
attr_reader :feature_set, :num_classes, :classes, :features
|
20
17
|
|
21
18
|
def initialize(path = YAML_PATH)
|
22
19
|
load_from_yaml(path)
|
data/lib/spellr/language.rb
CHANGED
@@ -7,8 +7,7 @@ require 'fast_ignore'
|
|
7
7
|
|
8
8
|
module Spellr
|
9
9
|
class Language
|
10
|
-
attr_reader :name
|
11
|
-
attr_reader :key
|
10
|
+
attr_reader :name, :key
|
12
11
|
|
13
12
|
def initialize(name, key: name[0], includes: [], hashbangs: [], locale: [], addable: true) # rubocop:disable Metrics/ParameterLists
|
14
13
|
@name = name
|
data/lib/spellr/line_location.rb
CHANGED
@@ -4,10 +4,7 @@ require_relative 'file'
|
|
4
4
|
|
5
5
|
module Spellr
|
6
6
|
class LineLocation
|
7
|
-
attr_reader :line_number
|
8
|
-
attr_reader :char_offset
|
9
|
-
attr_reader :byte_offset
|
10
|
-
attr_reader :file
|
7
|
+
attr_reader :line_number, :char_offset, :byte_offset, :file
|
11
8
|
|
12
9
|
def initialize(
|
13
10
|
file = ::Spellr::File.new('[string]'),
|
@@ -16,7 +16,7 @@ module Spellr
|
|
16
16
|
@stderr ||= StringIO.new
|
17
17
|
end
|
18
18
|
|
19
|
-
def marshal_dump # rubocop:disable Metrics/MethodLength
|
19
|
+
def marshal_dump # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
20
20
|
l_exit_code = @exit_code if defined?(@exit_code)
|
21
21
|
l_counts = @counts if defined?(@counts)
|
22
22
|
l_stdin = @stdin if defined?(@stdin)
|
data/lib/spellr/version.rb
CHANGED
data/spellr.gemspec
CHANGED
@@ -14,6 +14,12 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = 'http://github.com/robotdana/spellr'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
|
+
if spec.respond_to?(:metadata)
|
18
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
19
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
20
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
21
|
+
end
|
22
|
+
|
17
23
|
spec.required_ruby_version = '>= 2.4'
|
18
24
|
|
19
25
|
spec.files = Dir.glob('{lib,exe,wordlists}/**/{*,.*}') + %w{
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spellr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dana Sherson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -299,7 +299,10 @@ files:
|
|
299
299
|
homepage: http://github.com/robotdana/spellr
|
300
300
|
licenses:
|
301
301
|
- MIT
|
302
|
-
metadata:
|
302
|
+
metadata:
|
303
|
+
homepage_uri: http://github.com/robotdana/spellr
|
304
|
+
source_code_uri: http://github.com/robotdana/spellr
|
305
|
+
changelog_uri: http://github.com/robotdana/spellr/blob/main/CHANGELOG.md
|
303
306
|
post_install_message:
|
304
307
|
rdoc_options: []
|
305
308
|
require_paths:
|