Module: ArchUnit::Extraction::ArchIgnore

Defined in:
lib/archunit/extraction/arch_ignore.rb

Overview

Reads bounded, repository-owned exclusions without evaluating project code. Only the project-root .archignore is read. Symlinks and negation are rejected.

Constant Summary collapse

MAX_BYTES =
1024 * 1024

Class Method Summary collapse

Class Method Details

.patterns(root) ⇒ Array<String>

Returns exclusion patterns using the source enumerator’s glob syntax.

Parameters:

  • root (Pathname) —

    canonical project root

Returns:

  • (Array<String>) —

    exclusion patterns using the source enumerator’s glob syntax



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/archunit/extraction/arch_ignore.rb', line 17

def patterns(root)
  path = root.join('.archignore')
  stat = configuration_stat(path)
  return [] unless stat

  validate_configuration(stat)
  parse(read_configuration(path))
rescue Errno::ELOOP
  raise UserError, '.archignore must not be a symlink'
rescue SystemCallError, IOError => e
  raise TechnicalError, "could not read .archignore: #{e.message}"
end