Skip to content

src: promote verbosity to constructor arg#869

Merged
knative-prow-robot merged 5 commits intoknative:mainfrom
lkingland:lkingland/verbosisty-constructor-param
Mar 4, 2022
Merged

src: promote verbosity to constructor arg#869
knative-prow-robot merged 5 commits intoknative:mainfrom
lkingland:lkingland/verbosisty-constructor-param

Conversation

@lkingland
Copy link
Copy Markdown
Member

@lkingland lkingland commented Feb 28, 2022

Changes

tl;dr Probably best to use either constructor args or struct member initialization and not mix. We have chosen constructors for package public API and struct members for package internal implementations. This enforces that choice with regards to the oft-ignored verbosity flag.

  • 🧹 Moves verbosity flag to constructor arg

This rectifies a long-standing inconsistency where, early in the system's evolution all subsystems were initialized as simple structs. When we moved to using proper constructors, the Verbosity flag was left as a struct member. This is a bit confusing and awkward because it mixes constructor-based configuration with the direct setting of struct members. The former is often best for external package APIs, the latter is often best for internal. This situation straddles the line, because these packages are used by their parent package, so either way could be a defensible position.

Explicitly requiring the verbosity to be provided in the constructor is not awe-inspiring elegance, but I suppose mixing constructor-based initialization with struct members much less so. This is evidenced by how much main's default Client constructor is simplified by requiring this flag in the constructor.

/kind cleanup

@knative-prow-robot knative-prow-robot added do-not-merge/work-in-progress 🤖 PR should not merge because it is a work in progress. size/L 🤖 PR changes 100-499 lines, ignoring generated files. approved 🤖 PR has been approved by an approver from all required OWNERS files. labels Feb 28, 2022
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 28, 2022

Codecov Report

Merging #869 (7c843bb) into main (043a00d) will increase coverage by 0.14%.
The diff coverage is 11.53%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #869      +/-   ##
==========================================
+ Coverage   45.18%   45.33%   +0.14%     
==========================================
  Files          48       48              
  Lines        4818     4798      -20     
==========================================
- Hits         2177     2175       -2     
+ Misses       2342     2324      -18     
  Partials      299      299              
Impacted Files Coverage Δ
cmd/client.go 18.86% <0.00%> (+2.47%) ⬆️
cmd/completion_util.go 0.00% <0.00%> (ø)
cmd/run.go 61.64% <0.00%> (+2.43%) ⬆️
docker/pusher.go 61.98% <0.00%> (-0.32%) ⬇️
knative/deployer.go 5.56% <0.00%> (-0.02%) ⬇️
knative/describer.go 0.00% <0.00%> (ø)
knative/lister.go 0.00% <0.00%> (ø)
knative/remover.go 0.00% <0.00%> (ø)
docker/runner.go 14.61% <50.00%> (ø)
cmd/root.go 73.61% <100.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 043a00d...7c843bb. Read the comment docs.

@lkingland lkingland changed the title Lkingland/verbosisty constructor param src: promote verbosity to constructor arg Feb 28, 2022
@knative-prow-robot knative-prow-robot added the needs-rebase Cannot be merged due to conflicts with HEAD. label Feb 28, 2022
@lkingland lkingland force-pushed the lkingland/verbosisty-constructor-param branch from eddb917 to 1e91e01 Compare February 28, 2022 20:59
@knative-prow-robot knative-prow-robot removed the needs-rebase Cannot be merged due to conflicts with HEAD. label Feb 28, 2022
@lkingland lkingland force-pushed the lkingland/verbosisty-constructor-param branch 2 times, most recently from 6101682 to 5645c4f Compare March 1, 2022 14:04
@knative-prow-robot knative-prow-robot added needs-rebase Cannot be merged due to conflicts with HEAD. size/XL 🤖 PR changes 500-999 lines, ignoring generated files. and removed size/L 🤖 PR changes 100-499 lines, ignoring generated files. labels Mar 1, 2022
@lkingland lkingland self-assigned this Mar 1, 2022
@knative knative deleted a comment from knative-prow-robot Mar 2, 2022
@lkingland lkingland force-pushed the lkingland/verbosisty-constructor-param branch from 5645c4f to efa4638 Compare March 2, 2022 22:48
@knative-prow-robot knative-prow-robot added size/L 🤖 PR changes 100-499 lines, ignoring generated files. and removed needs-rebase Cannot be merged due to conflicts with HEAD. size/XL 🤖 PR changes 500-999 lines, ignoring generated files. labels Mar 2, 2022
@lkingland lkingland force-pushed the lkingland/verbosisty-constructor-param branch from efa4638 to d20e537 Compare March 2, 2022 22:50
@lkingland lkingland force-pushed the lkingland/verbosisty-constructor-param branch from d20e537 to edbd4c8 Compare March 2, 2022 22:51
@lkingland lkingland marked this pull request as ready for review March 2, 2022 22:51
@knative-prow-robot knative-prow-robot removed the do-not-merge/work-in-progress 🤖 PR should not merge because it is a work in progress. label Mar 2, 2022
@matejvasek
Copy link
Copy Markdown
Contributor

/lgtm
/hold for the others

@knative-prow-robot knative-prow-robot added the do-not-merge/hold 🤖 PR should not merge because someone has issued a /hold command. label Mar 4, 2022
@knative-prow-robot knative-prow-robot added the lgtm 🤖 PR is ready to be merged. label Mar 4, 2022
Copy link
Copy Markdown
Contributor

@lance lance left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@knative-prow-robot knative-prow-robot removed the lgtm 🤖 PR is ready to be merged. label Mar 4, 2022
@matejvasek
Copy link
Copy Markdown
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm 🤖 PR is ready to be merged. label Mar 4, 2022
Copy link
Copy Markdown
Contributor

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@knative-prow-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lkingland, zroubalik

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [lkingland,zroubalik]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@zroubalik
Copy link
Copy Markdown
Contributor

/unhold

@knative-prow-robot knative-prow-robot removed the do-not-merge/hold 🤖 PR should not merge because someone has issued a /hold command. label Mar 4, 2022
@knative-prow-robot knative-prow-robot merged commit 5a122c3 into knative:main Mar 4, 2022
@lkingland lkingland deleted the lkingland/verbosisty-constructor-param branch September 20, 2022 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved 🤖 PR has been approved by an approver from all required OWNERS files. lgtm 🤖 PR is ready to be merged. size/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants