syntax_suggest 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 338fe09b04529ea04747cadd14a39b290802d6c524f1484b8a80fbaacd1ae7e5
4
- data.tar.gz: 507b73a5e7fd07872db31ced86da79b0de641036bbff0ffd92fd24bb5686a10a
3
+ metadata.gz: 930f25a74c71bd7440dfe5cb89a57216414fef8110eae8786bddc9396b542dff
4
+ data.tar.gz: cb679eceb6f2ee38ec68f84f1745aefa5dff73450f5b7ad835b8a05b531d1023
5
5
  SHA512:
6
- metadata.gz: 1e58c6b3bff188226bce33e89f85ce909794a2ee92317d8c86e59d25b442c7ff92ef8e19e8bee6cfcd80d1415f15f086a8c197ccf705e833a65feb4d4e0a0cbe
7
- data.tar.gz: f4b6078565ec509cec459355bdabe4e799e1a7a2857361a71e060d6d9ce02daaa3595c7459bead91874fbdacca26f0517d7984240613269baa718853c631daa6
6
+ metadata.gz: 68bc380be685aaf34df8992c8fdc599ac3e4cd3367e13c7d014acbf4b82c50edff1e684964f8d6f7503a9408095160ea47b5573bb901fbce2d6ac1e9e7fdd455
7
+ data.tar.gz: 15c6acaf604d5d4f4bdabea04a6cfad1310214c20f9581397d87a03c67d3079ea26c8924d4f3258b59925105d304f9b7ded5dd0e65e959e691cc8a342588006f
@@ -0,0 +1,44 @@
1
+ name: CI
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ lint:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Checkout code
12
+ uses: actions/checkout@v3
13
+ - name: Set up Ruby
14
+ uses: ruby/setup-ruby@v1
15
+ with:
16
+ ruby-version: 3.1
17
+ bundler-cache: true
18
+ - name: Linting
19
+ run: bundle exec standardrb
20
+
21
+ test:
22
+ runs-on: ubuntu-latest
23
+ strategy:
24
+ fail-fast: false
25
+ matrix:
26
+ ruby:
27
+ - 2.5
28
+ - 2.6
29
+ - 2.7
30
+ - '3.0'
31
+ - 3.1
32
+ - "3.2.0-preview1"
33
+ - head
34
+ steps:
35
+ - name: Checkout code
36
+ uses: actions/checkout@v3
37
+ - name: Set up Ruby
38
+ uses: ruby/setup-ruby@v1
39
+ with:
40
+ ruby-version: ${{ matrix.ruby }}
41
+ bundler-cache: true
42
+ - name: test
43
+ run: bundle exec rake test
44
+ continue-on-error: ${{ matrix.ruby == 'head' }}
data/CHANGELOG.md CHANGED
@@ -1,48 +1,52 @@
1
1
  ## HEAD (unreleased)
2
2
 
