gruntjs / gruntjs/grunt

Should tasks with errors warn or fail?

Open
#1,163 12 comments 0 reactions 0 assignees View on GitHub
needs discussion
Dominant language
JavaScript
Stars
12.2k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

We've seen this issue pop up a bunch of times in the contrib plugins. Some people want a failing task to warn, so that following tasks continue to run. Other people want a failing task to error, so that following tasks don't run.

Currently, the only way to allow the user control over this is to have failing fail, causing any following tasks to not run, which can then be overridden globally with the `--force` CLI option. **Is this how we're currently handling this in contrib?**

This seems to be the ideal behavior:
1. A task should fail on anything that prevents it from accomplishing its primary task.
2. A task should warn on anything that doesn't prevent it from accomplishing its primary task.
3. By default, a failing task prevents any further tasks from being run.
4. A flag should be able to be set in each location the user might specify the task that signifies that it should be exempt from rule 3.

Examples:
- A linting plugin should fail if there are linting errors. Anything else "bad" is a warning.
- A compiling plugin should fail if it can't actually compile files (due to a syntax error or file permission error). Anything else "bad" is a warning.
- A file copying plugin should fail if it can't actually copy files. Anything else "bad" is a warning.

I'd like to discuss these two questions:
1. How can we settle this once-and-for-all and improve grunt-contrib plugins RIGHT NOW?
2. How should this problem be solved in the future?

Contributor guide

Open the contributing guide

Research direction

Start by reviewing how contrib plugins currently handle task failures and how the --force CLI option changes task execution. Compare the linting, compiling, and file-copying examples, then identify the locations where a per-task exemption could be specified. Done requires an agreed behavior and an actionable implementation scope, not just discussion.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.