dotnet / dotnet/msbuild

[BuildCheck Suggestion]: Flag usage of the Warning or Error Tasks without an associated Code

Open
#10,474 0 comments 0 reactions 0 assignees View on GitHub
Area: BuildCheck BuildCheck Suggestion Priority:2 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

### Summary

When Warning or Error is used without Code, users lose the ability to manage the severity of the Warning or Error. This can lead to situations with impossible-to-work-around warnings leading to an overall worse user experience.

### Background and Motivation

This bit the containers targets [here](https://github.com/dotnet/sdk/blob/71ebd47cba756870c456081848b0d525eefb1732/src/Containers/packaging/build/Microsoft.NET.Build.Containers.targets#L218-L225) - we should not have been able to write this logic and should have been forced to create a Code.

### Sample issue or antipattern that the check should be flagging

See above

### Sample output

> BC0666: Warning and Error Tasks should not be used without passing the Code parameter

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the BuildCheck implementation that analyzes Warning and Error tasks, then review the Microsoft.NET.Build.Containers.targets example linked in the issue. The work is complete when usage without a Code parameter produces BC0666, with coverage for the reported antipattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.