syntax_tree-array_brackets 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +168 -0
- data/.streerc +1 -0
- data/.vscode/settings.json +4 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +61 -0
- data/README.md +41 -0
- data/Rakefile +12 -0
- data/lib/syntax_tree/array_brackets/version.rb +7 -0
- data/lib/syntax_tree/array_brackets.rb +6 -0
- data/lib/syntax_tree/node.rb +84 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 310c9fa6ba5f710b1cfd410e930e2c55c67a89c02310099b542f1970c11f47ca
|
4
|
+
data.tar.gz: 18d763015004da43943e609760b85e0d8c4265a974662e3743c7f40ffd21ba21
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2b5e483494a5df437e5dfb3c919224b662d128d0a46fb00448b029e02dc8646cb8ce1191fe00381e8636e96733960d94ac02b1a1b33838da015f4bffad44be3b
|
7
|
+
data.tar.gz: 13ec518da27b95ac23f5d1c9ffef9c2d0a08379451d447145689518d21cbce9e813a3d506cbefde8bc05c294a203691303c6477d264a6c6ed0e482adb97df865
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,168 @@
|
|
1
|
+
inherit_gem:
|
2
|
+
syntax_tree: config/rubocop.yml
|
3
|
+
|
4
|
+
AllCops:
|
5
|
+
DisplayCopNames: true
|
6
|
+
DisplayStyleGuide: true
|
7
|
+
NewCops: enable
|
8
|
+
SuggestExtensions: false
|
9
|
+
TargetRubyVersion: 2.7
|
10
|
+
Exclude:
|
11
|
+
- '{.git,.github,bin,coverage,pkg,sorbet,spec,test/fixtures,vendor,tmp}/**/*'
|
12
|
+
- test.rb
|
13
|
+
|
14
|
+
Gemspec/DevelopmentDependencies:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Layout/LineLength:
|
18
|
+
Max: 120
|
19
|
+
|
20
|
+
Lint/AmbiguousBlockAssociation:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Lint/AmbiguousOperatorPrecedence:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
Lint/AmbiguousRange:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Lint/BooleanSymbol:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Lint/Debugger:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Lint/DuplicateBranch:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Lint/EmptyBlock:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Lint/InterpolationCheck:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Lint/MissingSuper:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
Lint/NonLocalExitFromIterator:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Lint/RedundantRequireStatement:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
Lint/RescueException:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
Lint/SuppressedException:
|
57
|
+
Enabled: false
|
58
|
+
|
59
|
+
Lint/UnderscorePrefixedVariableName:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
Lint/UnusedMethodArgument:
|
63
|
+
AllowUnusedKeywordArguments: true
|
64
|
+
|
65
|
+
Metrics:
|
66
|
+
Enabled: false
|
67
|
+
|
68
|
+
Naming/MethodName:
|
69
|
+
Enabled: false
|
70
|
+
|
71
|
+
Naming/MethodParameterName:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
Naming/RescuedExceptionsVariableName:
|
75
|
+
PreferredName: error
|
76
|
+
|
77
|
+
Naming/VariableNumber:
|
78
|
+
Enabled: false
|
79
|
+
|
80
|
+
Security/Eval:
|
81
|
+
Enabled: false
|
82
|
+
|
83
|
+
Style/AccessorGrouping:
|
84
|
+
Enabled: false
|
85
|
+
|
86
|
+
Style/Alias:
|
87
|
+
Enabled: false
|
88
|
+
|
89
|
+
Style/CaseEquality:
|
90
|
+
Enabled: false
|
91
|
+
|
92
|
+
Style/CaseLikeIf:
|
93
|
+
Enabled: false
|
94
|
+
|
95
|
+
Style/ClassVars:
|
96
|
+
Enabled: false
|
97
|
+
|
98
|
+
Style/CombinableLoops:
|
99
|
+
Enabled: false
|
100
|
+
|
101
|
+
Style/DocumentDynamicEvalDefinition:
|
102
|
+
Enabled: false
|
103
|
+
|
104
|
+
Style/Documentation:
|
105
|
+
Enabled: false
|
106
|
+
|
107
|
+
Style/EndBlock:
|
108
|
+
Enabled: false
|
109
|
+
|
110
|
+
Style/ExplicitBlockArgument:
|
111
|
+
Enabled: false
|
112
|
+
|
113
|
+
Style/FormatString:
|
114
|
+
Enabled: false
|
115
|
+
|
116
|
+
Style/FormatStringToken:
|
117
|
+
Enabled: false
|
118
|
+
|
119
|
+
Style/GuardClause:
|
120
|
+
Enabled: false
|
121
|
+
|
122
|
+
Style/HashLikeCase:
|
123
|
+
Enabled: false
|
124
|
+
|
125
|
+
Style/IdenticalConditionalBranches:
|
126
|
+
Enabled: false
|
127
|
+
|
128
|
+
Style/IfInsideElse:
|
129
|
+
Enabled: false
|
130
|
+
|
131
|
+
Style/IfWithBooleanLiteralBranches:
|
132
|
+
Enabled: false
|
133
|
+
|
134
|
+
Style/KeywordParametersOrder:
|
135
|
+
Enabled: false
|
136
|
+
|
137
|
+
Style/MissingRespondToMissing:
|
138
|
+
Enabled: false
|
139
|
+
|
140
|
+
Style/MutableConstant:
|
141
|
+
Enabled: false
|
142
|
+
|
143
|
+
Style/NegatedIfElseCondition:
|
144
|
+
Enabled: false
|
145
|
+
|
146
|
+
Style/Next:
|
147
|
+
Enabled: false
|
148
|
+
|
149
|
+
Style/NumericPredicate:
|
150
|
+
Enabled: false
|
151
|
+
|
152
|
+
Style/ParallelAssignment:
|
153
|
+
Enabled: false
|
154
|
+
|
155
|
+
Style/PerlBackrefs:
|
156
|
+
Enabled: false
|
157
|
+
|
158
|
+
Style/SafeNavigation:
|
159
|
+
Enabled: false
|
160
|
+
|
161
|
+
Style/SpecialGlobalVars:
|
162
|
+
Enabled: false
|
163
|
+
|
164
|
+
Style/StructInheritance:
|
165
|
+
Enabled: false
|
166
|
+
|
167
|
+
Style/YodaExpression:
|
168
|
+
Enabled: false
|
data/.streerc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--plugin=array_brackets
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
syntax_tree-array_brackets (0.1.0)
|
5
|
+
syntax_tree (>= 2.0.1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.2)
|
11
|
+
diff-lcs (1.5.0)
|
12
|
+
json (2.6.3)
|
13
|
+
parallel (1.23.0)
|
14
|
+
parser (3.2.2.1)
|
15
|
+
ast (~> 2.4.1)
|
16
|
+
prettier_print (1.2.1)
|
17
|
+
rainbow (3.1.1)
|
18
|
+
rake (13.0.6)
|
19
|
+
regexp_parser (2.8.0)
|
20
|
+
rexml (3.2.5)
|
21
|
+
rspec (3.12.0)
|
22
|
+
rspec-core (~> 3.12.0)
|
23
|
+
rspec-expectations (~> 3.12.0)
|
24
|
+
rspec-mocks (~> 3.12.0)
|
25
|
+
rspec-core (3.12.2)
|
26
|
+
rspec-support (~> 3.12.0)
|
27
|
+
rspec-expectations (3.12.3)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.12.0)
|
30
|
+
rspec-mocks (3.12.5)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.12.0)
|
33
|
+
rspec-support (3.12.0)
|
34
|
+
rubocop (1.51.0)
|
35
|
+
json (~> 2.3)
|
36
|
+
parallel (~> 1.10)
|
37
|
+
parser (>= 3.2.0.0)
|
38
|
+
rainbow (>= 2.2.2, < 4.0)
|
39
|
+
regexp_parser (>= 1.8, < 3.0)
|
40
|
+
rexml (>= 3.2.5, < 4.0)
|
41
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
42
|
+
ruby-progressbar (~> 1.7)
|
43
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
44
|
+
rubocop-ast (1.28.1)
|
45
|
+
parser (>= 3.2.1.0)
|
46
|
+
ruby-progressbar (1.13.0)
|
47
|
+
syntax_tree (6.1.1)
|
48
|
+
prettier_print (>= 1.2.0)
|
49
|
+
unicode-display_width (2.4.2)
|
50
|
+
|
51
|
+
PLATFORMS
|
52
|
+
arm64-darwin-21
|
53
|
+
|
54
|
+
DEPENDENCIES
|
55
|
+
rake (~> 13.0)
|
56
|
+
rspec (~> 3.0)
|
57
|
+
rubocop (~> 1.21)
|
58
|
+
syntax_tree-array_brackets!
|
59
|
+
|
60
|
+
BUNDLED WITH
|
61
|
+
2.4.10
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# SyntaxTree::ArrayBrackets
|
2
|
+
|
3
|
+
A plugin for force syntax_tree to using bracket array.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Install the gem and add to the application's Gemfile by executing:
|
8
|
+
|
9
|
+
$ bundle add syntax_tree-array_brackets
|
10
|
+
|
11
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
12
|
+
|
13
|
+
$ gem install syntax_tree-array_brackets
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
### CLI
|
18
|
+
|
19
|
+
Pass a plugin option to syntax_tree cli:
|
20
|
+
|
21
|
+
```
|
22
|
+
--plugin=array_brackets
|
23
|
+
```
|
24
|
+
|
25
|
+
### Library
|
26
|
+
|
27
|
+
Add `require` to your code:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
require "syntax_tree/array_brackets"
|
31
|
+
```
|
32
|
+
|
33
|
+
## Development
|
34
|
+
|
35
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
36
|
+
|
37
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
Bug reports and pull requests are welcome on GitHub at [https://github.com/nobuyo/syntax_tree-array_brackets](https://github.com/nobuyo/syntax_tree-array_brackets).
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
require "rubocop/rake_task"
|
6
|
+
require "syntax_tree/rake_tasks"
|
7
|
+
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
9
|
+
RuboCop::RakeTask.new
|
10
|
+
SyntaxTree::Rake::CheckTask.new()
|
11
|
+
|
12
|
+
task default: [:spec, :rubocop, :"stree:check"]
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module SyntaxTree
|
4
|
+
class ArrayLiteral
|
5
|
+
def format(q)
|
6
|
+
lbracket = self.lbracket
|
7
|
+
contents = self.contents
|
8
|
+
|
9
|
+
# deleted formatting bracket array to percent array
|
10
|
+
|
11
|
+
if empty_with_comments?
|
12
|
+
EmptyWithCommentsFormatter.new(lbracket).format(q)
|
13
|
+
return
|
14
|
+
end
|
15
|
+
|
16
|
+
q.group do
|
17
|
+
q.format(lbracket)
|
18
|
+
|
19
|
+
if contents
|
20
|
+
q.indent do
|
21
|
+
q.breakable_empty
|
22
|
+
q.format(contents)
|
23
|
+
q.if_break { q.text(",") } if q.trailing_comma?
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
q.breakable_empty
|
28
|
+
q.text("]")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
class QWords
|
34
|
+
def format(q)
|
35
|
+
opening, closing = "[", "]"
|
36
|
+
|
37
|
+
q.group do
|
38
|
+
q.text(opening)
|
39
|
+
|
40
|
+
loc = elements.first.location.to(elements.last.location)
|
41
|
+
str_contents =
|
42
|
+
elements.map do |element|
|
43
|
+
StringContent.new(parts: [element], location: nil)
|
44
|
+
end
|
45
|
+
contents = Args.new(parts: str_contents, location: loc)
|
46
|
+
|
47
|
+
q.indent do
|
48
|
+
q.breakable_empty
|
49
|
+
q.format(contents)
|
50
|
+
q.if_break { q.text(",") } if q.trailing_comma?
|
51
|
+
end
|
52
|
+
|
53
|
+
q.breakable_empty
|
54
|
+
q.text(closing)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class QSymbols
|
60
|
+
def format(q)
|
61
|
+
opening, closing = "[", "]"
|
62
|
+
|
63
|
+
q.group do
|
64
|
+
q.text(opening)
|
65
|
+
|
66
|
+
loc = elements.first.location.to(elements.last.location)
|
67
|
+
str_contents =
|
68
|
+
elements.map do |element|
|
69
|
+
SymbolLiteral.new(value: element, location: nil)
|
70
|
+
end
|
71
|
+
contents = Args.new(parts: str_contents, location: loc)
|
72
|
+
|
73
|
+
q.indent do
|
74
|
+
q.breakable_empty
|
75
|
+
q.format(contents)
|
76
|
+
q.if_break { q.text(",") } if q.trailing_comma?
|
77
|
+
end
|
78
|
+
|
79
|
+
q.breakable_empty
|
80
|
+
q.text(closing)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: syntax_tree-array_brackets
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nobuo Takizawa
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-05-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: syntax_tree
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.1
|
27
|
+
description:
|
28
|
+
email:
|
29
|
+
- longzechangsheng@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".rspec"
|
35
|
+
- ".rubocop.yml"
|
36
|
+
- ".streerc"
|
37
|
+
- ".vscode/settings.json"
|
38
|
+
- CHANGELOG.md
|
39
|
+
- Gemfile
|
40
|
+
- Gemfile.lock
|
41
|
+
- README.md
|
42
|
+
- Rakefile
|
43
|
+
- lib/syntax_tree/array_brackets.rb
|
44
|
+
- lib/syntax_tree/array_brackets/version.rb
|
45
|
+
- lib/syntax_tree/node.rb
|
46
|
+
homepage: https://github.com/nobuyo/syntax_tree-array_brackets
|
47
|
+
licenses:
|
48
|
+
- MIT
|
49
|
+
metadata:
|
50
|
+
rubygems_mfa_required: 'true'
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 2.7.0
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.4.10
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: A syntax_tree plugin for force syntax_tree to using bracket array
|
70
|
+
test_files: []
|