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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80438eca6b5b281ceab331e0ab9886fcb9c622cfe1e91ca2762ed10628c44ee1
4
- data.tar.gz: 434910ca88653cb6a7d4bb11dabc32e4c782b22df4e65cc488ebaf6439bb3b38
3
+ metadata.gz: 31be9d119f5909486cfd46089d224e0bf1a47b815951766fc138bf1a6637dec3
4
+ data.tar.gz: b621fac32ca57cd912b0167cd02f0fb998c2366b8160247324f2f9e190638704
5
5
  SHA512:
6
- metadata.gz: b14f3fe397b01f9a7e1742246a451e68238833c98e98b6716e36a11bb38d556463d992a0cdb8577f2dac2b65bb39eb0a9f3d050f884814c7449d0b6d2239e013
7
- data.tar.gz: 45fe01c33fd31faafd21248751f2a85f38c3807b75eb242fa994ffbdd14735f2dde343cf397b5f14281a24107ca5532d45b4c107b720546ac4994121c5599e58
6
+ metadata.gz: 7a701cb79672ac340ac8d688b1b859189647ed4e1cb0d7c0b869cf55517287330cbf3144283a25a151c36ac00ee7aa1c2da0ee322be3c2e8aabd409b0f104ec8
7
+ data.tar.gz: 88a37834530501ddfe3bd5e63c667b97a8b0b282fc71b40ab9040e06725bc235798c86d28f1f817ec332f7018bdfcef69f951ad854d93e02b797efdd62b7ef04
@@ -1,3 +1,6 @@
1
+ # v0.8.6
2
+ - `--suppress--file-rules` so you can check files that would usually be ignored
3
+
1
4
  # v0.8.5
2
5
  - Single line disable! use `spellr:disable-line` #25
3
6
 
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/master/lib/.spellr.yml).
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/master/wordlists
332
+ Wordlists packaged with this gem have their own licenses, see them in https://github.com/robotdana/spellr/tree/main/wordlists
@@ -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
- attr_reader :byte_offset
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)
@@ -10,10 +10,11 @@ require 'pathname'
10
10
 
11
11
  module Spellr
12
12
  class Config
13
- attr_writer :reporter
14
- attr_writer :checker
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, Metrics/CyclomaticComplexity
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)
@@ -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
- ignore_rules: Spellr.config.excludes,
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
@@ -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, Metrics/AbcSize
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)
@@ -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
@@ -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]'),
@@ -9,8 +9,8 @@ require_relative 'token_regexps'
9
9
 
10
10
  module Spellr
11
11
  class LineTokenizer < StringScanner
12
- attr_reader :line
13
- attr_reader :skip_key
12
+ attr_reader :line, :skip_key
13
+
14
14
  alias_method :skip_key?, :skip_key
15
15
 
16
16
  include TokenRegexps
@@ -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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spellr
4
- VERSION = '0.8.5'
4
+ VERSION = '0.8.6'
5
5
  end
@@ -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.5
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-06-06 00:00:00.000000000 Z
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: