Skip to content

Commit

Permalink
Update 0276-problem-matchers.md (actions#1105)
Browse files Browse the repository at this point in the history
* Update 0276-problem-matchers.md

Update to reflect current behavior

* Update docs/adrs/0276-problem-matchers.md

Co-authored-by: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com>
  • Loading branch information
jsoref and fhammerl authored Jan 21, 2022
1 parent ea67ff9 commit c95d5ea
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions docs/adrs/0276-problem-matchers.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,31 @@ Compilation failures during a CI build should surface good error messages.

For example, the actual compile errors from the typescript compiler should bubble as issues in the UI. And not simply "tsc exited with exit code 1".

VSCode has an extensible model for solving this type of problem. VSCode allows users to configure which problems matchers to use, when scanning output. For example, a user can apply the `tsc` problem matcher to receive a rich error output experience in VSCode, when compiling their typescript project.
VSCode has an extensible model for solving this type of problem. VSCode allows users to configure which [problems matchers](https://code.visualstudio.com/docs/editor/tasks#_defining-a-problem-matcher) to use, when scanning output. For example, a user can apply the `tsc` problem matcher to receive a rich error output experience in VSCode, when compiling their typescript project.

The problem-matcher concept fits well with "setup" actions. For example, the `setup-nodejs` action will download node.js, add it to the PATH, and register the `tsc` problem matcher. For the duration of the job, the `tsc` problem matcher will be applied against the output.

## Decision

### Registration

#### Using `##` command
#### Using `::` command

`##[add-matcher]path-to-problem-matcher-config.json`
`::add-matcher::path-to-problem-matcher-config.json`

Using a `##` command allows for flexibility:
Using a `::` command allows for flexibility:
- Ad hoc scripts can register problem matchers
- Allows problem matchers to be conditionally registered

Note, if a matcher with the same name is registered a second time, it will clobber the first instance.

#### Unregister using `##` command
Note, at some point the syntax changed from `##` to `::`.

#### Unregister using `::` command

A way out for rare cases where scoping is a problem.

`##[remove-matcher]owner`
`::remove-matcher::owner`

For this to be usable, the `owner` needs to be discoverable. Therefore, debug print the owner on registration.

Expand Down Expand Up @@ -104,7 +106,7 @@ message: ; expected
fromPath: C:\myrepo\myproject\ConsoleApp1\ClassLibrary1\ClassLibrary1.csproj
```

Additionally the line will appear red in the web UI (prefix with `##[error]`).
Additionally the line will appear red in the web UI (prefix with `::error`).

Note, an error does not imply task failure. Exit codes communicate failure.

Expand Down

0 comments on commit c95d5ea

Please sign in to comment.