spellr 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +34 -15
  4. data/exe/spellr +8 -1
  5. data/lib/spellr/backports.rb +48 -21
  6. data/lib/spellr/base_reporter.rb +0 -4
  7. data/lib/spellr/check.rb +7 -47
  8. data/lib/spellr/check_dry_run.rb +14 -0
  9. data/lib/spellr/check_interactive.rb +24 -0
  10. data/lib/spellr/check_parallel.rb +23 -0
  11. data/lib/spellr/cli.rb +5 -90
  12. data/lib/spellr/cli_options.rb +98 -0
  13. data/lib/spellr/column_location.rb +2 -4
  14. data/lib/spellr/config.rb +39 -41
  15. data/lib/spellr/config_loader.rb +3 -29
  16. data/lib/spellr/config_validator.rb +63 -0
  17. data/lib/spellr/file_list.rb +7 -24
  18. data/lib/spellr/interactive.rb +80 -45
  19. data/lib/spellr/interactive_add.rb +20 -16
  20. data/lib/spellr/interactive_replacement.rb +52 -29
  21. data/lib/spellr/key_tuner/naive_bayes.rb +7 -59
  22. data/lib/spellr/key_tuner/possible_key.rb +5 -24
  23. data/lib/spellr/key_tuner/stats.rb +2 -0
  24. data/lib/spellr/language.rb +7 -8
  25. data/lib/spellr/line_location.rb +2 -7
  26. data/lib/spellr/line_tokenizer.rb +1 -9
  27. data/lib/spellr/output.rb +5 -7
  28. data/lib/spellr/output_stubbed.rb +16 -16
  29. data/lib/spellr/quiet_reporter.rb +1 -0
  30. data/lib/spellr/reporter.rb +0 -4
  31. data/lib/spellr/string_format.rb +8 -15
  32. data/lib/spellr/token.rb +13 -29
  33. data/lib/spellr/token_regexps.rb +2 -2
  34. data/lib/spellr/tokenizer.rb +0 -10
  35. data/lib/spellr/validations.rb +31 -0
  36. data/lib/spellr/version.rb +1 -1
  37. data/lib/spellr/wordlist.rb +9 -17
  38. data/lib/spellr/wordlist_reporter.rb +0 -4
  39. data/lib/spellr.rb +12 -0
  40. data/spellr.gemspec +12 -7
  41. data/wordlists/ruby.txt +1 -0
  42. metadata +59 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d62f8784cec5a6100e381fe52ad9d8315203c488fb0b6673fa6adc2cac1e4375
4
- data.tar.gz: a09e0852f55429b6697c7ac2a1388e4ca1c18ce8b33e1a505789ac091c51fea0
3
+ metadata.gz: c712613dec647be23db6a02ac4612afe8ec9af7347bb5aae0b6068f4c8b609e6
4
+ data.tar.gz: ccb5af415199801c8d68b278105cb93156e3ab2d8d73c2a0a5221a7307e39102
5
5
  SHA512:
6
- metadata.gz: 6b9682c7bd5fe23a14b23393b55166cd743f1abe32f30bcb8990a146441b61b806e261ae9be4679878916e46f485280c97a127904c95edd022f7eb5e68999360
7
- data.tar.gz: d1b64e78bed6b152606646afc56db541e07f89bfe3c507b642f2b8f827071656a604b44f63ab39508cdde01b44cf8a09461f70046285d74ad50c2ee98a278a9a
6
+ metadata.gz: e2003cd517d9e915d8e154474bf404ee64c87796e7a59ea47710e3963c681e90b52cb6a93be80ca1ccfe810062b4882f344b0ac2ba04c6f85ab9685f3bb0bcc6
7
+ data.tar.gz: 1e8144ed3b9f86b194e91952acfac4536ad432cd47ee2ccadc22dbbc6d5f3d126f6db0a7a219a31a3b0dfb5ff8d7627b470f9ea32c91868edf0e23f102678e48
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # v0.7.0
2
+ - dry_run checks config validity
3
+ - require fast_ignore 0.6.0
4
+ - new interactive UI
5
+ - misc performance improvements
6
+ - drop ruby 2.4 support because simplecov does
7
+
1
8
  # v0.6.0
