Skip to content

[system-command-line] some cleanup fixes - #4238

Merged
vlada-shubina merged 2 commits into
dotnet:feature/system-command-linefrom
vlada-shubina:fixes
Jan 11, 2022
Merged

[system-command-line] some cleanup fixes#4238
vlada-shubina merged 2 commits into
dotnet:feature/system-command-linefrom
vlada-shubina:fixes

Conversation

@vlada-shubina

Copy link
Copy Markdown
Member
  • removed irrelevant TODOs
  • fixed some strings that were not localized

@vlada-shubina

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

if (or.IsImplicit)
{
if (string.IsNullOrWhiteSpace(parameter.DefaultValue))
if (!string.IsNullOrWhiteSpace(parameter.DefaultValue))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Should this scenario be covered with unit test?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

When writing unit tests I discovered that this code is never used at the moment: default value is set via SetDefaultValue (otherwise it won't be shown in help). This delegate will never be called when or.IsImplicit is true. Also we never read and pass the default value except for help - it is read and parsed by Edge further on.
I'm tempted to throw an unhandled exception here instead, then the logic change will be caught by existing unit tests. We can unit test this delegate, but little sense as other scenarios are covered by bigger scope tests.

Ideally this logic is moved to Edge at some point which becomes the single source of truth for template parameter conversion using Generator.ConvertParameterValueToType method and set up default/host/default if no option value for given parameter and parsing logic just need to indicate if option was specified/specified without value/specified with value and the rest is done in Edge with proper localized error handling. Part of this work is already described in #4225. Errors with invalid default values should be blocked on validation when installing.

@vlada-shubina
vlada-shubina merged commit 78b4c7d into dotnet:feature/system-command-line Jan 11, 2022
@vlada-shubina
vlada-shubina deleted the fixes branch January 11, 2022 08:47
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.

3 participants