referral 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -1
- data/lib/referral/matches_token_names.rb +1 -1
- data/lib/referral/sorts_tokens.rb +2 -2
- data/lib/referral/value/token.rb +25 -18
- data/lib/referral/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbc3ccfe2fc13d49b4fe81db0b450452485ff2ee6a76d05c4ab04368df20f56b
|
4
|
+
data.tar.gz: ecdfede161422d2a90f199f718d80ade1eb644c520e5929c71643272295e0728
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10da1ed6a90542750ec6f77ed4258017432f782245fc159dc30ec24c5ac139e12f43ea273260650c810338fdeb4367c6dc1a42aff397d29105935584960d7242
|
7
|
+
data.tar.gz: 0b8e3682cd38e2acad49887aaddd026c0d85bbe686e39923163b8f87f4f65a132d3ef6086411d2c7959d2eb66475b8d7256f6724c9e09cc50977be22efefecee
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -120,6 +120,8 @@ on there while you're at it:
|
|
120
120
|
|
121
121
|
<img width="1272" alt="Screen Shot 2019-06-27 at 1 27 42 PM" src="https://user-images.githubusercontent.com/79303/60287234-64560a00-98df-11e9-9fed-46c68fdaac58.png">
|
122
122
|
|
123
|
+
> It is important to note that Numbers, like earlier versions of Excel, uses an unsigned Integer for row numbering that limits the number of shown rows to ~65,000. On larger codebases, referral may create more references than this. LibreOffice and newer versions of Excel do not have this limitation on viewing.
|
124
|
+
|
123
125
|
### Recipe: detect references you forgot to update
|
124
126
|
|
125
127
|
When working in a large codebase, it can be really tough to figure out if you
|
@@ -141,7 +143,7 @@ test/lib/splits_furigana_test.rb 56 634edc04 searls@gmail.com 2017-09-04T13:34:0
|
|
141
143
|
```
|
142
144
|
|
143
145
|
[**Warning:** running `git-blame` on each file is, of course, a bit slow. Running
|
144
|
-
this command on the [KameSame](https://kamesame.com) codebase took 3 seconds of
|
146
|
+
this command on the [KameSame](https://www.kamesame.com/) codebase took 3 seconds of
|
145
147
|
wall-time, compared to 0.7 seconds by default.]
|
146
148
|
|
147
149
|
And it gets better! Since we're already running `blame`, why not sort every line
|
@@ -12,7 +12,7 @@ module Referral
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.names_from_token(token)
|
15
|
-
token.
|
15
|
+
token.full_name_tokens.reject { |t| t.name.nil? }.map { |t| t.name.to_s }
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.names_from_query(query)
|
@@ -8,9 +8,9 @@ module Referral
|
|
8
8
|
}
|
9
9
|
},
|
10
10
|
scope: ->(tokens) {
|
11
|
-
max_length = tokens.map { |t| t.
|
11
|
+
max_length = tokens.map { |t| t.scope_and_names.size }.max
|
12
12
|
tokens.sort_by { |token|
|
13
|
-
names = token.
|
13
|
+
names = token.scope_and_names.map { |fq| fq.name.to_s }
|
14
14
|
[
|
15
15
|
*names.fill("", names.size...max_length),
|
16
16
|
token.file, token.line, token.column, token.id,
|
data/lib/referral/value/token.rb
CHANGED
@@ -7,27 +7,38 @@ module Referral
|
|
7
7
|
keyword_init: true
|
8
8
|
)
|
9
9
|
|
10
|
-
def
|
10
|
+
def scope_and_names
|
11
11
|
[
|
12
|
-
*parent&.
|
13
|
-
*
|
12
|
+
*parent&.scope_and_names,
|
13
|
+
*literal_name_tokens,
|
14
14
|
].compact
|
15
15
|
end
|
16
16
|
|
17
|
-
def full_name
|
18
|
-
join_names(fully_qualified)
|
19
|
-
end
|
20
|
-
|
21
17
|
def scope
|
22
18
|
return "" unless parent
|
23
19
|
parent.full_name
|
24
20
|
end
|
25
21
|
|
22
|
+
def full_name
|
23
|
+
join_names(full_name_tokens)
|
24
|
+
end
|
25
|
+
|
26
|
+
def full_name_tokens
|
27
|
+
[
|
28
|
+
*(include_parents_in_full_name? ? parent&.scope_and_names : []),
|
29
|
+
*literal_name_tokens,
|
30
|
+
].compact
|
31
|
+
end
|
32
|
+
|
26
33
|
def literal_name
|
27
|
-
|
28
|
-
|
34
|
+
join_names(literal_name_tokens)
|
35
|
+
end
|
36
|
+
|
37
|
+
def literal_name_tokens
|
38
|
+
if identifiers && !identifiers.empty?
|
39
|
+
identifiers
|
29
40
|
else
|
30
|
-
|
41
|
+
[self]
|
31
42
|
end
|
32
43
|
end
|
33
44
|
|
@@ -45,6 +56,10 @@ module Referral
|
|
45
56
|
|
46
57
|
protected
|
47
58
|
|
59
|
+
def include_parents_in_full_name?
|
60
|
+
node_type.token_type == :definition && node_type.good_parent == true
|
61
|
+
end
|
62
|
+
|
48
63
|
def join_names(tokens)
|
49
64
|
tokens.reduce("") { |s, token|
|
50
65
|
next s unless token.name
|
@@ -55,14 +70,6 @@ module Referral
|
|
55
70
|
end
|
56
71
|
}
|
57
72
|
end
|
58
|
-
|
59
|
-
def identity_components
|
60
|
-
if identifiers && !identifiers.empty?
|
61
|
-
identifiers
|
62
|
-
else
|
63
|
-
[self]
|
64
|
-
end
|
65
|
-
end
|
66
73
|
end
|
67
74
|
end
|
68
75
|
end
|
data/lib/referral/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: referral
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Searls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|