parse_packwerk 0.19.3 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b486557a328142805a1438ec1ab80fb90a1b3b4a4e12cf73b1cc7ffb3428956a
4
- data.tar.gz: 63c9abe25dd4c3e5073142dd61f54f89cd4b870b36ff8743d4e1b00ea501e36d
3
+ metadata.gz: 54e72896efeae11785e34d5c4445255a7418499095d6f8f10443047437e49ad4
4
+ data.tar.gz: e722da109f4ef007f2b017d2fdbc4aba4cc6b09d94d8efb031cb7f4f7a1dae40
5
5
  SHA512:
6
- metadata.gz: b2b2c4175eacf0c19572de1c0c9f59e2eb988dc7f4109bc755626543f0a1248cb495a528c1bfae6a40c8df6e243fef69546784053b85506850528dc8c1f498b5
7
- data.tar.gz: '0608bf404eaa66deb3193662fee01a461bbea0fe6f74b03698ae689a14bd868d156beb95c67a6d075356cbee9e2e8ac4251ca59cad6281985d910f52995397e6'
6
+ metadata.gz: 993a09365ac56439efba8c66c0892275a184969be156e9b33cd7e8d218ab00222f55f7488d888348bb73805b91b7b3a223d46e58236695c567628a175fbe4508
7
+ data.tar.gz: 7d7b919458f16a8c53038405a3e777552a92e1660a23312a288d4b0653ba59648314fd861be63b4c27f89b50975cb4bf24756538e40cadfbe803e5160c72f5d2
@@ -7,6 +7,7 @@ module ParsePackwerk
7
7
  const :exclude, T::Array[String]
8
8
  const :package_paths, T::Array[String]
9
9
  const :requires, T::Array[String]
10
+ const :raw, T::Hash[String, T.untyped]
10
11
 
11
12
  sig { returns(Configuration) }
12
13
  def self.fetch
@@ -22,7 +23,8 @@ module ParsePackwerk
22
23
  Configuration.new(
23
24
  exclude: excludes(raw_packwerk_config),
24
25
  package_paths: package_paths(raw_packwerk_config),
25
- requires: raw_packwerk_config['require'] || []
26
+ requires: raw_packwerk_config['require'] || [],
27
+ raw: raw_packwerk_config
26
28
  )
27
29
  end
28
30
 
@@ -11,6 +11,7 @@ module ParsePackwerk
11
11
  const :metadata, MetadataYmlType
12
12
  const :dependencies, T::Array[String]
13
13
  const :config, T::Hash[T.untyped, T.untyped]
14
+ const :violations, T.nilable(T::Array[Violation])
14
15
 
15
16
  sig { params(pathname: Pathname).returns(Package) }
16
17
  def self.from(pathname)
@@ -29,9 +30,15 @@ module ParsePackwerk
29
30
  metadata: package_loaded_yml[METADATA] || {},
30
31
  dependencies: package_loaded_yml[DEPENDENCIES] || [],
31
32
  config: package_loaded_yml,
33
+ violations: PackageTodo.from(PackageTodo.yml(directory(package_name))).violations
32
34
  )
33
35
  end
34
36
 
37
+ sig { params(package_name: String).returns(::Pathname) }
38
+ def self.directory(package_name)
39
+ Pathname.new(package_name).cleanpath
40
+ end
41
+
35
42
  sig { returns(Pathname) }
36
43
  def yml
37
44
  Pathname.new(name).join(PACKAGE_YML_NAME).cleanpath
@@ -39,7 +46,7 @@ module ParsePackwerk
39
46
 
40
47
  sig { returns(Pathname) }
41
48
  def directory
42
- Pathname.new(name).cleanpath
49
+ self.class.directory(self.name)
43
50
  end
44
51
 
45
52
  sig { returns(Pathname) }
@@ -56,10 +63,5 @@ module ParsePackwerk
56
63
  def enforces_privacy?
57
64
  enforce_privacy
58
65
  end
59
-
60
- sig { returns(T::Array[Violation]) }
61
- def violations
62
- PackageTodo.for(self).violations
63
- end
64
66
  end
65
67
  end
@@ -9,8 +9,7 @@ module ParsePackwerk
9
9
 
10
10
  sig { params(package: Package).returns(PackageTodo) }
11
11
  def self.for(package)
12
- package_todo_yml_pathname = package.directory.join(PACKAGE_TODO_YML_NAME)
13
- PackageTodo.from(package_todo_yml_pathname)
12
+ PackageTodo.from(self.yml(package.directory))
14
13
  end
15
14
 
16
15
  sig { params(pathname: Pathname).returns(PackageTodo) }
@@ -42,5 +41,10 @@ module ParsePackwerk
42
41
  )
43
42
  end
44
43
  end
44
+
45
+ sig { params(dirname: Pathname).returns(Pathname) }
46
+ def self.yml(dirname)
47
+ dirname.join(PACKAGE_TODO_YML_NAME).cleanpath
48
+ end
45
49
  end
46
50
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parse_packwerk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.3
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-17 00:00:00.000000000 Z
11
+ date: 2023-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime
@@ -30,14 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.2.16
33
+ version: '2.2'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.2.16
40
+ version: '2.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement