Class: VivlioStarter::CLI::SamovarCommands::LintCommand

Inherits:
VsCommand
  • Object
show all
Defined in:
lib/vivlio_starter/cli/samovar/lint_command.rb

Overview

lint コマンドの Samovar 実装

Constant Summary

Constants included from OptionTokenNormalizer

OptionTokenNormalizer::BARE_VALUE_DEFAULTS

Instance Method Summary collapse

Methods included from OptionTokenNormalizer

#initialize, prepended

Instance Method Details

#callObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/vivlio_starter/cli/samovar/lint_command.rb', line 40

def call
  return print_help if options[:help]

  # 前提条件の検証(ProjectRoot ◎ / CatalogFile ◎ / CatalogEntries ○ / ContentsDir ◎)
  guard_failure = Guards.precheck(
    Guards::ProjectRootCheck.new,
    Guards::CatalogFileCheck.new,
    Guards::RelaxedCheck.new(Guards::CatalogEntriesCheck.new),
    Guards::ContentsDirCheck.new
  )
  return guard_failure if guard_failure

  targets = files || []
  LintCommands.execute_lint(targets, build_options)
rescue SystemExit => e
  e.status
rescue StandardError => e
  Common.log_error("lint 実行中にエラー: #{e.message}")
  Common.log_error(e.backtrace.first(5).join("\n")) if ENV['VERBOSE']
  1
end