-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
triageA new issue that needs review by the core teamA new issue that needs review by the core team
Description
Overview
ParsePackwerk::Package has methods that support having top level keys for enforce_layers, enforces_privacy, metadata etc
However, it does not have similar methods for .owner. Compare:
# Works ok
pry > ParsePackwerk.all.first.enforce_layers
false
# Works ok
pry > ParsePackwerk.all.first.enforce_privacy
false
# Fails
pry > ParsePackwerk.all.first.owner
NoMethodError: undefined method 'owner' for an instance of ParsePackwerk::Package (NoMethodError)
# Works ok to build a new package with the expected changes
pry > ParsePackwerk.all.first.with(dependencies: [])
<ParsePackwerk::Package ... dependencies=[]...>
# Works ok to build a new package with the expected changes
pry> ParsePackwerk.all.first.with(enforce_dependencies: false)
<ParsePackwerk::Package ... enforce_dependencies=true ...>
# Fails
pry> ParsePackwerk.all.first.with(owner: "foo")
ArgumentError: Unexpected arguments: input({owner: "foo"}), unexpected({"owner" => "foo"}) (ArgumentError)
raise ArgumentError.new("Unexpected arguments: input(#{changed_props}), unexpected(#{difference})")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Context
Packwerk originally stored owner information in the package.yml metadata section:
enforce_dependency: true
enforce_privacy: true
metadata:
owner: Team
From discussion at rubyatscale/code_ownership#141 it seems that promoting owner to a top level key may be the preferred option:
enforce_dependency: true
enforce_privacy: true
owner: Team
While ParsePackwerk supports writing package.yml files with owner as a top level key, there's no equivalent set of methods for retrieving or updating the fields.
I'm able to work around this by directly manipulating the config hash directly with something like p=ParsePackwerk.all.first; p.config["owner"] = "foo"
Metadata
Metadata
Assignees
Labels
triageA new issue that needs review by the core teamA new issue that needs review by the core team
Type
Projects
Status
Triage