github / github/vscode-github-actions

Do not warn about missing values if a fallback is provided

Aberta
#76 2 comentários 2 reações 0 responsáveis Ver no GitHub
enhancement
Linguagem predominante
TypeScript
Estrelas
660
Forks
213
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

**Is your feature request related to a problem? Please describe.**
I want to allow many values to be overridden using `vars` but still provide defaults/fallback values when the var is not set. This is possible with the "or" operator:

```
${{vars.optional_config || 'default value'}}
```

However, this currently generates a warning "Context access might be invalid: optional_config"

**Describe the solution you'd like**
The static analyser should detect that the `||` operator provides a default and not generate a warning.

Alternatively, provide a function (e.g. `val_or_default(vars.optional_config, 'default value')`) to make the user's intention explicit to the linter.

Guia de contribuição

Abrir o guia de contribuição

Direção de pesquisa

Start by locating the static analyser that reports “Context access might be invalid” and reproduce the issue with the provided `vars.optional_config || 'default value'` expression. The work is done when an expression with an `||` fallback no longer produces a missing-value warning, while the existing warning behavior remains for unguarded access.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
typescript, vscode
Domínio
devtools
Tipo de issue
Funcionalidade
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
45/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.