Class: Pod::Command::Repo::Lint

Inherits:
Pod::Command::Repo show all
Defined in:
lib/cocoapods/command/repo.rb

Overview

———————————————————————–#

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command::Repo

#branch_name, #branch_remote_name, #dir, #url_of_git_repo

Methods included from Executable

#executable, execute_command

Methods inherited from Pod::Command

parse, report_error, run, verify_git_version!

Methods included from Pod::Config::Mixin

#config

Constructor Details

#initialize(argv) ⇒ Lint

Returns a new instance of Lint.



105
106
107
108
109
# File 'lib/cocoapods/command/repo.rb', line 105

def initialize(argv)
  @name = argv.shift_argument
  @only_errors = argv.flag?('only-errors')
  super
end

Class Method Details

.optionsObject



101
102
103
# File 'lib/cocoapods/command/repo.rb', line 101

def self.options
  [['--only-errors', 'Lint presents only the errors']].concat(super)
end

Instance Method Details

#runObject



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/cocoapods/command/repo.rb', line 116

def run
  if @name
    dirs = File.exist?(@name) ? [Pathname.new(@name)] : [dir]
  else
    dirs = config.repos_dir.children.select(&:directory?)
  end
  dirs.each do |dir|
    SourcesManager.check_version_information(dir)
    UI.puts "\nLinting spec repo `#{dir.realpath.basename}`\n".yellow

    validator = Source::HealthReporter.new(dir)
    validator.pre_check do |_name, _version|
      UI.print '.'
    end
    report = validator.analyze
    UI.puts
    UI.puts

    report.pods_by_warning.each do |message, versions_by_name|
      UI.puts "-> #{message}".yellow
      versions_by_name.each { |name, versions| UI.puts "  - #{name} (#{versions * ', '})" }
      UI.puts
    end

    report.pods_by_error.each do |message, versions_by_name|
      UI.puts "-> #{message}".red
      versions_by_name.each { |name, versions| UI.puts "  - #{name} (#{versions * ', '})" }
      UI.puts
    end

    UI.puts "Analyzed #{report.analyzed_paths.count} podspecs files.\n\n"
    if report.pods_by_error.count.zero?
      UI.puts 'All the specs passed validation.'.green << "\n\n"
    else
      raise Informative, "#{report.pods_by_error.count} podspecs failed validation."
    end
  end
end