microsoft / microsoft/typespec

Turn StyleCop off in test projects

Open
#4,284 3 comments 0 reactions 0 assignees View on GitHub
emitter:client:csharp
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

`StyleCop` is checking if a source file has the license header.
There might be exceptions defined in it and our generated source code in `Generated` directory does not trigger the error.

But in the mean time, the customization code of one library should also be considered as part of the generated library which I think do not have to have a license header.
But styleCop requires us must have a license header for them which might be inconvenient.

how to reproduce:
1. we had license header in [this file](https://github.com/microsoft/typespec/blob/1c5d61fcfb563efd1cd14cf3bf67a0a4031905d3/packages/http-client-csharp/generator/TestProjects/Local/Unbranded-TypeSpec/src/Custom/Friend.cs#L1), remove the license header.
2. run `dotnet build .\generator\TestProjects\Local\Unbranded-TypeSpec\UnbrandedTypeSpec.sln` we would see the following `styleCop` errors:
```
C:\Users\dapzhang\Documents\workspace\typespec\packages\http-client-csharp\generator\TestProjects\Local\Unbr
anded-TypeSpec\src\Custom\Friend.cs(1,1): error SA1636: The file header copyright text should match the copy
right text from the settings. (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentatio
n/SA1636.md) [C:\Users\dapzhang\Documents\workspace\typespec\packages\http-client-csharp\generator\TestProje
cts\Local\Unbranded-TypeSpec\src\UnbrandedTypeSpec.csproj]
```

It is fine that we regard this as by design, if so, please just close this issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.