Skip to content

Commit 6f5c7bf

Browse files
authored
Apply and enforce file-level license headers (#869)
* Apply and enforce file-level license headers Use `mattermost-govet` and `eslint`'s `header/header` to ensure each file begins with the appropriate header, then fix all instances. ``` // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. ``` Note that this renames `LICENSE` to `LICENSE.txt` purely to align on the copyright messaging across repos. * align plugin-ci with go.mod version * switch to 2018 * bundle LICENSE.txt and NOTICE.txt if they exist * updated NOTICE.txt and configuration
1 parent b353bf9 commit 6f5c7bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+17183
-24369
lines changed

.config/notice-file/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Notice.txt File Configuration
2+
3+
We are automatically generating Notice.txt by using first-level dependencies of the project. The related pipeline uses `config.yaml` stored in this folder.
4+
5+
6+
## Configuration
7+
8+
Sample:
9+
10+
```
11+
title: "Mattermost Playbooks"
12+
copyright: "©2015-present Mattermost, Inc. All Rights Reserved. See LICENSE for license information."
13+
description: "This document includes a list of open source components used in Mattermost Playbooks, including those that have been modified."
14+
search:
15+
- "go.mod"
16+
- "client/go.mod"
17+
dependencies: []
18+
devDependencies: []
19+
```
20+
21+
| Field | Type | Purpose |
22+
| :-- | :-- | :-- |
23+
| title | string | Field content will be used as a title of the application. See first line of `NOTICE.txt` file. |
24+
| copyright | string | Field content will be used as a copyright message. See second line of `NOTICE.txt` file. |
25+
| description | string | Field content will be used as notice file description. See third line of `NOTICE.txt` file. |
26+
| dependencies | array | If any dependency name mentioned, it will be automatically added even if it is not a first-level dependency. |
27+
| devDependencies | array | If any dependency name mentioned, it will be added when it is referenced in devDependency section. |
28+
| search | array | Pipeline will search for package.json/go.mod files mentioned here. Globstar format is supported ie. `x/**/go.mod`. |

.config/notice-file/config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: "Mattermost GitHub Plugin"
3+
copyright: "©2018-present Mattermost, Inc. All Rights Reserved. See LICENSE.txt for license information."
4+
description: "This document includes a list of open source components used in the plugin, including those that have been modified."
5+
search:
6+
- "go.mod"
7+
- "webapp/package.json"
8+
dependencies: []
9+
devDependencies: []

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ jobs:
1616
plugin-ci:
1717
uses: mattermost/actions-workflows/.github/workflows/plugin-ci.yml@main
1818
secrets: inherit
19+
with:
20+
golang-version: "1.22"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ server/plugin/manifest.go
1515

1616
# VS Code
1717
.vscode
18+
19+
# notice
20+
.notice-work
File renamed without changes.

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ install-go-tools:
160160
@echo Installing go tools
161161
$(GO) install github.com/golangci/golangci-lint/cmd/[email protected]
162162
$(GO) install gotest.tools/[email protected]
163+
$(GO) install github.com/mattermost/mattermost-govet/v2@3f08281c344327ac09364f196b15f9a81c7eff08
163164

164165
## Runs eslint and golangci-lint
165166
.PHONY: check-style
@@ -178,6 +179,7 @@ ifneq ($(HAS_SERVER),)
178179
@echo Running golangci-lint
179180
$(GO) vet ./...
180181
$(GOBIN)/golangci-lint run ./...
182+
$(GO) vet -vettool=$(GOBIN)/mattermost-govet -license -license.year=2018 ./...
181183
endif
182184

183185
## Builds the server, if it exists, for all supported architectures, unless MM_SERVICESETTINGS_ENABLEDEVELOPER is set
@@ -224,6 +226,12 @@ bundle:
224226
rm -rf dist/
225227
mkdir -p dist/$(PLUGIN_ID)
226228
./build/bin/manifest dist
229+
ifneq ($(wildcard LICENSE.txt),)
230+
cp -r LICENSE.txt dist/$(PLUGIN_ID)/
231+
endif
232+
ifneq ($(wildcard NOTICE.txt),)
233+
cp -r NOTICE.txt dist/$(PLUGIN_ID)/
234+
endif
227235
ifneq ($(wildcard $(ASSETS_DIR)/.),)
228236
cp -r $(ASSETS_DIR) dist/$(PLUGIN_ID)/
229237
endif

0 commit comments

Comments
 (0)