2
9
  - add CSS wordlist from MDN
3
10
  - improve html wordlist comprehensiveness from MDN and W3C
data/README.md CHANGED
@@ -124,37 +124,52 @@ $ spellr --interactive
124
124
  You'll be shown each word that's not found in a dictionary, it's location (path:line:column), along with a prompt.
125
125
  ```
126
126
  file.rb:1:0 notaword
127
- [r,R,s,S,a,e?]
127
+ [a]dd, [r]eplace, [s]kip, [h]elp, [^C] to exit: [ ]
128
128
  ```
129
129
 
130
- Type `?` for this list of what each letter command does
130
+ Type `h` for this list of what each letter command does
131
131
  ```
132
+ [a] Add notaword to a word list
132
133
  [r] Replace notaword
133
- [R] Replace all future instances of notaword
134
+ [R] Replace this and all future instances of notaword
134
135
  [s] Skip notaword
135
- [S] Skip all future instances of notaword
136
- [a] Add notaword to a word list
137
- [e] Edit the whole line
138
- [?] Show this help
136
+ [S] Skip this and all future instances of notaword
137
+ [h] Show this help
138
+ [ctrl] + [C] Exit spellr
139
+
140
+ What do you want to do? [ ]
139
141
  ```
140
142
 
141
- If you type `r`, `R` or `e` you'll be shown a prompt with the original word and it prefilled ready for correcting:
143
+ ---
144
+
145
+ If you type `r` or `R` you'll be shown a prompt with the original word and it prefilled ready for correcting:
142
146
  ```
143
147
  file.txt:1:0 notaword
144
- >> notaword
145
- => not_a_word
148
+ [a]dd, [r]eplace, [s]kip, [h]elp, [^C] to exit: [r]
149
+
150
+ [^C] to go back
151
+ Replace notaword with: notaword
146
152
  ```
147
153
  To submit your choice and continue with the spell checking click enter. Your replacement word will be immediately spellchecked. To instead go back press Ctrl-C once (pressing it twice will exit the spell checking).
148
154
 
155
+ Lowercase `r` will correct this particular use of the word, uppercase `R` will also all the future times that word is used.
156
+
157
+ ---
158
+
149
159
  If you instead type `s` or `S` it will skip this word and continue with the spell checking.
150
160
 
161
+ Lowercase `s` will skip this particular use of the word, uppercase `S` will also skip future uses of the word.
162
+
151
163
  ---
152
164
 
153
165
  If you instead type `a` you'll be shown a list of possible wordlists to add to. This list is based on the file path, and is configurable in `.spellr.yml`.
154
166
  ```
155
- Add notaword to wordlist:
156
- [e] english
157
- [r] ruby
167
+ file.txt:1:0 notaword
168
+ [a]dd, [r]eplace, [s]kip, [h]elp, [^C] to exit: [a]
169
+
170
+ [e] english
171
+ [^C] to go back
172
+ Add notaword to which wordlist? [ ]
158
173
  ```
159
174
  Type `e` to add this word to the english wordlist and continue on through the spell checking. To instead go back to the prompt press Ctrl-C once (pressing it twice will exit the spell checking).
160
175
 
@@ -167,6 +182,10 @@ If the tokenizer finds a word you don't want to add to the wordlist (perhaps it'
167
182
  # spellr:enable
168
183
  ```
169
184
 
185
+ This works with any kind of comment, even in the same line
186
+ ```html
187
+ <span><!-- spellr:disable -->nonsenseword<!-- spellr:enable --></span>
188
+ ```
170
189
  ## Configuration
171
190
 
172
191
  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).
@@ -206,8 +225,8 @@ languages:
206
225
  - /applies_to/
207
226
  key: r # this is the letter used to choose this wordlist when using `spellr --interactive`.
208
227
  hashbangs:
209
- - ruby # if the hashbang contains ruby, this file will match,
210
- # even if it doesn't otherwise match the includes pattern.
228
+ - ruby # if the file has no extension and the hashbang/shebang contains ruby
229
+ # this file will match even if it doesn't otherwise match the includes pattern.
211
230
  ```
