question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authoring tools: templates & template packages validation

See original GitHub issue

As a template author, I want a way to validate the templates, so that I can validate template before the publish. Audience: template authors

Background

The template configuration requires manual editing in of JSON configuration which is source of authoring mistakes. The configuration involves a lot of conditions, which are not validated in any way until the template is being generated. When grouping the templates the configuration is manually, and requires careful combination of the fields across multiple JSON files. The grouping errors are shown only when the template is being run (not when the package containing it is installed)

Planned validation checks:

(note: though some of the issues are closed, their comments contain suggested validation check)

Justification

  • decrease the number of issues when authoring 1st party templates and detecting them post PR/even releasing them
  • improve easiness of authoring and quality of 3rd party templates; detect potential issues prior to testing
  • improve UX for final users by not allowing to install invalid templates / warning about possible issues

Technical details

We plan to expose 2 ways:

As part of this task, the validation in template engine and dotnet new should be improved as well.

  • when reading the template, the generator should ensure it has a minimum required set of information in order to proceed. The JSON parsing errors and basic errors and warnings should be exposed.
  • when installing the template, the conflicts should be detected
  • the host should be able to inject the checks for host.json file.
  • the way to present the errors should be potentially implemented in host itself

Feedback from @sayedihashimi

  • Templates shouldn’t have to be installed in order to be validated
    • More specifically be able to pass in a folder path or a path to .nupkg file
  • The tool should accept multiple values for folder path/path to .nupkg
    • For authors that have developed several templates this would be helpful
  • After running the tool it should return a non-zero exit code if the validation is not successful
    • This will enable users to script the validate step, and be able to fail the CI build if so
  • Error and warning messages should follow the MSBuild error/warning format so that errors/warnings should be auto-detected if a user executes the tool via an MSBuild file.
    • The MSBuild team may know of any formal docs.
    • MSBuild book

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sayedihashimicommented, Apr 13, 2021

How does this fit in with @sayedihashimi 's tool?

I think the idea is to have some similar validation, but it’s built into dotnet new instead of a stand alone tool.

The tool should accept multiple values for folder path/path to .nupkg

This is good, but in addition to this I think that when a folder path is specified, the tool should search the folder recursively for all templates. If a user is authoring a template pack (i.e. AWS/Uno/etc) they can pass the root folder to the validator and then it will discover all the templates that the folder contains.

1reaction
KathleenDollardcommented, Apr 13, 2021

One of the things we should validate for is the use of parens around complex conditions as discussed in #2209

Read more comments on GitHub >

github_iconTop Results From Across the Web

Verification and Validation Plan Template
Use this template to: Determine whether the products in the software development life-cycle fulfill the requirements established during the previous phase.
Read more >
Validation Templates and Software Quality SOPs Archives
The Validation Center™ library offers computer system validation SOPs and templates to expedite your implementation of a software validation program that ...
Read more >
Create a template package for dotnet new - .NET
In this part of the series you'll learn how to: Create a template package by using the Microsoft.TemplateEngine.Authoring.Templates NuGet ...
Read more >
Software development tool validation Template - CM-DM
This template doesn't cover the risk management. It is the result of process risk management to used this template to validate a software...
Read more >
Writing Templates | Backstage Software Catalog and ...
Templates are stored in the Software Catalog under a kind Template . You can create your own templates with a small yaml definition...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found