We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c81e537 commit d848688Copy full SHA for d848688
1 file changed
lib/problematic_variable_finder/problem.rb
@@ -0,0 +1,42 @@
1
+module ProblematicVariableFinder
2
+ class Problem
3
+ attr_accessor \
4
+ :gem_name,
5
+ :gem_version,
6
+ :file_name,
7
+ :line_number,
8
+ :out_of_date,
9
+ :type,
10
+ :code
11
+
12
+ def initialize(**attrs)
13
+ attrs.each do |key, value|
14
+ send("#{key}=", value)
15
+ end
16
17
18
+ def github_link
19
+ @github_link ||=
20
+ begin
21
+ if source_code_uri
22
+ "#{source_code_uri}/#{file_name}:#{line_number}"
23
+ else
24
+ "#{gem_name} #{file_name}:#{line_number}"
25
26
27
28
29
+ def source_code_uri
30
+ gem_spec&.metadata['source_code_uri']
31
32
33
34
+ def gem_spec
35
+ return nil if gem_name.nil?
36
37
+ @gem_spec ||= Gem::Specification.find_all_by_name(gem_name).find do |s|
38
+ s.version.to_s == gem_version
39
40
41
42
+end
0 commit comments