node_mutation 1.12.1 → 1.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +1 -1
- data/lib/node_mutation/action.rb +13 -4
- data/lib/node_mutation/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c09d8d3b9a1b4185382f7117d766d6220d9f9cbe4851f86af6c99e32af2ba88
|
4
|
+
data.tar.gz: e392926a8e647d85028c5d41c3890bea801f47dae425b885ff1892aaf8b396b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bb3a9d27929b69bba72947e39160163d671a7ac493d0b861057b1e08fd651e4bbcadc90f56d9b4ae8a7ee825aa1c207af7136f1b2afb11a7533b0c9898d211d
|
7
|
+
data.tar.gz: '0943c3dfd903a6b9e789cfcb7289bbe2fed18f37a1176210ceff267233383c879813b67e3ff2e915e8c179f6144afe9c5ba5fb8baf3055845a93dd2885a58fce'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# NodeMutation
|
2
2
|
|
3
|
+
## 1.12.3 (2023-03-30)
|
4
|
+
|
5
|
+
* `remove_whitespace` for both before and after whitespace
|
6
|
+
|
7
|
+
## 1.12.2 (2023-03-25)
|
8
|
+
|
9
|
+
* `remove_whitespace` handles more cases
|
10
|
+
|
3
11
|
## 1.12.1 (2023-03-23)
|
4
12
|
|
5
13
|
* Define `Action`, `Location` and `Range` in `NodeMutation::Struct`
|
data/Gemfile.lock
CHANGED
data/lib/node_mutation/action.rb
CHANGED
@@ -54,12 +54,21 @@ class NodeMutation::Action
|
|
54
54
|
end
|
55
55
|
|
56
56
|
# remove unused whitespace.
|
57
|
-
# e.g.
|
58
|
-
# the code should be changed to
|
57
|
+
# e.g. `%i[foo bar]`, if we remove `foo`, the whitespace should also be removed,
|
58
|
+
# the code should be changed to `%i[bar]`.
|
59
59
|
def remove_whitespace
|
60
|
-
|
60
|
+
if file_source[@end] == ' ' && file_source[@start - 1] == ' '
|
61
|
+
@start -= 1
|
62
|
+
@end += 1
|
63
|
+
return
|
64
|
+
end
|
65
|
+
|
66
|
+
if ["\n", ';', ')', ']', '}', '|', nil].include?(file_source[@end]) && file_source[@start - 1] == ' '
|
67
|
+
@start -= 1
|
68
|
+
return
|
69
|
+
end
|
61
70
|
|
62
|
-
|
71
|
+
if ['(', '[', '{', '|'].include?(file_source[@start - 1]) && file_source[@end] == ' '
|
63
72
|
@end += 1
|
64
73
|
end
|
65
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: node_mutation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.12.
|
4
|
+
version: 1.12.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erubis
|
@@ -83,7 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
rubygems_version: 3.4.
|
86
|
+
rubygems_version: 3.4.6
|
87
87
|
signing_key:
|
88
88
|
specification_version: 4
|
89
89
|
summary: ast node mutation apis
|