dead_code_terminator 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +3 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +0 -9
- data/Gemfile +3 -0
- data/README.md +4 -0
- data/lib/dead_code_terminator/ast.rb +3 -5
- data/lib/dead_code_terminator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0594405128f563ed209b13acac45f6d1dcfebb56c36f51bee071cab04e208ecf'
|
4
|
+
data.tar.gz: 3c16615d8ed48a12d1284908a35e580d90c008eb85ec4e7c3aa94a133fe0e775
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 215e88c2977706899fb2d312b483cd46e8d9311f1cb411f62d9cce8a3d64fce29891ebdaf02497fb9e200efc805830af06104840a9e9da0bdc825f3a2085933b
|
7
|
+
data.tar.gz: aeb91248beb05727ae810e98833a70c19df8e6b34f6641a40d477a3f71773943453cdcf8aa706387002ba04db471acdb33c15afcf234b3a93f6aadac4d845c19
|
data/.github/workflows/main.yml
CHANGED
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -23,15 +23,6 @@ Layout/TrailingWhitespace:
|
|
23
23
|
Lint/BooleanSymbol:
|
24
24
|
Enabled: false
|
25
25
|
|
26
|
-
# Metrics/AbcSize:
|
27
|
-
# Enabled: false
|
28
|
-
|
29
|
-
# Metrics/MethodLength:
|
30
|
-
# Enabled: false
|
31
|
-
|
32
26
|
Metrics/BlockLength:
|
33
27
|
Exclude:
|
34
28
|
- spec/**/*rb
|
35
|
-
|
36
|
-
# Lint/UnusedMethodArgument:
|
37
|
-
# Enabled: false
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# DeadCodeTerminator
|
2
2
|
|
3
|
+
![ci](https://github.com/razum2um/dead_code_terminator/actions/workflows/main.yml/badge.svg)
|
4
|
+
[![gem](https://badge.fury.io/rb/dead_code_terminator.svg)](https://rubygems.org/gems/dead_code_terminator)
|
5
|
+
[![codecov](https://codecov.io/gh/razum2um/dead_code_terminator/branch/master/graph/badge.svg)](https://app.codecov.io/gh/razum2um/dead_code_terminator)
|
6
|
+
|
3
7
|
This acts like [webpack's DefinePlugin](https://webpack.js.org/plugins/define-plugin/) with minification pass. It allows to eliminate dead code statically, which can be required by regulations.
|
4
8
|
|
5
9
|
```ruby
|
@@ -53,11 +53,7 @@ module DeadCodeTerminator
|
|
53
53
|
@rewriter ||= Parser::Source::TreeRewriter.new(buf)
|
54
54
|
end
|
55
55
|
|
56
|
-
def range(from, len
|
57
|
-
unless len
|
58
|
-
len = from.end - from.begin
|
59
|
-
from = from.begin
|
60
|
-
end
|
56
|
+
def range(from, len)
|
61
57
|
Parser::Source::Range.new(buf, from, from + len)
|
62
58
|
end
|
63
59
|
|
@@ -81,6 +77,8 @@ module DeadCodeTerminator
|
|
81
77
|
return else_branch if value == Cond::Base::ELSE
|
82
78
|
end
|
83
79
|
end
|
80
|
+
|
81
|
+
ast
|
84
82
|
end
|
85
83
|
end
|
86
84
|
end
|