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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e9c718aeaa911a43d9f908ff6627f237b4d060d24c70ffe5266f997acc13e6d
4
- data.tar.gz: 0e37e4bc4ea3b095ba44ba3a89398940e56e7672302ce1ee7b856a1312f59b63
3
+ metadata.gz: bbc3ccfe2fc13d49b4fe81db0b450452485ff2ee6a76d05c4ab04368df20f56b
4
+ data.tar.gz: ecdfede161422d2a90f199f718d80ade1eb644c520e5929c71643272295e0728
5
5
  SHA512:
6
- metadata.gz: a5eeb557ef3127b448d868a292f0eca478c66c918d77abace17c0141a75795816a9ea3acc86db29ca82a6199cdc2cd86bc0cf1ddbcca088a4ed5c62b4d91f534
7
- data.tar.gz: 011312e247b8aeca7acfe0a200c1c14e8eb799daac38d645ec30bef5a39659bd26e0760320fd82db64c6a35d8ded79dfc0f2e944a80f267745bd68a94236846e
6
+ metadata.gz: 10da1ed6a90542750ec6f77ed4258017432f782245fc159dc30ec24c5ac139e12f43ea273260650c810338fdeb4367c6dc1a42aff397d29105935584960d7242
7
+ data.tar.gz: 0b8e3682cd38e2acad49887aaddd026c0d85bbe686e39923163b8f87f4f65a132d3ef6086411d2c7959d2eb66475b8d7256f6724c9e09cc50977be22efefecee
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- referral (0.0.2)
4
+ referral (0.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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.fully_qualified.reject { |t| t.name.nil? }.map { |t| t.name.to_s }
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.fully_qualified.size }.max
11
+ max_length = tokens.map { |t| t.scope_and_names.size }.max
12
12
  tokens.sort_by { |token|
13
- names = token.fully_qualified.map { |fq| fq.name.to_s }
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,
@@ -7,27 +7,38 @@ module Referral
7
7
  keyword_init: true
8
8
  )
9
9
 
10
- def fully_qualified
10
+ def scope_and_names
11
11
  [
12
- *parent&.fully_qualified,
13
- *identity_components,
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
- if identifiers.empty?
28
- name.to_s
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
- join_names(identifiers)
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
@@ -1,3 +1,3 @@
1
1
  module Referral
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-06-28 00:00:00.000000000 Z
11
+ date: 2019-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler