Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.x: Check for license header and add them #588

Merged
merged 3 commits into from
Jun 15, 2018

Conversation

akarnokd
Copy link
Collaborator

This PR adds an unit test that scans most *.cs files in the Rx.NET project for the existence of a license header:

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.

It creates a list of such files and by default, the header is added to those files. The logic excludes certain type of cs files such as generated ones and designer ones.

I'm not 100% certain for the file path detection part. Works for me locally, which assumes the work directory will be somewhere below Rx.NET.

@danielcweber
Copy link
Collaborator

I have seen this included into CI in other projects at a really early stage in the pipelline . Do you think that would be an option?

@akarnokd
Copy link
Collaborator Author

I don't know how to do that. In RxJava, we have a plugin that checks this but it is treated as warnings only. I haven't found one that can actually add the missing header so RxJava has this test as well which when run locally will add the headers too. There is no reason to do it on VSTS because the sources are not synced back to the repo anyway.

@danielcweber
Copy link
Collaborator

I'd really prefer a solution that works on the CI level. Maybe there's a task on the marketplace for that...

@akarnokd
Copy link
Collaborator Author

A quick search only brings up a VS extension for adding licenses manually but it doesn't verify if there is one. I can't find anything among the VSTS tasks either. This PR can fail on CI if there are missing headers as demonstrated by the first commit.

@danielcweber danielcweber merged commit 9ab92ce into dotnet:master Jun 15, 2018
@akarnokd akarnokd deleted the LicenseHeaderCheck branch June 26, 2018 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants