Class: Homebrew::TapAuditor Private

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
brew/Library/Homebrew/tap_auditor.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Auditor for checking common violations in Taps.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tap, strict:) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • tap (Tap)
  • strict (Boolean, nil)


14
15
16
17
18
19
20
# File 'brew/Library/Homebrew/tap_auditor.rb', line 14

def initialize(tap, strict:)
  @name                      = tap.name
  @path                      = tap.path
  @tap_audit_exceptions      = tap.audit_exceptions
  @tap_pypi_formula_mappings = tap.pypi_formula_mappings
  @problems                  = []
end

Instance Attribute Details

#nameObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
# File 'brew/Library/Homebrew/tap_auditor.rb', line 11

def name
  @name
end

#pathObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
# File 'brew/Library/Homebrew/tap_auditor.rb', line 11

def path
  @path
end

#problemsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
# File 'brew/Library/Homebrew/tap_auditor.rb', line 11

def problems
  @problems
end

#tap_audit_exceptionsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
# File 'brew/Library/Homebrew/tap_auditor.rb', line 11

def tap_audit_exceptions
  @tap_audit_exceptions
end

#tap_pypi_formula_mappingsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



11
12
13
# File 'brew/Library/Homebrew/tap_auditor.rb', line 11

def tap_pypi_formula_mappings
  @tap_pypi_formula_mappings
end

Instance Method Details

#auditvoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.



23
24
25
26
# File 'brew/Library/Homebrew/tap_auditor.rb', line 23

def audit
  audit_json_files
  audit_tap_formula_lists
end

#audit_json_filesvoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.



29
30
31
32
33
34
35
36
# File 'brew/Library/Homebrew/tap_auditor.rb', line 29

def audit_json_files
  json_patterns = Tap::HOMEBREW_TAP_JSON_FILES.map { |pattern| @path/pattern }
  Pathname.glob(json_patterns).each do |file|
    JSON.parse file.read
  rescue JSON::ParserError
    problem "#{file.to_s.delete_prefix("#{@path}/")} contains invalid JSON"
  end
end

#audit_tap_formula_listsvoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.



39
40
41
42
# File 'brew/Library/Homebrew/tap_auditor.rb', line 39

def audit_tap_formula_lists
  check_formula_list_directory "audit_exceptions", @tap_audit_exceptions
  check_formula_list "pypi_formula_mappings", @tap_pypi_formula_mappings
end

#problem(message) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:



45
46
47
# File 'brew/Library/Homebrew/tap_auditor.rb', line 45

def problem(message)
  @problems << ({ message: message, location: nil })
end