unparser 0.4.4 → 0.4.9
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 +4 -4
- data/README.md +1 -3
- data/lib/unparser.rb +21 -3
- data/lib/unparser/ast.rb +1 -1
- data/lib/unparser/ast/local_variable_scope.rb +6 -6
- data/lib/unparser/cli.rb +65 -45
- data/lib/unparser/{cli/color.rb → color.rb} +0 -10
- data/lib/unparser/constants.rb +1 -1
- data/lib/unparser/diff.rb +115 -0
- data/lib/unparser/dsl.rb +1 -1
- data/lib/unparser/emitter.rb +4 -5
- data/lib/unparser/emitter/argument.rb +9 -13
- data/lib/unparser/emitter/literal/primitive.rb +1 -1
- data/lib/unparser/emitter/literal/range.rb +1 -1
- data/lib/unparser/node_helpers.rb +4 -2
- data/lib/unparser/preprocessor.rb +1 -1
- data/lib/unparser/validation.rb +149 -0
- metadata +97 -78
- data/.circleci/config.yml +0 -41
- data/.gitignore +0 -37
- data/.rspec +0 -4
- data/.rubocop.yml +0 -9
- data/Changelog.md +0 -142
- data/Gemfile +0 -7
- data/Gemfile.lock +0 -176
- data/LICENSE +0 -20
- data/Rakefile +0 -22
- data/config/devtools.yml +0 -2
- data/config/flay.yml +0 -3
- data/config/flog.yml +0 -2
- data/config/mutant.yml +0 -6
- data/config/reek.yml +0 -98
- data/config/rubocop.yml +0 -122
- data/config/yardstick.yml +0 -2
- data/lib/unparser/cli/differ.rb +0 -152
- data/lib/unparser/cli/source.rb +0 -267
- data/spec/integration/unparser/corpus_spec.rb +0 -111
- data/spec/integrations.yml +0 -87
- data/spec/spec_helper.rb +0 -20
- data/spec/unit/unparser/buffer/append_spec.rb +0 -24
- data/spec/unit/unparser/buffer/append_without_prefix_spec.rb +0 -23
- data/spec/unit/unparser/buffer/capture_content_spec.rb +0 -17
- data/spec/unit/unparser/buffer/content_spec.rb +0 -38
- data/spec/unit/unparser/buffer/fresh_line_spec.rb +0 -20
- data/spec/unit/unparser/buffer/indent_spec.rb +0 -20
- data/spec/unit/unparser/buffer/nl_spec.rb +0 -16
- data/spec/unit/unparser/buffer/unindent_spec.rb +0 -20
- data/spec/unit/unparser/comments/consume_spec.rb +0 -22
- data/spec/unit/unparser/comments/take_all_spec.rb +0 -19
- data/spec/unit/unparser/comments/take_before_spec.rb +0 -46
- data/spec/unit/unparser/comments/take_eol_comments_spec.rb +0 -32
- data/spec/unit/unparser/emitter/class_methods/handle_spec.rb +0 -17
- data/spec/unit/unparser_spec.rb +0 -1841
- data/unparser.gemspec +0 -30
data/.circleci/config.yml
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
defaults: &defaults
|
2
|
-
working_directory: ~/unparser
|
3
|
-
docker:
|
4
|
-
- image: circleci/ruby:2.5.5
|
5
|
-
version: 2
|
6
|
-
jobs:
|
7
|
-
unit_specs:
|
8
|
-
<<: *defaults
|
9
|
-
steps:
|
10
|
-
- checkout
|
11
|
-
- run: bundle install
|
12
|
-
- run: bundle exec rspec spec/unit
|
13
|
-
integration_specs:
|
14
|
-
<<: *defaults
|
15
|
-
steps:
|
16
|
-
- checkout
|
17
|
-
- run: bundle install
|
18
|
-
- run: bundle exec rspec spec/integration
|
19
|
-
metrics:
|
20
|
-
<<: *defaults
|
21
|
-
steps:
|
22
|
-
- checkout
|
23
|
-
- run: bundle install
|
24
|
-
- run: bundle exec rake metrics:rubocop
|
25
|
-
- run: bundle exec rake metrics:reek
|
26
|
-
- run: bundle exec rake metrics:flay
|
27
|
-
- run: bundle exec rake metrics:flog
|
28
|
-
mutant:
|
29
|
-
<<: *defaults
|
30
|
-
steps:
|
31
|
-
- checkout
|
32
|
-
- run: bundle install
|
33
|
-
- run: bundle exec mutant --since origin/master --zombie -- 'Unparser*'
|
34
|
-
workflows:
|
35
|
-
version: 2
|
36
|
-
test:
|
37
|
-
jobs:
|
38
|
-
- unit_specs
|
39
|
-
- integration_specs
|
40
|
-
- metrics
|
41
|
-
- mutant
|
data/.gitignore
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
## MAC OS
|
2
|
-
.DS_Store
|
3
|
-
|
4
|
-
## TEXTMATE
|
5
|
-
*.tmproj
|
6
|
-
tmtags
|
7
|
-
|
8
|
-
## EMACS
|
9
|
-
*~
|
10
|
-
\#*
|
11
|
-
.\#*
|
12
|
-
|
13
|
-
## VIM
|
14
|
-
*.sw[op]
|
15
|
-
|
16
|
-
## Rubinius
|
17
|
-
*.rbc
|
18
|
-
.rbx
|
19
|
-
|
20
|
-
## PROJECT::GENERAL
|
21
|
-
*.gem
|
22
|
-
coverage
|
23
|
-
profiling
|
24
|
-
turbulence
|
25
|
-
rdoc
|
26
|
-
pkg
|
27
|
-
tmp
|
28
|
-
doc
|
29
|
-
log
|
30
|
-
.yardoc
|
31
|
-
measurements
|
32
|
-
|
33
|
-
## BUNDLER
|
34
|
-
.bundle
|
35
|
-
|
36
|
-
## PROJECT::SPECIFIC
|
37
|
-
/vendor
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
data/Changelog.md
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
# v0.4.4 2019-03-27
|
2
|
-
|
3
|
-
* Bump parser dependency to ~> 2.6.2
|
4
|
-
|
5
|
-
# v0.4.3 2019-02-24
|
6
|
-
|
7
|
-
* Bump parser dependency to ~> 2.6.0
|
8
|
-
|
9
|
-
# v0.4.2 2018-12-04
|
10
|
-
|
11
|
-
* Drop hard ruby version requirement. Still officially I'll only support 2.5.
|
12
|
-
|
13
|
-
# v0.4.1 2018-12-03
|
14
|
-
|
15
|
-
* Fix unparsing of `def foo(bar: bar())`
|
16
|
-
|
17
|
-
# v0.4.0 2018-12-03
|
18
|
-
|
19
|
-
* Change to modern AST format.
|
20
|
-
* Add experimental `Unparser.{parser,parse,parse_with_comments}`
|
21
|
-
|
22
|
-
# v0.3.0 2018-11-16
|
23
|
-
|
24
|
-
* Drop support for Ruby < 2.5
|
25
|
-
|
26
|
-
# v0.2.7 2018-07-18
|
27
|
-
|
28
|
-
* Add emitters for `__FILE__` and `__LINE__`
|
29
|
-
https://github.com/mbj/unparser/pull/70
|
30
|
-
|
31
|
-
# v0.2.7 2018-02-09
|
32
|
-
|
33
|
-
* Allow ruby_parser 2.5
|
34
|
-
|
35
|
-
# v0.2.6 2017-05-30
|
36
|
-
|
37
|
-
* Reduce memory consumption via not requirering all possible parsers
|
38
|
-
* Allow ruby 2.4
|
39
|
-
* Update parser dependency
|
40
|
-
|
41
|
-
# v0.2.5 2016-01-24
|
42
|
-
|
43
|
-
* Add support for ruby 2.3
|
44
|
-
* Bump parser dependency to ~>2.3.0
|
45
|
-
* Trade uglier for more correct dstring / dsyms
|
46
|
-
* Drop support for ruby < 2.1
|
47
|
-
|
48
|
-
# v0.2.4 2015-05-30
|
49
|
-
|
50
|
-
* Relax parser dependency to ~>2.2.2
|
51
|
-
|
52
|
-
# v0.2.3 2015-04-28
|
53
|
-
|
54
|
-
* Compatibility with parser ~>2.2.2, >2.2.2.2
|
55
|
-
|
56
|
-
# v0.2.2 2015-01-14
|
57
|
-
|
58
|
-
* Really add back unofficial support for 1.9.3
|
59
|
-
|
60
|
-
# v0.2.1 2015-01-14
|
61
|
-
|
62
|
-
* Add back unofficial support for 1.9.3
|
63
|
-
|
64
|
-
# v0.2.0 2015-01-12
|
65
|
-
|
66
|
-
* Bump required ruby version to 2.0.0
|
67
|
-
|
68
|
-
# v0.1.17 2015-01-10
|
69
|
-
|
70
|
-
* Fix jruby complex / rational generation edge case
|
71
|
-
* Support generation under MRI 2.2
|
72
|
-
|
73
|
-
# v0.1.16 2014-11-07
|
74
|
-
|
75
|
-
* Add emitter for complex and rational literals
|
76
|
-
* Fix edge cases for MLHS
|
77
|
-
* Fix differencies from 2.2.pre7 series of parser
|
78
|
-
|
79
|
-
# v0.1.15 2014-09-24
|
80
|
-
|
81
|
-
* Handle syntax edge case for MRI 2.1.3 parser.
|
82
|
-
|
83
|
-
# v0.1.14 2014-06-15
|
84
|
-
|
85
|
-
* Fix emitter to correctly unparse foo[] = 1
|
86
|
-
|
87
|
-
# v0.1.13 2014-06-08
|
88
|
-
|
89
|
-
* Add support for rubinius.
|
90
|
-
|
91
|
-
# v0.1.12 2014-04-13
|
92
|
-
|
93
|
-
* Add support for 2.1 kwsplat
|
94
|
-
|
95
|
-
# v0.1.11 2014-04-11
|
96
|
-
|
97
|
-
* Fix performance on local variable scope inspection
|
98
|
-
|
99
|
-
# v0.1.10 2014-04-06
|
100
|
-
|
101
|
-
* Fix emit of inline rescues in combination with control flow keywords.
|
102
|
-
* Begin corpus testing on rake ci against rubyspec
|
103
|
-
|
104
|
-
# v0.1.9 2014-01-14
|
105
|
-
|
106
|
-
* Fix emit of proc { |(a)| }
|
107
|
-
|
108
|
-
# v0.1.8 2014-01-11
|
109
|
-
|
110
|
-
* Fix all bugs found while round tripping rubyspec.
|
111
|
-
|
112
|
-
# v0.1.7 2014-01-03
|
113
|
-
|
114
|
-
* Add back support for root nodes of type resbody https://github.com/mbj/unparser/issues/24
|
115
|
-
|
116
|
-
# v0.1.6 2013-12-31
|
117
|
-
|
118
|
-
* Emit 1.9 style hashes where possible: https://github.com/mbj/unparser/pull/23
|
119
|
-
* Fix invalid quoting of hash keys: https://github.com/mbj/unparser/issues/22
|
120
|
-
* Fix crash on take before introduced by code refactorings: https://github.com/mbj/unparser/issues/20
|
121
|
-
* Fix crash on comment reproduction https://github.com/mbj/unparser/issues/17
|
122
|
-
|
123
|
-
# v0.1.5 2013-11-01
|
124
|
-
|
125
|
-
* Fix crash with comment reproduction.
|
126
|
-
|
127
|
-
# v0.1.4 2013-11-01
|
128
|
-
|
129
|
-
* Code cleanups.
|
130
|
-
* Remove warnings.
|
131
|
-
|
132
|
-
# v0.0.3 2013-06-17
|
133
|
-
|
134
|
-
* Adjust to changes in parser 2.0.0.beta5 => beta6
|
135
|
-
|
136
|
-
# v0.0.2 2013-06-17
|
137
|
-
|
138
|
-
Crappy release
|
139
|
-
|
140
|
-
# v0.0.1 2013-06-15
|
141
|
-
|
142
|
-
Initial release
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,176 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/mbj/mutant.git
|
3
|
-
revision: 2b7791503fb12827afdf3397cef0db490a176134
|
4
|
-
specs:
|
5
|
-
mutant (0.8.25)
|
6
|
-
abstract_type (~> 0.0.7)
|
7
|
-
adamantium (~> 0.2.0)
|
8
|
-
anima (~> 0.3.1)
|
9
|
-
ast (~> 2.2)
|
10
|
-
concord (~> 0.1.5)
|
11
|
-
diff-lcs (~> 1.3)
|
12
|
-
equalizer (~> 0.0.9)
|
13
|
-
ice_nine (~> 0.11.1)
|
14
|
-
memoizable (~> 0.4.2)
|
15
|
-
parser (~> 2.6.0)
|
16
|
-
procto (~> 0.0.2)
|
17
|
-
unparser (~> 0.4.3)
|
18
|
-
mutant-rspec (0.8.25)
|
19
|
-
mutant (~> 0.8.25)
|
20
|
-
rspec-core (>= 3.8.0, < 4.0.0)
|
21
|
-
|
22
|
-
PATH
|
23
|
-
remote: .
|
24
|
-
specs:
|
25
|
-
unparser (0.4.3)
|
26
|
-
abstract_type (~> 0.0.7)
|
27
|
-
adamantium (~> 0.2.0)
|
28
|
-
concord (~> 0.1.5)
|
29
|
-
diff-lcs (~> 1.3)
|
30
|
-
equalizer (~> 0.0.9)
|
31
|
-
parser (~> 2.6.2)
|
32
|
-
procto (~> 0.0.2)
|
33
|
-
|
34
|
-
GEM
|
35
|
-
remote: https://rubygems.org/
|
36
|
-
specs:
|
37
|
-
abstract_type (0.0.7)
|
38
|
-
adamantium (0.2.0)
|
39
|
-
ice_nine (~> 0.11.0)
|
40
|
-
memoizable (~> 0.4.0)
|
41
|
-
anima (0.3.1)
|
42
|
-
abstract_type (~> 0.0.7)
|
43
|
-
adamantium (~> 0.2)
|
44
|
-
equalizer (~> 0.0.11)
|
45
|
-
ast (2.4.0)
|
46
|
-
axiom-types (0.1.1)
|
47
|
-
descendants_tracker (~> 0.0.4)
|
48
|
-
ice_nine (~> 0.11.0)
|
49
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
50
|
-
codeclimate-engine-rb (0.4.1)
|
51
|
-
virtus (~> 1.0)
|
52
|
-
coercible (1.0.0)
|
53
|
-
descendants_tracker (~> 0.0.1)
|
54
|
-
concord (0.1.5)
|
55
|
-
adamantium (~> 0.2.0)
|
56
|
-
equalizer (~> 0.0.9)
|
57
|
-
descendants_tracker (0.0.4)
|
58
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
59
|
-
devtools (0.1.23)
|
60
|
-
abstract_type (~> 0.0.7)
|
61
|
-
adamantium (~> 0.2.0)
|
62
|
-
anima (~> 0.3.0)
|
63
|
-
concord (~> 0.1.5)
|
64
|
-
flay (~> 2.12.0)
|
65
|
-
flog (~> 4.6.2)
|
66
|
-
mutant (~> 0.8.24)
|
67
|
-
mutant-rspec (~> 0.8.24)
|
68
|
-
procto (~> 0.0.3)
|
69
|
-
rake (~> 12.3.0)
|
70
|
-
reek (~> 5.3.0)
|
71
|
-
rspec (~> 3.8.0)
|
72
|
-
rspec-core (~> 3.8.0)
|
73
|
-
rspec-its (~> 1.2.0)
|
74
|
-
rubocop (~> 0.61.1)
|
75
|
-
simplecov (~> 0.16.1)
|
76
|
-
yard (~> 0.9.16)
|
77
|
-
yardstick (~> 0.9.9)
|
78
|
-
diff-lcs (1.3)
|
79
|
-
docile (1.3.1)
|
80
|
-
equalizer (0.0.11)
|
81
|
-
erubis (2.7.0)
|
82
|
-
flay (2.12.0)
|
83
|
-
erubis (~> 2.7.0)
|
84
|
-
path_expander (~> 1.0)
|
85
|
-
ruby_parser (~> 3.0)
|
86
|
-
sexp_processor (~> 4.0)
|
87
|
-
flog (4.6.2)
|
88
|
-
path_expander (~> 1.0)
|
89
|
-
ruby_parser (~> 3.1, > 3.1.0)
|
90
|
-
sexp_processor (~> 4.8)
|
91
|
-
ice_nine (0.11.2)
|
92
|
-
jaro_winkler (1.5.2)
|
93
|
-
json (2.2.0)
|
94
|
-
kwalify (0.7.2)
|
95
|
-
memoizable (0.4.2)
|
96
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
97
|
-
morpher (0.2.6)
|
98
|
-
abstract_type (~> 0.0.7)
|
99
|
-
adamantium (~> 0.2.0)
|
100
|
-
anima (~> 0.3.0)
|
101
|
-
ast (~> 2.2)
|
102
|
-
concord (~> 0.1.5)
|
103
|
-
equalizer (~> 0.0.9)
|
104
|
-
ice_nine (~> 0.11.0)
|
105
|
-
procto (~> 0.0.2)
|
106
|
-
parallel (1.13.0)
|
107
|
-
parser (2.6.2.0)
|
108
|
-
ast (~> 2.4.0)
|
109
|
-
path_expander (1.0.3)
|
110
|
-
powerpack (0.1.2)
|
111
|
-
procto (0.0.3)
|
112
|
-
psych (3.1.0)
|
113
|
-
rainbow (3.0.0)
|
114
|
-
rake (12.3.2)
|
115
|
-
reek (5.3.1)
|
116
|
-
codeclimate-engine-rb (~> 0.4.0)
|
117
|
-
kwalify (~> 0.7.0)
|
118
|
-
parser (>= 2.5.0.0, < 2.7, != 2.5.1.1)
|
119
|
-
psych (~> 3.1.0)
|
120
|
-
rainbow (>= 2.0, < 4.0)
|
121
|
-
rspec (3.8.0)
|
122
|
-
rspec-core (~> 3.8.0)
|
123
|
-
rspec-expectations (~> 3.8.0)
|
124
|
-
rspec-mocks (~> 3.8.0)
|
125
|
-
rspec-core (3.8.0)
|
126
|
-
rspec-support (~> 3.8.0)
|
127
|
-
rspec-expectations (3.8.2)
|
128
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
129
|
-
rspec-support (~> 3.8.0)
|
130
|
-
rspec-its (1.2.0)
|
131
|
-
rspec-core (>= 3.0.0)
|
132
|
-
rspec-expectations (>= 3.0.0)
|
133
|
-
rspec-mocks (3.8.0)
|
134
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
135
|
-
rspec-support (~> 3.8.0)
|
136
|
-
rspec-support (3.8.0)
|
137
|
-
rubocop (0.61.1)
|
138
|
-
jaro_winkler (~> 1.5.1)
|
139
|
-
parallel (~> 1.10)
|
140
|
-
parser (>= 2.5, != 2.5.1.1)
|
141
|
-
powerpack (~> 0.1)
|
142
|
-
rainbow (>= 2.2.2, < 4.0)
|
143
|
-
ruby-progressbar (~> 1.7)
|
144
|
-
unicode-display_width (~> 1.4.0)
|
145
|
-
ruby-progressbar (1.10.0)
|
146
|
-
ruby_parser (3.12.0)
|
147
|
-
sexp_processor (~> 4.9)
|
148
|
-
sexp_processor (4.11.0)
|
149
|
-
simplecov (0.16.1)
|
150
|
-
docile (~> 1.1)
|
151
|
-
json (>= 1.8, < 3)
|
152
|
-
simplecov-html (~> 0.10.0)
|
153
|
-
simplecov-html (0.10.2)
|
154
|
-
thread_safe (0.3.6)
|
155
|
-
unicode-display_width (1.4.1)
|
156
|
-
virtus (1.0.5)
|
157
|
-
axiom-types (~> 0.1)
|
158
|
-
coercible (~> 1.0)
|
159
|
-
descendants_tracker (~> 0.0, >= 0.0.3)
|
160
|
-
equalizer (~> 0.0, >= 0.0.9)
|
161
|
-
yard (0.9.18)
|
162
|
-
yardstick (0.9.9)
|
163
|
-
yard (~> 0.8, >= 0.8.7.2)
|
164
|
-
|
165
|
-
PLATFORMS
|
166
|
-
ruby
|
167
|
-
|
168
|
-
DEPENDENCIES
|
169
|
-
anima (~> 0.3.1)
|
170
|
-
devtools (~> 0.1.23)
|
171
|
-
morpher (~> 0.2.6)
|
172
|
-
mutant!
|
173
|
-
unparser!
|
174
|
-
|
175
|
-
BUNDLED WITH
|
176
|
-
1.17.3
|
data/LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2013 Markus Schirp
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'devtools'
|
2
|
-
Devtools.init_rake_tasks
|
3
|
-
|
4
|
-
Rake.application.load_imports
|
5
|
-
task('metrics:mutant').clear
|
6
|
-
|
7
|
-
namespace :metrics do
|
8
|
-
task mutant: :coverage do
|
9
|
-
args = %w[
|
10
|
-
bundle exec mutant
|
11
|
-
--ignore-subject Unparser::Buffer#initialize
|
12
|
-
--include lib
|
13
|
-
--require unparser
|
14
|
-
--use rspec
|
15
|
-
--zombie
|
16
|
-
--since HEAD~1
|
17
|
-
]
|
18
|
-
args.concat(%w[--jobs 4]) if ENV.key?('CIRCLECI')
|
19
|
-
|
20
|
-
system(*args.concat(%w[-- Unparser*])) or fail "Mutant task failed"
|
21
|
-
end
|
22
|
-
end
|