Skip to content

Commit

Permalink
Merge pull request #418 from Juniper/add-license-headers
Browse files Browse the repository at this point in the history
Add license headers
  • Loading branch information
chrismarget-j authored Sep 22, 2024
2 parents bd2300a + f473189 commit d13e3a6
Show file tree
Hide file tree
Showing 212 changed files with 859 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .ci/scripts/gofmt_check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/env bash

# Copyright (c) Juniper Networks, Inc., 2022-2024.
# All rights reserved.
# SPDX-License-Identifier: Apache-2.0

echo -n "Check formatting... "
require_formatting=$(gofmt -l .)

Expand Down
5 changes: 5 additions & 0 deletions .ci/scripts/gofumpt_check.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/env bash

# Copyright (c) Juniper Networks, Inc., 2024-2024.
# All rights reserved.
# SPDX-License-Identifier: Apache-2.0

set -euo pipefail

# init array of files which need updating by gofumpt
Expand Down
14 changes: 9 additions & 5 deletions .ci/scripts/license_header_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ skip_regexes+=("^Third_Party_Code/.*$")
skip_regexes+=("^\.gitignore$")
skip_regexes+=("^\.notices.tpl$")

copyright_template="Copyright \(c\) Juniper Networks, Inc\., %s-%s\."
copyright_template="Copyright \\(c\\) Juniper Networks, Inc\\., %s-%s\\."
arr_line="All rights reserved\."
spdx_line="SPDX-License-Identifier: Apache-2.0"
leading_comment="[ #/]{0,3}"
Expand All @@ -39,7 +39,7 @@ do
[ -n "$skip" ] && printf "skipping %s" "$file" && continue

# shellcheck disable=SC2059
printf "checking %s\n" "$file"
printf "checking %s... " "$file"

# determine the the the file was introduced and the year it was most recently modified
first_year=""
Expand All @@ -52,10 +52,11 @@ do
else
first_year="$line"
fi
done <<< "$(git log --follow --pretty=format:"%ad" --date=format:'%Y' "$file" | sed -n '1p;$p')"
done <<< "$((git log --follow --pretty=format:"%ad" --date=format:'%Y' "$file"; echo) | sed -n '1p;$p')"

# assume current year for both values if git log didn't find anything (new file)
[ -z "$first_year" ] && [ -z "$recent_year" ] && first_year=$(date '+%Y') && recent_year=$(date '+%Y')
[ -z "$first_year" ] && first_year=$(date '+%Y')
[ -z "$recent_year" ] && recent_year=$(date '+%Y')

# shellcheck disable=SC2059
copyright_line=$(printf "${copyright_template}" "$first_year" "$recent_year")
Expand All @@ -69,8 +70,11 @@ do
grep -Eq "${leading_comment}${arr_line}" <<< "$head" || ((failed+=2))
grep -Eq "${leading_comment}${spdx_line}" <<< "$head" || ((failed+=4))

if [ "$failed" -gt 0 ]
if [ "$failed" -eq 0 ]
then
echo "ok"
else
echo "failure reason: $failed"
problem_files+=("$file")
problem_headers+=("${copyright_line//\\/}\n${arr_line//\\/}\n${spdx_line//\\/}")
fi
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/go_tools.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright (c) Juniper Networks, Inc., 2023-2024.
# All rights reserved.
# SPDX-License-Identifier: Apache-2.0

name: Go package

on: [push]
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/license_header_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ jobs:
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: fetch main
run: |
git fetch origin main
- name: unshallow
run: |
git pull --unshallow
- name: license header check
run: |
git fetch origin main --depth 1
make fumpt-check
make license-header-check
4 changes: 4 additions & 0 deletions apstra/api_anomalies.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_anomalies_integration_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2023-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration

package apstra
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_blueprints.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_blueprints_deploy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2023-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_blueprints_deploy_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import "testing"
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_blueprints_integration_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration

package apstra
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_config.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2023-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

const (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_config_audit.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2023-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

const (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_configlet_structures.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2023-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_configlets.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_configlets_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration
// +build integration

Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_interface_map_digests.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_interface_map_digests_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration
// +build integration

Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_interface_maps.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_interface_maps_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration
// +build integration

Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_logical_devices.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_logical_devices_integration_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2024-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration

package apstra
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_logical_devices_unit_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2024-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_rack_types.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_rack_types_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration
// +build integration

Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_tags.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_tags_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration
// +build integration

Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_templates.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_design_templates_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration

package apstra
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_device_profiles.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_device_profiles_modular.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2023-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_device_profiles_modular_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2023-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration
// +build integration

Expand Down
4 changes: 4 additions & 0 deletions apstra/api_device_profiles_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration

package apstra
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_features.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2024-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_features_integration_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2024-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration

package apstra
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_iba_dashboards.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_iba_dashboards_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2022-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration

package apstra
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_iba_predefined_probes.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2023-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_iba_predefined_probes_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2023-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration
// +build integration

Expand Down
4 changes: 4 additions & 0 deletions apstra/api_iba_probes.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2023-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
4 changes: 4 additions & 0 deletions apstra/api_iba_probes_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2023-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

//go:build integration
// +build integration

Expand Down
4 changes: 4 additions & 0 deletions apstra/api_iba_widgets.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) Juniper Networks, Inc., 2023-2024.
// All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package apstra

import (
Expand Down
Loading

0 comments on commit d13e3a6

Please sign in to comment.