Skip to content

Commit 7c77e3e

Browse files
authored
[7.x] Update license headers and check with GitHub action (#5639)
* Add license header scripts and workflow * Normalize all the line endings * Update permission * Update license headers in all C# files * Fix errant spaces in C# filenames * Update add license headers
1 parent b1673cf commit 7c77e3e

File tree

3,553 files changed

+73320
-19016
lines changed

Some content is hidden

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

3,553 files changed

+73320
-19016
lines changed

.github/add-license-headers.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
script_path=$(dirname $(realpath -s $0))/../
3+
4+
function add_license () {
5+
(find "$script_path" -name $1 | grep -v "/bin/" | grep -v "/obj/" )|while read fname; do
6+
line=$(sed -n '2p;3q' "$fname")
7+
if ! [[ "$line" == " * Licensed to Elasticsearch B.V. under one or more contributor" ]] ; then
8+
cat "${script_path}.github/license-header.txt" "$fname" > "${fname}.new"
9+
mv "${fname}.new" "$fname"
10+
fi
11+
done
12+
}
13+
14+
add_license "*.cs"

.github/check-license-headers.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
3+
# Check that source code files in this repo have the appropriate license
4+
# header.
5+
6+
if [ "$TRACE" != "" ]; then
7+
export PS4='${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
8+
set -o xtrace
9+
fi
10+
set -o errexit
11+
set -o pipefail
12+
13+
TOP=$(cd "$(dirname "$0")/.." >/dev/null && pwd)
14+
NLINES=$(wc -l .github/license-header.txt | awk '{print $1}')
15+
16+
function check_license_header {
17+
local f
18+
f=$1
19+
if ! diff .github/license-header.txt <(head -$NLINES "$f") >/dev/null; then
20+
echo "check-license-headers: error: '$f' does not have required license header, see 'diff -u .github/license-header.txt <(head -$NLINES $f)'"
21+
return 1
22+
else
23+
return 0
24+
fi
25+
}
26+
27+
cd "$TOP"
28+
nErrors=0
29+
for f in $(git ls-files | grep '\.cs$'); do
30+
if ! check_license_header $f; then
31+
nErrors=$((nErrors+1))
32+
fi
33+
done
34+
35+
if [[ $nErrors -eq 0 ]]; then
36+
exit 0
37+
else
38+
exit 1
39+
fi

.github/license-header.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+

.github/workflows/license.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: License headers
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Check license headers
14+
run: |
15+
./.github/check-license-headers.sh

.gitignore

Lines changed: 94 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,94 @@
1-
*.userprefs
2-
*.local.xml
3-
*.sln.docstates
4-
*.obj
5-
*.swp
6-
*.exe
7-
*.pdb
8-
*.user
9-
*.aps
10-
*.pch
11-
*.tss
12-
*.vspscc
13-
*_i.c
14-
*_p.c
15-
*.ncb
16-
*.suo
17-
*.tlb
18-
*.tlh
19-
*.bak
20-
*.cache
21-
*.ilk
22-
*.log
23-
*.nupkg
24-
*.ncrunchsolution
25-
[Bb]in
26-
[Dd]ebug/
27-
test-results
28-
test-results/*
29-
*.lib
30-
*.sbr
31-
*.DotSettings.user
32-
obj/
33-
[Rr]elease*/
34-
!docs/release-notes
35-
_ReSharper*/
36-
_NCrunch*/
37-
[Tt]est[Rr]esult*
38-
39-
.fake/*
40-
.fake
41-
packages/*
42-
paket.exe
43-
paket-files/*.cached
44-
45-
BenchmarkDotNet.Artifacts
46-
build/*
47-
!build/tools
48-
!build/keys
49-
build/tools/*
50-
!build/tools/sn
51-
!build/tools/sn/*
52-
!build/tools/ilmerge
53-
!build/*.fsx
54-
!build/*.fsx
55-
!build/*.ps1
56-
!build/*.nuspec
57-
!build/*.png
58-
!build/*.targets
59-
!build/*.sh
60-
!build/scripts
61-
62-
.ci/output
63-
64-
65-
/dep/Newtonsoft.Json.4.0.2
66-
!docs/build
67-
docs/node_modules
68-
doc/Help
69-
70-
/src/Nest.Tests.Unit/*.ncrunchproject
71-
*.ncrunchproject
72-
Cache
73-
YamlCache
74-
tests.yaml
75-
76-
*.DS_Store
77-
*.sln.ide
78-
79-
launchSettings.json
80-
# https://github.com/elastic/elasticsearch-net/pull/1822#issuecomment-183722698
81-
*.project.lock.json
82-
project.lock.json
83-
.vs
84-
.vs/*
85-
.ionide
86-
.ionide/*
87-
88-
.idea/
89-
*.sln.iml
90-
/src/.vs/restore.dg
91-
# temporary location for doc generation
92-
docs-temp
93-
*.binlog
94-
dotnet-tool/*
1+
*.userprefs
2+
*.local.xml
3+
*.sln.docstates
4+
*.obj
5+
*.swp
6+
*.exe
7+
*.pdb
8+
*.user
9+
*.aps
10+
*.pch
11+
*.tss
12+
*.vspscc
13+
*_i.c
14+
*_p.c
15+
*.ncb
16+
*.suo
17+
*.tlb
18+
*.tlh
19+
*.bak
20+
*.cache
21+
*.ilk
22+
*.log
23+
*.nupkg
24+
*.ncrunchsolution
25+
[Bb]in
26+
[Dd]ebug/
27+
test-results
28+
test-results/*
29+
*.lib
30+
*.sbr
31+
*.DotSettings.user
32+
obj/
33+
[Rr]elease*/
34+
!docs/release-notes
35+
_ReSharper*/
36+
_NCrunch*/
37+
[Tt]est[Rr]esult*
38+
39+
.fake/*
40+
.fake
41+
packages/*
42+
paket.exe
43+
paket-files/*.cached
44+
45+
BenchmarkDotNet.Artifacts
46+
build/*
47+
!build/tools
48+
!build/keys
49+
build/tools/*
50+
!build/tools/sn
51+
!build/tools/sn/*
52+
!build/tools/ilmerge
53+
!build/*.fsx
54+
!build/*.fsx
55+
!build/*.ps1
56+
!build/*.nuspec
57+
!build/*.png
58+
!build/*.targets
59+
!build/*.sh
60+
!build/scripts
61+
62+
.ci/output
63+
64+
65+
/dep/Newtonsoft.Json.4.0.2
66+
!docs/build
67+
docs/node_modules
68+
doc/Help
69+
70+
/src/Nest.Tests.Unit/*.ncrunchproject
71+
*.ncrunchproject
72+
Cache
73+
YamlCache
74+
tests.yaml
75+
76+
*.DS_Store
77+
*.sln.ide
78+
79+
launchSettings.json
80+
# https://github.com/elastic/elasticsearch-net/pull/1822#issuecomment-183722698
81+
*.project.lock.json
82+
project.lock.json
83+
.vs
84+
.vs/*
85+
.ionide
86+
.ionide/*
87+
88+
.idea/
89+
*.sln.iml
90+
/src/.vs/restore.dg
91+
# temporary location for doc generation
92+
docs-temp
93+
*.binlog
94+
dotnet-tool/*

src/ApiGenerator/CodeTemplatePage.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1-
// Licensed to Elasticsearch B.V under one or more agreements.
2-
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3-
// See the LICENSE file in the project root for more information
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
419

520
using System;
621
using System.Threading.Tasks;

src/ApiGenerator/Configuration/CodeConfiguration.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1-
// Licensed to Elasticsearch B.V under one or more agreements.
2-
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3-
// See the LICENSE file in the project root for more information
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
419

520
using System;
621
using System.Collections.Generic;

src/ApiGenerator/Configuration/GeneratorLocations.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1-
// Licensed to Elasticsearch B.V under one or more agreements.
2-
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3-
// See the LICENSE file in the project root for more information
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
419

520
using System.IO;
621
using System.Reflection;

src/ApiGenerator/Configuration/Overrides/EndpointOverridesBase.cs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1-
// Licensed to Elasticsearch B.V under one or more agreements.
2-
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3-
// See the LICENSE file in the project root for more information
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
419

520
using System.Collections.Generic;
621
using System.Linq;

0 commit comments

Comments
 (0)