Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A path to handling ironically "strict" YAML #653

Open
bollwyvl opened this issue Oct 15, 2019 · 10 comments
Open

A path to handling ironically "strict" YAML #653

bollwyvl opened this issue Oct 15, 2019 · 10 comments

Comments

@bollwyvl
Copy link
Contributor

Over on conda-forge/yamllint-feedstock#18 I pulled out a feature of that feedstock where we used yamllint to lint its own recipe. To get there, we used this construction:

package:
  name: '{% set name = "yamllint" %}{{ name }}'
  version: '{% set version = "1.15.0" %}{{ version }}'

... but the bot couldn't find the version bump, even when upstream packages were dropping, so we were merrily building that version over and over again.

I'd like to be able to add that typographic feature: while not all conda recipes can be clean-as-the-driven-snow YAML, a lot could be, and could benefit from the tooling being able to be linted. A longer con would be adding an opt-in yamllint: true to the bot, I suppose...

@bollwyvl
Copy link
Contributor Author

(I have not xonsh'd in anger, and would appreciate a pointer to where to look in this repo to start)

@CJ-Wright
Copy link
Member

I think you need to add your string template to the regex for finding the version and

@CJ-Wright
Copy link
Member

CJ-Wright commented Oct 15, 2019

Most likely the thing that is tripping the bot up is the quotations. If you have a regex to fix that would you mind adding it to the checksum logic? That way we could address #529

@bollwyvl
Copy link
Contributor Author

bollwyvl commented Oct 15, 2019 via email

@bollwyvl
Copy link
Contributor Author

It's looking like I can't exactly have the syntax I used work for both conda-build and the bot, but my original goal of pure-YAML (is there such a thing) DRY recipes can be made to work, with the broadly supported:

package:
  name: |-
    {% set name = "yamllint" %}{{ name }}
  version: |-
    {% set version = "1.18.0" %}{{ version }}

As to the quoted shas (which are probably a good idea)... still tinkering. Might need extra patterns...

@bollwyvl
Copy link
Contributor Author

Alas, the bot swallows {{version}} above...

@wolfv
Copy link
Contributor

wolfv commented Oct 28, 2019

I agree that having the variables being expressed as yaml itself would be a nice benefit.

A syntax like this:

variables:
  version: 3.21.2
  name: my_package

would, in a way, make more sense since then recipes could simply be parsed as yaml (and edited).

One other problem is that comments might get lost (even though they have meaning in conda-build...

@bollwyvl
Copy link
Contributor Author

bollwyvl commented Oct 28, 2019 via email

@wolfv
Copy link
Contributor

wolfv commented Oct 29, 2019

Hmm I wonder if you could do

# {% set myvar = "whatevever" %}

so that it would be a yaml comment, but still set a jinja var?

@bollwyvl
Copy link
Contributor Author

bollwyvl commented Oct 29, 2019 via email

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

No branches or pull requests

3 participants