212
231
 
213
232
  ## Development
data/exe/spellr CHANGED
@@ -2,4 +2,11 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require_relative '../lib/spellr/cli'
5
- Spellr::CLI.new(ARGV)
5
+
6
+ begin
7
+ Spellr::CLI.new(ARGV).check
8
+ rescue Spellr::Error => e
9
+ require_relative '../lib/spellr/string_format'
10
+ warn Spellr::StringFormat.red(e.message)
11
+ exit 1
12
+ end
@@ -1,27 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Array
4
- unless RUBY_VERSION >= '2.4'
5
- def sum
6
- if block_given?
7
- reduce(0) { |total, value| total + yield(value) }
8
- else
9
- reduce(:+)
10
- end
11
- end
12
- end
13
- end
14
-
15
- class Regexp
16
- alias_method :match?, :match unless RUBY_VERSION >= '2.4'
17
- end
18
-
19
- class String
20
- alias_method :match?, :match unless RUBY_VERSION >= '2.4'
21
- end
3
+ ruby_version = Gem::Version.new(RUBY_VERSION)
22
4
 
23
- class Hash
24
- unless RUBY_VERSION >= '2.5'
5
+ unless ruby_version >= Gem::Version.new('2.5')
6
+ class Hash
25
7
  def slice!(*keys)
26
8
  delete_if { |k| !keys.include?(k) }
27
9
  end
@@ -30,4 +12,49 @@ class Hash
30
12
  dup.slice!(*keys)
31
13
  end
32
14
  end
15
+
16
+ require 'yaml'
17
+ module YAML
18
+ class << self
19
+ alias_method :safe_load_without_symbolize_names, :safe_load
20
+ def safe_load(path, *args, symbolize_names: false, **kwargs)
21
+ if symbolize_names
22
+ symbolize_names!(safe_load_without_symbolize_names(path, *args, **kwargs))
23
+ else
24
+ safe_load_without_symbolize_names(path, *args, **kwargs)
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ def symbolize_names!(obj) # rubocop:disable Metrics/MethodLength
31
+ case obj
32
+ when Hash
33
+ obj.keys.each do |key| # rubocop:disable Style/HashEachMethods # each_key never finishes.
34
+ obj[key.to_sym] = symbolize_names!(obj.delete(key))
35
+ end
36
+ when Array
37
+ obj.map! { |ea| symbolize_names!(ea) }
38
+ end
39
+ obj
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ # all this to avoid a deprecation warning
46
+ unless ruby_version >= Gem::Version.new('2.6')
47
+ require 'yaml'
48
+ module YAML
49
+ class << self
50
+ alias_method :safe_load_without_permitted_classes, :safe_load
51
+ def safe_load(path, *args, permitted_classes: nil, **kwargs)
52
+ if permitted_classes
53
+ safe_load_without_permitted_classes(path, permitted_classes, *args, **kwargs)
54
+ else
55
+ safe_load_without_permitted_classes(path, *args, **kwargs)
56
+ end
57
+ end
58
+ end
59
+ end
33
60
  end
@@ -7,10 +7,6 @@ module Spellr
7
7
  class BaseReporter
8
8
  include Spellr::StringFormat
9
9
 
10
- def parallel?
11
- true
12
- end
13
-
14
10
  def initialize(output = nil)
15
11
  @output = output
16
12
  end
data/lib/spellr/check.rb CHANGED
@@ -2,24 +2,12 @@
2
2
 
3
3
  require_relative '../spellr'
4
4
  require_relative 'tokenizer'
5
- require_relative 'token'
6
- require_relative 'column_location'
7
- require_relative 'line_location'
8
- require_relative 'output_stubbed'
9
- require_relative 'backports'
10
-
11
- require 'parallel'
5
+ require_relative 'string_format'
12
6
 
13
7
  module Spellr
14
- class InvalidByteSequence
15
- def self.===(error)
16
- error.is_a?(ArgumentError) &&
17
- /invalid byte sequence/.match?(error.message)
18
- end
19
- end
20
-
21
8
  class Check
