Skip to content

Conversation

marc-hb
Copy link
Collaborator

@marc-hb marc-hb commented Oct 14, 2025

Add typing information to the _whence() function that I found difficult to read. Other cosmetic fixes.

Add typing information to the _whence() function that I found difficult
to read. Other cosmetic fixes.

Signed-off-by: Marc Herbert <[email protected]>
@marc-hb
Copy link
Collaborator Author

marc-hb commented Oct 14, 2025

I struggled a bit while trying to review #849

cc: @thorsten-klein

@marc-hb marc-hb marked this pull request as ready for review October 14, 2025 02:38
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.52%. Comparing base (594a789) to head (fa26659).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/west/configuration.py 87.50% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #866   +/-   ##
=======================================
  Coverage   84.52%   84.52%           
=======================================
  Files          11       11           
  Lines        3366     3366           
=======================================
  Hits         2845     2845           
  Misses        521      521           
Files with missing lines Coverage Δ
src/west/configuration.py 84.91% <87.50%> (ø)

def _whence(self, configfile):
if configfile == ConfigFile.ALL:
def _whence(self, locations: ConfigFile) -> list[_InternalCF | None]:
if locations == ConfigFile.ALL:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think a large part of the readability issue is: ConfigFile is not a configuration file but an Enum. This is one way to mitigate this problem (without the massive churn of renaming the Enum)

Copy link
Contributor

Choose a reason for hiding this comment

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

The name config for a ConfigFile object is used at many more places. It is always this enum.
So I would prefer if the naming is consistent.
Would do you think about changing the variable name (and maybe also the type name) at all places?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think local variables of a given type have to be named the same across the board.

I submitted a change in this particular place because I found it especially confusing. I had a very quick look at other places and while the name configfile is still not good, they generally did not seem as confusing. So not worth the git churn IMHO. If you find some other confusing places then by all means submit another PR.

Copy link
Contributor

@mbolivar mbolivar left a comment

Choose a reason for hiding this comment

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

fine with me if it makes it more readable for you!

@pdgendt pdgendt merged commit c81a1fc into zephyrproject-rtos:main Oct 21, 2025
27 checks passed
@marc-hb marc-hb deleted the cosmetic-config branch October 21, 2025 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants