Sha256: 46fad318e375053a667eb7b87e64ff66ed391438b1278fb568eb11dfbd830106

Contents?: true

Size: 1.45 KB

Versions: 3

Compression:

Stored size: 1.45 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require_relative '../providers/console'
require_relative '../providers/datadog'

require_relative '../engines/eslint/extractor'
require_relative '../engines/debug/extractor'
require_relative '../engines/git/extractor'
require_relative '../engines/npm/extractor'
require_relative '../engines/packwerk/extractor'
require_relative '../engines/rubocop/extractor'
require_relative '../engines/semgrep/extractor'
require_relative '../engines/sorbet/extractor'

PROVIDERS = {
  console: Providers::Console,
  datadog: Providers::Datadog
}.freeze

EXTRACTORS = {
  eslint: Engines::Eslint::Extractor,
  debug: Engines::Debug::Extractor,
  git: Engines::Git::Extractor,
  npm: Engines::Npm::Extractor,
  packwerk: Engines::Packwerk::Extractor,
  rubocop: Engines::Rubocop::Extractor,
  semgrep: Engines::Semgrep::Extractor,
  sorbet: Engines::Sorbet::Extractor
}.freeze

config_provider = ENV['CODEMONITOR_PROVIDER'] || 'console'
config_extractors = ENV['CODEMONITOR_EXTRACTORS']

provider = PROVIDERS[config_provider.to_sym].new
extractors = if config_extractors
               EXTRACTORS.slice(*config_extractors.split(',').map(&:to_sym)).values
             else
               EXTRACTORS.values
             end

puts '# process start'

# Run all the extractors and collect the data
extractors
  .map(&:new)
  .map do |extractor|
    extractor.call(provider)
  end

# Send all the data to the provider
provider.send

puts '# process end'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
codemonitor-0.3.3 exe/codemonitor
codemonitor-0.3.2 exe/codemonitor
codemonitor-0.3.1 exe/codemonitor