22
9
  attr_reader :files, :reporter
10
+ include StringFormat
23
11
 
24
12
  def exit_code
25
13
  reporter.exit_code
@@ -32,8 +20,6 @@ module Spellr
32
20
  end
33
21
 
34
22
  def check
35
- return check_parallel if reporter.parallel?
36
-
37
23
  files.each do |file|
38
24
  check_and_count_file(file)
39
25
  end
@@ -41,54 +27,28 @@ module Spellr
41
27
  reporter.finish
42
28
  end
43
29
 
44
- def check_parallel # rubocop:disable Metrics/MethodLength
45
- acc_reporter = @reporter
46
- Parallel.each(files, finish: ->(_, _, result) { acc_reporter.output << result }) do |file|
47
- @reporter = acc_reporter.class.new(Spellr::OutputStubbed.new)
48
- check_and_count_file(file)
49
- reporter.output
50
- end
51
- @reporter = acc_reporter
52
-
53
- reporter.finish
54
- end
55
-
56
30
  private
57
31
 
58
32
  def check_and_count_file(file)
59
33
  check_file(file)
60
34
  reporter.output.increment(:checked)
61
- rescue InvalidByteSequence
35
+ rescue Spellr::InvalidByteSequence
62
36
  # sometimes files are binary
63
- reporter.output.warn "Skipped unreadable file: #{file}"
37
+ reporter.warn "Skipped unreadable file: #{aqua file.relative_path}"
64
38
  end
65
39
 
66
- def check_tokens_in_file(file, start_at, wordlist_proc)
40
+ def check_file(file, start_at = nil, found_word_proc = wordlist_proc_for(file))
67
41
  Spellr::Tokenizer.new(file, start_at: start_at)
68
- .each_token(skip_term_proc: wordlist_proc) do |token|
42
+ .each_token(skip_term_proc: found_word_proc) do |token|
69
43
  reporter.call(token)
70
44
  reporter.output.exit_code = 1
71
45
  end
72
46
  end
73
47
 
74
48
  def wordlist_proc_for(file)
75
- wordlists = Spellr.config.wordlists_for(file)
49
+ wordlists = Spellr.config.wordlists_for(file).sort_by(&:length).reverse
76
50
 
77
51
  ->(term) { wordlists.any? { |w| w.include?(term) } }
78
52
  end
79
-
80
- def check_file_from_restart(file, restart_token, wordlist_proc)
81
- # new wordlist cache when adding a word
82
- wordlist_proc = wordlist_proc_for(file) unless restart_token.replacement
83
- check_file(file, start_at: restart_token.location, wordlist_proc: wordlist_proc)
84
- end
85
-
86
- def check_file(file, start_at: nil, wordlist_proc: wordlist_proc_for(file))
87
- restart_token = catch(:check_file_from) do
88
- check_tokens_in_file(file, start_at, wordlist_proc)
89
- nil
90
- end
91
- check_file_from_restart(file, restart_token, wordlist_proc) if restart_token
92
- end
93
53
  end
94
54
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../spellr'
4
+ require_relative 'check'
5
+
6
+ module Spellr
7
+ class CheckDryRun < Check
8
+ def check
9
+ files.each do |file|
10
+ puts file.relative_path
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../spellr'
4
+ require_relative 'check'
5
+
6
+ module Spellr
7
+ class CheckInteractive < Check
8
+ private
9
+
10
+ def check_file_from_restart(file, restart_token, wordlist_proc)
11
+ # new wordlist cache when adding a word
12
+ wordlist_proc = wordlist_proc_for(file) unless restart_token.replacement
13
+ check_file(file, restart_token.location, wordlist_proc)
14
+ end
15
+
16
+ def check_file(file, start_at = nil, wordlist_proc = wordlist_proc_for(file))
17
+ restart_token = catch(:check_file_from) do
18
+ super(file, start_at, wordlist_proc)
19
+ nil
20
+ end
21
+ check_file_from_restart(file, restart_token, wordlist_proc) if restart_token
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../spellr'
4
+ require_relative 'check'
5
+ require_relative 'output_stubbed'
6
+ require 'parallel'
7
+
8
+ module Spellr
9
+ class CheckParallel < Check
10
+ def check # rubocop:disable Metrics/MethodLength
11
+ acc_reporter = @reporter
12
+
13
+ Parallel.each(files, finish: ->(_, _, result) { acc_reporter.output << result }) do |file|
14
+ @reporter = acc_reporter.class.new(Spellr::OutputStubbed.new)
15
+ check_and_count_file(file)
16
+ reporter.output
17
+ end
18
+ @reporter = acc_reporter
19
+
20
+ reporter.finish
21
+ end
22
+ end
23
+ end
data/lib/spellr/cli.rb CHANGED
@@ -1,10 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'optparse'
4
- require 'pathname'
5
- require 'open3'
6
-
7
3
  require_relative '../spellr'
