Comments (2)
Seems like the the code is only checking if the variable exists, not if it is also set.
Expectation is that nil or "" (empty string) would cause such a variable to fail the requires checks.
Documentation has this:
Variables set to empty zero length strings, will pass the requires check.
which is not so good. I really have to question that, both in what it means (what is an empty and zero length string), and if such behavior is even useful. The code behind variables is quite involved, so in many places you find variables being defaulted to an empty string (i.e. ""
) and other things.
Again with the documentation:
If you want to check that certain variables are set before running a task then you can use requires. This is useful when might not be clear to users which variables are needed, or if you want clear message about what is required. Also some tasks could have dangerous side effects if run with un-set variables.
which seems OK, but misses the use-cases where one task calls another with non-trivial variable passing, and included task files ... these are cases where requires
would be useful. We have it in our task files, but it only acts as documentation for us (since it does not work).
I think the required checks should be:
- Does the variable exist (in the scope of a compiled task).
- Is the variable set.
- Is the variable set to a string of length greater than 0.
In the case that 3 would not be accepted as part of the implementation, then we need a way to set a variable to nil
via the template engine (e.g a slim sprig function).
from task.
Seems like the the code is only checking if the variable exists, not if it is also set.
Expectation is that nil or "" (empty string) would cause such a variable to fail the requires checks.
from task.
Related Issues (20)
- Remote file not working HOT 3
- Taskfile not trusted by user HOT 1
- feat: add `isWSL` function to detect if Task is being ran on WSL HOT 4
- documentation: env option does not override environment settings HOT 1
- Feature Request: Allow .CHECKSUM and .TIMESTAMP variables to be used in cmds
- Add default shell setting from env varibale or in yaml please!
- Honour the global-level 'run: once' setting in an included Taskfile
- Expose VARS as environment variables
- Task "generates" not working as expected HOT 5
- Env access for sh vars HOT 1
- Changes to environment do not persist across tasks HOT 1
- Task label not reflected in logs when using output prefixed HOT 1
- Make `sources:` respect a new `.taskignore` file, similar to `.gitignore` HOT 4
- `TASKFILE_DIR` with incorrect value HOT 2
- Vars passed from the CLI don't seem to work HOT 3
- Included Taskfile watch: true not working
- Feature: matrix support HOT 5
- Task-level vars are ignored during 'requires' evaluation HOT 1
- Multi-line python commands fail with IndentationError HOT 2
- Set all envs with a given prefix
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from task.