pyOpenSci / buffy

Editorial bots generator used for pyosbot
https://pyos-bot-buffy.readthedocs.io/en/latest/
MIT License
1 stars 1 forks source link

Question - initial_value responder not identifying missing values as expected #18

Open lwasser opened 7 months ago

lwasser commented 7 months ago

In the config file, i have this line: which i thought sets up an initial_Value responder

my understanding of that responder is that it will check to ensure there is a value in each of the with the following tags that is added to the responder config:

i'm curious why it's not flagging the missing values when i create an issue.

the issue looks like this:

Submitting Author: <!--author-name--> <!--end-author-name--> (<!--author-handle--> <!--end-author-handle-->)
All current maintainers: (@github_handle1, @github_handle2)
Package Name: Package name here
One-Line Description of Package: Description here 
Repository Link:  <!--target-repository--> <!--end-target-repository-->
Version submitted: <!--version-submitted--> <!--end-version-submitted--> 
lwasser commented 7 months ago

hey @xuanxu i'm still fighting with this responder.

ropensci has this

Sometimes warn_if_empty has a - before it and others it doesnt.

initial_values:
      if:
        value_matches:
          submission-type: "Standard|Estándar|Stats"
      values:
        # Below there is a list of items under author1 and each has a -
        - author1:
          - heading: Submitting Author
          - warn_if_empty: true
        - reviewers-list
        - repourl:
          - heading: Repository
          - warn_if_empty: true
         # Here there is a heading element and then warn_if_empty with no - before it. 
        - submission-type:
          - heading: Submission Type
            warn_if_empty: true
        - editor
        - language:
          - heading: Language Code
            warn_if_empty: true

for us it's not working at all . i tried adding warn_if_empty as the docs suggest that defaults to false. i've gone ahead and removed the - before warn_if_empty but again rOpenSci seems to use both approaches (see above).

    initial_values:
      values:
        - version-submitted
          warn_if_empty: true
        - target-repository
          warn_if_empty: true
        - author-handle
          warn_if_empty: true
    repo_checks:
      checks:
        - repo summary
        - languages

I also don't understand what heading does in this responder. i will update the docs once i understand how this should work and be configured. many thanks!

xuanxu commented 7 months ago

In your example the value names are missing a : at the end so it is not being parsed as a hash/dictionary, this should work:

initial_values:
  values:
    - version-submitted:
      - warn_if_empty: true
    - target-repository:
      - warn_if_empty: true
    - author-handle:
      - warn_if_empty: true

As for the ropensci code, I guess the case where they are missing the -is not working, but I'd have to check the code, maybe there's a failsafe for that case.

xuanxu commented 7 months ago

About the heading: it is used to configure the visible text to use if a value is missing and has to be created. An example, this:

initital_values:
  values:
    - author-handle
      - heading: Your Github Username 

Will add this:

Your Github Username: <!--author-handle--><!--end-author-handle-->

if you don't set the heading, the name of the value will be used:

Author handle: <!--author-handle--><!--end-author-handle-->
lwasser commented 7 months ago

ok this makes sense. @xuanxu i suspect if i understood the syntax rules i'd ask you less questions 😆

So below you have provided me with this:

initial_values:
  values:
    - version-submitted:
      - warn_if_empty: true
    - target-repository:
      - warn_if_empty: true
    - author-handle:
      - warn_if_empty: true

how do i know when i need a - for an element. when i see a dash i think i'm creating a "list" or i think an "array" in this yaml? format?

so is the rule for the above that for the version-submitted key (in the hidden html comment), if i want to define settings for that key, i'd always need a : after the key like this:

  values:
    - version-submitted:
      - warn_if_empty: true

Is it true that - that colon : tells ruby that there are values to follow associated with that key value?

Next question: do i always need the -?

example - is this valid:

  values:
    - version-submitted:
       warn_if_empty: true

Many thanks. i'm going to test this out now

lwasser commented 7 months ago

ok it seems like that - is actually required. but i'd still love to understand the syntax rules around how each responder is configured.

it just reponded about missing values correctly here! yay!