4
+ require_relative 'cli_options'
8
5
 
9
6
  module Spellr
10
7
  class CLI
@@ -12,102 +9,20 @@ module Spellr
12
9
 
13
10
  def initialize(argv)
14
11
  @argv = argv
15
-
16
- parse_command
12
+ CLI::Options.parse(@argv)
13
+ Spellr.config.valid?
17
14
  end
18
15
 
19
16
  def check
20
- require_relative 'check'
21
-
22
- validate_config
23
-
24
- checker = Spellr::Check.new(files: files)
17
+ checker = Spellr.config.checker.new(files: files)
25
18
  checker.check
26
19
 
27
20
  exit checker.exit_code
28
21
  end
29
22
 
30
- def validate_config
31
- return true if Spellr.config.valid?
32
-
33
- Spellr.config.print_errors
34
- exit 1
35
- end
36
-
37
23
  def files
38
24
  require_relative 'file_list'
39
- Spellr::FileList.new(*argv)
40
- end
41
-
42
- def wordlist_option(_)
43
- require_relative 'wordlist_reporter'
44
- Spellr.config.reporter = Spellr::WordlistReporter.new
45
- end
46
-
47
- def quiet_option(_)
48
- Spellr.config.quiet = true
49
- require_relative 'quiet_reporter'
50
- Spellr.config.reporter = Spellr::QuietReporter.new
51
- end
52
-
53
- def interactive_option(_)
54
- require_relative 'interactive'
55
- Spellr.config.reporter = Spellr::Interactive.new
56
- end
57
-
58
- def config_option(file)
59
- Spellr.config.config_file = Pathname.pwd.join(file).expand_path
60
- end
61
-
62
- def dry_run_option(_)
63
- files.each { |f| puts f.relative_path_from(Pathname.pwd) }
64
-
65
- exit
66
- end
67
-
68
- def version_option(_)
69
- require_relative 'version'
70
- puts(Spellr::VERSION)
71
-
72
- exit
73
- end
74
-
75
- def parse_command
76
- parse_options
77
- check
78
- end
79
-
80
- def options_help(_)
81
- puts options.help
82
-
83
- exit
84
- end
85
-
86
- def parse_options
87
- options.parse!(argv)
88
- end
89
-
90
- def options # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
91
- @options ||= begin
92
- opts = OptionParser.new
93
-
94
- opts.banner = 'Usage: spellr [options] [files]'
95
- opts.separator('')
96
- opts.on('-w', '--wordlist', 'Outputs errors in wordlist format', &method(:wordlist_option))
97
- opts.on('-q', '--quiet', 'Silences output', &method(:quiet_option))
98
- opts.on('-i', '--interactive', 'Runs the spell check interactively',
99
- &method(:interactive_option))
100
- opts.separator('')
101
- opts.on('-d', '--dry-run', 'List files to be checked', &method(:dry_run_option))
102
- opts.separator('')
103
- opts.on('-c', '--config FILENAME', String, <<~HELP, &method(:config_option))
104
- Path to the config file (default ./.spellr.yml)
105
- HELP
106
- opts.on('-v', '--version', 'Returns the current version', &method(:version_option))
107
- opts.on('-h', '--help', 'Shows this message', &method(:options_help))
108
-
109
- opts
110
- end
25
+ Spellr::FileList.new(@argv)
111
26
  end
