Skip to content

Commit

Permalink
Allow violations to be set on a package
Browse files Browse the repository at this point in the history
  • Loading branch information
shageman committed Aug 16, 2023
1 parent df5013d commit 7ec80c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/parse_packwerk/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Package < T::Struct
const :metadata, MetadataYmlType
const :dependencies, T::Array[String]
const :config, T::Hash[T.untyped, T.untyped]
const :stored_violations, T.nilable(T::Array[Violation])

sig { params(pathname: Pathname).returns(Package) }
def self.from(pathname)
Expand All @@ -29,6 +30,7 @@ def self.from(pathname)
metadata: package_loaded_yml[METADATA] || {},
dependencies: package_loaded_yml[DEPENDENCIES] || [],
config: package_loaded_yml,
stored_violations: nil
)
end

Expand Down Expand Up @@ -59,7 +61,7 @@ def enforces_privacy?

sig { returns(T::Array[Violation]) }
def violations
PackageTodo.for(self).violations
stored_violations || PackageTodo.for(self).violations
end
end
end

0 comments on commit 7ec80c6

Please sign in to comment.