Module: JRuby::Lint::Checkers::CheckGemNode
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.add_wiki_link_finding(collector) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/jruby/lint/checkers/gem.rb', line 4 def self.add_wiki_link_finding(collector) unless @added_wiki_link collector.findings << Finding.new("For more on gem compatibility see http://wiki.jruby.org/C-Extension-Alternatives", [:gems, :info]).tap do |f| def f.to_s end end @added_wiki_link = true end end |
Instance Method Details
#check_gem(collector, call_node) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/jruby/lint/checkers/gem.rb', line 25 def check_gem(collector, call_node) @gems ||= collector.project.libraries.gems gem_name = gem_name(call_node) if instructions = @gems[gem_name] CheckGemNode.add_wiki_link_finding(collector) msg = "Found gem '#{gem_name}' which is reported to have some issues:\n#{instructions}" collector.findings << Finding.new(msg, [:gems, :warning], call_node.position) end end |
#gem_name(node) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/jruby/lint/checkers/gem.rb', line 16 def gem_name(node) first_arg = node.args_node.child_nodes[0] if first_arg.node_type.to_s == "STRNODE" first_arg.value.to_s end rescue nil end |