112
27
  end
113
28
  end
@@ -0,0 +1,98 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'optparse'
4
+ require 'pathname'
5
+ require_relative '../spellr'
6
+
7
+ module Spellr
8
+ class CLI
9
+ class Options
10
+ class << self
11
+ def parse(argv)
12
+ options.parse!(argv)
13
+ end
14
+
15
+ private
16
+
17
+ # rubocop:disable Layout/LineLength
18
+ def options # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
19
+ opts = OptionParser.new
20
+
21
+ opts.banner = 'Usage: spellr [options] [files]'
22
+ opts.separator('')
23
+ opts.on('-w', '--wordlist', 'Outputs errors in wordlist format', &method(:wordlist_option))
24
+ opts.on('-q', '--quiet', 'Silences output', &method(:quiet_option))
25
+ opts.on('-i', '--interactive', 'Runs the spell check interactively', &method(:interactive_option))
26
+ opts.separator('')
27
+ opts.on('--[no-]parallel', 'Run in parallel or not, default --parallel', &method(:parallel_option))
28
+ opts.on('-d', '--dry-run', 'List files to be checked', &method(:dry_run_option))
29
+ opts.separator('')
30
+ opts.on('-c', '--config FILENAME', String, <<~HELP, &method(:config_option))
31
+ Path to the config file (default ./.spellr.yml)
32
+ HELP
33
+ opts.on('-v', '--version', 'Returns the current version', &method(:version_option))
34
+ opts.on('-h', '--help', 'Shows this message', &method(:options_help))
35
+
36
+ opts
37
+ end
38
+ # rubocop:enable Layout/LineLength
39
+
40
+ def wordlist_option(_)
41
+ require_relative 'wordlist_reporter'
42
+ Spellr.config.reporter = Spellr::WordlistReporter.new
43
+ end
44
+
45
+ def quiet_option(_)
46
+ Spellr.config.quiet = true
47
+ require_relative 'quiet_reporter'
48
+ Spellr.config.reporter = Spellr::QuietReporter.new
49
+ end
50
+
51
+ def interactive_option(_)
52
+ require_relative 'interactive'
53
+ require_relative 'check_interactive'
54
+ Spellr.config.reporter = Spellr::Interactive.new
55
+ Spellr.config.checker = Spellr::CheckInteractive unless @parallel_option
56
+ end
57
+
58
+ def config_option(file)
59
+ file = Pathname.pwd.join(file).expand_path
60
+
61
+ unless ::File.readable?(file)
62
+ raise Spellr::Config::NotFound, "Config error: #{file} not found or not readable"
63
+ end
64
+
65
+ Spellr.config.config_file = file
66
+ end
67
+
68
+ def parallel_option(parallel) # rubocop:disable Metrics/MethodLength
69
+ @parallel_option = true
70
+ Spellr.config.checker = if parallel
71
+ require_relative 'check_parallel'
72
+ Spellr::CheckParallel
73
+ else
74
+ require_relative 'check'
75
+ Spellr::Check
76
+ end
77
+ end
78
+
79
+ def dry_run_option(_)
80
+ Spellr.config.dry_run = true
81
+ end
82
+
83
+ def version_option(_)
84
+ require_relative 'version'
85
+ puts(Spellr::VERSION)
86
+
87
+ exit
88
+ end
89
+
90
+ def options_help(_)
91
+ puts options.help
92
+
93
+ exit
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -30,17 +30,15 @@ module Spellr
30
30
  line_location.file
31
31
  end
32
32
 
33
- def file_name
34
- line_location.file_name
35
- end
36
-
37
33
  def to_s
38
34
  "#{line_location}:#{char_offset}"
39
35
  end
40
36
 
37
+ # :nocov:
41
38
  def inspect
42
39
  "#<#{self.class.name} #{self}>"
43
40
  end
41
+ # :nocov:
44
42
 
45
43
  def coordinates
46
44
  [line_number, char_offset]