3
+ ## 1.0.0 (Library renamed to syntax_suggest )
4
+
5
+ - [Breaking] Output "Syntax OK" will no longer be output when `syntax_suggest` is fired due to a syntax error. (https://github.com/ruby/syntax_suggest/pull/158)
3
6
  - [Breaking] Rename `dead_end` to `syntax_suggest` (https://github.com/zombocom/dead_end/pull/154)
4
7
  - [Breaking] Lazy loading moved from `autoload` to manually checking for constants and requiring `dead_end/api`. To manually use any SyntaxSuggest internals you MUST require `dead_end/api`, otherwise it will be lazy loaded on syntax error (https://github.com/zombocom/dead_end/pull/148)
5
8
  - Default to highlighted output on Ruby 3.2 (https://github.com/zombocom/dead_end/pull/150)
6
9
  - Debug functionality enabled by `DEBUG=1` env var is now under `SYNTAX_SUGGEST_DEBUG=1`. Note this is not a stable interface or feature. Output content is subject to change without major version change (https://github.com/zombocom/dead_end/pull/149)
7
10
  - Enable/Disable dead_end by using the `dead_end` kwarg in `detailed_message` (https://github.com/zombocom/dead_end/pull/147)
8
11
  - Respect `highlight` kwarg in Ruby 3.2's `detailed_message` to enable/disable control characters (https://github.com/zombocom/dead_end/pull/147)
12
+ - Added workarounds for running on ruby/ruby repo (https://github.com/ruby/syntax_suggest/pull/156)
9
13
 
10
- ## 4.0.0
14
+ ## dead_end 4.0.0
11
15
 
12
16
  - Code that does not have an associated file (eval and streamed) no longer produce a warning saying that the file could not be found. To produce a warning with these code types run with DEBUG=1 environment variable. (https://github.com/zombocom/dead_end/pull/143)
13
17
  - [Breaking] Lazy load SyntaxSuggest internals only if there is a Syntax error. Use `require "dead_end"; require "dead_end/api"` to load eagerly all internals. Otherwise `require "dead_end"` will set up an autoload for the first time the SyntaxSuggest module is used in code. This should only happen on a syntax error. (https://github.com/zombocom/dead_end/pull/142)
14
18
  - Monkeypatch `SyntaxError#detailed_message` in Ruby 3.2+ instead of `require`, `load`, and `require_relative` (https://github.com/zombocom/dead_end/pull/139)
15
19
 
16
- ## 3.1.2
20
+ ## dead_end 3.1.2
17
21
 
18
22
  - Fixed internal class AroundBlockScan, minor changes in outputs (https://github.com/zombocom/dead_end/pull/131)
19
23
 
20
- ## 3.1.1
24
+ ## dead_end 3.1.1
21
25
 
22
26
  - Fix case where Ripper lexing identified incorrect code as a keyword (https://github.com/zombocom/dead_end/pull/122)
23
27
 
24
- ## 3.1.0
28
+ ## dead_end 3.1.0
25
29
 
26
30
  - Add support for Ruby 3.1 by updating `require_relative` logic (https://github.com/zombocom/dead_end/pull/120)
27
31
  - Requiring `dead_end/auto` is now deprecated please require `dead_end` instead (https://github.com/zombocom/dead_end/pull/119)
28
32
  - Requiring `dead_end/api` now loads code without monkeypatching core extensions (https://github.com/zombocom/dead_end/pull/119)
29
33
  - The interface `SyntaxSuggest.handle_error` is declared public and stable (https://github.com/zombocom/dead_end/pull/119)
30
34
 
31
- ## 3.0.3
35
+ ## dead_end 3.0.3
32
36
 
33
37
  - Expand explanations coming from additional Ripper errors (https://github.com/zombocom/dead_end/pull/117)
34
38
  - Fix explanation involving shorthand syntax for literals like `%w[]` and `%Q{}` (https://github.com/zombocom/dead_end/pull/116)
35
39
 
36
- ## 3.0.2
40
+ ## dead_end 3.0.2
37
41
 
38
42
  - Fix windows filename detection (https://github.com/zombocom/dead_end/pull/114)
39
43
  - Update links on readme and code of conduct (https://github.com/zombocom/dead_end/pull/107)
40
44
 
41
- ## 3.0.1
45
+ ## dead_end 3.0.1
42
46
 
43
47
  - Fix CLI parsing when flags come before filename (https://github.com/zombocom/dead_end/pull/102)
44
48
 
45
- ## 3.0.0
49
+ ## dead_end 3.0.0
46
50
 
47
51
  - [Breaking] CLI now outputs to STDOUT instead of STDERR (https://github.com/zombocom/dead_end/pull/98)
48
52
  - [Breaking] Remove previously deprecated `require "dead_end/fyi"` interface (https://github.com/zombocom/dead_end/pull/94)
@@ -53,11 +57,11 @@
53
57
  - Parse errors emitted per-block rather than for the whole document (https://github.com/zombocom/dead_end/pull/94)
54
58
  - The "banner" is now based on lexical analysis rather than parser regex (fix #68, fix #87) (https://github.com/zombocom/dead_end/pull/96)
55
59
 
56
- ## 2.0.2
60
+ ## dead_end 2.0.2
57
61
 
58
62
  - Don't print terminal color codes when output is not tty (https://github.com/zombocom/dead_end/pull/91)
59
63
 
60
- ## 2.0.1
64
+ ## dead_end 2.0.1
61
65
 
62
66
  - Reintroduce Ruby 2.5 support (https://github.com/zombocom/dead_end/pull/90)
63
67
  - Support naked braces/brackets/parens, invert labels on banner (https://github.com/zombocom/dead_end/pull/89)
@@ -65,94 +69,94 @@
65
69
  - CLI returns non-zero exit code when syntax error is found (https://github.com/zombocom/dead_end/pull/86)
66
70
  - Let -v respond with gem version instead of 'unknown' (https://github.com/zombocom/dead_end/pull/82)
67
71
 
68
- ## 2.0.0
72
+ ## dead_end 2.0.0
69
73
 
70
74
  - Support "endless" oneline method definitions for Ruby 3+ (https://github.com/zombocom/dead_end/pull/80)
71
75
  - Reduce timeout to 1 second (https://github.com/zombocom/dead_end/pull/79)
72
76
  - Logically consecutive lines (such as chained methods are now joined) (https://github.com/zombocom/dead_end/pull/78)
73
77
  - Output improvement for cases where the only line is an single `end` (https://github.com/zombocom/dead_end/pull/78)
74
78
 
75
- ## 1.2.0
79
+ ## dead_end 1.2.0
76
80
 
77
81
  - Output improvements via less greedy unmatched kw capture https://github.com/zombocom/dead_end/pull/73
78
82
  - Remove NoMethodError patching instead use https://github.com/ruby/error_highlight/ (https://github.com/zombocom/dead_end/pull/71)
79
83
 
80
- ## 1.1.7
84
+ ## dead_end 1.1.7
81
85
 
82
86
  - Fix sinatra support for `require_relative` (https://github.com/zombocom/dead_end/pull/63)
83
87
 
84
- ## 1.1.6
88
+ ## dead_end 1.1.6
85
89
 
86
90
  - Consider if syntax error caused an unexpected variable instead of end (https://github.com/zombocom/dead_end/pull/58)
87
91
 
88
- ## 1.1.5
92
+ ## dead_end 1.1.5
89
93
 
90
94
  - Parse error once and not twice if there's more than one available (https://github.com/zombocom/dead_end/pull/57)
91
95
 
92
- ## 1.1.4
96
+ ## dead_end 1.1.4
93
97
 
94
98
  - Avoid including demo gif in built gem (https://github.com/zombocom/dead_end/pull/53)
95
99
 
96
- ## 1.1.3
100
+ ## dead_end 1.1.3
97
101
 
98
102
  - Add compatibility with zeitwerk (https://github.com/zombocom/dead_end/pull/52)
99
103
 
100
- ## 1.1.2
104
+ ## dead_end 1.1.2
101
105
 
102
106
  - Namespace Kernel method aliases (https://github.com/zombocom/dead_end/pull/51)
103
107
 
104
- ## 1.1.1
108
+ ## dead_end 1.1.1
105
109
 
106
110
  - Safer NoMethodError annotation (https://github.com/zombocom/dead_end/pull/48)
107
111
 
108
- ## 1.1.0
112
+ ## dead_end 1.1.0
109
113
 
110
114
  - Annotate NoMethodError in non-production environments (https://github.com/zombocom/dead_end/pull/46)
111
115
  - Do not count trailing if/unless as a keyword (https://github.com/zombocom/dead_end/pull/44)
112
116
 
113
- ## 1.0.2
117
+ ## dead_end 1.0.2
114
118
 
115
119
  - Fix bug where empty lines were interpreted to have a zero indentation (https://github.com/zombocom/dead_end/pull/39)
116
120
  - Better results when missing "end" comes at the end of a capturing block (such as a class or module definition) (https://github.com/zombocom/dead_end/issues/32)
117
121
 
118
- ## 1.0.1
122
+ ## dead_end 1.0.1
119
123
 
120
124
  - Fix performance issue when evaluating multiple block combinations (https://github.com/zombocom/dead_end/pull/35)
121
125
 
122
- ## 1.0.0
126
+ ## dead_end 1.0.0
123
127
 
124
128
  - Gem name changed from `syntax_search` to `dead_end` (https://github.com/zombocom/syntax_search/pull/30)
125
129
  - Moved `syntax_search/auto` behavior to top level require (https://github.com/zombocom/syntax_search/pull/30)
126
130
  - Error banner now indicates when missing a `|` or `}` in addition to `end` (https://github.com/zombocom/syntax_search/pull/29)
127
131
  - Trailing slashes are now handled (joined) before the code search (https://github.com/zombocom/syntax_search/pull/28)
128
132
 
129
- ## 0.2.0
133
+ ## dead_end 0.2.0
130
134
 
131
135
  - Simplify large file output so minimal context around the invalid section is shown (https://github.com/zombocom/syntax_search/pull/26)
132
136
  - Block expansion is now lexically aware of keywords (def/do/end etc.) (https://github.com/zombocom/syntax_search/pull/24)
133
137
  - Fix bug where not all of a source is lexed which is used in heredoc detection/removal (https://github.com/zombocom/syntax_search/pull/23)
134
138
 
135
- ## 0.1.5
139
+ ## dead_end 0.1.5
136
140
 
137
141
  - Strip out heredocs in documents first (https://github.com/zombocom/syntax_search/pull/19)
138
142
 
139
- ## 0.1.4
143
+ ## dead_end 0.1.4
140
144
 
141
145
  - Parser gem replaced with Ripper (https://github.com/zombocom/syntax_search/pull/17)
142
146
 
143
- ## 0.1.3
147
+ ## dead_end 0.1.3
144
148
 
145
149
  - Internal refactor (https://github.com/zombocom/syntax_search/pull/13)
146
150
 
147
- ## 0.1.2
151
+ ## dead_end 0.1.2
148
152
 
149
153
  - Codeblocks in output are now indented with 4 spaces and "code fences" are removed (https://github.com/zombocom/syntax_search/pull/11)
150
154
  - "Unmatched end" and "missing end" not generate different error text instructions (https://github.com/zombocom/syntax_search/pull/10)
151
155
 
152
- ## 0.1.1
156
+ ## dead_end 0.1.1
153
157
 
154
158
  - Fire search on both unexpected end-of-input and unexected end (https://github.com/zombocom/syntax_search/pull/8)
155
159
 
156
- ## 0.1.0
160
+ ## dead_end 0.1.0
157
161
 
158
162
  - Initial release
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- syntax_suggest (0.0.1)
4
+ syntax_suggest (1.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -11,6 +11,8 @@ Unmatched `end', missing keyword (`do', `def`, `if`, etc.) ?
11
11
  5 end
12
12
  ```
13
13
 
14
+ > This project was previously named `dead_end` as it attempted to find dangling `end` keywords. The name was changed to be more descriptive and welcoming as part of the effort to merge it into [Ruby 3.2](https://bugs.ruby-lang.org/issues/18159#note-29).
15
+
14
16
  ## Installation in your codebase
15
17
 
16
18
  To automatically annotate errors when they happen, add this to your Gemfile:
data/Rakefile CHANGED
@@ -6,3 +6,4 @@ require "rspec/core/rake_task"
6
6
  RSpec::Core::RakeTask.new(:spec)
7
7
 
8
8
  task default: :spec
9
+ task test: :spec
@@ -137,7 +137,7 @@ module SyntaxSuggest
137
137
  # puts "woof" # 3
138
138
  # end # 4
139
139
  #
140
- # However due to https://github.com/zombocom/syntax_suggest/issues/32
140
+ # However due to https://github.com/ruby/syntax_suggest/issues/32
141
141
  # the problem line will be identified as:
142
142
  #
143
143
  # ❯ class Dog # 1
@@ -65,6 +65,7 @@ module SyntaxSuggest
65
65
  )
66
66
 
67
67
  if display.document_ok?
68
+ @io.puts "Syntax OK"
68
69
  @exit_obj.exit(0)
69
70
  else
70
71
  @exit_obj.exit(1)
@@ -23,7 +23,6 @@ module SyntaxSuggest
23
23
 
24
24
  def call
25
25
  if document_ok?
26
- @io.puts "Syntax OK"
27
26
  return self
28
27
  end
29
28
 
@@ -4,7 +4,7 @@ module SyntaxSuggest
4
4
  # Converts a SyntaxError message to a path
5
5
  #
6
6
  # Handles the case where the filename has a colon in it
7
- # such as on a windows file system: https://github.com/zombocom/syntax_suggest/issues/111
7
+ # such as on a windows file system: https://github.com/ruby/syntax_suggest/issues/111
8
8
  #
9
9
  # Example:
10
10
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SyntaxSuggest
4
- VERSION = "0.0.1"
4
+ VERSION = "1.0.0"
5
5
  end
@@ -14,12 +14,12 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  spec.summary = "Find syntax errors in your source in a snap"
16
16
  spec.description = 'When you get an "unexpected end" in your syntax this gem helps you find it'
17
- spec.homepage = "https://github.com/zombocom/syntax_suggest.git"
17
+ spec.homepage = "https://github.com/ruby/syntax_suggest.git"
18
18
  spec.license = "MIT"
19
19
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
20
20
 
21
21
  spec.metadata["homepage_uri"] = spec.homepage
22
- spec.metadata["source_code_uri"] = "https://github.com/zombocom/syntax_suggest.git"
22
+ spec.metadata["source_code_uri"] = "https://github.com/ruby/syntax_suggest.git"
23
23
 
24
24
  # Specify which files should be added to the gem when it is released.
25
25
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syntax_suggest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - schneems
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-26 00:00:00.000000000 Z
11
+ date: 2022-11-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: When you get an "unexpected end" in your syntax this gem helps you find
14
14
  it
@@ -19,8 +19,8 @@ executables:
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
- - ".circleci/config.yml"
23
22
  - ".github/workflows/check_changelog.yml"
23
+ - ".github/workflows/ci.yml"
24
24
  - ".gitignore"
25
25
  - ".rspec"
26
26
  - ".standard.yml"
@@ -33,7 +33,6 @@ files:
33
33
  - Rakefile
34
34
  - bin/console
35
35
  - bin/setup
36
- - dead_end.gemspec
37
36
  - exe/syntax_suggest
38
37
  - lib/syntax_suggest.rb
39
38
  - lib/syntax_suggest/api.rb
@@ -60,12 +59,13 @@ files:
60
59
  - lib/syntax_suggest/ripper_errors.rb
61
60
  - lib/syntax_suggest/unvisited_lines.rb
62
61
  - lib/syntax_suggest/version.rb
63
- homepage: https://github.com/zombocom/syntax_suggest.git
62
+ - syntax_suggest.gemspec
63
+ homepage: https://github.com/ruby/syntax_suggest.git
64
64
  licenses:
65
65
  - MIT
66
66
  metadata:
67
- homepage_uri: https://github.com/zombocom/syntax_suggest.git
68
- source_code_uri: https://github.com/zombocom/syntax_suggest.git
67
+ homepage_uri: https://github.com/ruby/syntax_suggest.git
68
+ source_code_uri: https://github.com/ruby/syntax_suggest.git
69
69
  post_install_message:
70
70
  rdoc_options: []
71
71
  require_paths:
data/.circleci/config.yml DELETED
@@ -1,91 +0,0 @@
1
- version: 2.1
2
- orbs:
3
- ruby: circleci/ruby@1.8.0
4
- references:
5
- unit: &unit
6
- run:
7
- name: Run test suite
8
- command: bundle exec rspec spec/
9
-
10
- lint: &lint
11
- run:
12
- name: Run linter, fix with `standardrb --fix` locally
13
- command: bundle exec standardrb
14
-
15
- jobs:
16
- "ruby-2-5":
17
- docker:
18
- - image: circleci/ruby:2.5
19
- steps:
20
- - checkout
21
- - ruby/install-deps
22
- - <<: *unit
23
-
24
- "ruby-2-6":
25
- docker:
26
- - image: circleci/ruby:2.6
27
- steps:
28
- - checkout
29
- - ruby/install-deps
30
- - <<: *unit
31
-
32
- "ruby-2-7":
33
- docker:
34
- - image: circleci/ruby:2.7
35
- steps:
36
- - checkout
37
- - ruby/install-deps
38
- - <<: *unit
39
-
40
- "ruby-3-0":
41
- docker:
42
- - image: circleci/ruby:3.0
43
- steps:
44
- - checkout
45
- - ruby/install-deps
46
- - <<: *unit
47
-
48
- "ruby-3-1":
49
- docker:
50
- - image: 'cimg/ruby:3.1'
51
- steps:
52
- - checkout
53
- - ruby/install-deps
54
- - <<: *unit
55
-
56
- "ruby-3-2":
57
- docker:
58
- - image: 'ruby:3.2.0-preview1'
59
- steps:
60
- - checkout
61
- - ruby/install-deps
62
- - <<: *unit
63
- "ruby-3-2-yjit":
64
- docker:
65
- - image: 'ruby:3.2.0-preview1'
66
- steps:
67
- - run: echo "export RUBY_YJIT_ENABLE=1" >> $BASH_ENV
68
- - checkout
69
- - ruby/install-deps
70
- - <<: *unit
71
-
72
- "lint":
73
- docker:
74
- - image: circleci/ruby:3.0
75
- steps:
76
- - checkout
77
- - ruby/install-deps
78
- - <<: *lint
79
-
80
- workflows:
81
- version: 2
82
- build:
83
- jobs:
84
- - "ruby-2-5"
85
- - "ruby-2-6"
86
- - "ruby-2-7"
87
- - "ruby-3-0"
88
- - "ruby-3-1"
89
- - "ruby-3-2"
90
- - "ruby-3-2-yjit"
91
- - "lint"