Skip to content

Improve print order of state variables in settings module.#106

Merged
da-h merged 4 commits intoda-h:masterfrom
sbrodehl:dev-settings-print-order
Apr 12, 2022
Merged

Improve print order of state variables in settings module.#106
da-h merged 4 commits intoda-h:masterfrom
sbrodehl:dev-settings-print-order

Conversation

@sbrodehl
Copy link
Copy Markdown
Collaborator

@sbrodehl sbrodehl commented Apr 7, 2022

Improve print order of state variables in settings module

This MR sorts state variables based on their (nested) module name in case-insensitive, alphabetical order, with parameters always on top.

Description

Setup:
Use settings module to print state variables.

Problem:
Some variables were hard to find between nested modules.

Previously:
Note the ** and <--, which are variables of different modules, which are not printed as a group.

d           = ...  **
sa│Aa│a     = ...
  │  │b     = ...
  │Ab       = ...  <--
  │D        = ...  <--
  │L│a      = ...
  │ │b      = ...
  │M        = ...  <--
  │Sa│a     = ...
  │  │ba    = ...
  │  │bb│ta = ...
  │  │  │tb = ...
  │Sb       = ...  <--
  │Sca│a    = ...
  │   │b    = ...
  │Scb│a    = ...
  │   │b    = ...
  │Ta       = ...  <--
  │Tb│m     = ...
  │ │n      = ...
  │a        = ...  <--
sb          = ...  **
v           = ...  **

New Behavior:

d           = ...  **
sb          = ...  **
v           = ...  **
sa│a        = ...  <--
  │Ab       = ...  <--
  │D        = ...  <--
  │M        = ...  <--
  │Sb       = ...  <--
  │Ta       = ...  <--
sa│Aa│a     = ...
  │  │b     = ...
  │L│a      = ...
  │ │b      = ...
  │Sa│a     = ...
  │  │ba    = ...
  │  │bb│ta = ...
  │  │  │tb = ...
  │Sca│a    = ...
  │   │b    = ...
  │Scb│a    = ...
  │   │b    = ...
  │Tb│m     = ...
  │ │n      = ...

Things done in this MR

  • Create tree of state variables, sorts parameters and modules separately, and first list parameters, then sorted modules.

Check all before creating this PR:

  • Documentation adapted
  • unit tests adapted / created

Example Usage

Use the settings module to list state variables.

@sbrodehl sbrodehl requested a review from da-h April 12, 2022 11:45
@da-h
Copy link
Copy Markdown
Owner

da-h commented Apr 12, 2022

Great improvement of readability of the output!

Thanks for making this project better for everyone. 👍 🚀

@da-h da-h merged commit e70f187 into da-h:master Apr 12, 2022
github-actions Bot pushed a commit that referenced this pull request Apr 12, 2022
Improve print order of state variables in settings module.
@sbrodehl sbrodehl deleted the dev-settings-print-order branch April 12, 2022 14:02
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.

2 participants