Class: Contextizer::Analyzers::JavaScriptAnalyzer

Inherits:
Base
  • Object
show all
Defined in:
lib/contextizer/analyzers/java_script_analyzer.rb

Constant Summary collapse

LANGUAGE =
:javascript
SIGNALS =
[
  { type: :file, path: "package.json", weight: 5 },
  { type: :dir,  path: "node_modules", weight: 10 },
  { type: :file, path: "webpack.config.js", weight: 5 },
  { type: :file, path: "vite.config.js", weight: 5 }
].freeze
FRAMEWORK_SIGNALS =
{}.freeze

Instance Method Summary collapse

Methods inherited from Base

call, #initialize

Constructor Details

This class inherits a constructor from Contextizer::Analyzers::Base

Instance Method Details

#analyzeObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/contextizer/analyzers/java_script_analyzer.rb', line 17

def analyze
  SIGNALS.each { |signal| @score += signal[:weight] if check_signal(signal) }

  return nil if @score.zero?

  {
    language: LANGUAGE,
    framework: nil,
    score: @score
  }
end